Wednesday, January 19, 2011

Step-by-step developing Android Apps on Nexus One in Windows 7 64-Bit

Most of this is found at http://developer.android.com/sdk/index.html

1. Download the Java JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select the Java button, you don't need the Java EE.
2. Install the Java JDK.

3. Download the SDK (not the installer exe, but the zip file) from the above link. Currently you want the android-sdk_r08-windows.zip file.
4. Unpack the zip file to the location you want to have the SDK installed (doesn't much matter where, just remember where you put it). For example C:\Users\ which will be used here.

5. Add the ANDROID_SWT user variables:
5.1. Open start menu, enter sysdm.cpl into the text field and press enter.
5.2. In the opened window, select Advanced System Settings on the left.
5.3. Select Environment variables in the lower right corner.
5.4. Press the New button under the User variables windows (the top one).
5.5. Enter ANDROID_SWT in the variable name field and the path to the swt 64-bit SWT file into the variable value field. For example C:\Users\<YOUR USERNAME HERE>\android-sdk-windows\tools\lib\x86_64.
5.6. Press OK in all the windows to close them.

6. Download Eclipse from http://www.eclipse.org/downloads/, you want Eclipse IDE for Java Developers for Windows 64 Bit. Unpack the eclipse folder to wherever you want to have eclipse installed. Go into the folder and drag the eclipse.exe file to your desktop or start menu while holding the SHIFT key to make a shortcut to Eclipse.

7. Follow the instructions at http://developer.android.com/sdk/eclipse-adt.html to install the Eclipse ADT Plugin. Here is the list from that page:
7.1. In Eclipse go to Help > Install New Software.....
7.2. Press Add in the top right hand corner.
7.3. write ADT Plugin in the name field and https://dl-ssl.google.com/android/eclipse/ in the Location URL. If you get any errors, try changing from https to http.
7.4. In the Available Software dialog, select the checkbox next to Developer Tools, press Next.
7.5. In the next window, you'll see a list of the tools to be downloaded. Click Next.
7.6. Read and accept the license agreements, then click Finish.
7.7. When the installation completes, restart Eclipse.
7.8. After restaing Eclipse, go to Window > Preferences....
7.9. Select Android from the list on the left.
7.10. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
7.11. Click Apply, then OK.

8. Add the SDK components needed to code for Android (not just the manager which is what you downloaded):
8.1. In Eclipse select Window > Android SDK and AVD Manager.
8.2. Select Available Packages on the left.
8.3. Check the checkbox next to Android Repository to install all versions of the SDK (so you can develop for all versions of Android 1.5 - 2.3).
8.4. Click Install Selected.
8.5. Accept the licenses, press Accept All and then Install.

9. Follow http://developer.android.com/guide/developing/device.html to set up device (Nexus One):
9.1. Connect you Nexus One to the PC using an USB cable.
9.2. When/If Windows says it has failed to install drivers for a device, tell it you have drivers. If windows doesn't ask you for drivers go to the start menu and type devmgmt.msc into the field and press Enter. You will get a list of all your devices, find the one with a red mark and right click it. Select Update Driver Software.
9.3. Select Browse my computer for driver software.
9.4. Select Browse and select the google-usb_driver folder in the SDK folder you unpacked in step 3.

10. Turn on "USB Debugging" on the Nexus One.
10.1. press MENU, select Applications > Development, then enable USB debugging.

11. Try to see if your Nexus One is connected by opening command line (go to start menu, enter cmd and press enter). navigate to the location of your SDK and the platform-tools directory. Run adb devices or just run it directly by using the full path: C:\Users\<YOUR USERNAME HERE>\android-sdk-windows\platform-tools\adb.exe devices. You should see something like:
List of devices attached
HT9DSP500000 device


12. If you already have a project written in Eclipse open the AndroidManifest.xml file, open the Application tab at the bottom and then select true in the Debuggable drop-down box on the left.
12.1. If you do not have a project, follow http://developer.android.com/resources/tutorials/hello-world.html to set one up.

13. To run yourIn Eclipse select Run > Run Configurations...
13.1. Select Android Application on the left and press the New icon.
13.2. Enter whatever you want in the Name field and press browse and select the project you want to run.
13.3. In the target tab. Select Manual.
13.4. Press run. In the dialog select you device and press OK.

Monday, January 10, 2011

"Recent changes" in Android Market

Been frustrated over apps updating, but not telling you about what changes they have done?
Not so big a problem anymore.
A "recent changes" section has been added in the latest release of Android Market, here's how to find it:

- Open the page for an app in Android Market.
- Scroll down to Description
- Click on More and scroll to the end of the section
- Under the title "Recently changed in this version" you'll find the latest changes.

Tuesday, January 4, 2011

TCPDF multipage table page break in multiline cell problem

I had a problem when I was creating PDFs from HTML with TCPDF. Tables spanning multiple pages which contained cells with multiple lines ended up page breaking in the middle of the cells and causing havoc with the automatically generated table header on the next page.

You might have seen other people having this problem:
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468.
And http://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/ created their own class to circumvent the problem.

The fix now is as nicolaasuni says in http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468?message=8669584, get the latest version of TCPDF.

Alternatively, if you can't upgrade, you can use the nobr attribute which tells TCPDF not to break in the middle of a cell or other HTML tag. Usage:
<tr nobr="true">
<td>your content here</td>
</tr>


Solution found (nicolaasuni again): http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3457446?message=7762133

Thursday, December 30, 2010

New Firebug Autocomplete annoying with jQuery

Firebug is a great tool for web developers to debug webpages.

If you have installed the latest update from Firefox' Add-ons menu and tried to write jQuery commands into the console/command line of firebug you might have run across an annoying problem.

Firebug tries to autocomplete $, $(, $(', etc. adding $ and completing ' after the next character. Basically you have to keep hitting escape or delete to write your jQuery statement.

This problem is luckily fixed in the latest beta release. It is not available through the add-on menu in Firefox, but can be downloaded directly from the Firebug website. So head over to http://blog.getfirebug.com/2010/12/22/firebug-1-6-1b2/ and download it.

Source: http://code.google.com/p/fbug/issues/detail?id=3184.

Saturday, December 18, 2010

Windows 7 middle click mouse doesn't close tabs

In Firefox on Windows 7, closing tabs by clicking on them with the middle mouse button doesn't work. You only get the Alt+Tab 'window' to switch between programs.

To fix this:
- Go to Control Panel
- Select 'Hardware and Sound'
- Select 'Mouse' under 'Devices and Printers'
- In the drop-down box for 'Wheel button' change it from 'Flip' to 'Middle-click'
- Press OK

This should now enabling closing tabs with clicking the middle mouse button.

Sound cut-off in Deus Ex 1

Playing the old classic on Windows 7 gave me some trouble with speech being cut of about 1 second before it should have finished.

Read a few places about this problem and some suggestions about changing latency to 46 or 60 (in the deusex.ini file in the deusex/system folder), but this didn't work for me.

Changing from using Direct3D Support to OpenGL as the video device did.
Here is how:
- Open 'Deus Ex Safe Mode' from start menu
- Select 'Change your 3D video device'
- Select 'show all devices'
- Select 'OpenGL Support' and press next
- Accept settings suggestion (can be changed in-game later)
Enjoy!

If this doesn't work for you, here are some forums with suggestions for how to get it to work with Direct3D:
http://www.ttlg.com/forums/showthread.php?s=&threadid=50981
http://www.ttlg.com/forums/showthread.php?t=99140 (since DeusEx runs on the Unreal rendering engine)

Saturday, November 13, 2010

Workaround for Ubuntu install hangs on forward button

Have you tried installing Ubuntu using the official guide where you create a Live/Install USB using Universal USB Installer in Windows? Did the install not continue after pressing continue when selecting language or when selecting keyboard layout?

This seems to be because of gparted/parted not being able to start. It affects installing from Ubuntu 10.4-netbook 10.10-netbook, and 10.10-desktop.

A workaround is to create the Live/Install USB in Ubuntu.

You will need two USB drives (including the one you created in windows).

Start the Live session, get a copy of the iso you put on the USB onto the computer (either from a different machine or download it). Open the startup disk creator in you Ubuntu Live session (System->Administration->Startup Disk Creator). Select the iso file and the other USB drive.
Create the startup disk. Shut down, remove the USB created in windows. Start up using the USB created in Ubuntu to boot from. Install from the USB created in Ubuntu. The forward button should now work.

Sources: A Ubuntu bug report that I cannot find again. Please tell me if you have seen it so I can give credit.