Showing posts from 2011

Running Android Unit Test

Create a unit test based on AndroidTestCase then modify AndroidManifest to add:

<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
<instrumentation android:targetPackage="com.mypackagename.test"
android:name="android.test.InstrumentationTestRunner" />

Then select the class and run as "Android JUnit test"

Creating a new eclipse workspace and importing existing Android projects

First make sure you setup the Android SDK location in your Android Preferences

Typically I change the font settings in:
- Window | Preferences - General | Appereance | Color and Fonts - Basic | Text Font
And I choose "Lucida Console 9" on Windows

Regarding Java compiler warning, I choose to rely on the Override annotation to check override and interface implementations (!) spelling:

- Window | Preferences - Java | Compiler | Errors/Warnings | Annotations Missing @Override: Warning (check "include implementations of interface...")

You might get the following warnings:
android requires compiler compliance level 5For this select Android | Fix Project Properties
But since I use @Override for interface implementation, I make sur the workspace java level is set to 1.6 and that there is no project specific settings

HTC Desire debugging with Windows 7 64 bits

Pluging the HTC Desire with Debugging on was always telling ADB driver not found and running adb devices was not showing my device. Here is what I did.
Install Google USB Driver package from Android Update Manager (Third Party Add ons/Google Inc)Modify the file android_winusb.inf in android-sdk-windows\extras\google\usb_driver to add the following lines (under [Google.NTamd64]):
;HTC Desire
%SingleAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C87&REV_0226&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_0BB4&PID_0C87&MI_01From Device Manager, Select the ADB component (which should have an exclamation mark) and select update driver and give the usb driver locationadb kill-serveradb devices should now display the devices correctly

Xcode/ios 4 shortcut on Windows Keyboard

As I use Synergy to control my Mac, here are the shortcut I have on XCode

Ctrl (win) = Ctrl (mac)Win = AltAlt = Cmd/AppleEditor
Switch .h/.mm Ctrl+Alt+UpRunning/debugging
Run Alt+R Continue Ctrl+Alt+Y

Run batch files from cygwin

I could not find a simple way to call a .bat file from cygwin and passing argument. One solution I found is to cmd /c. But in cygwin the must be spelled "cmd //c".

cmd //c "dir"

Java applet on Ubuntu

Test java install at the following link:
Sun java pluginRemove any existing instance of open jdk plugin

sudo apt-get remove icedtea6-plugin

Then install: Sun java plugin
Make the plugin workIt this link still does not work:

sudo update-alternatives --config
sudo update-alternatives --config

Choosing /usr/lib/jvm/java-6-sun/jre/lib/i386/ has worked for me
Open jdk pluginRemove any existing instance of sun java plugin

sudo apt-get remove sun-java6-plugin

Then install: Icedtea plugin

Wordpress to Wordpress multisite

This assumes that you have a new wordpress installed with multisite enabled and that you want to move an existing site into it. It also assumes that you have WordPress MU Domain Mapping plugin installed
Databaseexport current database as sql and edit sql filereplace `wp_ with `wp_nnn_ where nnn is the blog idin wp_options change field name wp_user_roles to wp_nnn_user_rolesNote that wp_user will be ignored Rename linkswp-content/uploads/xxx to files/xxxwp-content/gallery to wp-content/blogs.dir/nnn/galleryimport the file in the new databaseFilesTransfer content of uploads to blogs.dir/nnn/files(Nextgen) Transfer content of gallery to blogs.dir/gallerySettings update(Nextgen) option: update default folder (wp-content/gallery) to wp-content/blogs.dir/nnn/gallery/ (to do this in wp_nnn_options, field ngg_optionsPost updateAfter importing the new database, you might to change some links after changing the domain name:
UPDATE wp_nnn_posts SET POST_CONTENT = replace(POST_CONTENT, 'myoldd…

Auto-formatting in Visual Studio C++ 2010

To autoformat the source code with the correct indentation the shortest shortcut I found is CTRL+A,K,F (keep CTRL pressed than press A - to select all - then K then F to reformat)

Visual Studio, settings Build current project shortcut

Go to Tools|Customize... then press the Keyboard... button at the bottom. Look for Build.BuildOnlyProject and assign whatever shortcut you want (F7, F11...)

Cygwin, setting svn editor

Under cygwin but sing regular Win32 svn, setting the SVN_EDITOR for example using notepad++ is the following:
export SVN_EDITOR='"C:\Program Files (x86)\Notepad++\notepad++.exe"'

Manipulating svn:ignore using command line

svn:ignore is a property that must be set or get.
To check current folder ignore list (assuming you're at the folder location - hence using . below but that could be any folder name)
svn propget svn:ignore .
Example to set to ignore Thumbs.db
svn propset svn:ignore "Thumbs.db" .
Or simply edit the property
svn propedit svn:ignore .

Deleting files (.svn, Thumbs.db)

Remove .svn files
rm -rf $(find . -name .svn)
Remove Thumbs.db files
rm -rf $(find . -name Thumbs.db)