Posts

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" /> </application> <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 5 For 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_01 From Device Manager, Select the ADB component (which should have an exclamation mark) and select update driver and give the usb driver location adb kill-server adb 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 General Ctrl (win) = Ctrl (mac) Win = Alt Alt = Cmd/Apple Editor Switch .h/.mm Ctrl+Alt+Up Running/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". Example: cmd //c "dir"

Java applet on Ubuntu

Test java install at the following link:  http://www.java.com/fr/download/help/testvm.xml Sun java plugin Remove any existing instance of open jdk plugin sudo apt-get remove icedtea6-plugin Then install: Sun java plugin Make the plugin work It this link still does not work: http://www.java.com/fr/download/help/testvm.xml sudo update-alternatives --config firefox-javaplugin.so sudo update-alternatives --config mozilla-javaplugin.so Choosing /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so has worked for me Open jdk plugin Remove 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 Database export current database as sql and edit sql file replace `wp_ with `wp_ nnn _ where nnn is the blog id in wp_options change field name wp_user_roles to wp_nnn_user_roles Note that wp_user will be ignored  Rename links wp-content/uploads/xxx to files/xxx wp-content/gallery to wp-content/blogs.dir/nnn/gallery import the file in the new database Files Transfer content of uploads to blogs.dir/nnn/files (Nextgen) Transfer content of gallery to blogs.dir/gallery Settings 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_options Post update After importing the new database, you might to change some links after changing the domain name: UPDATE wp_nnn_posts SET POST_CONTENT = r

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)