Archive for June, 2007

Obj-C Graphing Packages

Friday, June 29th, 2007

Certainly one of the nicer graphing packages I've used is the VantagePoint graphing library from Visualize Inc. It's 100% Java, it's fast, well designed, and very feature-complete. Sure, there are a few things I'd like to see them put into the product, but it's very few, and that's impressive. What I've been looking for is an Objective-C/Cocoa version of the same kind of thing so that the code that I'm working on in OS X can have stellar graphing as well. Specifically, right now, I'm looking at the heat/contour graphs in VantagePoint and wishing I had something like that in Obj-C for my Poission's Equation solver code - Potentials.

Potentials is meant to be a very simple solver of Poission's equation in 2D - and as such - be very fast. Once we have the solution in 2D, there's always the time factor which could yield interesting capacitance calculations if that was where we wanted to go, or maybe put in a little fluid and see charge distributed over time. It's something that might be very interesting to play with, but the first step is to be able to see the results in the code without having to run a stand-alone plotting package.

I came across Visual Data Tools, Inc. and their two products DataTank and DataGraph. While DataTank looks to be certainly more than I need, it's also much more expensive, and at $1195 for a license, that's a for a hobby project. And DataGraph looks pretty nice, but is lacking a few of the graph types that VantagePoint has - specifically, the 3D and 3D-mapped-to-2D like the heat and contour graphs. These are the ones that I wanted to use in Potentials, so it's bit of a bind. I wrote the developers to ask if there were these plot types in DataGraph and they mentioned that they were thinking of putting out a new version, targeted somewhere between DataGraph and DataTank, and that the new Bar graph would be in DataGraph soon. While this is good news, I had to write back and ask what the new product would have - I really need the different graph types.

I hope there's something coming that's reasonably priced and has the features I need and integrates well with Xcode. It'd be great to get this code to the next level and have the plotting contained within it. We'll just have to hope that they come back with good news.


UPDATE: it looks like the DataGraph developer is going to keep the low-end product without the two plot types I need for Potentials. I can respect that, but there's no way I can see dropping $1195 for this code... not without some proof that it'll make money, and I don't expect to sell it, so that's especially hard. So I sent an email to the Red Rock Software guys - they make DeltaGraph which has all kinds of nice graphs in it, asking if they had anything that would allow me to incorporate their graphs into my code. I didn't see anything on their site, but it's possible they are thinking about it - or have it. Who knows. It's priced as a nice, graphing package - $300+, but it's not the $1000+ of DataTank. We'll see what they come back with, but I'm not holding out a great deal of hope. I also looked at the VVI Vvidgets and while they seem to have the bases covered, it's more low level, and not nearly as clear-cut as the DataGraph or DeltaGraph tools.

Trying to Keep an Even Keel

Thursday, June 28th, 2007

Today has been an interesting day. Things have been rough at times in the past few weeks, certainly seem to be going through a slump. And like any slump you have to try to keep an eye on the horizon for you know that someday soon your luck is going to change and things will turn around and once again life will be good. But making it through a tough slump is no fun, and one lasting a few weeks to a few months is certainly something you look to get out of as soon as possible.

On the downside, last night my son told me the keyboard on the kid's computer (a Mac mini) was messed up, so I went to look at it and see what the problem was. Well... it wasn't the keyboard - it was the mini! It would start to power up, I could hear the DVD engage, and the light on the front came on, but no chime, and that means bad news. I took it apart to see if it was a simple RAM seating problem - nope. Maybe the drive connector - nope. I was thinking that it was a bad drive and that would be horrible as all the kid's stuff is on the box. I have some backups, but nothing recent, and there's stuff there that is really nice.

So this morning, I did some googling and found out that it might be the power supply, or the system board, or maybe the battery, but it's something along those lines. Most likely not the hard drive. That was definitely on the upside. Tonight I have to go home and try out a few things, and if nothing works, it's time to go to the Apple store and see what they can do for me. Not ideal, but saving the data is now priority 1. As soon as it's set up, we're getting a nightly backup in place. Not going to let this happen again. Ever.

