My job (placement) offer from IBM!

As part of my Computer Science degree, I have the choice of completing a one-year work placement in between the second and final years. This makes the degree a year longer, but means a much higher probability of obtaining a graduate job (and even achieving a high final-year project mark, apparently).

I applied to several companies in different fields (science, finance, software development) and attended various interviews, assessment centres and aptitude tests. A few days after attending IBM’s assessment centre, I received a call asking whether I would accept a job offer starting in July 2011, which I gladly accepted. IBM call this an Industrial Placement.

In the offer letter package that I received by email a few days later, I was told who my manager would be, along with his phone number. I called him to ask him a few questions about forms I had to fill out, but also took the opportunity to find out more about what I’ll be doing.

I found out that I’ll be on the team responsible for IBM Rational Software Architect (RSA), the division of IBM that replaces Rational, which IBM took over in the 90s. RSA is essentially a set of tools that developers use to design software architectures (usually in UML), which helps them to be more productive and engineering-conscious by generating code skeletons, helping with planning/workflow and more.

I’ll be based at IBM’s software development labs in Hursley (near Winchester), so I’ll have to find a place to live out there some time before July. I’m really excited and am looking forward to starting the first job of my Computer Science career.

I’ll try to write a detailed article about the application process for those who are applying soon and post it on this blog.

SQLite timestamp comparison causes SQLiteException or error

When getting the “next” or “previous” entry in an SQLite table, I’ve been using the rowId so far and it’s been okay.

Recently, though, it’s not been that easy. For example, when a user imports a set of entries, some of which have an earlier timestamp than the current entries, they end up in the middle of the entries but their rowIds are newer and so are considered to be at the end of the list.

This causes weird navigation issues, so it’s best to stick with a single way to order entries.

Here is a sample of a SELECT statement that will get a rowId of the next entry in order of timestamp:

However, this causes an SQLite exception in Android/Java and other errors in other SQLite implementations. The problem is the space in the timestamp given. Whenever there is a space there should be quotation marks surrounding the piece of text.

So the timestamp should be “2010-09-15 13:15:20.250″, giving a SELECT statement that looks like this:

This selects one row where the timestamp is the next greatest than the given one, i.e. the one right after the given one. It should also be error-free, now that we’ve included the quotation marks.

Backing up, importing and restoring databases on Android

If your Android application has a database and you want your users to be able to backup the database and restore it as they see fit, you’ll need to mess about with database files.

Below is a class called DbExportImport. Once you’ve set it up with the correct values, all you need to do is call exportDb(), importDb() or restoreDb() from your application to perform the necessary operations.

This is also useful as a temporary measure when changing your package name or key for application signing, as your application will be newly installed and you will lose your database.

I have only left in a few comments, so for any clarification, leave a comment and I’ll make it a little clearer.

Quotation Keeper is now on the Android market

Quotation Keeper has officially been released on the Android market.

Get it by searching “Quotation Keeper” on the market, or scanning the QR code below:

Click here to go to the main Quotation Keeper page to find out more.

Backup, import and restore database options added to Quotation Keeper

I’ve just added backup, import and restore capabilities to Quotation Keeper.

Now if you change or format your device, or even want to send your entire database to another person, you only need to back up your database to your SD card and restore again when you’re ready.

The difference between import and restore is simple:

If you import, you will add entries from the backed-up database to your existing database. If you restore, you will replace your own database with the backed-up one.

Updating files and folders to Android device with one click via adb

I like to keep an updated copy of certain files on my Android phone at all times, such as the latest copy of certain code so I can look at it when I’m on the train.

I’ve done it in quite a few different ways:

  • Mount SD card as a removable storage device via USB
  • Run an FTP server on my phone and transfer files over wifi
  • Bluetooth file transfer

But these are all tedious because they’re all manual and they take too long.

Then I realised that ADB push and ADB shell are run from the command line/terminal, which means I can run a batch script. (A batch script is a text file with commands written that all run one after another in the command line)

Now all I need to do is click the file on my desktop and the files get updated within a fraction of a second on my phone.

So here’s an example version of my batch file that automatically updates a folder on my phone:

‘rm -r’ delete the folder and everything in it.

‘mkdir’ creates a folder by that name.

‘push’ copies the folder contents from the first argument to the second argument.

Note for those running emulators on their computers: Add ‘-d’ after the word adb on each line to send the commands to a device and not an emulator.

All that’s left is to write it up in Notepad and save it as Filename.bat. After that, just double-click the file and the operation should run in a fraction of a second.

ADB ‘Push: Permission Denied’ on Android adb shell push

I just spent a little while trying to figure out why I was getting ‘push: permission denied’ when running:

I did some googling to no avail.

Then I remembered that pushing and pulling is not done in the shell, it’s just done with adb.

Thus, it should have been:

Which succeeds. I know it’s a silly error to make, but I thought I’d share this in case anybody else uses the adb shell push instead of regular adb push and can’t figure out why permission is denied.

How to change the refresh rate/interval of AdMob ads on Android

Once you’ve set up AdMob ads for your application, you might want to change how often they are refreshed.

If they are refreshed often, your users will see more ads when they’re on the same screen. This is good in that they see more ads, but can also be very annoying.

In the XML entry for your AdMob banner, just add this attribute to set your refresh rate to 60 seconds, as an example:

AdMob only allows you to have a refresh rate between 12-120 seconds

The complete XML element for the AdMob banner should look something like this:

Hello, world!

Hello, world!

This is my first post on what should hopefully be a regularly updated blog about my projects, endeavours and ideas.

Allow me to introduce myself. My name is Horatio and at the time of writing I am a Computer Science student at the University of Birmingham. When not at university, I live in central London.

I’ve been working on several Android applications for a while when I have some spare time and shall hopefully be releasing some soon.

If you have any suggestions, I’m always open to them so contact me.

HXCaine