Google search bar

April 10, 2009

MercurialEclipse

Installing MercurialEclipse plugin I've run into the problem that the plugin would say something like 'error when verifying mercurial install...'

Well. I installed the mercurial 1.2.1 windows binary package from here: , set HG environment variable to the path to the hg executable. the hg install directory was added to the PATH. Now the pluggin seems to work well.

March 12, 2009

Atheros Wireless in Ubuntu 8.10 Intrepid Ibex

Thanks for this blog entry
http://unsharptech.com/2008/10/31/atheros-wireless-in-ubuntu-810-intrepid-ibex/

With my Toshiba L355D-S7825 laptop I have to install a backports package

The package is linux-backports-modules-intrepid-generic

sudo apt-get install linux-backports-modules-intrepid-generic

February 26, 2009

Could not install cygwin on MS Windows Vista 32-bit

I just did a fresh install of windows on a fairly new laptop. The factory install was corrupt in some way. Windows explorer would crash all the time. It was annoying. So I wiped the harddrive and restored with Toshiba's handy-dandy windows-recovery-and-bloatware-restoration cd.

Any windows machine I use regularly has cygwin installed. I need my linux/unux-like tools. Cause I'd loose my geek card if I didn't unzip files using command line tools.

Something happened during the installation. It froze and never progressed. I've installed cygwin a bunch of times, so I'm confident this was not a case of impatience. I killed the install. Later I started another install. This would fail with a message to the effect that cygwin install failed to start because cygintl-3.dll couldn't be found. This caused bash.exe to hang. Tried a couple more times. Same result.

I decided that there might be something wrong in the cygwin-packages directory. When you run the installer it asks for a package dir and an install dir. So, I deleted the package dir.

The next run of the installer was completely successful.

January 31, 2009

I messed up my install of Juice podcatcher

Long explanation (If you want the skinny, just look at the summary below)

Update, 2/1: the fix was not completely successful. See the update at the end.

This isn't really a software engineering topic. But, hey! It's my blog. Someone might really need this information!

So I wanted to try the Juice open source podcast receiver (some people call them podcatchers). As of my writing this article, the current version is 2.2. I installed it, started it, opened up the preferences and saved them with a wrong path to the directory where my podcasts should be saved. I think the problem is that by default the path was wrong for Vista. It was "C:\Users\\My Documents\My Received Podcasts"

But it should have been "C:\Users\\Documents\My Received Podcasts".

After I saved the preferences with the invalid path, Juice would crash every time I tried to start it. The following is from the log and shows the error that was crashing Juice.
Traceback (most recent call last):
File "gui.py", line 4, in ?
File "iPodderGui.pyc", line 3573, in main
File "ipodder\configuration.pyc", line 468, in __init__
File "os.pyc", line 154, in makedirs
OSError: [Errno 17] File exists: 'C:\\Users\\Ari Zelanko\\My Documents\\My Received Podcasts'
I tried to find a solution by googling the error. It didn't yield anything. Several people had posted questions on many sites about similar problems. No solutions were published.

I tried to reinstall the application. I uninstalled and reinstalled. No improvement. Juice still crashed on startup. I opened up the readme file in the Juice install directory. It has a section about updated from an older version of Juice (formerly iPodder). This is a quote from the Juice 2.2 readme file:
In iPodder 1.0 the settings were stored in the iPodder installation directory, probably C:\Program Files\iPodder. Starting with version 1.1 the configuration are placed outside the installation directory, in a user-specific directory, if possible. The default location is the NT-style Application directory, usually C:\Documents and Settings\yourname\Application Data\iPodder. If your settings were lost, try locating these three files in the previous installation directory and copying them to the new configuration directory: favorites.txt, history.txt, schedule.txt.
So, I started to look around my user directory for the settings. I found them. On Vista the path to the configuration was "C:\Users\\AppData\Roaming\iPodder".

"I'll just remove the settings folder and Juice will start up normally, right?" I thought. So I deleted the iPodder directory under my user profile. I started up Juice and voila! There was no change. Juice still crashed with the same message! How infuriating! (I should stop the gratuitous use of exclamation points!)

Just when I was about to give up, I thought, "Maybe if I reinstall right now, the problem will go away." ... And that worked.

Summary

The problem:
Because I set an invalid path-to-save-my-podcasts-to in the Juice preferences, the application wouldn't start. Rather it would crash on startup.

