My views on software, programming, Linux, the Internet, government, taxation, working, and life.

Tuesday, October 24, 2006

My Phone Rings and The Internet Drops Its Connection

Day 1: You hear slight high pitched sounds on the phone at first, along with some mild fuzz.
Day 2: When you're talking, people ask you to speak up and you sort of get the feeling that your words are getting cut out.
Day 3: When someone calls you, your Internet connection goes down 50% of the time. When they don't call you, even though you get on the Internet, you find your Internet speed goes down remarkably.
Day 4: When someone calls you, your Internet connection always goes down.
Day 5: You can't seem to connect to the Internet without multiple attempts. You also find that if you turn off your DSL modem, the symptoms you saw on days 1 and 2 go away.

Your copper wire cable may look like it's connected on the screws in your demarcation point outside your house, but in fact it may have built up moisture, corrosion, or is a wire that's about to break. Note also that copper wire is brittle in cold weather, so if there's improper insulation on the wire and in the demarcation box against cold air, it's bound to break.

Open that demarcation box, unscrew the wires carefully, and put them back on the screws again. Then, ensure the box is sealed good such that cold air cannot get in there again.

You'll find that your Internet speed goes back up, the high pitched sounds and cutouts no longer occur, and the phoneline works while you're on the Internet at the same time.

Making Imaging Apps in Linux PHP

I found after some research that if you know a little PHP, it's super-easy to make your own imaging apps in PHP on Linux.

But wait! Before you read "linux" and get turned off because your users use Windows, do not despair. You can use Ubuntu Linux or your favorite Linux as your scan station, but then the web app can serve up the docs for viewing and printing through other workstations running Windows and either IE or Firefox.

In Ubuntu Linux, you'll find a 'scanimage' command-line command is readily available to you which interfaces with your USB scanner. Also in Ubuntu Linux, if you temporarily turn on universe mode in your /etc/apt/sources.list file and do an apt-get update, then 'apt-cache search plugin | grep -i plugin' and 'apt-cache search tiff | grep -i tiff', you can then find 3 things extra that will be useful to you: mozilla-acroread, acroread-plugins, and libtiff-tools. You can install them with 'apt-get install x' style syntax.

PHP supports shelling out to command-line in the background with the $result = `$sCmd`; syntax and from that you can shell out to run the scanimage command. This can be told a set of parameters to read in the image from the USB scanner and convert it to a TIFF image. Great -- you have a TIFF file, but it doesn't display well in IE without a plugin and IE will want to load it with Kodak Image Viewer on Windows XP, which loads outside the browser. The ideal thing would be to convert that TIFF to a PDF, and there are a few reasons for this. For one, Linux makes very efficient PDFs that are more compressed than PDFs generated by even Adobe itself. Adobe's tools add a lot of bloat for extra features that you might not use in ordinary scanned forms you pull from your scanner. Therefore, TIFF to PDF conversion and storage is going to consume less disk space on Linux than straight TIFF image storage would, but it's your call.

If you choose to convert to PDF and then store the TIFF, you first run it through scanimage, generate the TIFF, and then use a tool called tiff2pdf to convert it (very fast, I might add!) to PDF. Then, store the PDF and delete the TIFF file. Last, display the PDF in the browser.

If you choose to store the TIFF images but provide viewing of the TIFF as a PDF on the fly, have PHP run it through tiff2pdf on the fly and then display the PDF in the browser.

With the Adobe Acrobat plugin, you can then view the PDF with options to flip through pages, magnify, rotate, email, save, and print the document. If Reader is installed, you can set it to open separately from the browser. If the plugin is installed, you can set it to open the document inline inside the browser.

Still, if you absolutely want to display the TIFF image, look around on the web and you'll find products that are free that work in IE or Firefox to display these in about the same format as Adobe Reader offers.

Linux also has a way to push the files easily to Windows with something called 'smbfs'. If this is installed in your brand of Linux, you can mount a remote Windows share locally on your Linux hard drive with the 'mount -t smbfs' command (do 'man mount' or read docs on the web for how to do this). Then, you can copy the files to this Windows server just as easy as you copying them from one directory to another on Linux with the 'cp' command.

Quit Using DIV Tags Already

I don't mean quit using DIV tags altogether, but dang it, if you're going to use them in your HTML to replace where you might be using TABLE tags, test them in all kinds of font situations and on Macs, the top 4 versions of desktop Linux, and Windows, using Firefox, IE6 and 7, and Safari. Please!!!!

You see, the problem is that I now go to many sites where the message is out that DIVs are what you're supposed to use instead of TABLE tags. But the problem I'm seeing is that text is bleeding over into other columns and on top or under pictures. TABLE tags can prevent that. So can really good CSS tweaks and some sufficient testing with those existing DIVs.

But no, programmers aren't getting it, and they're ruining the web.

Just today I went to a really nicely designed page at Yahoo for their new search engine marketing. I noticed that even the big Yahoo corp can't get it right and some of the DIVs were bleeding text over into other stuff. Did they only test on IE? Did they only use Windows? Yeah, they probably did.

PHP Is My Web Language of Choice

As much as I like, I've come to realize that there are 6 forces that will always be in computer programming:

  • THE SCIENTISTS. Computer "scientists" and professors who will espouse the productivity of Scheme and LISP and who end up making big-selling web products from it, oddly enough, such as the fact that most of Yahoo's ecommerce catalog is running on LISP. .....Morons.

  • THE OOP PURISTS. Folks who like to sit in meetings all day, never getting anything done, trying to put a square peg into a round hole by trying to make everything fit into the MVC programming model with OOP minutia. These are the Java and C# guys. The VB6 guys moved to VS.NET, realized that everyone was going away from "BASIC" to C#, and C# was like an easier C++ but sort of like Java, and so all the VB6 guys are now C# guys. .....Morons.

  • THE TIGHTWAD OLDIES. Companies still using COBOL and RPG because their tightwad asses can't get up and realize the huge expense this has, and they're having to look high and low for existing programmers either willing to retool in this ancient stuff, or old programmers who realized that retirement isn't as cracked up as it was made out to be. ....Morons.

  • THE NEXT-BIG-THINGERS. Nutjobs who jump on the next big thing every time, leaping from language to language without caring about their craft -- only about methodologies and science. These are the guys espousing the wonders of Ruby, Haskell, Lua, etc. ....Morons.

  • THE CONFUSED. People still using Delphi and VB6 because they are confused and the world is moving too fast. ....Morons.

  • THE PRODUCTIVE. People who actually want to get some work done and grabbed the "VB6" of the Linux platform either because Microsoft backstabbed them too many times or because they were fed up with constant reboots, glaring security holes, etc. That "VB6" of Linux is PHP. And usually when you learn PHP, you also learn Perl and Python too so that you can do command-line stuff (Perl) and richclient GUI stuff (Python). This last group is the group I'm in. We're the ones that get sh*t done.

About the only thing I can say for J2EE is that it is a complete stack with all the bells and whistles, so they say. In reality, however, it lacks good reporting and charting. Try and see if there's something already in J2EE that allows you to do easy piechart PNG creation and you'll find there isn't anything. But beyond that, it's got a lot of stuff in it. Only recently has Zend, makers of PHP, gotten on board with this and developed the new Zend Framework. Zend is trying to make their own J2EE-like stack, taking elements of PEAR which they had been using for years.