Skip to content
Home » JPG

JPG

Spot phishing e-mails with Outlook

I got e-mail the other day from Turbotax saying someone had filed my taxes for me. Obviously a cause for concern, right? Here’s how I determined the message was fake in about three minutes. You can spot phishing e-mails with Outlook the same way.

Some people will tell you not to even open a message like this, but if you’re a computer professional, at some point someone is going to want you to prove the message was fake. I think this is something every e-mail administrator, desktop support professional, security professional, and frankly, every helpdesk professional ought to be able to do.

So here’s how you can get the proof. And generally speaking, Outlook’s default configuration plays it safe enough that this procedure won’t get you into any trouble, at least on modern versions of Windows.

Read More »Spot phishing e-mails with Outlook

IEcapt is a command-line web browser that outputs screenshots

Sometimes you need to capture a web page in PNG or JPG format. And if you need to do that, it probably helps to be able to do it in an automated fashion, like by a script.

That’s IEcapt‘s purpose in life. IEcapt renders web pages using the Internet Explorer engine, then outputs it as a graphics file. Uses include e-mailing a dashboard to someone or capturing steps when technical writing. Sure, you can use a tool like Snagit or Greenshot, but IEcapt is free and can be automated.

If you need IEcapt, you probably already know it.

Another easy Apache tweak

I ran my site through Google Page Speed on Tuesday, and scored a surprising 88 out of 100–higher than I expected. Getting above 90 is going to take some optimizations on files that WordPress updates may change, so I’m hesitant to do that, but one thing it told me to do was to cache more aggressively. That’s pretty easy, as it turns out, and I could definitely feel a difference afterward.

Here’s the trick.Read More »Another easy Apache tweak

A fast way to turn lots of images into an Adobe Acrobat PDF file

I have a collection of magazine scans that, inconveniently, came as a series of JPG images rather than as PDFs that are more conducive to reading. I wanted PDFs, so I found a way to turn lots of images into an Adobe Acrobat PDF file.

Building the PDF manually took a good 30 minutes per issue, so I wanted a faster way. Using command-line tools, I was able to convert the entire collection (about 40 issues) in less than 30 minutes.Read More »A fast way to turn lots of images into an Adobe Acrobat PDF file

More tips for playing with toy trains

As you can probably guess from the length of time between postings, the Lionel has proven to be quite the distraction. A welcome one, but definitely a distraction.
I’ve picked up a few tricks along the way.

Clean old plastic buildings quickly. My buildings had accumulated a decade or so of dust and grime sitting in a box, and they probably weren’t clean when they were boxed either. The solution? Put a dab of hand soap and a small amount of laundry detergent in a bucket, then fill it with warm water. Just put in enough soap and detergent to make some suds. Disassemble the buildings and drop them in. Let them soak for a few minutes, then scrub with a toothbrush. They’ll look almost new. Note: Don’t do this if they have decals, or if you deliberately weathered the buildings. If you don’t know what weathering means, then go get your bucket.

Cleaning severely rusted track. To clean severely rusted track, give it a thrice-over with a drill’s metal brush attachment. It’ll mark the track up badly, but it’ll clean it up fairly nicely and may allow a dysfunctional train to run again. Don’t worry about ruining a prized collectible; used Lionel track sells for 25-50 cents a section at a hobby shop. This also means you shouldn’t put a lot of time and effort into salvaging rusty track–especially considering the new stuff sells for a dollar.

Lubricate your cars’ wheels for smoother operation. Unlike the engine, WD-40 is fine for this. Put a small quantity of oil into a bottlecap, then use a toothpick to apply it anywhere that the axles come in contact with other parts of the car. After doing this, your train will run more quietly and smoother, and your locomotives will be able to pull approximately 30% more weight, so you can feel free to add another car or two.

Buildings on the cheap for the nether regions of your layout. If you have some kind of structured drawing program (Adobe Illustrator, KDE Kontour, Macromedia Freehand, or even something like Visio) you can draw the basic shapes of buildings, print them out on heavy card stock, and cut them up and glue them together. Get started by taking measurements from an existing building and use that as a guide to help you learn the height of a door, window, and floor. Export the file to some kind of raster format (JPG or PNG) prior to printing and use GIMP or Photoshop to add textures if your drawing program doesn’t support it. For added realism, cut out the windows and glue in pieces of transparent plastic (kitchen plastic wrap is fine but cutouts from clear plastic bags are nicer). It doesn’t take any longer than assembling and painting a plastic model, the results are surprisingly convincing–the only advantage plastic offers is more realistic texture–and you’ll never beat the price. And if something happens to the building, you can always print out and reassemble another one.

Polystyrene sheets for scratchbuilding plastic models on the cheap. Once you’ve built some paper models and want to move up to building plastic buildings from scratch, you can pay $7 for a small sheet of polystyrene at a hobby shop, or you can buy 88-cent Beware of Dog signs from the nearest hardware or discount store. It’s the same stuff, only bigger and printed on one side. Put the printed side on the inside of the model and cover it with paper if you want to keep your secret safe. If you live near a big city, I’ve heard that plastic distributors sell big 4’x8′ sheets of polystyrene for about $7. A square foot of material makes for a good-sized building, so a 4×8 sheet will probably yield more than 30 buildings.

Easy and secure remote Linux/Unix file transfers with SCP