The error log:
Traceback (most recent call last):
File "gui.py", line 4, in ?
File "iPodderGui.pyc", line 3573, in main
File "ipodder\configuration.pyc", line 468, in __init__
File "os.pyc", line 154, in makedirs
OSError: [Errno 17] File exists: 'C:\\Users\\Ari Zelanko\\My Documents\\My Received Podcasts'
The Solution:
I removed the iPodder config directory under my user profile ("C:\Users\\AppData\Roaming\iPodder"). I then ran the Juice 2.2 installer again. I started the app and this time set the right directory for saving podcasts!

Update: The fix wasn't successful (2/1/2009)
After a restart, the problem in this post returned. For now I've carefully reproduced the issue, entered a bug with the project and included logs, config files and such. I've uninstalled Juice for now. I think I will look for another free podcatcher program.

January 27, 2009

Java Resources

Thanks to theServerSide for this great article by Ted Neward.

It contains a lot of resources for an up-and-coming java dev.

January 16, 2009

Install Ruby from binaries on Windows

Suppose you want to install ruby on Microsoft Windows and you don't want to use the One-click installer. Maybe it's because the installer is for ruby 1.8.6 and the newest stable binaries are for 1.8.7. You just have to get the most up-to-date binaries, because obviously 1.8.6 is just way too old.

I looked around for instuctions and found the answer posted by Lolindrath at stackoverflow.com.

  1. Download the windows binaries for Ruby 1.8.7 here: http://www.ruby-lang.org/en/downloads/ extract that to wherever you would like, I use c:\ruby. Then put c:\ruby\bin in your PATH environment variable.
  2. Download the zlib package: http://www.zlib.net/zlib123-dll.zip and extract the zlib1.dll, rename it to zlib.dll and move it into your Windows\System32.
  3. Download the iconv package: http://sourceforge.net/project/showfiles.php?group_id=25167&package_id=51458. Find and extract the iconv.dll into your Windows\System32.
  4. Download the rubygems package and follow the instructions, basically extracting the package and running ruby setup.rb
  5. Verify that everything works properly by trying a gem install rails, once that installs then do: rails test_project
These are the steps just as they were posted. I didn't just download the libraries from the links above. I checked for newer versions, but as of this post, there were none. I have not done step five. But I've installed a few gems and a couple of scripts I've written run fine.

January 14, 2009

That file isn't open!

I sometimes need to do something like delete a file and I can't because, according to windows, a program has the file open. Sometimes this happens because a process doesn't exit when you think it has.

Do you want to find out what program has a file open?

You can do it with a free program called ProcessExplorer.
In the program's Find menu choose 'Find Handle or DLL...' (Or press ctrl-F)
Enter a part of the file's name. Press enter. Voila! You now have a listing that includes the process id that has that file open. If you kill the process, you should have no trouble deleting that pesky file.

If you are not sure what killing a process is or if you should, then just restart the computer and that should fix the problem.

December 24, 2008

Updating RubyGems broke the gem command

On a windows box where I have ruby installed at "C:\Program Files\ruby\" rather than "C:\ruby\".

I ran:
gem update --system

The result was that the next time I tried to execute the gem command I got the following:

C:\>gem
The filename, directory name, or volume label syntax is incorrect.


I found that the gem.bat file had been changed and there was an extra double-quote on two lines.

@"ruby.exe"" "c:/Program Files/ruby/bin/gem" %1 %2 %3 %4 %5 %6 %7 %8 %9

And

@"ruby.exe"" "%~dpn0" %*

In both these cases, where there were two juxtaposed double-quotes (two double-quotes in a row), I had to remove one of the double quotes. Yielding:

@"ruby.exe" "c:/Program Files/ruby/bin/gem" %1 %2 %3 %4 %5 %6 %7 %8 %9

And

@"ruby.exe" "%~dpn0" %*


Problem was solved. I found a comment on the RubyGems forum that agreed with my fix.

December 09, 2008

Using patches to manage bug change-sets

I have just discovered that you can manage sets of changes in Eclipse by using patches.

In the Package Explorer, select Team | Create Patch...
Follow wizard to export the patch file to the clipboard, the filesystem or the workspace.

You can then Override and Update to return the workspace to a state corresponding to the CVS repository.

Later, you can Apply Patch.. from the Team submenu, select the patch file you previously exported. Voila, your changes are back.

October 14, 2008

Identifying the source of a java Class

My coworker, Mike, shared this with me. You can find out what jar a class is loaded from.
Class.forName("com.foo.MyClass")
.getProtectionDomain().getCodeSource()

October 13, 2008

Setting up Websphere for a remote debugger

