Wednesday, August 15, 2012

Cross-platform mobile development: PhoneGap + Enyo



If you want to develop a mobile application, but don't want to have to rewrite it for every platform you want to develop for (Android, iOS, etc.), PhoneGap is what you want. It allows you to develop applications using web technologies (HTML, CSS, JavaScript), and then deploy them to a large number of platforms, such as Android and iOS. It has APIs that let you interface directly with the mobile device's hardware (camera, GPS, accelerometer, you name it). It's even been approved by Apple, and we all know what a feat that is ;)

Undoubtedly you'll want a nice framework that gives you all the UI widgets you're used to: layouts, spinners, popups, progress bars, etc. That's where Enyo comes in. Enyo was actually the JavaScript framework that was part of WebOS. Since WebOS has been open-sourced, so has Enyo. I would recommend Enyo over other JavaScript frameworks like jQuery Mobile and Sencha; see here for some reasons why: Enyo+PhoneGap Vs jQueryMobile+PhoneGap

There are already some apps out there using this approach. Here are a couple for android:
I've even done some playing around with phonegap and the enyo samples myself. I put it in github in case it's of any interest:
https://github.com/bmaupin/junkpile/tree/master/java/testing/android-phonegap-enyo-test

The screenshots in this post are from that code, and you can see more here:
https://github.com/bmaupin/junkpile/tree/master/java/testing/android-phonegap-enyo-test/screenshots

Enjoy!

Thursday, July 19, 2012

The evolution of Android Arabic support

Now that full Arabic support has finally been added to the latest version of Android (4.1, nicknamed Jelly Bean), here are some details as to what extent Arabic has been supported in previous versions:

up to and including Android 2.1:



No Arabic support whatsoever. Any attempt to show Arabic text will result in rectangular boxes instead of characters. Applications that wish to support Arabic must include their own Arabic font. There is no shaping support, meaning letters will not connect to each other, but this can be provided by a third-party library. In addition, the diacritics/harakat will not be properly placed and will often overlap, making them difficult to read.

Android 2.2 - Android 2.3:



In Android 2.2, an Arabic font was added (DroidSansArabic), which is the default Arabic font in Android until Android 4.0. still no shaping or diacritic support.

Android 3



With Android 3.0, shaping support is finally added, so now the Arabic letters will connect without the aid of a third-party library. Still no diacritic support.

Android 4.0



The default Arabic font is changed to Droid Naskh, and another Arabic font is added to replace DroidSansArabic: Droid Kufi. Still no diacritic support.

Android 4.1



Finally, full Arabic support, including support for diacritic placement!

Friday, July 6, 2012

Pimsleur: the best way to learn a language

First, a disclaimer: I'm not getting paid to say this. I am not affiliated with Pimsleur in any way, and there are no affiliate links here. I'm simply a huge fan of a great product.

I've used many programs to study languages, including (but not limited to):
  • Berlitz
  • Living Language
  • Rosetta Stone
  • Teach Yourself
  • VocabuLearn
Pimsleur beats them all, hands down. Here's why I recommend it to anyone wanting to learn a language:
  1. It teaches you using the same methods you used to learn your first language as a baby. So the focus is on listening and speaking, and you learn the grammar intuitively. So no more studying charts, paradigms, conjugations, etc.

  2. The repetition is built-in. With other programs, I end up having to repeat the lessons over and over. I end up getting bored and don't retain much information at all. Not so with Pimsleur.

  3. Because the focus is on listening and speaking, you actually get comfortable speaking the language. I've used other programs that help me learn how to read a language, but that does little in helping me communicate with other people. With Pimsleur, you'll be speaking from day one (literally).

  4. Let's face it, I'm busy. I don't have time to sit in front of a computer and do Rosetta Stone for hours, or study a book for hours. Pimsleur's focus on listening and speaking means I can do the lessons during my commute, at the gym, folding clothes, whatever.
So what are you waiting for? The first lesson for your language of choice is available from Pimsleur's website for free. I think they should make the second lesson available for free too, but something is better than nothing.

Where to get Pimsleur:

  • Your local library
    Many local libraries have Pimsleur available to check out for free. Can't hurt to check.

  • Used online or locally
    You might be able to find Pimsleur used on sites like ebay, amazon, or at a local used bookstore.

  • Buy the digital version from pimsleur.com
    Sometimes this can even be cheaper than a used copy of the CDs, and if you're like me and would rather listen to it on your phone/mp3 player than have to carry around a stack of CDs, it's win-win.

  • Buy the CDs new
    This is probably the most expensive option: buying the Pimsleur CDs new from pimsleur.com or another site like amazon.
If you do end up buying online, be sure to use my tip to check if there's a coupon code before you pay the full retail price!:
How to save money when shopping online

Thursday, July 5, 2012

no wifi networks showing on android


if for some reason no wifi networks are showing on your android device, first reboot it. if that doesn't do the trick, restoring your wifi access points from a previous backup may work:

  1. open Titanium Backup

  2. click Backup/Restore

  3. scroll down and select Wi-Fi Access Points

  4. click Restore next to the most recent backup

  5. reboot your phone