Sometimes you need to transfer files between Linux boxes, or between a Linux box and some other box, and setting up Samba or some other form of network file system may not be practical (maybe you only need to transfer a couple of files, or maybe it’s just a one-time thing) or possible (maybe there’s a firewall involved).
Well, you should already have SSH installed on your Linux boxes so you can remotely log in and administer them. On Debian, apt-get install ssh sshd. If you’re running distro based on Red Hat or UnitedLinux, you may have a little investigative work to do. (I’d help you, but I haven’t run anything but Debian for 2 or 3 years.)

The cool thing about SSH is that it not only does remote login, but it will also do remote file transfer. And unlike FTP, you don’t have to stumble around with a clumsy interface.

If you want to transfer files from a Windows box, just install PuTTY. I just downloaded the 240K PSCP.EXE file and copied it into my Windows directory. That way I don’t have to mess with paths, and it’s always available. Make sure you’re downloading the right version for your CPU. The Windows NT Alpha version won’t run on your Intel/AMD/VIA CPU. Incidentally, Putty.exe is a very good Telnet/SSH client and a must-have if you’re ever connecting remotely to Unix/Linux machines from Windows.

SSH includes a command called SCP. SCP works almost like the standard Unix CP command. All you to do access a remote file is append a username, followed by the @ sign, and the IP address of the remote server. SCP will then prompt you for a password.

Let’s say I want to move a file from my Linux workstation to my webserver:

scp logo.jpg root@192.168.1.2:/var/www/images

SCP will prompt me for my password. After I enter it, it’ll copy the file, including a nice progress bar and an ETA.

On a Windows machine with PuTTY installed, simply substitute the command pscp for scp.

I can copy the other way too:

scp root@192.168.1.2:/var/www/index.php .

This command will grab a file from my webserver and drop it in the current working directory.

To speed up the transfers, add the -C switch, which turns on compression.

SCP is more secure than any other means of file transfer, it’s probably easier (since you already need SSH anyway), and since it’ll do data compression, it’s probably faster too.

Optimizing Web graphics

Gatermann told me about a piece of freeware he found on one of my favorite sites, tinyapps.org, called JPG Cleaner. It strips out the thumbnails and other metadata that editing programs and digital cameras put in your graphics that isn’t necessary for your Web browser to render them. Sometimes it saves you 20K, and sometimes it saves you 16 bytes. Still, it’s worth doing, because more often than not it saves you something halfway significant.
That’s great but I don’t want to be tied to Windows, so I went looking for a similar Linux program. There isn’t much. All I was able to find was a command-line program, written in 1996, called jpegoptim. I downloaded the source, but didn’t have the headers to compile it. I went digging and found that someone built an RPM for it back in 1997, but Red Hat never officially adopted it. I guess it’s just too special-purpose. The RPM is floating around, I found it on a Japanese site. If that ever goes away, just do a Google search for jpegoptim-1.1-0.i386.rpm.

I used the Debian utility alien to convert the RPM to a Debian package. It’s just a 12K binary, so there’s nothing to installing it. So if you prefer SuSE or TurboLinux or Mandrake or Caldera, it’ll install just fine for you. And Debian users can convert it, no problem.

Jpegoptim actually goes a step further than JPG Cleaner. Aside from discarding all that metadata in the header, its main claim is that it optimizes the Huffman tables that make up the image data itself, reducing the image in size without affecting its quality at all. The difference varies; I ran it on several megabytes’ worth of graphics, and found that on images that still had all those headers, it frequently shaved 20-35K from their size. On images that didn’t have all the extra baggage (including some that I’d optimized with JPG Cleaner), it reduced the file size by another 1.5-3 percent. That’s not a huge amount, but on a 3K image, that’s 40-50 bytes. On a Web page that has lots of small images, those bytes add up. Your modem-based users will notice it.

And Jpegoptim will also let you do the standard JPEG optimization, where you set the file quality to a numeric value between 1 and 100, the higher being the truest to the original. Some image editors don’t let you adjust the quality in a very fine-grained manner. I’ve found that a level of 70 is almost always perfectly acceptable.

So, to try to get something for nothing, change into an image directory and type this:

jpegoptim -t *

And the program will see what it can save you. Don’t worry if you get a negative number; if the “optimized” file ends up actually being bigger, it’ll discard the results.

To lower the quality and potentially save even more, do this:

jpegoptim -m70 -t *

And once again, it’ll tell you what it saves you. (The program always optimizes the Huffman tables, so there’s no need to do multiple steps.) Be sure to eyeball the results if you play with quality, and back up the originals.

Commercial programs that claim to do what these programs do cost anywhere from $50 to $100. This program may be obscure, but that’s criminal. Go get it and take advantage of it.

Also, don’t forget the general rule of file formats. GIF is the most backward-compatible, but it’s encumbered by patents and it’s limited to 256-color images. It’s good for line drawings and cartoons, because it’s a lossless format (it only compresses the data, it doesn’t change it).

PNG is the successor to GIF, sporting better compression and support for 24-color images. Like GIF, it’s lossless, so it’s good for line drawings, cartoons, and photographs that require every detail to be preserved. Unfortunately, not all browsers support PNG.

JPEG has the best compression, because it’s lossy. That means it looks for details that it can discard to make the image compress better. The problem with this is that when you edit JPEGs, especially if you convert them between formats, you’ll run into generation loss. Since JPEG is lossy, line drawings and cartoons generally look really bad in JPEG format. Photographs, which usually have a lot of subtle detail, survive JPEG’s onslaught much better. The advantage of JPEG is the file sizes are much smaller. But you should always examine a JPEG before putting it on the Web; blindly compressing your pictures with high compression settings can lead to hideous results. There’s not much point in squeezing an image down to 1.5K when the result is something no one wants to look at.