Tuesday, July 31, 2007

Get keys out of Hashtable

You've filled up your Hashtable with key/value pairs, now how do you get the keys out? Below is a simple way using foreach:

protected Hashtable list = new Hashtable();

public void AddItem(int itemnum, string title, int cost, int quantity)
{
  Item i = new Item();
  i.Cost=cost;
  i.ItemId=itemnum;
  i.Quantity=quantity;
  i.Title=title;

  list.Add(itemnum, i);
}

public int GetTotal()
{
  int tot=0;
   IDictionaryEnumerator Enum = list.GetEnumerator();
  while(Enum.MoveNext())
{
     Item i = (Item)list[Enum.Key];
    tot+=(i.Cost*i.Quantity);
}

  return tot;
}

Monday, July 30, 2007

Add better ringtones to iPhones lacking alerts

The iPhone is lacking in the ringtone alert department. Take the half-hour set-up and spare yourself from drab incoming call alerts.

1.) Get yourself some tones you'd rather hear when a call comes in. Try this suggestion from tuaw which describes how to use iTunes clips for use as a ringtone.

2.) Once you've got a few tones, head over to Hack the iPhone and download iPhoneInterface. Here is the direct link to the download for Windows (XP and Vista). This tool is what you will use to upload your tones to the iPhone.

3.) Now that you have your tones and have uploaded them to your iPhone using iPhoneInterface, you simply navigate to Settings -> Sound > Ringtone on your iPhone and choose the new ringtone you just uploaded.

Friday, July 13, 2007

Could not find file InstallState

I created a Windows Service which needed installed onto the machine before I could test its functionality. I added a setup project (File > Add > New Project) and added the Setup Project under "Other Project Types". Everything built fine and I was ready to go until I started receiving the 'Could not find file...InstallState' when I tried to actually install the service. It took a half a day to figure out the problem, here is what I found. When you initially set up the project and go into Custom Actions to add primary output the project looks like this:

As you'll notice, there are too many primary active outputs. Delete all four from the left side under Install, Commit, Rollback, and Uninstall. If there are two under your setup file in Solution exporer (see highlights), then delete one or you will receive a some removed file error. The best way to do it is delete both and then right click the setup project (in solution explorer) go to Add > Project Output and set the service as primary output. You should then only have one listing under your setup project and none listed in the Custom Action section. Once your solution looks like the below, build and install.

Thursday, July 12, 2007

install windows service

I found a great explanation on how to install a Windows Service using Visual Studios 2005. http://aspalliance.com/1316_Working_with_Windows_Service_Using_Visual_Studio_2005#Page4
Thanks Abhishek!!

Monday, July 2, 2007

iPhone root password cracked

That was quick...

Root password is "alpine"
The user account "mobile" has a password of "dottie"