Debugging JNI code in Java using GDB

February 13th, 2009 No comments

Lately, I’ve had to debug JNI code used by my Java Web Start application. Some of the issues I’ve dealt with did not show up until the code was combined and used in the resulting application. The following was how I used GDB to debug the code.

First, start the application as usual.  I was debugging a java web start application, so my command will be slightly different, but the debugging procedure will work regardless of what java program you are running. At the command line, you can type the following to launch the jnlp file:

javaws < location of jnlp file >

The jnlp file can be local or a remote file, just as long as it references and loads the code you are debugging. After it loads, the process ID needs to be found. Usually, I’ll just look at all the java processes running and can figure out which one is the application I’m interetesd in:

pa aux | grep java

Once the process ID has been identified, gdb can be launched and attached to the running process:

gdb -p < PID >

This starts gdb and attaches to the java program. At this point, the execution blocks until you do something with it. Just type “continue” and run the program as usual. When or if the program causes a segmentation fault, the debugger will block; you can then do a backtrace and see exactly what file and what line caused the issue.

Categories: Programming Tags: , , ,

Fuel injector fixed!

February 9th, 2009 No comments

Today I stopped by the seller’s house to have him look over the vacuum system, since I found a plugged line while trying to diagnose the power loss. On my drive over, I noticed that the kickdown switch was under the pedal, and needed to be pressed past the point when you think you have the pedal floored. Once I did that, it downshifted fine and had plenty of power.

While at his house, he replaced two vacuum valves and one black vacuum thingy, and fixed some of the vacuum hose connections. It turned out that one of the vacuum lines had a BB in it (from a BB gun?), and some cables weren’t even connected to anything.  He mentioned something about Crazy Rays and getting parts there for later, so he can replace the remaining black vacuum thingy.  He definitely knows his stuff!  Crazy Ray’s looks like an awesome place to get parts for an old car.

He took the leaking injector out and took it apart.  One of the metal mating surfaces had a burr or gouge in it, so he filed it down and sanded it and put it back together.  After test driving some more, it ended up leaking again, so he found another spare injector and just used the top portion of the spare with the bottom casing of the leaking one.  After installing it a second time, the leak was fixed!  He showed the injector to me and explained that the nozzles looked like they were new so I can probably hold off on buying new injectors.

The turbo seems like it’s working now and the fuel leak has been fixed, so tomorrow Andrea will be driving it to work!

Categories: Auto Tags: , , ,

No power at full throttle: update

February 7th, 2009 No comments

Here are some photos of the engine bay.  One of the injectors seems to have a fuel leak (left to right, top to bottom, seen in the third, fourth, and fifth pic below).  Tomorrow I’ll try checking some more references to see what I can do about it.  If I need to replace the injector, it’ll cost about $50.  The fuel leak is probably related to the power loss, so after I diagnose and fix the vacuum leak and the fuel leak, it should be good to go!

Categories: Auto Tags: , ,

First problem: no power at full throttle

February 7th, 2009 No comments

For the little that I’ve test driven this car (Andrea test drove it), I’ve noticed that the car has no power, either from the transmission not down shifting properly, or the turbo providing no boost.  There could be several reasons for this, but I suspect the top reason is vacuum related.  Below are two images of something I discovered after inspecting obvious vacuum fittings.  The junction near the screw on fuel filter has a line that is plugged with a wooden dowel!  That means anything downstream from that tube isn’t getting any vacuum.  So far the only symptom has been the lack of power and the shifting issue.  I spoke with the seller and he’s going to help diagnose the problem on Monday.

Categories: Auto Tags: , , ,

1993 Mercedes-Benz 300D 2.5

February 6th, 2009 No comments

Meet Andrea’s new car:

The car is a 1993 Mercedes-Benz 300D 2.5 with 188K miles!  The mileage might seem high to most people, but after driving my 2005 VW Golf TDI for 95K miles with zero problems, and after researching the Mercedes diesel engines, I don’t think Andrea will have to worry about the engine failing.  Just do a quick search on craigslist and see how many old 1980s/1990s 300Ds are for sale and you’ll see that most are in the 200K+ mile range.  It is an old car though, so I’m sure eventually it will have electrical/mechanical issues.  For now, it seems great though.  Mechanically, everything that I’ve tested is working.  When the time comes for repairs, hopefully they’ll be minor enough that I could tackle them.  I think the only two things I won’t attempt to do on the car are transmission and engine related.

