Friday, July 9, 2010

Using gmail or Android marketplace without Data plan (T-mobile)

Just wanted to post this in case someone else finds it useful. Unfortunately, T-mobile reps incorrectly insist you cannot open the Android Marketplace without a data plan. Searching on the topic brings up lots of uncertain older posts

I bought a new HTC MyTouch Slide off ebay. I already have a Tmobile account but did not want the data plan. I connected to my home WIFI and was able to browse the internet. However when trying to go to
Android marketplace or login to gmail, it waits, "Signing in, need to connect with Google servers..." and then after 2 minutes says, "You dont have a network connection. .. your phone may not be provisioned
for data services. Please try again when connected to a mobile network, or connect to a WIFI network."

The solution was to go to Home, Menu, Settings and then disable the "Enable Always On Mobile Data".
Under Settings, 'Wireless and Networks' scroll to the bottom, 'Mobile Network settings' and uncheck "Enable Always On Mobile Data".

And it worked!

Thursday, July 1, 2010

How to duplicate a row of a database table, with foreign key dependencies

I was required to duplicate a row of a database table, with foreign key dependencies. It is not a trivial problem as the dependent rows of the foreign key tables have to be created, and then the values of these ids taken and the fields updated in the primary table. Of course, the dependent rows will likely also have foreign key fields so their dependent table rows have to be created first. This ripple effect can go on and on.

This is hard to do in sql and thinking about it, it would be easier to do using recursion in a programming language.

Steps:

write a recursive method
NewId createRow() {
  for each dependent foreign key field {
   newId = dependent table.createRow()
   update foreign key field with newId
  }
}

"for each dependent foreign key field": this list can be obtained using JDBC.