Android secret code trick for testing purposes

Android users can launch various tests and other advanced functions straight from the dialer by entering secret codes. These codes follow a certain pattern: *#*#{number}#*#*.

You can use the Android secret code trick in your own apps for lots of reasons; like switching between development and production webservices or toggling debug modes.

Below the gist of trick (pun intended):

First we declare a Broadcast receiver in our manifest.

Second we write the receiver and flip a boolean value everytime the secret code has been entered in the dialer.

Fix Mac OS X svn ssl bug: "bad decompression"

Using SVN over SSL has been a real pain on Mac OS X (tested on snow leopard and lion).

More 'heavy' SVN commands may cause "SSL handshake failed: SSL error: bad decompression", depending on your server configuration.

After some research this should be due a bug in the SSL library bundled with Apple's developer tools.

On the CollabNet forums someone suggested switching the standard http library called Neon for a new one called Serf written by some Google developers. This library should be really performant and handles SSL by itself.

Sadly the SVN tools from Apple don't come with the Serf library so we have to download a package which does.

The trick is the configure SVN to use the Serf library instead of the Neon library.

Owkay, so let's fix this step by step!

Step 1: check existing svn

Open up a terminal and check if the Serf library is for some reason already available by using following command:

svn --version

Screen_shot_2011-07-30_at_11
The library is available when you find "*ra_serf" in the list. If so, goto step 4.

Step 2: install svn package

*Snow Leopard

