Sunday, September 14, 2008

Upgrading iPhone firmware with Pwnage

These are the steps I use to upgrade my firmware on my 2G iPhone:

1. Use Pwnage to build the custom IPSW file

2. Put the iPhone into recovery mode

  • Disconnect iPhone

  • Shutdown iPhone

  • Hold down home button

  • Plug iPhone in



3. Restore custom IPSW file

  • In iTunes, hold down Alt and click restore

Friday, September 12, 2008

VMWare Fusion won't shutdown

I had a problem where I couldn't shutdown my Windows XP under VMWare Fusion - it started shutting down and then just locked up. There doesn't appear to be any way to force a shutdown via Fusion.

My solution, via Google, was:

1. Force quit VMWare Fusion and vmware-vmw (password required) via the Activity Monitor.

2. Goto to the Virtual Machine (eg. Documents/Virtual Machines/XP) and "Show Package Contents"

3. Find the file ending with ".vmem" and move it to the trash.

4. Restart the Virtual Machine and all should be good!

Edit:
Well, it turns out there is an easy way to do this from the VMWare application itself. In the comments below, Ben from VMWare mentions that holding down the "Option" key while the Virtual Machine menu is open will change the "Shut Down Guest" to "Power Off". Nice!!

Friday, September 5, 2008

"could not sync mail accounts to the iphone because the iphone cancelled the sync"

I got this problem after adding a new mail account to my Mac and then trying to sync it to the iPhone (by selecting it to Sync in iTunes).

If you have a JailBroken iPhone, you can fix this by:


ssh root@xxx.xxx.xx.xxx (default password is 'alpine')
cd /var/mobile/Library
chmod -R 777 Mail/

Thursday, August 7, 2008

Some tricks when deploying your .Net COM Dll to the GAC

A little trick here:

Add the Dll manually to the GAC in the Setup project (as a file rather than as a "project Output"); then set the "register" property of the Dll to "vsdraCOM". If you use "Project Output" for the Dll project it seems to (a) register the COM object only sometimes, and (b) keeps trying to stick the TLB into the GAC and giving you an error.

Wednesday, July 23, 2008

taskdef class. org.apache.catalina.ant.InstallTask cannot be found

If you get this error trying to run your ant build, this can fix it:

Copy the "catalina-ant.jar" file from $TOMCAT_HOME\server\lib to $ANT_HOME\lib

Updated: 20 Feb 2013

If you've updated to Tomcat 7 then somewhere along the way, the "InstallTask" has been deprecated and replaced with "DeployTask". If you edit your build script and replace it, it should work.  For more details, read here.

In order to get some of your other Tomcat 7 Catalina-Ant bits working (eg. StartTask, StopTask), follow Paul Grenyer's useful guide.

Tuesday, July 22, 2008

Moving your VB6 COM collections to .Net under Vantive VBA

A pretty typical VB6 object model was to use a collection class to represent a group of objects. So you'd have a "Car" object with properties like "Colour", "Make", "Model" etc. and you'd store multiple of these in a "Cars" object, which would internally use a Collection and externally provide your "Add", "Count" "Remove" and enumerator methods. You could expose these as method parameters via COM and Vantive VBA would happily be able to enumerate the collection:


Dim oCars as Object
Dim oCar as Object
Set oCars = oComVB6.FetchCarsByColour("blue")
For Each oCar in oCars
MsgBox "Make is " & oCar.Make
Next oCar


Skip forward a few years: Vantive is still kicking and it is time to convert your VB6 COM component to .Net. Our VB6 Collection object is gone, what will we use instead? What about an array of objects? So in .Net we have:


public class Car : ICar {...}
public Car[] FetchCarsByColour(string colour) {...}


To access these from Vantive VBA, this should do the trick:


Dim oCars() as Object
Dim oCar as Object
oCars = oComNet.FetchCarsByColour("blue")
For I = 0 to UBound(oCars)
...


This works fine via VB6, but when you try to compile this in Vantive VBA, you'll get a "Cannot assign whole array" error message on the oCars=... line.

The solution is to use the ArrayList class. Like this:


public ArrayList FetchCarsByColour(string colour) {...}


Which you can then access in Vantive VBA exactly as you could with the VB6 collection, including the "Count" method:


Dim oCars as Object
Dim oCar as Object
Set oCars = oComNet.FetchCarsByColour("blue")
For Each oCar in oCars
MsgBox "Make is " & oCar.Make
Next oCar
MsgBox "You found " & oCars.Count & " cars"

Wednesday, June 18, 2008

"TNS-12541: TNS:no listener" error proves no match for Super-useful Oracle commands

I'm running Oracle on my XP development box. After making a few changes to my network I found that Oracle no longer started. The first step to checking things was to use super-useful Oracle command #1: "tnsping". If you have the Oracle bin in your path, you can run this from anywhere:
tnsping mybase

TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 18-JUN-2
008 11:14:42

Copyright (c) 1997, 2005, Oracle. All rights reserved.

Used parameter files:
C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.1
98)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mybase)))

TNS-12535: TNS:operation timed out


So, first problem is that the host name I'm using is hard-coded in there to be "10.0.1.1". A quick check of "ipconfig /all" reveals that, with my network tinkering, my IP address has changed. In fact, I'm running XP on a virtual machine and not using a static IP address so the IP address was going to change sometime anyway. So we'll replace my IP address with my new IP address instead. To modify this setting, find your "tnsnames.ora" file; for me it lives at C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora.

OK, so now a "tnsping" gives me the lovely "TNS-12541: TNS:no listener" message. Checking my Windows Services, I can see that the Oracle TNS Listener service (OracleOraDb10g_home1TNSListener) is stopped. If I try to start it I get a nice generic Windows Service message "Error 1067: The process terminated unexpectedly."

So, how do I find out what is happening with the listener? By using super-useful Oracle command #2: "lsnrctl". Again you can find this in your Oracle bin directory. You can now check the listener status via "lsnrctl status". Again, this revealed the same "10.0.1.198" IP address hard-coded in the listener config. So again we need to replace that with the new IP address also. The file that controls this is "listener.ora" and it lives in the same place as your "tnsnames.ora".

I found these needed to be done in a set order:
  1. Shutdown Oracle.
    sqlplus user/pwd as sysdba
    shutdown immediate

  2. Stop the listener.
    lsnrctl stop

  3. Change the IP addresses in *.ora files.


  4. Start the listener (notice that your database is not registered)
    lsnrctl start

  5. Start Oracle.
    sqlplus user/pwd as sysdba
    startup

  6. Check the db is registered to the listener.
    lsnrctl status

  7. Try to login via the tnsname.
    sqlplus user/pwd@mybase

So, to summarise, replace the hard-coded IP address with your new IP address in your "tnsnames.ora" and "listener.ora" files.

Note that I did try to use both "localhost" and "127.0.0.1" but couldn't get the listener to pick up the database√.