Here are a couple of references for configuring Websphere for use with a remote debugger:

Jacoozi: Remote Debugging with Eclipse
IBM Documentation -- another method, i have not tried.

Basically:

In the websphere administration console, go to a server's configuration and set it up.

October 07, 2008

Getting DB2 Error Code information

There is a way to get DB2 error information if you have DB2 installed.

Start the DB2 Command Line Processor (CLP).

For SQLCODE -551 you type: "? sql551"

For SQLSTATE 56098: "? 56098"

May 27, 2008

Bugzilla Comments are mostly plain text, so don't use HTML

Today I tried to get fancy using HTML in a bugzilla.

I wanted to do something like

<pre>
... some code ...
</pre>

for the sake of readability.

Well, I found out that doing so will just result in those tags showing up in the comment.

But bugzilla will try to create some hyperlinks for things in comments. See the Hints and Tips page of the bugzilla manual for more information.

March 19, 2008

ILog JRules BOM Update is trying to remove classes that I need!

Periodically, I need to update the JRules Execution Object Model and then update entries in the Business Object Model, accordingly.

Yesterday, when I did my normal procedure for this, the Update BOM option on a BOM Entry tried to remove a bunch of classes that I needed in the BOM.

I didn't know why.  So I experimented.  I created a brand new BOM Entry and tried to add the classes that JRules wanted to remove from the real BOM Entry.  It threw an error.  I tried to add some classes that were direct dependencies of the first, and they had the same problem.

I tried to think what had changed that these classes suddenly couldn't be in the BOM.  Then I remembered that we had recently changed the base class to use Log4J.  Log4J isn't part of the XOM.  So maybe the BOM can't use a class if it doesn't have a access to to the classes dependencies.  So, I tried adding a Log4J jar to the XOM project.  After doing that, the classes from the XOM that had become dependent upon Log4J stayed in the BOM.  The next time I tried to update the BOM, those classes remained in the BOM.

March 03, 2008

Deferred Constraints

In the Oracle DB, you can define a constraint as deferable. You can then make the constraint check fire at commit. It turns out, according to the DB people at my employer, that DB2 by IBM cannot. We have a table where rows can reference each other.

For example:

CREATE TABLE SELF_REFERENCE_EXAMPLE(
pk unsigned long;
...
another_row_pk;
CONSTRAINT FOREIGN KEY examplefk REFERENCES SELF_REFERENCE_EXAMPLE (pk);
);

And suppose we had a table like this.

pk |... |another_row_pk
=============================================
101 ... 208
208 101

Now, if we needed to move these rows to a history table, we can't move either because the other referenced row will not be in the history table.

In oracle we could make the history table fk constraint deferred and insert both rows. The fk constraint will be checked at commit, so there is not fk violation.

DB2 won't let us do the constraint deferral trick. So we have to do something like

insert 101 into the history table without its reference to 208.
insert 208 without its reference to 101.
update both rows with their respective references.
commit.

February 12, 2008

I really don't like ILog JRules

I'm using JRules 6.5.3. I am not loving it. It is really slow.

There is an eclipse-based IDE called ILog Rule Studio. It works somewhat, but builds are slow and you can't use the most recent jvm.

It is restricted to Java 1.4 and Java 5. If you use anything more current, some features of the ILog plug-ins won't work. Ruleset or RuleApp exports did not work until I installed the latest 1.5 JDK.

To use JRules you go through a process of "verbalization". You associate, hopefully, understandable English phases with java code. But doing a verbalization is painfully slow. When you verbalize, the save operation takes an amazing amount of time. I would say 10-30 seconds.

February 06, 2008

OpenLDAP wouldn't start. Here's how I fixed it.

Yesterday, a power outage brought my computer at work crashing down. When I tried to get my development environment going again, I couldn't interact with my local OpenLDAP server.

The slapd.exe process would essentially hang. I killed the process, and started it from the command line:

$ slapd -d -1


This showed that the process was hanging after loading a file in the data directory.

So I zipped up (zip file) the data directory. and then deleted the contents. Now, it would start up.

But there are no entries in the directory now. So I import an ldif file and, Voila!, I'm back in business.

December 12, 2007

Prototype extends arrays so they should not be used as hash sets

We've started using the Prototype js library. We were having some weird behavior with some arrays in existing code when the Prototype lib was included in a page.

Turns out that Prototype adds some methods to Array. They are good, but one should be careful using Array objects as hash(key-value) sets.

Here is the blog entry we found that cleared everything up.