Download a SVN package and install. Remember the location where the svn tools will live. (note: i've used CollabNet but registration is required, others should do fine also I think)

*Lion

At the time of writing this post there seems to be no package available for Lion on CollabNet but you can with MacPorts. After upgrading to Lion, you'll also have to upgrade (sudo port -v selfupdate) or install MacPorts but you'll also need the latest Xcode (>= 4.1). You can install subversion with MacPorts with "sudo port install subversion". Following steps stay the same except the svn tools will live in another directory, for me that's /opt/local/bin.

Step 3: check for serf library

Let's check again if Serf's available. (note: replace path with your own install location)

/opt/subversion/bin/svn --version

Screen_shot_2011-07-30_at_14
As you can see, the Serf library is available!

Step 4: configure svn

Great, now we just have to configure your subversion settings so it will use the Serf library. 

open ~/.subversion/servers 

Search for the [global] section and add "http-library = serf" and save file.
Screen_shot_2011-07-30_at_14

Step 5: add new svn tools to path

To complete this, we add the freshly installed svn tools to the environment path.

open ~/.profile

And add following:

export PATH=/opt/subversion/bin:$PATH

Again, use the path to which you've installed the tools. Make sure the existing path gets appended so the new svn tools will take precedence over old ones.

Step 6: retry failed svn commands

After this, you should be able to execute svn command without the SSL "bad decompression" error.

If not, check if you really using the new svn tools and make sure they got exported to your environment. (note: initiate new terminal session so path changes take effect)

A good command to diagnose the problem in my case was doing a recursive svn list command.

svn ls -R https://svn.example.com/project/trunk

That's it! Enjoy!

Gentse Feesten 2011 app

Gisteren las ik een leuke (re)tweet van Daniel Termont met een link naar het volledige programma van de Genste Feesten in excel formaat.

Tot mijn verwondering vond ik geen enkele Genste Feesten Android app op de market.

Bij deze zelf snel (lees enkele uren) iets elkaar gestoken dus gelieve dat in het achterhoofd te houden.

Download nu van Android Market!

 

Features:

  • Volledig programma offline beschikbaar!
  • Bekijk gebeurtenissen per dag en locatie
  • Mogelijkheid te filteren op locatie
  • Bekijk wat er vandaag of nu bezig is op de feesten

Opmerking: de data ongewijzigd zoals ik deze heb afgehaald, je zal gauw merken dat niet alles correct is.

Ik hoop ook nog enkele andere zaken toe te voegen als ik de tijd vind zoals het bekijken wat nu bezig is en de mogelijkheid gebeurtenissen een ster te geven en deze in apart lijstje te raadplegen. Alsook een eenvoudig zoekfuntie zou handig zijn. Suggesties altijd welkom!

Voor de geïnsteresseerden, code op github: https://github.com/niob/gf2011

Changelog:

1.5

  • Toon openbare toiletten op een kaartje

1.4

  • Filteren op locatie beschikbaar op elk scherm
  • Filter heeft invloed op elke lijst
  • Direct toegang naar wat vandaag te doen is

1.2 - 1.3

  • Bugfix: database kopieren werkt gewoon niet op sommige devices dus in deze versie wordt dat database eenmalig opgevuld bij het opstarten.

1.1

  • Bekijk welke gebeurtenissen er nu bezig zijn
  • Bugfix: sommige devices waren niet in staat de sqlite database te kopieren bij eerste gebruik, dit doordat sommige Android toestellen niet instaat zijn ingepakte bestanden groter dan 1mb uit de assets folder te decomprimeren.
  • Opkuisen van data: sommige (belangrijke) locaties kwamen dubbel voor.

1.0

  • Volledig programma offline te bekijken
  • Bekijk gebeurtenissen per dag en locatie
  • Mogelijkheid te filteren op locatie

Simple file transfer between devices/computers with Gmail

You ever wanted to simply move one or more files like images or couple mp3s between workstation, laptop or mobile device, but don't really have dropbox or similar service configured?

For this purpose I've found myself using Gmail as intermediate stop. Just start a new message, upload some stuff as attachment and save the message as draft.

Open up Gmail on the other computer or device, download the attachments and delete the message. And like that, you've just used Gmail as ftp-server!

The only limitation to this method are google's attachment restrictions. In short, up to 25 megabytes and avoid dangerous file types like executables.

Useful subversion alias

After using subversion from terminal for a while now, i've found following command so useful, I've turned it into an alias.

Add new files ready to commit

svn st | grep "^?" | awk '{print $2}' | xargs svn add

This command is a mouthful but saves you from adding each file individually.

When you want to use this alias you'll have to take care of the nested quotes and escape them.

alias sa='svn st | grep "^?" | awk '\''{print $2}'\'' | xargs svn add'

One could make several variations on this alias for svn remove, revert or others. You'll just have to change the grep and xargs arguments.

StuBru latest tracks Android widget (v1.4)

I've created a small Android widget which shows the latest (or currently) played tracks on Belgian radio station Studio Brussel.

Clicking on the widget shows a list of the recently played tracks. Auto refresh can be enabled in the widget preferences.

Install app/widget from Android market:

https://market.android.com/details?id=be.niob.apps.nowplaying

v1.4

- Show title and date in list of tracks

- Check network connection before retrieving tracks and inform user

v1.3

- Replaced refresh and preferences button icons with better ones on widget

v1.2

- Set auto refresh off by default to preserve battery

- Added preferences screen for enabling auto refresh and setting refresh frequency

- Added manual refresh button to widget

v1.1

- Widget shows latest tracks and auto refreshes itself

- Show list of played tracks when cliking on the widget

Fix "The server is not responding" for PhpMyAdmin on Mac OS X

First I downloaded and moved all PhpMyAdmin files to an appropriate directory and added an alias to my Apache's httpd.conf.

But PhpMyAdmin or better the mysql extension could not connect to my local mysql server, it gave me following message:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

Luckily there's an easy fix. The mysql extension apparently seems not capable of resolving localhost, so replacing the host with 127.0.0.1 did the trick.

Hoorah!

Terminal 'ls' alias

I use 'ls' very frequently in my mac os x or linux terminal. I've mostly been using 'ls -la' which stands for list the ALL files of current directory and put them nicely in columns.

A friend of mine gave me a nice tip yesterday. He also adds capital 'G' en 'h' as option. 'G' give you some nice colored or grouped list and 'h' makes sizes human readable.

Because remembering this or typing this over and over again is rather difficult, he also suggested to make an alias like so:

alias l='ls -alGh'

This way you only have to type 'l' and there you have your list, how convenient is that?

But when just executing this line in a terminal, it'll be forgotten next time you open one. In order for your aliases to be persistent (i.e. so they exist in all new Terminal windows) you need to put them in some file that gets read by your shell startup files (see "What startup files are read by the shell?"). So for example add the alias to the '~/.profile' file like so:

nano ~/.profile

You can add all kinds of aliases or functions to this file so they wil always be available for your account.

Coca Cola scam

Last weekend I've received a strange sms:

Congratulation! Your cell number has just won 300,000 pounds in the Ongoing UK COCACOLA 2010 PROMO.Email: cocacolauklive(a)live.co.uk or call+447045730922

This is obviously a scam. Check out the Windows Live e-mail-address or the common telephone number and the fact I've won out of the blue 300.000 pounds.

But I really was curious about how the scammers would try to get my money. So I called the number:

The man on the other side for sure wasn't from Great Britain, he sounded more like an Indian. He told me to send my personal details like name and address to the e-mail-address found in the sms.

I didn't go further but I'm still kinda wondering what the next steps would be. Maybe setting up a fake e-mail and use some fake credentials and wait for their response, but that would be to much work.

After searching the web, there a lots of similar Coca Cola scams with e-mail. Some even suggest it's often not really to steal your money but only your personal details used for fake identities.

Last thing I did was filling in a report to the internet fraud crime unit in Belgium. They've setup a site called e-cops especially for reporting such scams.