Wink Saville’s Blog

December 10, 2007

Git submodule and “how-to combine muliple git-repos”

Filed under: programming,scm — wink @ 2:47 am

Ok, I leaned what git submodule is for, well at least I think so. Apparently its primary use to as a mechanism for tagging a set of repositories, see my post here, which starts here. What help the most was looking at the tutorial here.

The as it indicates in the Title my original goal was to have some way of combining multiple git-repos. git-submodule doesn’t really do that and there doesn’t seem any easy way to do it. But Daniel Barkalow provided me with the instructions below which did combine them with linear history which is just fine. I do not understand why it works and I also wonder how the instructions might be changed if there were multiple branches in one of the repository and I had wanted to get that history also? Anyway, questions for the future.

Ah, okay. I was assuming that you wanted them to maintain their original identities (so you'd send stuff off for each of them separately, for example). I think you can do what you want by doing: # Set up the new line: $ mkdir x; cd x $ git init $ touch README $ git add README $ git commit # Add a project "foo" $ git fetch ../foo refs/heads/master:refs/heads/foo $ git merge --no-commit foo $ git read-tree --reset -u HEAD $ git read-tree -u --prefix=foo/ foo $ git commit And repeat for all of the other projects. What's going on here is that you're merging in each project, except that you're moving all of the files from that project into a subdirectory as you pull in the content. The resulting repository has one recent dull initial commit, and then merges in each of the other projects with their history, with only the slight oddity that they don't go back to the same initial commit, and the merge renames all of the project's files. I think there may be a more obvious way of doing this (it's essentially how gitweb and git-gui got into the git history), but I'm not sure what it is, if there is one. -Daniel

After this post, Daniel came back with a nice explanation for what each line did, you can see the post here.

December 9, 2007

How-to move a Eclipse project?

Filed under: Android,programming — wink @ 8:28 pm

Here was the link which helped me move an Eclipse project to a different directory. I had had the android projects in ~/prgs/android and wanted to move them to ~/workspace/android.  Turns out you use Eclipse menu “File/import/Existing Projects into Workspace” to do that.

December 8, 2007

Android Debugging – getting more info

Filed under: Android,programming — wink @ 12:58 am

In trying to diagnose where my Annotation problem was I wasn’t getting the full stack trace and hence didn’t know exactly where the problem was. After stumbling around one why I found a way to get the full stack trace; run the application from Eclipse in Run mode rather than Debug Mode:

% emulator &
% adb logcat

Then in Eclipse ran the application the application using Run. A message on the emulator UI says; “An error has occurred in process com.saville.tests … <Force Quit>”. And then in the logcat trace we see the full backtrace.

I/ActivityThread(  537): Loading code package com.saville.tests (in com.saville.tests)
D/ActivityThread(  537): Performing launch of ActivityRecord{4001cda0 {com.saville.tests/com.saville.tests.testAnnotation}}
V/testAnnotation(  537): onCreate: E
V/testAnnotation(  537): testAnno: E
V/testAnnotation(  537): Declared names: onCreate
V/testAnnotation(  537): Declared names: testAnno
V/testAnnotation(  537): cl.getAnnotation dies with 'native method not implemented'
D/dalvikvm(  537): Exception java/lang/RuntimeException from Looper.java:76 not caught locally
D/dalvikvm(  537): Exception java/lang/RuntimeException from ZygoteInit.java:1176 not caught locally
D/AndroidRuntime(  537): Shutting down VM
W/dalvikvm(  537): threadid=3: thread exiting with uncaught exception (group=0x4000e648)
E/AndroidRuntime(  537): Uncaught handler: thread Main exiting due to uncaught exception
E/AndroidRuntime(  537): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.saville.tests/com.saville.tests.testAnnotation}: java.lang.UnsupportedOperationException: native method not implemented
E/AndroidRuntime(  537):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1397)
E/AndroidRuntime(  537):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1410)
E/AndroidRuntime(  537):        at android.app.ActivityThread.access$1200(ActivityThread.java:76)
E/AndroidRuntime(  537):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:980)
E/AndroidRuntime(  537):        at android.os.Handler.dispatchMessage(Handler.java:80)
E/AndroidRuntime(  537):        at android.os.Looper.loop(Looper.java:71)
E/AndroidRuntime(  537):        at android.app.ActivityThread.main(ActivityThread.java:2506)
E/AndroidRuntime(  537):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  537):        at java.lang.reflect.Method.invoke(Method.java:380)
E/AndroidRuntime(  537):        at android.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1170)
E/AndroidRuntime(  537):        at android.os.ZygoteInit.main(ZygoteInit.java:1121)
E/AndroidRuntime(  537):        at android.dalvik.NativeStart.main(Native Method)
E/AndroidRuntime(  537): Caused by: java.lang.UnsupportedOperationException: native method not implemented
E/AndroidRuntime(  537):        at java.lang.Class.getDeclaredAnnotations(Native Method)
E/AndroidRuntime(  537):        at java.lang.Class.getAnnotations(Class.java:202)
E/AndroidRuntime(  537):        at java.lang.Class.getAnnotation(Class.java:185)
E/AndroidRuntime(  537):        at com.saville.tests.testAnnotation.testAnno(testAnnotation.java:33)
E/AndroidRuntime(  537):        at com.saville.tests.testAnnotation.onCreate(testAnnotation.java:19)
E/AndroidRuntime(  537):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:786)
E/AndroidRuntime(  537):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1367)
E/AndroidRuntime(  537):        ... 11 more
I/Process (  461): Sending signal. PID: 537 SIG: 3
I/dalvikvm(  537): threadid=7: reacting to signal 3
I/dalvikvm(  537): DALVIK THREADS:
I/dalvikvm(  537): "Main" prio=5 tid=3 NATIVE
I/dalvikvm(  537):   | group="main" sCount=1 dsCount=0 s=0 obj=0x4000eca0
I/dalvikvm(  537):   | sysTid=450 nice=0 sched=0/0 handle=-1090962004
I/dalvikvm(  537):   at android/os/BinderProxy.transact(Native Method)
I/dalvikvm(  537):   at android/app/ActivityManagerProxy.handleApplicationError(ActivityManagerNative.java:1205)
I/dalvikvm(  537):   at android/os/RuntimeInit.crash(RuntimeInit.java:234)
I/dalvikvm(  537):   at android/os/RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:53)
I/dalvikvm(  537):   at java/lang/ThreadGroup.uncaughtException(ThreadGroup.java:853)
I/dalvikvm(  537):   at java/lang/ThreadGroup.uncaughtException(ThreadGroup.java:850)
I/dalvikvm(  537):   (break frame)
I/dalvikvm(  537):   at android/dalvik/NativeStart.main(Native Method)
I/dalvikvm(  537):   (break frame)

