Now I actually delete my SPAM…

Since I started to use GMail I haven’t deleted any SPAM mail. Until now!

When I began using GMail I quickly realized that my SPAM automatically ended up in the SPAM folder and was deleted after 30 days. That is very convenient because that leaves a number (unread messages) next to the folder name which I quickly named “SPAM level” – a 30 day history of SPAM. When the FBI or some other organization announced that a mayor bot net had been closed or some spammer jailed I saw the result 30 days later in a drastic decrease in “SPAM level”!

The current rate of false positives (like – once every week – with no regular pattern in sender or content) has left me looking in my SPAM folder a lot! Which is very bad when there is a lot items in there! Having a SPAM folder containing hundreds sometimes thousands of items and trying to find one (ONE!) false positive is literally like looking for a needle in a haystack! It’s simply not worth it to have a SPAM level – so now I clear my SPAM folder every now and then – which means when I check my mail. Fortunately GMail allow me to do that with a single click!

Different people – different focus

I spent most of my yesterday migrating a very old website to a new host. This was/is a process with many pitfalls and many annoyances – but that is stuff for a completely different post!

What is really interesting is the way that different people choose to focus in the process of – well – anything related to “software”.

First thing I did with this particular site was to copy the database from one host to another. After that I moved the files (FTP download, FTP upload) and finally I changed the code (PHP) to reflect the new host – some database settings and some mail settings. At first load the page looked great – everything actually looked right. Navigation revealed no mistakes or configuration errors! Great!

Then I/we moved along to test some signup sequence (involving mail sending) and then problems started appearing! When listing some of the database content we saw that headlines suddenly contained question marks! Ouch! And the mails that the system should be generating never reached their target! Ouch again!

My natural response was to start debugging the mail send sequence – this part relied heavily on web server and SMTP server configuration – something had to be wrong somewhere. But the reaction from my peers was to focus mainly on the question marks in the text!

This situation is very common – I see it at least one every week at work – developers focus on the real problems, the real errors – and designers and managers focus mainly on the visual issues. I mean – who really cares if a line of text is placed two pixels higher or lower! The actual trouble is that these cases usually takes a very short time to fix and this leads designers and managers to think that it is better to fix right a-freaking-way! It is not! Cases like these are best solved by grouping them together and solving all of them at once – you know – that way you’ll have a whole hour worth of work.

1Password is great

I got a license for 1Password through some software bundle at a special price from MacUpdate. I just recently started using it today! It is awesome!

I really like that I don’t need to remember any passwords – but having different passwords for every site/service! I’ve actually taking it a step further and started using very very long random passwords everywhere – somewhere down the road I won’t be able to log into my Facebook account from another computer – even if I wanted to…

A nice feature is the Dropbox synchronization feature. It is even supported by the iPad version of 1Password.

Recording a conversation (Android)

A few weeks ago I sat down to make a new Android app.

I had decided to make a utility that could record conversations. There are many situations where this could be very handy – especially at work during customer calls making aggreements e.g..

Fortunately Android has the ability to record and play audio from various streams through the MediaRecorder class. The streams include MIC and VOICE_CALL. When reading this I was very excited and started coding the conversation recorder app.

After a successful run in the debugger I installed the app on my test phone and tried to record a conversation – It didn’t work!! After various checks I found out why: The phone conversation system is implemented in hardware – and the MediaRecorder class works in software. This means that the ability to record two sides of conversations is limited to the handsets (phones) that have a all-software implementation of the telephony subsystem. This means close to none. I then decided to scrap the program.

On Android Market there are several apps with the ability to record two sides of on-going conversations. So far I haven’t found any with a good handset coverage that didn’t require the use of speakerphone to record the connected party – a solution I find very… Not good…

References:
1:http://code.google.com/p/android/issues/detail?id=4075
2:http://code.google.com/p/android/issues/detail?id=8187#c14
3:http://developer.android.com/reference/android/media/AudioRecord.html#AudioRecord(int, int, int, int, int)
4:http://code.google.com/p/android/issues/attachmentText?id=8187&aid=9085326812219769698&name=Recorder.java&token=df6690859ac94739fff10400b085b8b1
5:http://nathanielkh.wordpress.com/android-app/record-my-call/
6:http://code.google.com/p/android/issues/detail?id=8187
7:https://market.android.com/details?id=rs.zoosvet.RecordCall
8:http://www.zoosvet.rs/android/RecordCall.html