Andrea has been driving to UMBC on opposite days that I’ve gone, so we’ve been driving to work separately on four of the five work days of the week.  Previously, we were splitting the cost of diesel for my car, since we drive everywhere together and my car is super efficient compared to her Oldsmobile Aurora.  Because of this, we were saving a lot of money.  Now that we drive separately, Andrea has been paying to fill up her Oldsmobile and has been getting really crappy mileage (~18 mpg?).  This “new” Mercedes should get her around 30, which should save her a considerable amount of money in the long term.

Go diesels!  I hope I hope I hope nothing major happens in the next year or two.  That would be super.

In the immediate future, the car will need: new tires, new mirror control switch, and a pillar trim piece.  Maybe I’ll also need to check the timing chain, but I need to read more about how to measure the chain stretch.

From what I’ve been reading, there’s no such thing as a cheap Mercedes.  We’ll see if that’s true.

Categories: Auto Tags: , ,

Skate wheels installed on a Brompton

July 30th, 2008 5 comments

This is probably an obvious howto, but it took me a couple nights trying to look up what kind of skate wheels to buy and a couple trips to Lowe’s to figure out what length screws to get, but here are some pictures of my skate wheel install.

I have a Brompton M6R (actually an M6L with a rear rack installed) but opted not to get the EZ wheels, since they were about $50 a set, and I needed two since I have two Bromptons.

I ended up purchasing eight 76mm 80A inline skate wheels, 16 wheel bearings thingies (608), 8 spacers, and four M6x1.0 in 30mm length.  I reused the rear rack wheel screws since I didn’t purchase screws in size M5 but I’ll do that tomorrow.  The standard ones will work, but they aren’t long enough to keep the bungie cords attached.  The install was super easy, but here are the pictures to help motivate you to do the same.

Original configuration:
IMGP4041

Most of the parts:
IMGP4047

Close up of the replacement screws:
IMGP4048
The screw length was barely long enough to work, so I may try getting screws with a length of 35mm, but Lowe’s only had lengths 30mm and 40mm, and 40mm was way too long.

Picture of one of the skate wheels I purchased:
IMGP4049

Brompton cone wheel and skate wheel side by side:
IMGP4054

IMGP4057

IMGP4058
The wheels don’t seem any wider than the standard Brompton wheels, but they are definitely larger in diameter.

Wheel bearings:
IMGP4059

Step 1: Pop the bearings into the wheel along with the spacer. The spacer is just a metal sleeve that separates the wheel bearings. Supposedly they help extend the life of the bearings, but for the Brompton, it’s probably overkill.
IMGP4061

IMGP4062

IMGP4065

IMGP4066

IMGP4068

Step 2: Screw them in! This part was super easy. Just reuse the washer.
IMGP4070

The rear wheels (if a rack is installed) is the same, except, depending on the length of screws, you may or may not be able to keep the bungie attached. I was unable to keep the bungie attached with the original screws. I kept the original screw, three washers, and the nut for each wheel.
IMGP4075

That’s all it takes! These are the pictures showing the resulting wheels installed on one of the Bromptons. I still have to get longer screws for the rear wheels and I have to buy the rubber bung for the seatpost or retro fit something standard; without a rubber stop in the seat post, the bike rolls too easily now!

IMGP4076

IMGP4079

IMGP4080

Categories: Biking Tags: , ,

Text2D class

June 10th, 2008 No comments

At work, I’ve been working on a new Java3D project.  Java3D has been great so far, and I’ve gotten a simple visualization program up and running in two weeks.  Today, I had to figure out how to determine the actual width of a Text2D object.  Creating a BoundingBox with the Text2D object’s getBounds() method doesn’t actually help, since it seems the dimensions are always a power of two.  I needed the actual width (the height can be calculated by multiplying the font size by the the rectangle scale factor), but the bounds returned didn’t give the the value I needed; it was close, but I needed to position the text to create an annotated axis.

