February 21, 2008, 9:46 pm
Linus Torvald’s talk at Google, about Git, a distributed version control system. I screen-captured his slides, and they are available for download or for view. I’ve been playing with git a bit in my personal projects. My workplace still uses Perforce though.
When on the road, I have the whole repo with me and can check-in my changes, revert, etc. When I get home, I can push my changes to my server and that can act as my “backup”. Although with Xcode 3.0 and its “snapshot” feature, I can sort of simulate this, but I would use that as a last resort though.
Technorati Tags: Linus Torvalds, git, distributed version control, Google
February 19, 2008, 8:50 am
Keep getting an “invalid argument” error when using Luigi Auriemma’s uif2iso after compiling on Mac OS X? In a nutshell, you will have to use “fseeko” instead of “fseek”, and “ftello” instead of “ftell” in his uif2iso.c file, when compiling in OS X.
I have made the appropriate changes (uif2iso.c), as well as fixed the warnings (version 0.1.2). I have made a diff of my changes also (uif2iso.diff.txt).
Technorati Tags: uif2iso, Mac OS X, invalid argument
February 18, 2008, 2:45 am
Recently I had a programming challenge in that I estimated a feature for this Java application that needed to know whether a certain program was running, and if it was running, terminate it.
Of course, in Java, it cannot be done in a cross-platform way. You can certainly launch a process in Java, then terminate that process you created, but you cannot know if a certain process is running and terminate that. To do this, you will need to have native code, and the way Java interfaces with your native code is through JNI (Java Native Interface).
In subsequent blog posts, I will write about how I coded this “Process Manager” JNI library using NetBeans — creating a process management library that can can return a list of running processes (and their process ids), as well as terminating the process by process id. The libraries I created were implemented in C, using NetBeans, on the Mac OS X, Windows, and Linux (Ubuntu) platforms using NetBeans 6.0.1.
It turns out it was easiest in Linux: you can easily list all the running processes through Java code. Processes are directories under “/proc”, with the directory filename as process id. Inside the directory itself is a text file with the filename of “status”, and the first line contains the process name. Of course to terminate this process by process id, you will still need to use native code.
Technorati Tags: NetBeans, JNI, Java Native Interface, cross-platform, process management
February 14, 2008, 12:42 am
If you have NetBeans 6.0 and you want to use the bundled JRuby, you might as well get 6.0.1 if you want NetBeans to handle updating the JRuby Gems for you (after changing the permissions of the JRuby gems directory of course, see below). NetBeans 6.0 has an OutOfMemory stack problem when trying to update the gems. The latest available Rails for JRuby Gems is 1.2.5 I believe (the bleeding edge as of this date is 2.0.2).
Of course, if you are using OS X’s included Ruby, just go to your command line and update Ruby gems normally (make sure you update rails with all its dependencies). Make sure to also update your environment.rb (in your Rails project configuration) to reflect the version of Rails you will be using.
When installing NetBeans, the whole bundle is installed using user “root” (read, write, execute privileges) and group “admin” (read and execute privileges only). The JRuby package is installed “inside” the NetBeans app bundle, and it has the same permissions. The current “user” needs to have “write” permissions to this JRuby directory, for NetBeans to update the gems:
- /Applications/NetBeans/NetBeans 6.0.1.app/Contents/Resources/NetBeans/ruby1/jruby-1.0.2/lib/ruby/gems/1.8
Either that, or you run NetBeans as root. If you want only users from the admin group to have access to this feature of NetBeans, do a “sudo chmod -R g+w <dir>”, or if you want everyone to have this write access, just do a “sudo chmod -R a+w <dir>” where <dir> is the directory path I referenced above.
Well, if anyone has trouble running NetBeans with Ruby on Rails, post a comment — I might have encountered your problem and solved it already, so I might be able to help.
Technorati Tags: NetBeans, Ruby on Rails, JRuby, Mac OS X