On the downside, I had another run in with the Rock Star and his own unique way of suggesting an idea. This time, he was saying that one of the methods on an object was not very strong. I looked at it, and it looked acceptable to me - certainly within the guidelines in the comments on the method. But he said how I should look at the code for a Java class and how it does the same thing the safe way. Well, I looked, and it did virtually the exact same thing. Nearly identical. When I pointed this out to him, he agreed, and then apologized - he'd not read the comments and formed a bad opinion. On top of that, the code he referenced was not what he thought - and it only bolstered my code. This is what's aggravating me about this guy - why not ask? Why accuse? Why not discuss the possibility? Why point out what's wrong and how to make it right - when in fact, all he did was show himself to be a lazy reader and have a poor memory.

So while that appears to be an upside, I talked to him and he doesn't see it as something to avoid. He didn't think there was anything wrong with his approach. This means that he's going to be doing it again, and again, and again... and after a while this is going to be really annoying. Maybe I'll just assume he doesn't know what he's talking about and force him to re-read the code, but my guess is he's going to be a pain in the neck for as long as he's here. That's too bad. Maybe when he learns enough of the systems he'll stop asking the questions. Hopefully.

Work is stressful even under the best of circumstances. The demands are high, the responsibilities for someone willing to accept them are high, and thankfully the rewards are high (otherwise it'd be a losing proposition). But there's got to be a way to get out of this slump and get back on top of the game. I know it's as much attitude as anything else, and getting that positive mental attitude is hard when you're in the slump. I just have to keep looking at the horizon. It'll come, I know it will.

Java Applets in Firefox

Wednesday, June 27th, 2007

java-logo-thumb.png

I've spent a bunch of the day messing around with Java applets and jars and Firefox trying to get a page to work. Needless to say, I'm less than thrilled with Sun's Applet support in Firefox... or maybe it's Firefox's support of the Java Applet VM. Either way, it's a load of crud and needs to be worked on pretty seriously.

First, why on earth has Sun not yet made a 64-bit applet plugin for Firefox and other 64-bit operating systems. Even their own 64-bit Solaris doesn't have one. I've looked at the bug tracking for Sun's Java and there are requests as far back as 1.3.x-days for a 64-bit applet plugin. But nothing yet in 1.6 - you've got to wonder what their own developers are using - 32-bit Windows is the answer. Amazingly short-sighted. Thankfully, Leopard will be 64-bit and have a 64-bit Java applet plug-in for Safari, and I'm assuming Firefox. I am amazed to think it's going to be a Mac to bring this to a usable platform. Certainly puts Windows and Sun to shame.

Next, there is a limitation on the linux Java plug-in with regards to the line length of an applet PARAM tag. Don't know what the actual length is, but when I sent in the bug (with an example) to the Firefox bugzilla site, the guy that picked it up said that the problem was in the Java plug-in and that's all the further it got. On windows there's no such limitation, but I do a lot of my developing on linux (64-bit at that) and it'd be nice to be able to have the same page render on linux and windows the same.

So I'm trying to figure out why this page is bringing Firefox to a crawl and not IE. I'm now convinced that the interface to the Java plug-in in IE is significantly different than the one in Firefox, and the IE one is doing something to compensate for any limitations in the plugin. One such difference is that in IE there appears to be a static picture taken of the applet and then it's stopped. This makes for applets that simply display information (like graphs) quicker to load and less of a CPU hog. Since I can't get the Firefox team to look into it, I'll have to simply hope that the next release will implement the plugin interface better and some of these things will just work themselves out. I sure hope so.

Working on Convergence Issues

Tuesday, June 26th, 2007

shark.png

Today I took out a few minutes to check on the convergence issues that I remembered were in shark, the simulator that I had originally written as part of the Ph.D. thesis while at Purdue. The big problem originally was that there wasn't a machine fast enough to give me real, solid, answers to the questions of the physics of the problem. At least not in 1988. Now, it's a little different story and yet I remembered that I was still troubled by some convergence issues, so I wanted to take a look and see if there was an easy solution to the convergence issues.

The code tries to 'step' the bias on the device from the initial equilibrium state to the requested bias point. This is a classic problem in modeling - if you can't get a reasonable initial guess to the solution, then back-off on the initial state and see if you can get that guy solved. If you can, then use that as the initial guess for the next 'step' in the bias ramp-up. Seems reasonable, and it works pretty well.

One clever trick is to look at the difference between the values at each node from one bias point to the next, and then scale that for a better initial guess at the next bias point. In theory, it should get you closer to the next bias point than the last state, and therefore get you to the solution even faster. Problem is that if you don't get the "jump" right you can make the situation worse for yourself. And that's what was happening in the code. I was overshooting the change, which is not really surprising as this is a massively non-linear system and I was trying to assume for the bias changes it was linear. Not good. When I took that out of the code, it got to the right values fast enough and a lot more controllable.

The right solution might be to look at the last two points and allow the change to be second-order. It's better than linear, but I have a feeling that even that isn't going to be good enough at predicting the solution to warrant the cost, and uncertainty, of using the "jumps" in the biasing of the device. But if I wanted to try something else, I'm guessing an a logarithmic scale is probably closer to 'right' than even a second-order approximation.

At this point, all the tests check out and it looks pretty good. The next thing to do is to put in the input deck for the drifting packet that was the problem that couldn't get solved in 1988. It'll be interesting to see how long it's going to take with modern desktop computer hardware. My guess is it'll work, and be on the order of days, but it'll generate answers.

Slowly Making Headway

Monday, June 25th, 2007

Today I think I'm turning the corner with the Rock Star developer that joined recently. Today he came over to say that there's a problem in a class collection that I had put together. Basically, there's a general interface to a table and both the table and views into tables implement this interface. That means that they can be "stacked" and one view can be placed on another to make a rather advanced view on the base data table. The key is that the tables are like database tables, and the views are like database views, so in some cases - like an aggregated view, it's impossible to set a value of the underlying data because it's aggregated. Same with database views.

Anyway, Rock Star wanted to say that the setValue() method worked in some cases and threw an exception in others and that was dependent on the implementation of the general table interface. He was saying that this was a bad design. I told him that there were methods in the interface to see if you could set values on this instance, and that if the method returned false, then not try to set them as it was going to throw an exception.

He tried to say that this was an inconsistency. "Not at all", I said. It may not have been how he would have one it, but there's nothing inconsistent about it. He then spent about 15 minutes trying to say how he'd do it - with multiple interfaces inherited from each other to make it clear what one instance was capable of having done to it. I pointed out that this idea would then lead to a ton of interfaces and then you're going to have a ton of methods returning the values cast into the right interface, or a bunch of if-then logic with instanceof tests to see what interface it was.

In the end he agreed that it was his inexperience with the classes that lead him to believe there was a problem. I felt as if we might have turned the corner. It would be nice if he learned that before he comes over to tell me how badly something is done he does the legwork to make sure it's not going to come back and bit him in the rump - just like today. I think he's got talent, he just needs to adjust his attitude to the rest of us and the development/deployment environment we have in place here.

Complaining about the iPhone

Monday, June 25th, 2007

It's still 5 days from launch, but it seems that there's a ton of folks that are talking about how wonderful, and horrible, it's going to be. I have to say it makes me giggle to see so many people talk as if from a position of fact on how good (or bad) something will be when they haven't even touched it. I know that the Apple fans are saying what a wonderful device it is, and how it will revolutionize the cell phone industry, and that's to be expected. It's standard cheerleading. Vista, Windows, OS X, Linux, editors, religions - it's all about point of view and opinion. But what's interesting is the negative press as well. It's as if it's the Crusades and there's the catholics and the heathen. It's not enough to allow them their cheerleading, they must actively be put down.

Honestly, I like Apple stuff, and I'd love it if Steve had another hit. But I'm not going to buy one anytime soon. I have a laptop and a phone and with these two I don't need to have a small-screen phone/computer. If I didn't have the laptop, I might consider it, but I can't imagine being without the laptop, so that's a long ways off.

Likewise, I don't care if the Zune sold as many or more units than the iPod. If it's better, then the market will decide and that will make Apple's products better. But I can see that the cell phone companies like Motorola, Nokia, etc. are much more interested in the iPhone than another iPod - this is their game, and if it takes off they are going to have to respond to it or be left behind on the high-end.

It'll be interesting who turns out to be right and will they eventually accept their mistakes. It'll be fun to watch.

Digging for Locking Problems

Friday, June 22nd, 2007

Once again I got the wake-up call and needed to deal with a problem on the server. During the night there had been a problem with deadlocks and it stopped the server. What a drag.

Thank goodness for the extra logging I had put into the server. This time it was the reloading of the missing marks after they had been received. The code evaluated the stock families for those with new prices from the loading of the missing marks. The problem was that in some conditions a tick coming in for the instrument that's getting revalued from the loading of the missing marks was locking from the stock down, and the revalue method was only locking the options. That's certainly a source of potential deadlock.

These deadlocks have been very hard to eliminate. I know that if I used the exclusive locks and not try to be cute with the read/write mutexes it'd be a lot easier. But I think it's important to the server that I try very hard to make these read/write mutexes work. I'm close, I can feel it.

The State of FORTRAN on Mac OS X

Thursday, June 21st, 2007

I've got my old thesis work that I was looking at yesterday. It's primarily f77 code, with a few of the critical methods converted to C with f2c and hand-tuned by me to get the best performance possible out of the code. It's nothing exceptional, but it's something I'm proud of, and I like to go back to it every so often and test it on new hardware that I get. Well, yesterday I was thinking about testing it on my MacBook Pro because the last time I tested it was on my G5 iMac, and it was very fast there, and I expect it to be even faster on my MacBook. It's got a faster processor, and if the compiler is capable of using multiple cores, then this will be even faster. So I was looking forward to it.

In the past, I've gone to the HPC Mac OS X page and they have had tarballs of g77, g95, gfortran that are built with the Developer Tools so that they work well with Xcode, which I am a big believer in. So I go there and get the latest Intel binaries for gfortran. Problem is, they don't compile the code. There's a problem in newton.F that causes an internal compiler segfault, and while they say "send in a bug report", I looked at the site and I think it's probably safe to assume that someone else has done this. There are a ton of rules to follow to submit the bug. So I missed there.

I tried the g95 compiler on SourceForge as it is supposed to be a different fork on the code, and while it compiled a little test program, it was spewing some errors that didn't look good, and in the end, didn't compile as much of the codebase as gfortran did. Strike two.

While I suppose I could buy a FORTRAN compiler, I really don't want to. I like the GCC tools, and I know that right now the gfortran snapshot (4.3.0) in the HPC download is 'experimental', it'll get better, and when it does, I'll get the next version. Until then, I'll have to wait. Not the worst thing in the world. It would be nice if Apple put it in Xcode, though. Face it, they're using gcc, so how hard could it really be?


UPDATE: I chatted with the maintainer of the HPC Mac OS X site and he said that he'd be updating the gfortran code in a few weeks due to the updates, but that the g77 code should work and it can be installed alongside the gfortran package. So I got it and it worked! The code compiles in less than a minute, and the tests run faster than any other machine I've ever run the code on. Amazing! Great guy.

As the hardware gets better, the times drop. I may have to come up with different tests. The latest tests show the MacBook Pro beats the G5 iMac. Nice.

Some Days are Harder than Others

Wednesday, June 20th, 2007

Today has been one of those days that seemed to start off bad and get worse as the day went on. Looking back on it, I suppose it started decently, but that's really only in relation to how it ended. I just want to go to bed and have the day end and put it in the history of my life.

Once of the developers moved to a cube close to me and even before he did, he said to me: "We'll fight over the blinds, Bob, and you'll give up." My cube backs to a set of windows and as such, to keep the glare on my monitors down, I've kept the blinds closed for more than three years - ever since we moved into this building. The developer knew this and he still seemed to want an argument. Odd. Anyway, today started with two of the blinds pulled up and while neither caused any glare at the time, it was 5:30 am, and the sun was just coming up. My rule had been: if it's causing glare, then they get shut. Well, I left one of the two open, but a few hours later, the other one was causing too much glare and had to be shut.

Now we get into the "up-down-up-down", Keystone Cops phase of the program. What's funny to me is that he had the choice of where to move and he could have moved to a cube that's got a real view of the windows on the other side of the building, but he didn't want to walk the extra 20 feet to talk to some people. Guess he really wanted to fight about it... or was just plain lazy. Or both.

Finally, the one blind closed, the other open, which is acceptable for me, we get into the it just keeps getting better portion of the day.

One of the new developers, the Rock Star I've mentioned in previous posts wanted me to look at his code and tell him what I thought of it. I said I would, and he wanted to do it right then. OK, I guess so. What I saw was something that I would have scrapped right away: no constructor, inconsistent use of the imports, virtually no comments, completely optimistic coding... in general, an example of what not to do for a production system. I started going through what I'd have done differently, and he wanted to argue about it.

I said "Hey, you asked me, I'm not interested in arguing about this."

"We're not arguing, we're discussing differences of opinion."

"Well... I don't want to discuss it. You asked me for my opinion, remember?"

So I continued. We talked more about his refusal to write code that was more robust, better commented, etc. In general, I came to realize that he really was committed to this way of writing code even-though he knew better.

At the end of the review he asked: "So, now are you going to let me code on BKit?"

"You've got to be kidding." I said, and went on to say that I can accept that this is the kind of job that he's going to do, but that I don't have to have him work on the projects I'm responsible for. I suspect that this is really what he was after by showing me his code, but it didn't turn out that way.

Then things got ratcheted up another notch when one of the Data Team guys was editing a price of an instrument while another was reloading it in the server. This ended up causing a deadlock - yeah, my mistake for not thinking of the possibility, but then the server had to be restarted. This was at 2:40 pm, and the restart takes 20 mins. The traders were not happy. I can completely understand, but I do wish they'd lay off the verbal abuse when things aren't going their way. It's not like I purposefully took down the server... it was a logic hole, and I've got it fixed up, but there was a lot of verbal abuse about missing the last 20 mins of the market. I hate it when that happens.

After things were up, I had about 30 mins to try and fix the bug so it'd be in development for tomorrow, and then Rock Star decides to ask me questions like: What java library is most used? and then Do you believe that java collections are widely used? I was in the middle of fixing this bug and so I answered him as quickly as I could, only to really find out what he was after a bit later.

He had looked up the source for Vector in the Java source and had seen that it didn't use one of my top-three code standards: single-entry/single-exit. He was using this as an example to say that if I thought Vector was "good", then I should think his code was "good" when he didn't code any differently than the Vector code.

What amazes me is that he was still on this kick of me liking his code. I finally got fed up with him and said "Well... when I need you to write code for me, I'll have to accept the best you can do. But for now, I don't need you to write code for me." And I can't imagine that I ever will.

I had to leave early for my daughter's birthday, and the commute was horrible, only to get home and find that work had called. Again, it seems like it kept getting worse and worse as time went on. I just wanted to go to bed.

Complaining about Comcast

Tuesday, June 19th, 2007

I was reading a story on Slashdot today about a blogger that was mad at Comcast for essentially rolling back features, in this case, HD channels, on her service. She could always upgrade her service to pay more to get them back and get others, but she was mad about what Comcast had done. I agree with her that it's a raw deal by Comcast, but honestly, what do any of us expect from the likes of Comcast, AT&T, and the large cable/telco companies? Honesty? A good deal? Please.

I spend more than $200/month to Comcast for cable and internet. I'm never going to get VOIP service until they change the regulations on 911 service, but given that I get all the channels, an HD PVR, 8Mbps (down) Internet, I'm not surprised that I pay a nearly insane amount of money to Comcast. But what's the option? AT&T? Not likely... they use a Dish service in Chicagoland, and their best DSL is still slower than the cable modem speed I'm getting. It's just what the market is willing to bear.

I can remember paying $750/mo for a 56kbps leased line through Sprint to the internet for my company. It was early 1990s, but still... $750/mo? The 56kbps line was no different copper than a standard phone line, and the service was something they already had in the CO (central office). I know this because my company was a computer/telco consulting company. But if you wanted to have something other than a modem connection in the early 1990s, that's what you had to pay. Comcast, while a different company, is doing the same thing - charging what the market will bear.

Unfortunately, there isn't enough competition to really drive prices down. Verizon's FiOS isn't in Chicagoland, and I can understand why - Comcast has incredible market penetration, and to put all the infrastructure in-place to 'steal' customers from Comcast is a dodgy proposition. Better to go to someplace that's not served by Comcast nearly as well and get much better market share right off the bat. So they go to other places first. Even if they did come in, they'd hardly undercut Comcast by much... maybe a few dollars, or provide features (like speed) that Comcast doesn't. Again, doing what Comcast did with their cable modem to AT&T's DSL.

So it's business... nothing more, nothing less. While I don't like it, I can't very well blame Comcast for doing it. I can vote with my dollars, and if I really don't like what Comcast is doing, I can go somewhere else. But in this area, the choices are limited, and it's not like AT&T is a corporate angel, either. It's business. What surprises me is that she was supposedly an industry insider, and she's still surprised. Now that's amazing.