The skinny, Use Object as a hash, nothing else.

Thanks for the insight, Andrew Dupont.

July 10, 2007

Java reflection: primitive arguments in methods

Suppose that we want to reflexively invoke an instance method for a java object. Further, suppose that one or more of the method arguments is of a primitive type (i.e. int, small, double, ...).

In the Class.getDeclaredMethod(String, Class[]) method, you pass in a string representing the method name and an array of Class objects representing the types of any arguments.

For the following class :

public class Reflector {
public void intMethod(String aString, int anInt) { /* Some Code */}
public void integerMethod(String aString, Integer anInteger) { /* Some Code */}
}

You would get the methods reflectively like so:

. . .
Reflector r = new Reflector();

Method m = r.getClass().getDeclaredMethod("intMethod", Class[] {String.class, Integer.TYPE});
Method m2 = r.getClass().getDeclaredMethod("integerMethod", Class[] {String.class, Integer.class});
. . .


And invoke them thusly:

. . .
m.invoke(r, Object[] {"MyString", Integer.valueOf(100)});
m2.invoke(r, Object[]{"MyString", Integer.valueOf(100)});
. . .


For m.invoke, you wrap the int in the wrapper class since we're passing in an array of Object. Java automatically tries to unwrap it for you.

For an argument that is of primitive types use the following when defining the signature:
byte => Byte.TYPE
short => Short.TYPE
int => Integer.TYPE
long => Long.TYPE
float => Float.TYPE
double => Double.TYPE
boolean => Boolean.TYPE

June 27, 2007

Velocity


Velocity Template Language (VTL)

Statements begin with '#'
ex. #set( $a = "Velocity" )

References (varables, properties, and methods) begin with '$'
Formal notation ${}
Quiet notation $! or $!{}

Literal string delimited by single-quote
ex. 'I know strings'
Interpolated string delimited by double-quote
ex. "I love $a" => I love Velocity

## This is a single line comment

#* This is
a
multiline
comment *#

#**
This is a documentation comment
@author Me
@version 5
*#

escaping characters
$$ => $
This snipet
#set($foo='dude')
Hi $foo
Hi \$foo
Hi \\$foo
Hi \\\$foo
produces
Hi dude
Hi $foo
Hi \dude
Hi \$foo

If a reference is undefined,
Hi $foo
would produce
Hi $foo
because $foo is undefined
while
Hi $!foo
produces
"Hi "
without the ".

June 19, 2007

Internet Explorer on Linux

http://www.tatanka.com.br

This site offers an option for easily installing several versions of IE for LINUX.

April 16, 2007

Use Windows CE devices with Linux (Kubuntu)

There's a good example at: http://doc.gwos.org/index.php/Pocket_PC_Evolution

The above is for setting up a syncing relationship.  I'm just going to set it up to browse the file system.

  1. Install these packages:
    1. synce-kde
    2. synce-multisync-plugin
    3. synce-dccm
    4. synce-serial
  2. Setup synce
    1. Connect the Pocket PC via USB
    2. run: 'dmesg'
    3. Look for a line like 'usb 4-2: PocketPC PDA converter now attached to ttyUSB0' and remember the ttyUSB0 part.  That's the device file for the PocketPC.
    4. Run: 'sudo synce-serial-config ttyUSB0', replacing ttyUSB0 with the appropriate device, if necessary.
    5. Run:'dccm' to start the daemon that will keep the connection alive.
    6. Run:'sudo synce-serial-start' to start the connection
    7. The above mentioned tutorial suggests running 'synce-pstatus' to get info on the device
    8. In konquerer, go to the address 'rapip:/'
    9. You're looking, hopefully, at your device's filesystem!

I haven't set up a partnership yet.  That's next.


April 11, 2007

Using RSYNC (or any other system command) from RUBY

I found a blog entry concerning using rsync from ruby for doing backup. To use RSYNC from within Ruby, do something like this

> system "rsync -<option(s)> <from> <to>"

You can invoke any system command in this way.

April 05, 2007

Followup: Linux CVS clients

Last month I moaned about how disappointed I am that there is no cvs client for linux that makes me as happy as TortoiseCVS for windows. Well, I like lincvs enough to say that it's pretty good. It shows me what files have been altered at a glance. It allows templates and caching for commit messages.

April 02, 2007

CVS: find different or unmanaged files

Suppose you want to find the files in a local directory that are not under CVS version control.
  1. cd into the directory
  2. run "cvs diff -l --brief"
You will see a list of differences. Files not under version control will be shown with a '?'