Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

Past Blogs

The Paranoid Web Developer.

12.31.2009

I may well have a reputation for being security-conscious to the point of paranoia. I say that you can't be too paranoid; nobody writes articles extolling the virtues of web sites that haven't been hacked. Check out these articles about the devious and clever Cross-Site Request Forgery technique.

Plenty to worry about, huh, web devs? Remember: just because you're paranoid, doesn't mean they aren't out to get you.

For most regular web-surfers, I think that here's little to worry about here. Users can protect themselves by logging into accounts only when needed, and logging out when done.

Appending an External JavaScript File.

12.27.2009

This basic bit of JavaScript will allow you to dynamically append an external JavaScript file to an HTML document.

var theScript = document.createElement('script');
theScript.type = 'text/javascript';
theScript.src = "da_script.js";
document.getElementsByTagName('head')[0].appendChild(theScript);

First, we prepare a new object using createElement(). Then, we append the new object to the end of the first (and, hopefully, only) head element in the document.

Ye-ouch!

12.23.2009

I was washing dishes, when my timer went off to pull some cookies out of the oven. I slapped on my oven mitt, pulled out the cookie sheet, and got one heck of a burn on the tip of my thumb. The water from my fingers had absorbed into the cloth of the mitt, and created a lovely new path for heat to escape from the hot baking tray right into my thumb. From now on, I'm resolved to thoroughly dry my hands before putting on the oven mitts.

Scams.

12.21.2009

I consider lots of things a scam: travel insurance, disc insurance, most credit reports, check cashing services, loan modification services and payday loans.

I had fingered change counting machinesfor scams too; they want to keep roughly 10% of your precious stash of coins. But there is a loophole - you can trade your counted coins for gift certificates with no "penalty". I checked it out and got a lovely Amazon gift certificate - practically as good as gold. (Note that you get only a paper receipt with a code; not a gift card.)

On the topic of scams, read about getting whatever kind of fix you need. That, my friends, is a despicable scam.

Natural Laws of Public Transit.

12.19.2009

There are a few "natural laws" of riding public transit that I have noticed over several years of bus ridership.

Photoshop - Seamless Background Photos.

12.14.2009

Seamless Background Photo I used my own photograph of Dale Chihuly's glass installation at ceiling of the Bellagio as the base for this seamless background. The number of objects and variety of color in this photograph made it quite an ambitious choice, but the transparency inherent in the glass artwork mitigated some of the odder blends.

I created this background in Photoshop. Here is a summary of the steps I used:

  1. Leaving a wide margin, copy a new image from original. This margin will give you extra source data for the blending the seams, so make it a little wider than the objects in the original photograph.
  2. Use the Offset Filter (Filter> Other> Offset) to shift the image 50% of its total dimensions both horizontally and vertically.
  3. Save your .PSD.
  4. Create a new layer.
  5. Use the clone tool to paint a large area into the new layer from the original layer.
  6. Align the new layer directly on top of the original layer. Set the layer blending mode to "difference" and nudging with the arrow keys will help.
  7. Add a layer mask to the new layer.
  8. With a soft brush, edit the new layer to blend nicely into the original layer. Paint black to "erase" the new layer and white to paint it back in.
  9. Go back to step 3 and repeat until the seams are gone.

Some notes:

Here's a more thorough tutorial of turning photographs into seamless backgrounds.

About Twilight.

12.10.2009

I read Stephenie Meyer's Twilight a couple of months ago. Twilight has a certain reputation, but so many of my friends had enjoyed it that I felt obligated to give it a try. I didn't like it.

Here's the thing. I like books where stuff happens. The first third of Twilight was moony high school melodrama and wistful thinking. Nothing happened. In the second act, the drama was interspersed with vampire exposition. In the third act, "bad" vampires were murdered, to protect the "good" vampire family unit.

There are also several messages in Twilight that I find quite uncomfortable. For instance, after saving the protagonist from a group of would-be rapist / murders, the love interest announces "You would have devastated their crime rate statistics for a decade." Yup, he blamed the would-be victim for the crime. Classy. Though Meyer uses subtle language in the novel, the vampire "hero" is a Spencer Pratt-class tool. The attraction between the protagonist and the love interest is based solely on physical properties - Edward's very handsome, and Bella smells nice. The protagonist's highest aspiration appears to be to get married, so she can go from taking care of her father to taking care of her husband.

For a similar view of the Twilight movie, check out this hilarious alternate script.

Free File Storage From Dropbox.

12.7.2009

I've been using Dropbox, a free online file storage system, for a couple of months now and I'm quite pleased with the service. For me, this service solves the problem of managing files between my laptop and desktop computers. I've ditched my flash drive, and I won't have to email myself updated files anymore.

I have 3 different computers - a home desktop (WinXP), a work desktop (Windows 7), and a personal laptop (MacOSX). I use my Dropbox to keep a variety of files synced between all of the computers - such as .PDFs with bookmarks, web pages I'm coding, half-written blogs, or even web links I want to check out later when I'm home. I don't have to worry about losing any of the Dropbox files; they're stored on 3 different computers, and on the Drobox servers.

Each computer that I've authorized for the Dropbox stores all of the files on its hard drive. When one of the computers is online, it checks for updates to the Drobox files, and if so, updates the local copy. Because the files are stored locally first, I never have to wait to open a really large file, but the Dropbox service keeps all the files nicely synchronized.

Dropbox offers a Pulic folder for file collaboration, and I've used the Dropbox photo album sharing without a hitch. There's even an free iPhone app for Dropbox. The Dropbox iPhone app lets you access your files from your iPhone (or iPod Touch) and can read a sizable number of file types. This could be quite handy for accessing all your recipes while shopping for dinner.

Bear in mind that, even though Drobbox has all kinds of security, there's always the chance they could get hacked. Don't store sensitive financial, legal, or business information in a Dropbox. Also, don't install this sort of thing on a public computer (such as those at the library or a cafe); stick with just accessing your files through the Dropbox web interface in those cases.

If you need more than 3 gigs of space, Dropbox offers 50 or 100 GB for monthly service fees. (Though it can't offer off-site storage unless you keep it in another building, an external hard drive may be cheaper in the long run.)

Dropbox is fast, reliable and works without any effort on my part. If you do sign up, be sure to use my link. Both you and I will get some extra free space.

Thanksgiving II.

12.5.2009

This year's Turkey day was as much of a success as last year. The in-laws made for delightful and very helpful company this year. It is always good to have a chance to show off in the kitchen.

Here, for posterity, was our menu:

I was very pleased that I managed to make rolls this year. I did forget the salt, but I rewrote the recipe to (hopefully) avoid that next time. Also, the chicken stock that I made a couple of months ago was used as an ingredient in many of our Thanksgiving dishes, so that's another feather in my cap. The husband should be very proud of all he made. In fact, now that I think about it, it's time for some left-over apple pie.

The Correct Use of "Literally".

12.3.2009

The chill in air in Seattle recently has me thinking about summer's heat wave. Relatively few buildings in Seattle have air conditioning, because it so rarely gets so hot. The downtown Central Library does have air conditioning, and when it opened on the morning of the hottest day, a goodly portion of the city's homeless rushed inside the library to cool off. That's right folks; it was a literal bum rush.

Last Month

Next Month