Android does not implement runtime Annotations

Filed under: Android,programming — wink @ 12:47 am

I posted a message here lamenting that runtime Annotations aren’t supported and that I couldn’t find a place to submit bug reports/feature requests. In any case I was hoping to use runtime Annotations for my StateMachine class but I guess I’ll try source only.

December 7, 2007

Android – application debug logging

Filed under: Android,programming — wink @ 10:04 pm

Here and Here are a couple of places that got me started. First the standard java logging mechanism doesn’t work. In addition System.out.print doesn’t work. You need to use the android.util.log.

package com.saville.tests;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

@StateMachine
public class test extends Activity
{

    /** Called with the activity is first created. */
    @Override
    public void onCreate(Bundle icicle)
    {
        super.onCreate(icicle);

        Log.v(TAG, "onCreate: E");
        setContentView(R.layout.main);
        Log.v(TAG, "onCreate: X");
    }

    private static final String TAG = "test";
}

The Log class supports various levels (VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT) the low-level routine is Log.println(int priority, String tag, String msg). But typically the v, d, i, w, e and a convince routines would be used. So that’s half the game, the other half is to be able to see the output. For that you use “logcat”. In Eclipse if you goto menu “Window/Show View/other/Android/logcat” or if your in the Debug perspective it will be in “Window/Show View/logcat”. Apparently, its not very reliable in Eclipse and executing:

adb logcat

Allows you to see it from a command line, but in Eclipse the log also includes a Date stamp which makes it nice. I was able to get the Eclipse/logcat going by closing than reopening. Of course you mileage may very:) If you look at the links above it appears you can use ddms, but I haven’t used that yet.

December 6, 2007

Android – adding busybox

Filed under: Android,programming — wink @ 10:59 pm

Here is a link to Beno’s blog on how to install BusyBox. He’s also got lots of good stuff on Android on his blog.

Not using eclipse and removing an Android app

Filed under: Android,programming — wink @ 10:10 pm