What is wrong with this damn phone?! (HTC Desire)

Almost a year ago I got my HTC Desire. And it is by far the best phone I have ever owned. Before I had a HTC Hero (I guess HTC isn’t proud of that one – I wasn’t able to find it on they website – the website only features the american/sprint version – mine was more Legend-ish) and before that I had some Windows Mobile (pre WP7) crap.

When I got my first Android phone I started living the mobile life – which really took pace when I got the HTC Desire. I now use my phone for all kinds of social media apps along with navigation, e-mail, news reading eg. – this means that I have a lot of programs on my phone. I actually have to erase a great bunch of those whenever my phone needs a firmware update to make room – that is acceptable. It is also acceptable that the phone is marked by the storage usage – it gets a bit slower… But…

Lately – since around late december – I have had some rebooting problems. I would press something – switch views in an app – open an SMS – make a call – and the phone would just reboot. Sometimes this reboot would be followed by another reboot. Sometimes the phone would get stuck rebooting and never complete. Sometimes there would be a constant reboot cycle. In these cases the fix would be to remove the battery and wait a few seconds before inserting and rebooting – not good.

I have google’d the issue using various phrases describing the problem and they point in different directions (see this, this and this). There seems to be others having this problem! But there is not a single answer – most seem to point towards overheating and hardware failure – which isn’t all good – since a fix would be off site and require a replacement phone!

To try and fix the problem I wanted do a soft reset of the phone – returning it to the state it had when I got it! This move seemed a bit hard (needing a lot of settings restored and a lot of passwords re-entered) so I decided to start by removing a lot of programs. This would at least free up some space on the phone and make it a bit faster – and it did! It was almost like having a new phone. The price of this was the loss of many of the features I had been using daily.

Funny thing is – the reboot problem was gone! Gone! My logical conclusion was that lack of space made the phone reboot when hitting some kind of swap space or temporary file limit – that description fit the observed behavior. Clearing some space – the phone worked perfectly – for about three days! Then it started rebooting again – without behing touched! The phone was a bit warm – suggesting overheating. But it also happened on a train trip where mobile network coverage was/is very bad – suggesting some kind of software/hardware error! But the real trouble: The problem was back!

Fortunately there haven’t been any trouble since – and I’m hoping that the problem is really a combination of all of the possible issues mentioned above. This would hopefully leave me with a phone with some semi-faulty hardware and some software causing the phone to overheat when pressuring the storage in areas with poor mobile network coverage. Funny enough this is a bit more acceptable – but it could be better – with no reboots at all!

Copy-paste of Windows dialogs

I just stumbled upon a very nifty feature.

When a dialog (yes/no, ok/cancel etc.) is shown in Windows (at least in Windows 7) you can actually copy-paste the dialog text and get some meaningful output. The following output comes from the SQLite Database Browser “do-you-want-to-save” dialog, check it out:

—————————
SQLite Database Browser
—————————
Do you want to save the changes made to the database file C:/Users/Michael Banzon/Documents/Stage5.db?
—————————
&Yes &No
—————————

It is very nice! It actually produce som understandable output even for non-techies – I can imagine that I’ll be using this feature frequently now that I know that it is there. Pasting text into (Gmail) e-mails is so much easier than pasting images!

Version control – the right tool!

I remember very clearly a few years back. My first introduction to version control. I thought “Wow! This CVS-thing is the most useful tool I’ll ever come across”. Some time went by and I worked on some projects where CVS was great! I mean – instead of swapping floppy disks or USB-drives around, manually synchronizing code. Geez – what had we been doing all this time!

Then… Along came Subversion (everyone might have known – but it came along – into my life). And I was amazed once again! It was CSV – but better! Oh my gods! Better! Than CSV! If I had a scale I needed a new one – this was off the charts! Every project I have worked on since then have used Subversion. It’s amazing. Ok – I admit it – it has some… ehm… let me get back to that – for now: Subversion is great! I even have my own repository for my @home projects – very neat. I don’t really share them with anyone – but they are in a Subversion repository – and that is great!

