Oct 18, 2009

NGN Hacked!

Sunday night and I'm casually browsing the net and decided to check up on my mates' golf handicaps. This is what I stumbled on...

untitled

The National Golf Network website (www.ngn.co.za) was hacked! NGN currently holds the contract to manage golf handicaps for the South African Golf Association. They have been under pressure of late, with rival companies bidding for the soon to be expired contract. This rather embarrassing situation obviously doesn't do their reputation any good.

I hope the damage is limited to defacing only and that the central handicap database remains untouched. Although, I could do with a lower handicap myself...

Sep 29, 2009

Happy Holidays – The Google Trends Experiment

We picked up on an interesting trend while playing around with Google Trends today. And to be honest I am not at all surprised with the results…

We were comparing the search popularity of a few programming languages when I noticed a marked decrease in searches around the holiday periods for all languages.

1

Low and behold, what happens when you add Porn to the mix…

2

Now we know what programmers do when they are on leave!
Get some sun dudes!

Jul 15, 2009

Google Adsense now in Rands

This would probably mean that you can see your Adsense earning in your local currency wherever you may be. Awesome, just makes it look like so much more. $1 US = R8.15 South African Rand. Now if you were living in Zimbabwe… $1 US = Z$ 442.60 Zimbabwe Dollar!   

Jul 3, 2009

Custom Application Deployment through Active Directory

I write various custom apps for our SME (Small to Medium Enterprise) to try and make our users’ lives easier. And make mine difficult in the process… I use C# Express Edition 2008 which doesn’t give you the ability to create a install project. You can publish the project but I find it very limiting plus you can’t create an msi package to roll out with Active Directory.

This got me started on an app to manage distribution of my custom apps better. I created a wizard interface that lets you create a “Project” and a generic remote path (I use the c$ share e.g. \\hostname\c$\projectname\). Next, browse and select the files associated with the project ie. executable, dlls, etc. In my case, I just link to the files in my Visual Studio created project “release” folder. Finally, the app gets a list of domain computers and you can select which hosts to roll out to. All the information is stored in a textfile.
The main interface lets you select a saved project and verify if the associated files (File.Exists) and hosts (with Ping) are available. If you are happy just click Deploy and Bobs your uncle. The files will copy to the selected hosts and you have the option of creating Desktop and Startup shortcuts. And you can do all this without even having to explain to a user how to run an installation…

I am not going to publish this app yet purely because its customized for my organisation and I don’t have time to write the app flexible enough. I will however send *edited* source code to anybody that could find it useful, just leave a comment.

Jul 1, 2009

C# Context Menu on ListViewItem

The problem when assigning a context menu directly to a ListView control is that the menu show everywhere on the control. This can be quite irritating if you just want it to show when you rightclick on a listviewitem. Below is example code to overcome the problem. Assign a contextmenu to the listview control and create a menuitem. In this example the listview contains a list of network host names/IPs, on rightclick it will show a context menu to browse to the c$ share of the host. I know its not the most elegant solution, but it works. Just note, the menu location offsets may need some tweaking.

       private void lvwHosts_MouseUp(object sender, MouseEventArgs e)
{
//Check if right clicked on a ListView Item
if ((lvwHosts.SelectedItems.Count != 0) && (e.Button == MouseButtons.Right))
{
//Create a new point relative to form and listview locations + offset
Point mousePoint = new Point();
mousePoint.X = this.Location.X + lvwHosts.Location.X + e.Location.X + 25;
mousePoint.Y = this.Location.Y + lvwHosts.Location.Y + e.Location.Y + 55;

//Show context menu
cmnBrowse.Show(mousePoint);
//Change text of current menu item to relevant path
cmnBrowse.Items[0].Text = @"Browse to \\" +
lvwHosts.SelectedItems[0].Text + @"\c$";

}
}

private void browseToCToolStripMenuItem_Click(object sender, EventArgs e)
{
string path = sender.ToString();
//Remove the "Browse to" substring
path = path.Remove(0, 10);
//Start explorer
Process.Start("explorer.exe",path);
}