My solution?  I had to rewrite the Text2D class.  I read a forum that mentioned this as a solution, but it didn’t give the code or how to do it.  If you go to the Java3D website (https://java3d.dev.java.net), you can browse the source code.  The Text2D class is located in the j3d-core-utils subproject.  I just copied the source file, added two private variables (height and width), created accessor methods getWidth and getHeight, and stored the height and width when it is calculated in the setupImage method.  Just change the package name and you can use the new class the same way the regular Text2D class is used.

What I don’t understand is, why didn’t Sun or the community in general do this?  It’s a really simple fix.  How do people even use the class if they can’t accurately determine how much space the actual text uses?  I’ll post the code (with the simple modifications) tomorrow.

Text2D.java

Categories: Programming Tags: , , ,

My experience with Bike Friday’s customer service

May 13th, 2008 3 comments

At the end of April, I purchased a used Bike Friday Tikit from the shop in College Park, MD. It was sold to me at a good price, and I’ve had fun riding it over the last couple weeks. After all the rave reviews about Bike Friday’s customer service, I expected something spectacular, but I am not impressed.

For the past few weeks, I’ve been trying to register my Tikit. Why is it so difficult? My bike doesn’t have a frame number, or rather, it doesn’t have one that I can see with my eyes. I’ve taken several pictures, examined it closely in the daylight, with a flashlight, and with my camera and flash. I don’t think there’s a frame number on the bottom of my bottom bracket shell. Bike Friday seems to disagree and says the frame number is there.

Last week I called the bike shop and asked them for some help, and they told me it may never have had a serial number. I’m not sure I believe that, but whatever. They also told me that the bike was a preproduction bike and was one of the first two Tikits sent to the Mt. Airy, MD store. Even armed with this helpful information, Bike Friday just can’t seem to help me out. I’ve called them more than five times, I’ve emailed them several times, I’ve emailed them pictures, and I’ve asked them for pictures of other Tikits (to see where the serial number exists and what it looks like). Everytime they tell me they’ll call me back but they never do. They haven’t sent me pictures either.

Another possible location of the frame number, according to their website, is under the folding stem. The problem with my bike, if that were the case: the hyperfolding stem was upgraded before I picked it up. I’m not sure what was involved with upgrading the folding to the new style, but if the serial number is still there, I can’t see it. If the stem was replaced to upgrade to the new style, then the serial number is no longer there. Maybe a blue Tikit wasn’t an early color? I have no idea how they came to the conclusion that the serial number has to be on the bottom bracket shell (since their website states the folding stem as a possible location as well).

This is so frustrating. I can’t believe they can’t take the time and effort to research this more.

*UPDATE*
2008 May 14
They have contacted me and everything seems to be set. At least they made an attempt to help me.

Categories: Biking Tags: , ,

SRAM Dual Drive hub

May 11th, 2008 5 comments

Recently, I won an ebay auction for a wheelset that came off a Cannondale hybrid bike. I was mainly interested in the SRAM Dual Drive hub, since I’d like to use it with my Tikit. When I got home today, I finally got a chance to play with it. At first, when I tried spinning the cassette, the movement wasn’t smooth, and something didn’t seem right. After taking the hub apart, I found a metal piece on the edge of the hub’s shell.

IMGP3384

IMGP3385

IMGP3386

SRAM’s website and parts list shows this as “Assy Planet Gear Carrier Dual Drive” and part number 65 0372 111 100 . I’m not sure how much this part costs, but I’m not really in a hurry to install it. Maybe tomorrow I’ll give the bike shop in College Park a call to see if they can find out how much it’ll cost.

Categories: Miscellaneous Tags: , ,

Packed Car

May 11th, 2008 No comments

Today I drove back from PA with four cases of water, one 27″ CRT Television, two backpacks, two boxes of bike parts, one Bike Friday Tikit, one Downtube 9, one dvd player and speaker system, and four cases of water (for my brother). Impressive isn’t it? I can’t believe how much weight the water added, but everything (including my brother) made the handling of the car much different.

IMG_2000.rotated

IMG_2001.rotated