Ok – I admit it! Subversion has some odd bumps. Branching and merging is one. I read a small tutorial about it and went for it! No problem! Well… Until we had to merge some changes in the stable version to the development branch – how was that done. I have to say – I need to look merging branches up every single time I need to do it. That is ridiculous! I’m a developer! I use a tool written by other developers! To be used only by developers! And the way everyone develops software is by having at least one stable branch and one development branch (if you don’t – then we need to discuss something completely different! If it is because merging and branching sucks – please read on). Why is this so hard!? To tell you the truth – it’s not!

Let me nail this to the wall: BRANCHING AND MERGING IS EASY!

It is a 3-step process:

  1. Get rid of your old version control system!
  2. Get Mercurial (or Git)
  3. Branch/merge happily hereafter!

Easy!

There are several things I’d like to point out – more of that in a later post!

First you should go learn the basics – I recommend: Hg Init: a Mercurial tutorial, by Joel Spolsky.

Limited refactoring

Yesterday I was programming something in C#.NET using Visual Studio and I ran into a rather annoying lack of feature.

I am using Visual Studio 2005 so this might have been resolved in 2008 or 2010 – but non-mandatory program suites call for previous version updates! (This is why our rather limited team of developers solve this by supplying mandatory updates via subscription)

Anyway – My solution has a few projects (a main .exe and a few DLL’s) and one of these holds some settings and resources which is accessed through the ‘standard’ interface. We’ve simply double clicked the right place and added settings and resources. It works! It’s magic!!

The problem occurred when I wanted to change the default namespace for the project containing the settings and resources. VS2005 refactor my settings and resources to the new namespace – which is great, that was what I wanted – but in EVERY place where these are referred I need to change the reference manually! That was a LOT of work! Luckily it required no thinking at all! :-)

I find it very ridiculous that the namespace is changed for the settings/resources but isn’t changed throughout the rest of the code – this is actually a feature that the normal ‘refactor’ function handles nicely without much trouble and something that a simple search and replace can solve…

Caching in browsers

The other day at work we ran into a problem with users updating to the newest version of our software.

Our main program queries a server with the version number and receives an address from where the newest installer can be fetched. The program then launches a browser that downloads and runs (on the users request) the installer – bam! Updated!

So we thought – but it turns out that we made a minor mistake (I’m gonna claim that it is a browser misbehaving ’till the end of days!) that caused the older version to be downloaded instead. The case was this:

We always point a user to a static address containing the newest version. The static address is a PHP script redirecting to the right/newest version. The redirect was done with a HTTP 301 (moved permanently) and therein was the error! See (this is tested in Chrome and Chrome only) when the browser sees that the address it is GET’ing is moved permanently it decides to cache the multi-MB install file. When the user returns a week-or-so later GET’ing the same static address (now redirecting by 301 to a new address) the browser (Chrome!) don’t really bother actually performing the GET – it just assume that that address has moved permanently and therefore we GET the address that it was previously resolved to!

Ouch! Users where stuck in an endless update cycle! I wrote a short piece about it on our company weblog to help users update properly.

Needless to say we changed the PHP script doing the redirect – and made some small adjustments to do avoid this type of problems!

Eclipse and Android Development – Fixing GPS under DDMS

I am currently working on an Google Android project that require the use of the Location Services – good thing the Eclipse plugin supports this!

Running Eclipse in DDMS mode will enable a console where coordinates can be typed and sent to the debugger – very nifty. Except it didn’t work! During the first try, only the first location change came through to the UI. Later tests showed that location (regardless of input) at 0, 0 – which equals ERROR!

After spending some hours searching the internet and verifying that location changing worked by manually telnet’ing to the emulator and typing coordinates the mystery unfolded and the solution presented itself!

The problem is Eclipse locale handling (please not that ‘locale’ in this context has nothing to do with ‘location service’). In a classic case of parsing decimal strings the problem occurred in Eclipse and not in the emulator. The solution to the problem was to add a line containing “-Duser.language=en” to the eclipse.ini file (on Mac OS X this means opening the App-folder or vim’ing it from the command line). Problem solved – happy developer! :-)