Thursday, May 21, 2009
FIREFOX: Hogs memory better than Internet Explorer.
Friday, March 20, 2009
Transferring Files from an OLD Mac to a PC
"Sure!" I replied, enthusiastically. Little did I know the ordeal that was to come. Now, at least, I've learned from it and can spread the word to other PC people who might've had a Mac dropped in their midst.
I plugged in the old PowerBook's clunky AC adapter and eventually found the power switch on the left-rear panel. The cheesy "BOM BOMMMMM…" greeting tone came through, so far, so good. A grayscale image eventually flickered into view.
I don't know whether the display was responding to solar flares, unclean power, or sketchy connectors from the motherboard to the screen, but it took some effort to get the image to remain stable. The backlight appeared to be on its way out, like one of those ubiquitous fluorescent bulbs in a school or office that's started its death flickers. My initial idea was simply to offload the documents via the PowerBook's 3.5" diskette drive, so caveman-like, I grabbed up a handy diskette, plenty of which I have gathering dust in my desk drawer, and managed to single-click my way to formatting the diskette.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4ORVzN3fyBBg-qIWElJ7qMbOKJfY6wmF-Kbe2B_L65jPHoI69lVmAuYWQicCPaDewhWPID-R36fppR1kORSxa308xrM_fbdKZtOjR-h330BfXwncXr12n_TbcADPJMxEO8dPFYtyYLM/s200/stewie_mad.gif)
Sadly this was nixed by what the Mac reported as at least several dozen MB of documents and images on its hard drive. Worse, neither network nor USB nor writeable CD were an option with this old Mac.
Undaunted, I flipped off the PowerBook in disgust, then unplugged the sucker and let it sit on a table in my room while other more pressing, and interesting, things took up my time.
Weeks, then months, passed by. Yesterday I revisit the PowerBook, now a fine layer of dust and dog hair adorning its gray exterior. I pick it up and notice the power plug sticking out of the right-rear panel is askew for some reason. I yank the plug out and the metal sleeve is bent at around a 45-degree angle. Whoops! I probably carelessly bumped into it at some point, popping the thing.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMY_7NS9wfH22YpU9o3VW52IwmyUIskUj5VwNbTv6xBunKS9oDwQG_poHccmz5F5hY-dn9xRkgWrII92iv-NDs-Fm8TCRng9ugRWxBqJH-Nf0LggXOiqppPWf2QRmO5eaKVpRY330j3x4/s400/PowerBook140_POWER_before_after.jpg)
I try plugging the AC adapter in, then try carefully squeezing the sleeve back into place, and try working it around like a Q-Tip™ to see if I can get any power. Nope. I try realigning the sleeve again and notice that it's for naught, because the sleeve has been completely sheared away from the rest of the plug assembly.
Clearly if I'm going to get power to this clunker, I need to replace the plug. I dig around my collection of old and unused AC adapters, refugees from years of electronics equipment gone astray, lost to lightning strikes, or given away or sold with the wrong adapter in the package, separating the two forever.
I find one possible candidate, an old AC adapter from a 2400 baud modem, with a similarly shaped plug. I slice off the plug, slice away the broken Apple plug, and splice the replacement, then apply power. No dice!
Frustrated, I start digging around in a drawer where I keep anything from old greeting cards to duct tape to spare change. I find a strip of plugs from a universal AC adapter which has gone AWOL, each has two metal pins which are meant to plug in to a socket in the adapter’s cable. At this point I don’t care about a clean fit, so I grab the largest of the plugs and then go ahead and strip the wires from the Apple adapter and solder them to the pins. Incidentally, I have no idea off hand which is positive and which is negative, but as it happens when I get frustrated, I get impatient, so I opted to take the 50/50 shot at blowing something up.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgypXf1Na_kVQO1wV4BcfOVGdSiIHhj-VKvH0hyphenhyphengRnVvaMbXtRiRO2tj-J4ajtcm6kuSUeQQuWh6WBipcgkN00KlUSxzzbyKeV3WHSh7yNRKwV7rnwpCnjnY-waz-31bW4_4YcEy4Wfypg/s400/Mac_AC_Adapter.jpg)
Success, the annoying "BOM BOMMMMM…" smacks my eardrums!
Now I start poking around on the Mac to try to gather up all the files and compress them. Documents in general are notoriously compressible, so I figure I can get at least a good 70-80% compression on average. The problem, unlike Windows XP, with its default “Send to Compressed File” context menu option from Explorer, this System 7.0.1 doesn’t seem to have any way to compress files, let alone right-click. There is a StuffIt Expander 4.0.1 installed, but it only uncompresses.
Unperturbed, I set out in search of a compression utility. I checked out the latest version of StuffIt, but it requires the latest and greatest MacOS. I took a quick look, they didn’t seem to have download links for prior versions readily available. I searched around and found references to DropStuff 4.0.1, StuffIt Expander’s counterpart, which would enable me to gasp compress files and folders.
Of course, the StuffIt site didn’t have this file available, so I visited some FTP search sites, ending up finally at FileWatcher. A forum thread I came upon actually had a post where a user had mentioned the name of an .HQX file, dropstuff_w_ee_4_installer.hqx, which is basically the equivalent of a SETUP.EXE file in Windows. This is what I needed.
FileWatcher provided me with a suitable FTP site hosting the file, so I grabbed it, and on a freshly-formatted diskette, copied the .HQX file. I then inserted the diskette into the Mac’s drive and attempted to execute what should be an executable. I get this error message:
The document could not be opened because the application program that created it could not be found.
So let me get this straight, it’s an executable which can’t be executed, because the Mac tried and failed to find an application associated with it? Strange, too, was the fact that the DropStuff installer icon itself was plain, as if symbolic of an unknown file type. Did the Mac just not know what to do with this file? Did I grab a version of DropStuff which somehow was unreadable by this version of the System OS?
I decided to fall back and punt. I took a break, got a tasty beverage, then did some more research. It turned out that I had naively taken a blurb I’d heard years ago about Macs being able to read PC-formatted disks too seriously. It turned out not to work quite so seamlessly.
Eventually I found and installed the handy utility TransMac which enables Mac and PC files to be transferred from their respective media. Once I used this utility to create a Mac-formatted diskette on my PC, then copied the DropStuff installer to it, I found to my relief that when I inserted the diskette into the Mac, its own pixellated little icon appeared. When I clicked twice on the icon, an installer opened and began the installation process. At last, I was able to use DropStuff to systematically grab and compress my pal Don’s documents, copy them to diskette, and with TransMac as my Mac-to-PC ambassador, copy the resulting .SIT files to a folder on my PC.
I finally found and installed an old but Windows-compatible version 5 of the StuffIt suite to enable me to uncompress the document files on my Windows machine and migrate them to a writeable CD.
PROCEDURE
- Install TransMac on the Windows computer.
- Use TransMac to format a Mac diskette.
- Locate a file with an .HQX extension for a Mac version of DropStuff or a similar compression utility.
- Copy the .HQX file to diskette using TransMac.
- Install DropStuff on the Mac.
- Use DropStuff to compress files and folders, and copy them from Mac to diskette.
- Copy files from diskette to PC using TransMac.
- Install a Windows version of StuffIt, and use this to uncompress the .SIT files containing the migrated document files.
Aside from the PowerBook’s annoying lack of a simple eject button to pop the diskette out of the Mac, instead depending on the quaint user interface option of “Put Away” to get it back, things went pretty smoothly! Now this Mac can go into the dark night of the technology graveyard as many things have and will continue to do.
Monday, March 9, 2009
Top 10 List on 10 Separate Pages?? Uhhh... NO.
Increasingly, to get their advertising exposed to as many eyes as possible, content publishers will take anything from a howto article to a top 10 list and break it into individual pages. I think mainly the purpose of this is increase the CPM, which is understandable if someone is publishing content for purposes of earning some money.
Another reason for doing this is to try to regulate how much bandwidth is consumed in viewing the site. One user gobbling up 1 item of a top 10 list at a time uses less bandwidth than a user grabbing all 10 items at once. This is certainly a concern particularly for a forum which might be running with an ISP which charges for monthly bandwidth overage. However, some sites like Something Awful will do stuff like charge users a one-time fee for the privilege of searching their forum. While this is understandable, I find it annoying.
Say you have a favorite thread on a forum which is huge, but unfortunately only shows a set limit of posts per page. This add-on lets you bypass the site's limitation, and lets you consolidate all the posts into a single, huge web document.
In the screenshot below, by right-clicking on the Next link, a Repagination popup menu is present, and the "All" option I choose lets me append to the current page all subsequent pages of the forum thread.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMJdj0M7O7p8VO5WUDd8KYOs1eQYL6uIeixCAYhDdcCcH7NjyTq2PfGd4__we_8oHVEjv2zXRzTucMoUhXow1-fmJzKVe6r3hoOyGYINR_dbJB6lWv3x9KZTX6Rf1ntHcmEeF5-7-I-0g/s400/mega.jpg)
In this example, a thread which is several hundred pages long can, if I like, be loaded en masse in a single browser window. At that point, I can easily search it for references, in this case, to artists or songs I like, or just save the whole mess for viewing later on a laptop if I happen to be somewhere without wireless connectivity (a situation which is becoming increasingly infrequent).
While the popularity of this kind of add-on certainly will open the floodgates as far as your ability to gobble up more of a content publisher's bandwidth at one time, it also will and arguably should send the message that informed users can and will get around attempts to spoon-feed content and advertising to them.
Although this add-on hasn't been updated recently, someone posted an update to this extension here which makes it compatible with Firefox 3.x. I hope that the author will consider an update of his own, I find it an incredibly helpful and useful add-on!
Wednesday, February 18, 2009
When MAX Isn't - Getting the Maximum Value of a VARCHAR Field
The particulars of the (somewhat convoluted) balance calculation aren't terribly exciting, but in a nutshell, a part of the process involves grabbing the most recent customer invoice by its InvoiceNumber, and using a value associated with that invoice to perform other calculations which eventually lead to the account balance.
This is a list of the customer's InvoiceNumber values, in descending order as they appear in the Invoices table.
SELECT InvoiceNumber
FROM Invoices
WHERE AccountKey = '99432'
ORDER BY InvoiceNumber DESC
12345678900902
12345678900901
1234567890507
1234567890506
1234567890505
AccountKey represents a foreign key in the Invoices table representing the customer account. Notice that the result set shows the most recent Invoice at the top of the list, and since the primary key for the Invoices table is auto-incrementing, that invoice possesses the largest key value.
Some years back, a data fix was made to this table whereby the customer account number (in this case, 1234567890) was changed to add an additional digit. Thus, what was once 1234567890 became 12345678900.
Time went by. In the last couple of months, a different data fix was made to a piece of code responsible for calculating account balances, specifically late fee calculations. This turned out to be the crux of the matter, as you'll see here.
The code which calculates the account balance, as I mentioned, needs to obtain the customer's most recent InvoiceNumber. The code used to grab this had been modified to add this section of code as follows:
SELECT MAX(InvoiceNumber)
FROM Invoices
WHERE AccountKey = '99432'
1234567890507
Take a look at the position of this InvoiceNumber in the actual list:
12345678900902
12345678900901
1234567890507
1234567890506
1234567890505
Rhut rho! There's the problem. The InvoiceNumber field is of the SQL data type varchar, and consequently the MAX function is returning what is alphanumerically the largest value, when in fact numerically the one at the top of the list should be returned instead. This resulted in the wrong InvoiceNumber being grabbed as part of the late fee calculation, and this further led to a certain balance threshold not being exceeded, which then altered the balance from what it needs to be.
The fix is easy, just CAST the InvoiceNumber to a decimal within the MAX function.
SELECT MAX(CAST(InvoiceNumber AS decimal(18,0))
FROM Invoices
WHERE AccountKey = '99432'
12345678900902
Modifying this code allowed the process to properly obtain and work with the most recent InvoiceNumber. You might be asking, why not just avoid the hassle, and grab the MAX of the Invoices table's primary key for the given AccountKey value? That would certainly make more sense, and would be more efficient, after all, the primary key field for the Invoices table is an integer, not a varchar(25) like the InvoiceNumber.
However, the code which does the calculations is outside my normal scope, so rather than modify someone else's handiwork to the extent I'd prefer, I'm opting for a less invasive change which will compensate for whatever necessitates getting the InvoiceNumber directly. In resolving this issue, I've left detailed commentary in the work order on our internal helpdesk system, so that whomever stumbles across this code in future will have a point of reference.