Tuesday, December 30, 2008
Order parts from Digi-Key for hacking DNS-323
Did some research today and realized that instead of soldering my own TTL-RS232 converter, the easiest solution is ordering a converter cable, a female housing and some pins from Digi-Key.
Tuesday, March 11, 2008
Learning Python
I've always wanted to create a Nautilus extension for Subversion since that's been the primary environment at work for more than a year now. All developers switched to Linux, more specifically, Ubuntu. The subclipse plugin for Eclipse works pretty well, but it only takes care of the projects you imported into the workspace, nothing more. I've been using the SVN command line for updating/committing other files, and am very comfortable with that. However it would be still easier if we had something similar to TortoiseSVN that integrates with the file manager.
Since I had lots of C/C++ programming experience in the past, I started a C project called gvcs-client hosted at http://code.google.com/p/gvcs-client/ but implemented only a little bit in the "nautilus-svn" module. I have to say after working with garbage-collected languages for the past few years, going to back to C is such a pain! I'm pretty proficient in C programming, but productivity is really bad when I have to deal with things I never need to care with other languages.
This time I wanna use Python instead of C for this project. I know nothing about Python except for some applications I use everyday are Python-based, such as Meld and Deluge. I have a strong feeling that more and more desktop applications will be written in some higher level languages instead of C.
Anyway, the decision has been made, I'm going to learn Python, and this project is going to be my first Python program!
The old C-based incomplete implementation is still available here:
http://code.google.com/p/gvcs-client/source/browse
Since I had lots of C/C++ programming experience in the past, I started a C project called gvcs-client hosted at http://code.google.com/p/gvcs-client/ but implemented only a little bit in the "nautilus-svn" module. I have to say after working with garbage-collected languages for the past few years, going to back to C is such a pain! I'm pretty proficient in C programming, but productivity is really bad when I have to deal with things I never need to care with other languages.
This time I wanna use Python instead of C for this project. I know nothing about Python except for some applications I use everyday are Python-based, such as Meld and Deluge. I have a strong feeling that more and more desktop applications will be written in some higher level languages instead of C.
Anyway, the decision has been made, I'm going to learn Python, and this project is going to be my first Python program!
The old C-based incomplete implementation is still available here:
http://code.google.com/p/gvcs-client/source/browse
Thursday, February 01, 2007
Firefox Bookmark for Searching Maven Repository
I've completely switched all my projects from Ant to Maven, and it really makes my life easier when managing large projects with lots of subprojects and all sorts of internal or external dependencies. I created a Firefox bookmark the other day, it makes my life even easier when searching for packages I want to add to my projects. The bookmark is a one-line JavaScript code that asks for the package name when clicked, creates a Google search URL and redirects your page right away.
Here's what I did, I created a bookmark using Firefox's bookmarks manager and used the following line as the location.
Here's what I did, I created a bookmark using Firefox's bookmarks manager and used the following line as the location.
javascript:var q=prompt(%22Please enter keywords%22);if(q!=null){window.location='http://www.google.com/search?q=site%3Aibiblio.org+maven2+'+q;}
Thursday, June 15, 2006
Maven Nautilus Scripts
I've been using Maven2 a lot recently, and I wrote some simple Nautilus scripts to make my life a bit easier. I never had any problem running mvn commands myself, but thought it would help Maven beginners get started quickly without having to read all the documents first. My scripts should work in any GNOME 2.x (I'm using GNOME 2.14) environment.
Let's see some screen shots first.
Create a Maven Project
You can right click in any folder and create a Maven project right there.
Step 1, enter the groupId of your project.
Step 2, enter the artifactId of your project.
Step 3, choose an Archetype.
Step 4, Your project has been created!
You can now work on your new Maven project!
Install 3rd-party Jars
To install a 3rd party JAR to your local repository, just right-click on the file and select "Install Package"
The script automatically detects all available Java packages in the JAR, you can simply select a package name as the groupId. If you don't like any groupId detected by the script, click "Cancel" and enter whatever groupId you want.
Change the artifactId if it's not what you want.
Enter the version number
and the packing type...
The JAR has been installed to your local repository!
The scripts are pretty simple right now, I'm planning some improvements and new features, here's my TODO:
Version 0.2
- implement command "Deploy Package" that deploys packages to remote
repositories
- implement command "Run..." that prompts a list of builtin goals, the user
can select a goal and run it right away from the current directory
Version 0.3
- GUI for downloading and installing Sun JARs
Version X.X (unscheduled)
- Simple GUI for $HOME/.m2/settings.xml that allows the user to add a mirror,
configure a proxy, etc.
- Auto update nautilus-maven-scripts
- Auto update maven2 (through sudo or gksu if not installed in home dir)
Let's see some screen shots first.
Create a Maven Project
You can right click in any folder and create a Maven project right there.
Step 1, enter the groupId of your project.
Step 2, enter the artifactId of your project.
Step 3, choose an Archetype.
Step 4, Your project has been created!
You can now work on your new Maven project!Install 3rd-party Jars
To install a 3rd party JAR to your local repository, just right-click on the file and select "Install Package"
The script automatically detects all available Java packages in the JAR, you can simply select a package name as the groupId. If you don't like any groupId detected by the script, click "Cancel" and enter whatever groupId you want.
Change the artifactId if it's not what you want.
Enter the version number
and the packing type...
The JAR has been installed to your local repository!The scripts are pretty simple right now, I'm planning some improvements and new features, here's my TODO:
Version 0.2
- implement command "Deploy Package" that deploys packages to remote
repositories
- implement command "Run..." that prompts a list of builtin goals, the user
can select a goal and run it right away from the current directory
Version 0.3
- GUI for downloading and installing Sun JARs
Version X.X (unscheduled)
- Simple GUI for $HOME/.m2/settings.xml that allows the user to add a mirror,
configure a proxy, etc.
- Auto update nautilus-maven-scripts
- Auto update maven2 (through sudo or gksu if not installed in home dir)
Wednesday, January 25, 2006
Can't get 100% test coverage because of logging statements?
I was looking for a way that I can filter out all the logging statements such as:
and found that clover is capable of doing that, but as we're using Maven 2, the maven clover plugin doesn't seem to support it now, believe me, I've reviewed their source code.
Finally I found a solution that does the trick. In your test case, just set the logging level of the class under test to whatever you want, test your class and then set the logging level back! e.g. your class is foo.bar.MyClass
if (log.isDebugEnabled())
and found that clover is capable of doing that, but as we're using Maven 2, the maven clover plugin doesn't seem to support it now, believe me, I've reviewed their source code.
Finally I found a solution that does the trick. In your test case, just set the logging level of the class under test to whatever you want, test your class and then set the logging level back! e.g. your class is foo.bar.MyClass
Logger logger = Logger.getLogger("foo.bar");
Level oldLevel = logger.getLevel();
logger.setLevel(Level.OFF);
// test your class here...
logger.setLevel(oldLevel);
Friday, December 16, 2005
mixing libstdc++5 and 6 causes problems
My favourite IM module SCIM started crashing applications after a "apt-get upgrade", i found that scim in debian etch is linked with libstdc++5, so it works fine with any applications that link with the same version of libstdc++, as scim gtk im module is loaded as a shared library, if it attaches to any libstdc++6 process, it'll be a mix of v5 and v6, segmentation fault... there are quite a few apps even firefox 1.0.7 links with libstdc++6, which breaks ABI compatibility with v5. Checked my fedora core 4 box at work, all apps are using v6, so scim works flawlessly. I guess debian is still in a transition from libstdc++5 to libstdc++6.
Sunday, December 11, 2005
Connecting to Windows VPN from Debian
Tired of using the PPTP Client GUI? Here's how I did it without the GUI. I really don't like the old GTK 1.x based GUI, and the way how resolv.conf is handled by the GUI.
Now you can connect to the VPN server by:
And disconnect from the VPN server by:
And if you want, add this line to /etc/network/interfaces, so that the system will bring the interface up automatically.
# install packages
apt-get install ppp pptp-linux resolvconf
# create options.pptp
echo "lock noauth nobsdcomp nodeflate usepeerdns" > /etc/ppp/options.pptp
# create chap-secrets
echo "DOMAIN\\USERNAME PPTP PASSWORD *" > /etc/ppp/chap-secrets
chmod o-rw /etc/ppp/chap-secrets
# create /etc/ppp/peers/TUNNEL-NAME with the following content
pty "pptp SERVERIP --nolaunchpppd"
name DOMAIN\\USERNAME
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam TUNNEL-NAME
# activate the tunnel
pon TUNNEL-NAME
# deactivate the tunnel
poff TUNNEL-NAME
# debug the tunnel with:
pon TUNNEL-NAME debug dump logfd 2 nodetach
# add the tunnel to /etc/network/interfaces with the following content
iface vpn inet ppp
provider TUNNEL-NAME
# create /etc/ppp/ip-up.d/TUNNEL-NAME as follows
#!/bin/sh
if [ "${PPP_IPPARAM}" = "TUNNEL-NAME" ]; then
route add -net 192.168.0.0/24 dev ${IFNAME}
fi
# after you've installed resolvconf, the name servers are managed by
# the resolvconf program based on the status of the interfaces, so
# if you have a static interface, make sure you add your default name
# server to your interface config in /etc/network/interfaces, e.g.
iface eth0 inet static
...
dns-nameservers YOUR_NAME_SERVER
Now you can connect to the VPN server by:
ifup vpn
And disconnect from the VPN server by:
ifdown vpn
And if you want, add this line to /etc/network/interfaces, so that the system will bring the interface up automatically.
auto vpn
Subscribe to:
Posts (Atom)