2011 in review

December 31, 2011

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 180,000 times in 2011. If it were an exhibit at the Louvre Museum, it would take about 8 days for that many people to see it.

Click here to see the complete report.

MacBook Pro SSD upgrade may cause fan to run constantly

August 1, 2011

If after the upgrade to SSD you’ll hear the fan constantly running, reset the SMC – http://support.apple.com/kb/ht3964. Initially, the fan could come on due to SSD hard drive getting indexed. Regardless, resetting the SMC is a good idea.

JSON Lint

September 21, 2010

I came across a really handy tool to validate JSON strings. Kudos to the authors of this tool. Nice job!

Arduino 18 and Sanguino

August 17, 2010

Today I upgraded to Arduino 18 and none of projects were compiling when I was using a sanguino board. I kept getting this error:

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/
avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5/crtm644p.o: (.init9+0x0): undefined reference to `main'

The sanguino folder does not include the main.cpp file. Instead it includes an identical file called main.cxx. The easiest way to fix this problem is to copy the file and rename the new copy to main.cpp.

I added a space after the .../tools/ in the path above so that the code would look better on the page.

1Password slows down Safari on startup

August 11, 2010

I had purchased 1Password a while back. It is a password vault application for the Mac and iPhone. The application is pretty good. But the 1Password extension/plugin for Safari ought to come with a warning. This plugin will significantly slow down Safari specially on start-up. Without it Safari starts almost instantly. With 1Password, it can take up to a minute on year old top-of-the-line MacBook Pro. With 1Password, the Safari startup is really sluggish and I think 1Password also slows down Safari after the startup too. Today I finally decided that I had enough of this extension and uninstalled 1Password’s browser extensions. Safari is snappy once again.

iPhone voice memo to MP3

August 5, 2010

Today I tried the iPhone Voice Memos for the first time and recorded a meeting that lasted for 55 minutes. To get access to the voice memo file you need to sync the iPhone with your computer using iTunes. iTunes has a special folder called Voice Memos. The resulting file was in m4a format and it was about 110 MB. Way too large to share. iTunes does not offer a way to compress audio files. You can use GarageBand to convert it to a mono MP3 and in my case the resulting file was only 12 MB (almost 100 MB smaller – not bad).

In GarageBand select Podcast project, and from the Audio tab drag the m4a, then choose the Save Podcast to Disk from the GarageBand’s Share menu. There is no need to download, try or buy one of the countless audio converters that you may find on the web. GarageBand does a great job.

Blog stats

July 13, 2010

I normally don’t go out of my way to look at my blog stats. But just now as I was looking up something on my blog, the latest page views stats caught my eyes: 472,472. It is unusual to catch a symmetric page view pattern when you just happen to be browsing your blog. So I decided to capture it. Wikipedia lookup on 472 states that the famous Mount Vesuvius erupted in 472 AD.

UITextField: how to dismiss the Number Pad keyboard

July 11, 2010

By default the Number Pad keyboard unlike the default keyboard does not have a “Done” button. I tried a number of different techniques to dismiss the keyboard, e.g., set the UITextField’s delegate to the ViewController and then add this method:

- (void)textFieldDidEndEditing:(UITextField *)textField
{
    [textField resignFirstResponder];
}

But this didn’t work. The method would get called, but the focus still remained in the UITextField. Instead, I chose to use the touches methods to dismiss the keyboard. This allows the user to touch anywhere outside of the text field to dismiss the keyboard. Here is a method that will dismiss the keyboard:

-(void)touchesBegan: (NSSet *)touches withEvent:(UIEvent *)event
{
       // do the following for all textfields in your current view
	[self.my_text_field_1 resignFirstResponder];
       // save the value of the textfield, ...
}

Mapping cellular signal strength to 5 bars

July 4, 2010

By now you may have heard about the reception problems with iPhone 4. Apple has mentioned that the real problem has been with the way they mapped signal strength to the famous AT&T 5 bars icon (where 5 bars denotes excellent reception and no bars means very poor reception). Recently I had tried to solve the same problem so here is the mapping that I used. I wonder what Apple is now using.

But first a few words on signal strength and its unit. The cellular signal strength is represented in -dBm: the power ratio in decibels of the measured power referenced to one milliwatt. The useful range is somewhere between -50dBm to -110dBm. The smaller the number the worse the signal. So -50dBm is much better than -110dBm. A 3 dB increase represents doubling the power. I’ve not researched if it is possible to get the the actual signal strength using the iPhone SDK. But I’ve been using the Tetlit cellular modems and there are a couple of AT commands that provide this information: MONI and CQS. The AT command MONI returns the received signal strength in dBM. Based on testing, I’ve seen MONI returning signal strength anywhere from -55dbM to -110dBm depending on location. At lower dbms, e.g., -109 or above, you can definitely still send SMS but the quality of reception is lower (more bit rate errors) and I’m not sure if you can hold a conversation at these dBm levels.

The AT command +CQS maps the signal strength into a signal quality number between 0 to 99 as shown in the table below:

Signal Quality dbM Power (milliwatt)
0 -113 or less 0.0000000000050119 or less
2 to 30 -109 to -53 0.0000000000125893 to 0.0000050118723363 (2 dBm per step)
31 -51 or greater 0.0000079432823472 or greater
99 not known or not detectable

AT&T converts the reception signal strength to a number between 0 to 5. The famous bars icons are used to denote this: 5 bars means excellent reception and 0 bars means almost no reception.

According to the CSQ command mapping -113 dBm maps to 0 and -51 is the best you can get. The difference between these two is about 62 dBm and if you divide 62 dBm range by 6 you get 10.3 dBm per step which must be more or less the dbM interval that AT&T uses to map the signal strength to bars. Based on this approach here is the rounded dBm table mapped to a number between 0 to 5.

dbM Signal Quality
-60 or greater 5
-61 to -73 4
-74 to -85 3
-86 to -98 2
-99 to -110 1
-111 or less 0

But if you use this it is very rare to get 5 bars, so it is possible that most cell phones will reduce the dBm interval mapping to bars and increase the lower range so that -75dBm or greater maps to 5 bars and end up with something like this:

dbM Signal Quality
-75 or greater 5
-83 to -74 4
-95 to -82 3
-105 to -94 2
-110 -104 1
-111 or less 0

XCODE – change compiler version to 4.2

June 30, 2010

I’m running the latest version of xcode (3.2.3), which includes gcc 4.2. Today when I upgraded core-plot I ran into syntax errors with UIView.h. This was due to xcode using gcc 4 and not gcc 4.2.

Using the project info dialog I was unable to set the compiler version to 4.2 (even though it was showing that it was set to 4.2). To make this change stick, don’t start changing environment variables and symbolic links to fool xcode to use gcc 4.2 instead of 4. Instead, in your project info dialog, select the Other… option for C/C++ compiler and simply enter 4.2.Enter 4.2 Now when you build your project the 4.2 version instead of 4.0 version of the compiler is used. This ought to get rid of those pesky compiler errors when the system tries to compile the prefix file, echoing syntax errors with UIView.h file.


Follow

Get every new post delivered to your Inbox.