Okay, thanks to Jag, I’ve seen the coolest thing ever. The steampunk keyboard + monitor:
Now all I need is a few dozen hours of free time to build my own.
Okay, thanks to Jag, I’ve seen the coolest thing ever. The steampunk keyboard + monitor:
Now all I need is a few dozen hours of free time to build my own.
As I’ve been working on the web front end for the PWC database, we ran into an interesting problem. Our patient records are implemented w/ a “tab†style for the display of different parts of the record. Unfortunately, the folks using the database kept tabbing over to a different part of the record which wound up not saving any of the changes they made. My original quick fix for this was to have the tab buttons also save. But that made me nervous. I worried that if someone accidentally changed things or if I was giving a demo, a change to a new tab would save bad data.
I probably could have fixed this with some javascript so that all of the tabs were really part of the same webpage and they would be dynamically hidden or displayed using javascript to manipulate the CSS classes. But that didn’t occur to me until just now. Instead, I implemented a system to note changes in the form and alert if you navigated off the form without saving. Just as a reminder to myself, here’s what I did.
1. Create a confirm_exit.js file with the following:
var needToConfirm = false;
var fieldsChanged = “â€;window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
{
return “The following fields have changed and are not saved:\n†+ fieldsChanged;
}
}function fieldChanged(fieldName)
{
needToConfirm = true;
fieldsChanged = fieldsChanged + ††+ fieldName + “\nâ€;
}
When the script loads, it creates two new variables: needToConfirm and fieldsChanged. needToConfirm starts as false, meaning no need to prompt the user before leaving the page. fieldsChanged is empty since nothing has changed. I also set a trigger on the window: onBeforeUnload, which occurs any time the page is about to be unloaded. For example, close the browser, navigate to a new page, etc. This trigger sends you to the confirmExit function.
2. This is loaded into any webpage that has a form I care about
3. Each form element needs to have an onChange trigger: onChange=â€fieldChanged(‘descriptor’);†When the form element changes, the function is called. We set needToConfirm to be true and update the list of fields changed in the form with the descriptor.
4. Finally, we bless the save buttons on the form page by adding an onClick trigger: onClick=â€needToConfirm=false;†Having needToConfirm as false prevents the confirmExit() function from prompting the user when they hit the save button.
Voila! Forms that prompt you to save before leaving.
I haven’t been so much with the blogging lately. For me, that is generally a sign that things are busy enough that I’m living life rather than blogging it [ed note: For all of you young readers, this is what is known as irony. When I have the most to say, I have the least time to say it in; conversely, when I write the most, I have the least to say].
Quick highlights of things that are going on:
er, sorry just a minor Red Dawn reference – it’s not my fault, I grew up in the 80s.
Now that I’ve got that out of my system, a note on a new toy. As I mentioned before, I’m going to go (mostly) digital on my trip to Yellowstone. I bought 8 GB of memory cards which is only 800 or so pictures in raw format. For the past several years, I’ve shot around 800 pictures in film. On the one hand, I suspect I’ll take more pictures in digital since the marginal cost is basically zero. On the other hand, I’ll have the ability to prune out any bad shots. Still, I suspect that I’ll wind up wanting more memory cards.
Rather than trying to guess how many, I decided to buy the “Wolverine FlashPac 7060†(hey – I was getting there). The Wolverine is a pretty neat device. When I first started looking for a hard drive on which to temporarily store pictures, everything I found was a basic USB hard drive that required a computer to control. The FlashPac doesn’t. It’s a multi-type card reader and hard drive that has enough smarts in the firmware to know how to mount a memory card and copy all of the pictures from a card onto the internal drive. It preserves the contents of the card and you can manually erase the card in your camera. It comes in a variety of sizes, I bought the 60 GB version – enough for 6,000 pictures.
I got the device in today from B&H (they seemed to have the best prices). Unfortunately, it had outdated firmware installed on it which wouldn’t read my SDHC cards. Fortunately, I was expecting that and I had downloaded the next release of the firmware which does support SDHC (although at the fairly slow, standard SD speeds). Of course, getting the firmware on a device while using a linux computer is always challenging. After screwing around with it for an hour or so, I punted and used the old Windows 2000 partition I have on the desktop. I felt dirty afterward, but at least the device works with my memory cards now :).
Overall, it’s a very cool piece of hardware. It does what it says it does and seems to do it well. It’s not for archiving – that’s a whole different problem to tackle, but for short term storage, it’ll work.
Back when I was a postdoc, I was studying FFTs. Okay, actually, I’m not enough of a mathematician to study FFTs, I was studying the efficient implementation of FFTs on parallel computational clusters. One of the graduate students I was working with on the project penned the following:
If there’s a working FFT
That’s not in FORTRAN but in C
Alas it twice as slow will go
And that (as always) goes to show
If speed is your greatest asset,
Then what you C is what you get.
-V.V. (Mony) Iyers
For years, Fortran was the programming language of choice for engineers. It’s name, a derivative of “Formula Translator,†give you an impression of what it does: it makes it easy to represent matrix algebra formulas in a computer programming language. Because it is a compiled language and it has built in support for performing matrix algebra operations, it is extremely fast. I never did much Fortran programming and V.V. and I disagreed on the speed of Fortran vs C (I could always tweak C code to be as fast as Fortran), but it is a great programming language for engineers that has unfortunately, largely been replaced by Matlab.
Fortran was first released nearly 50 years ago and has been updated a few time since then. Given the age of the language, I hadn’t even thought about who invented it, and was saddened to learn that the creator (or at least the project lead) died last weekend. John Backus was apparently the project lead for the creation of Fortran back in the 50s and he died Saturday at the age of 82.
It’s hard to imagine what the engineering field would be like without Fortran and even though I hadn’t heard of him until this week, I think I’ll miss him.
In 2005, congress mandated a change to daylight savings time, essentially, starting it three weeks earlier (March 11th, this year) and ending it three weeks later. Our local paper is requesting suggestions for what people will do with their 22 extra hours of daylight. Here’s my suggestion: spend the time fixing all of the computer problems caused by the DST change.
Essentially, a change to DST is very similar to a self-inflicted Y2K problem. If you want to get a sense of how time/date issues can affect computer systems that aren’t prepared, take a look at this article regarding the new F-22 Raptor and it’s problems with the International Date Line. I wasn’t worried about Y2K because we knew about the issue for years and most modern operating systems and software had already addressed it. With the DST changes, we haven’t had nearly enough notice or preparation. Now, I’m not stocking up on canned goods, but I’m pretty certain that March 11th is going to bring about extra work.
so Saturday night around 11:30pm, the acid neutralizer I just installed, exploded. Okay, it didn’t really explode, but the top popped off again. Spoke to the customer support, looked around a bit more and it seems that the threads on the tank were stripped. I’ll call tomorrow and see about getting a replacement tank ðŸ™
Update: I just received a call from the folks that sold me the acid neutralizer (I didn’t even have to call them back). Two interesting things: 1) apparently, the tank head they sent is a down flow head and the system I’ve got is designed to be upflow. Not a big deal, except that I have to reverse the inlet and outlet plumb lines as compared to what’s labeled on the head. Normally they send a note along those lines – this time they didn’t. 2) Given that one of the threads is stripped, they’re going to send me a new tank and an RMA to return the old one.
Believe it or not, even after all of the difficulties, I’m still very happy with the company (CAI Technologies). They seem to sell good products and a reasonable cost (about half what I could find elsewhere). If you ever need specialty plumbing, check ’em out.
Two web-related notes:
Powered by WordPress