of course this will only work if you've already rooted your phone, installed Titanium Backup, and backed up your wifi access points. if you haven't done that, there are several apps in the google play market that claim to fix your wifi. if those don't work, you may need to a factory reset.

the moral of the story is: use Titanium Backup to back up your android device often!

Thursday, June 14, 2012

android vs iphone/ios

I just read an incredibly well-written article from the point of view of a 4-year iphone user switching to android. if you're looking for an iphone (or android) bashing, move along. this is actually a balanced article that points out the pros and cons for both. very well done:

29 Days with Android

Tuesday, June 5, 2012

Eclipse Subversive plugin out of Java heap space

Solution:

Use the JavaHL SVN Connector instead of SVN Kit. to install the JavaHL Connector:
  1. In eclipse go to Help --> Install New Software...

  2. Work with: --> choose the community.polarion.com update site

  3. Expand Subversive SVN Connectors

  4. Choose the JavaHL version corresponding with your version of subversion

  5. Click Next, and then follow the instructions to complete installation

  6. Window --> Preferences --> expand Team --> select SVN --> select the SVN Connector tab --> change the SVN Connector to JavaHL --> OK
There are additional steps for completing the JavaHL installation. Subversive doesn't seem to have any helpful documentation regarding this, but Subclipse does:
http://subclipse.tigris.org/wiki/JavaHL

In Linux (elementary, Ubuntu, Debian), you can do this to finish the installation:
  1. Install libsvn-java:
    sudo apt-get install libsvn-java

  2. Then edit eclipse.ini (located in /etc/ if you installed eclipse from a package or in the eclipse folder you extracted if you downloaded it from the eclipse website), and add the following line after the -vmargs line:
    -Djava.library.path=/usr/lib/jni

    For Ubuntu 12.04 64-bit, the line should be:
    -Djava.library.path=/usr/lib/x86_64-linux-gnu/jni/

  3. Restart Eclipse

Details:

So I recently switched to Subversive from Subclipse as my SVN plugin in Eclipse. I was checking out one of my repositories (a pretty big one), and I got this error:

Checkout operation for 'https://svn.example.com/myproject' failed.
Java heap space


I have 1 GB of java heap space given to Eclipse (-Xmx1024m in /etc/eclipse.ini), and I don't think I've run out yet, but I went ahead and upped it to 1.5 GB. I got the same error. 2 GB--same error. I tried again with 2 GB of heap space, closing all perspectives to save memory, and it finally worked.

I new something wasn't right, but at first I couldn't find anything in Google. I kept searching, and finally found this:
http://www.eclipse.org/forums/index.php?t=msg&goto=559537&S=9c09f002ceb108176748012e60540921

Essentially the problem is a bug with the SVNKit SVN connector. There are two connectors available:
  • SVNKit
    • Pros: easier to install
    • Cons: possibly buggier, because it's a Java reimplementation of Subversion
  • JavaHL
    • Pros: more stable, because it's a wrapper around the native subversion C code
    • Cons: a little more work to set up
The solution, as mentioned above, is to use the JavaHL connector, because this problem is caused by a bug in the SVNKit connector.

Friday, May 25, 2012

wine crashing on ubuntu 10.10

solution:



downgrade wine, like so:

  1. uninstall the current version of wine
    sudo apt-get remove wine1.3 wine1.3-gecko ttf-symbol-replacement-wine1.3

  2. install the older stable version of wine
    sudo apt-get install wine1.2




backstory:



I was recently trying to install steam on ubuntu 10.10 using the latest wine (1.4 something I believe). it kept crashing X windows right as it tried to launch steam.exe, or when I tried to launch it manually. here's the end of the terminal output:

err:wgl:is_extension_supported No OpenGL extensions found, check if your OpenGL setup is correct!
fixme:iphlpapi:NotifyAddrChange (Handle 0x453d95c, overlapped 0x4353d20): stub
fixme:winsock:WSALookupServiceBeginW (0x453da5c 0x00000ff0 0x453daa4) Stub!
[0525/102859:ERROR:network_change_notifier_win.cc(111)] WSALookupServiceBegin failed with: 8
fixme:toolhelp:CreateToolhelp32Snapshot Unimplemented: heap list snapshot
fixme:toolhelp:Heap32ListFirst : stub
ALSA lib pcm_pulse.c:1008:(_snd_pcm_pulse_open) Unknown field handle_underrun
err:winediag:AUDDRV_GetAudioEndpoint PulseAudio "default" -22 without handle_underrun. Audio may hang. Please upgrade to alsa_plugins >= 1.0.24
../../src/xcb_io.c:385: _XAllocID: Assertion `ret != inval_id' failed.
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
after 150 requests (144 known processed) with 0 events remaining.

I'm not sure which part of that caused the crash. I googled the third-to-last line, and came across this still unfixed bug that's been in ubuntu for the last four versions (please try to convince me the ubuntu developers care about stability):
https://bugs.launchpad.net/ubuntu/+source/libx11/+bug/507062

after I downgraded wine (see solution above), steam installed just fine:
winetricks steam

if, for some reason, you removed the wine PPA or need to install winetricks manually, this should do the trick:

cd /usr/local/bin
sudo wget http://winetricks.org/winetricks
sudo chmod +x winetricks
cd ~