Archive | October, 2012

SafeFrames for mobile apps

25 Oct

SafeFrames for mobile apps

When designing a mobile app for multiple devices and resolutions, it's important to know how the different aspects can limit the positioning of design elements. For a recent project, I made some SafeFrame images that the designer can overlay to make sure all important elements are within the limits of typical iOS devices and a popular Android tablet that we target. I guess this can be useful to others so here's the image for centered designs and here's the image for Left-adjusted designs (transparent PNGs).

Flash Builder fails to start

25 Oct

Flash Builder fails to start

After upgrading my Mac to Mountain Lion, I keep having problems with the machine not going to sleep as it should. Instead, some process (that I never started) hangs the machine at full load. I usually find my machine with the fans blowing hot air and in an unrecoverable crash state. Many of my friends have the same problems with Mountain Lion, but I've found that the problem disappears if I unplug my external screen before putting it to sleep? I dunno why, but this works.

Anyway - yesterday I for got to unplug the screen and upon rebooting I could no longer start Flash Builder. It took a while to Google the correct result so here's the quickfix and link. If Flash Builder 4.5, 4.6, 4.7 or any other version fails to restart, it's usually your workspace that have become corrupted. The fix is simple. Open a terminal window and navigate to your workspace directory. In this folder, there is a hidden directory called .metadata. This is what is corrupt. Solve the issue by changing the name like this:

mv .metadata .metadata.old

On next restart, Flash Builder (or rather Eclipse) will recreate this file. Unfortunately it won't restore your projects so you'll have to manually import these again. There's also a more complex option for the command-line savvy. 

AIR package has no certificates at entry in AIR

24 Oct

AIR package has no certificates at entry in AIR

Had a stupid Adobe AIR issue here that I couldn't find the answer to online, so I'm posting it here for future reference. If you get the error

AIR package has no certificates at entry /path/to/META-INF/AIR/appdescriptor.xml; ignoring

when installing your AIR app, it it probably something wrong with your certificate. In my case, I installed the APK and after a little time I simply got the message "Application not installed". I tried searching the usual sources, but didn't find the right answers. Eventually I installed a "logcat" tool on my Android phone to view the logs on the device directly. There it was - something about the certificate apparently?

I pondered this for a while and then it dawned on me. I had thought that I could use the same ".p12" certificate file that I use for exporting AIR to iOS. Apparently, you can't do this. You have to generate a separate ".p12" file (with no certification at all) for Android. So it's not like Android will accept ANY .p12 file - only those that are random and are not based on an authenticated real user. Obvious, right?

JY-MCU Pro Mini (made in china)

21 Oct

JY-MCU Pro Mini (made in china)

Some time ago I bought a dirt cheap Arduino Pro Mini clone from dx.com just to see if it worked. I didn't use it until today, but it works pretty well. It has one major drawback - it uses a non standard FTDI-connector in that it does not use the CTS-pin. It took a little time to figure out how to map this, so above is an image (click to enlarge) of the cable I made and below is the table of the pin mappings:

Adafruit FTDI Friend pin JY-MCU pin
GND GND
CTS -
VCC VBUS
TX RX
RX TX
RTS DTR

I have a Sparkfun FTDI adapter as well and this one is marked DTR instead of RTS, but it's otherwise similar. One thing to note - while the board itself is 3.3V there is no problem to use a 5V FTDI programmer with it. The board itself can run on anything from 3.3V to 12V so it's quite a flexible board. Earlier you could access the website of the makers of this board to access technical documentation, but now it's gone (or hard to find).

Now - about the ethics of buying china-made Arduino's. I feel that I can't post this without discussing it with myself a bit. I really don't like buying stuff like this from China and the reasons are:

  • You don't get any support if something fails
  • Documentation is non-existant
  • Nothing is given back to the Arduino project (like Adafruit and Sparkfun does)
  • I really should buy locally and not from Asia if possible

Buying this board was just a test, but would I buy more of these? Yes and it really comes down to price and how Open Hardware works. I recently delivered the first part of my first commercial project based on Arduino and electronics. For this project, I'll need to make something like 50 similar units that respond to a sensor.

The prototypes were based on Arduino Uno's and if I buy these locally I'll pay $43 per microcontroller. The Uno's are rather big so I'll certainly use something smaller for the production phase. If I do the project based on Arduino Pro Mini's, I'll pay $26 per MCU if bought here in Norway. I could also buy them direct from Sparkfun and with shipping, VAT and customs handling they'd be $22 apiece. Not shabby.

However, for such projects I wouldn't use off-the-shelf solutions. It's better to make custom boards specifically for the purpose and these would be something like $10 for the PCB and components - not including the soldering. I've done this several times now for personal projects, using only through-hole parts and soldering them by hand. In other words - a project like this wouldn't really be of any benefit to the Arduino project anyway, because it would simply not be the right way to solve such a project.

I really love working with through-hole and DIL parts, but of course SMD is even cheaper than that. Here's the crux - with the low price, free shipping and how the customs limit in Norway works, I can get the chinese clone-boards for less than $9 apiece. I can't even buy the SMD parts for that price, let alone solder them. Maybe the answer to this project would be to make a custom board with Arduino Pro Mini header-inserts?

Update: I'm not entirely sure, but I think this may be the website of JY-MCU? It is crazy slow so it's definitely a chinese website... If you just wait 5-10 minutes, you'll actually find what I made above at the bottom of this page.