As a test I followed the instructions here, to test how easy it was to not use eclipse. It wasn’t hard at all except for figuring out how to remove an app. First I put the <andriod_sdk>/tools directory on my path so the tools were easily accessible (<android_sdk> respresents the full path to where I install the sdk). Since I had already installed one app, when using eclipse, and the second app I installed had the same name I didn’t know which app was running. I snooped around the debugger, adb, and saw that there was a shell command:

adb shell

I then used the ls command and found data/com.saville.tests and deleted it but the app was still there. While playing with the emulator I also found the the right most icon (yellow folder icon) on the home page (press the house button on the emulator), was the “Applications” folder where applications can be run.

Another important location was the “Dev Tools” icon, which is the silver folder icon with the gear on the right. Here I found by navigating to “Dev Tools/Package Browser/com.saville.tests” I saw that the “Source” of my app was in /data/app/test1.apk. I deleted that and bye-bye test1 from the “Applications” folder.

Further more if I deleted the /data/data/com.saville.tests the information in “Dev Tools/Package Browser” disappeared.

How to create a New Android Project

Filed under: Android,programming — wink @ 5:52 pm

I installed Android and then tried to follow the instructions on how to develop a new application here. I tried Create new project in workspace and added the ‘test1′ to “Project name:”, then tabbed to “Package name:”. At the top of the dialog the help line said; “Package name must be specified”. I typed a character, the help line said; “Package name must have at least tw o identifiers.”. If I then type two identifiers “a b” it says; “‘a b’ is not a valid java identifier”.

I wasn’t making much progress, I then googled around and found this, so the Package name must be a reverse DNS type name of two identifiers. So I used ‘com.saville’. The the help line changed to, “Activity name must be specified.”, I added “test1″ to Activity name: and pressed Finnish.

This created the project file in /home/wink/workspace/test1 with assets/ bin/ res/ and src/ and AndroidManifest.xml plus a bunch of other files in the subdirectories. In particular the source is in test1/src/com/saville/test1.java along with R.java.

After that far, I asked my self; how do I print out “hello, world”? The HelloActivity in the samples seem to be missing the R.java file. Anyway I googled for <android hello world> and found this.

December 2, 2007

Debugging initialization of Firefox extensions

Filed under: firefox — wink @ 7:31 pm

That worked beautifully, I wanted to set a break point
on the first line of my code that executed after it loaded.
I ran:

firefox -chrome chrome://venkman/content

and then did “window.open()” my code loaded and I
set a future breakpoint on the first statement in the file.
I then checked “Save Break/Watch Settings On Exit” in
the file menu and then exited firefox.
I’d like to thank Alex Vincent for solving the mystry on how to debug a the initialization/loading of a Firefox extension. Earlier I had a problem concerning why my Firefox extension would not work on the Mac. My attempts to debug that led me to want to use a debugger to watch how my extension worked as it was loaded, but I couldn’t figure out a solution. So I posted a message to the Mozilla developer forums javaScript Debugger email list.

The solution was provided by Alex Vincent, which was to not use the -venkman option but instead execute using -chrome below is the last message I posted this subject which details the solution:

That worked beautifully, I wanted to set a break point
on the first line of my code that executed after it loaded,
so I ran:

firefox -chrome chrome://venkman/content

and then executed “window.open()” as you suggested.
My code loaded and I set a future breakpoint on the
first statement in the file. I then checked
“Save Break/Watch Settings On Exit” in
the file menu and then exited firefox.

I then ran a second time with the same command:

firefox -chrome chrome://venkman/content

Then did “window.open()” a second time and we dropped
back into the debugger at my break point at the top of
the file. This was exactly what I wanted.

This is exactly what I wanted, hopefully this helps
someone else in the future.

THANKS Alex!

Wink

Getting GEFORCE 7600 working on Ubuntu 7.10

Filed under: linux,ubuntu — wink @ 2:07 am

I had a heck of a time trying to get this to work every time I tried to enable the restricted driver so I could run the enhanced UI all that would happen when rebooting is I’d get a message indicating that we were going to use Low-Resolution.

Things got disparate when I brought my two Dell’s from NXP home and wanted to hook them up to my linux box. So I searched the net and ran across Alberto Milone’s Envy package. To get the enhanced UI going I needed to install xserver-xgl.

sudo apt-get install xserver-xgl

This was found when executing compiz from the command line and an error is seen “Xgl: not present”. After installing I still have a couple of complaints; first X thinks the display is 3200×1600 and tends to put things in the middle of the display. Secondly, the menu bars at the top and bottom extend across both screens. On windows the system understands that there are two screens and it works better.

« Newer PostsOlder Posts »

Powered by WordPress