ImageMagick IS (Magic)

The more I look at what I’m been doing over the past year in terms of educating myself (probably my biggest hobby, and I do not mean that facetiously), the more I see myself – in the computer arena – drifting from learning new languages and such to learning/creating more tools.

By tools, I mean code or applications (such as Erwin) that helps take the drudgery – and time-consuming efforts – out of basic operations and leave one with more time to do the fun/learning stuff.

An example of a tool would be installation (and training) of a spam filter. I finally found one I liked for Outlook (yes, I’m asking for it…) and installed it.

  • Before: Getting 100-200 spams a day, deleting one by one (with big batches at once after breaks/sleep)
  • After: Browse the list of spams once or so a day, delete all. (I’ve only gotten one false positive so far! Amazing! [SpamBayes]

Same task – check spam – but now so much quicker.

Other Lee’s-True-Life-Examples:

  • Regular Expressions: I’ve used them before – beginning in Perl – but now I’m getting both better at them and learning the nuances of using them in PHP and ColdFusion. A long time ago (not!), I wrote the cruftiest e-mail address validator imaginable, with loops and so on; I’ve now compressed it to a single regex. That’s progress!
  • Scripts/Automation: Using Windoze batch files, SQL Server Scheduler and shell scripts (bash) on Linux, I now move around a hell of a lot of data every day. I not only do backups with these tools, but I post to my Web sites with database/content updates at periodic intervals. So, I can work locally and stuff just happens as I wish. Sure, took time to set up and code: But now it’s done; outside of an occasional check to make sure stuff is happening as I wished, no more time wasted (for example) exporting a SQL Server script that joins several tables to a flat file that is then FTP’d to one of my Web sites. It happens automagically.
  • Parsers: While parsers are usually a one-off affair (you write one for a specific, unique use), once written, it’s done! Just run when you need update, or set a crontab entry and you don’t even have to do that. And while parsers are basically unique, once you write a few, they get pretty similar in flavor (grab this file[s], extract such-and-such info, push this data to that). Another tool in the scabbard

Over the past week or so, I’ve finally (finally!) dug into the image-processing tool, ImageMagick.

I first ran across ImageMagic at cars.com; it was used there to batch-process vehicle images from vendors. I ran into some problem there, I cannot even remember what, and looking at the command line help (Solaris), I grabbed and e-mail address … and the woman there wrote back before the end of the day. Try that with Adobe!

I ran across it several other times over the year, but never installed it on a home machine and actually messed with it.

As mentioned above, that’s changed.

And ImageMagick is magic.

What a great tool.

I ran across an article about ImageMagick on the IBM site; it finally piqued my interest enough to download and play with.

A week later, I’m still playing with it.

I installed in on my Linux box, and – after some gnashing of teeth (hint: the php.ini file comes with “file uploads = no” by default) – got it working, and working well.

While ImageMagick is a command-line tool (which is what appeals to me – I like Adobe’s ImageReady with its droplet tool, but I like the command line), I integrated it into a PHP page so I could use it to easily batch process images.

A simple example?

Here’s a large image (scanned in from a slide) that is reduced – in the one upload – to a small (thumbnail) and full-sized image:

Full-size image:
Thumbnail image:

Hey, that’s good stuff. One upload, and the backend processes resize to my specs and puts them in the correct folders. The next step, of course, are various error-trapping mechanisms and so on, but – once I get this going here – it will make my life so much easier.

I’ll wonder how I got by without it.

Again, tools…

Did We Just Get Smarter???

In reference to the previous entry (of SunnComm threatening to sue a student for showing the company’s anti-piracy measures could be defeated by using the SHIFT key):

Just posted on C|Net, the company has told news.com that it will not sue the student.

The company said it will release a statement later today with more details, but it sounds like they backed down in the face of all the (no-so-good) publicity they were getting for the threat of litigation.

And really, how stupid to you have to be to sue someone for showing that your so-called security measures – which probably cost a pretty penny – can be defeated by a keyboard and an IQ of 10? Why not just keep it quiet and try to fix it?

Also, there was probably some pressure from other parties (RIAA??) to not pursue this – A case like this, a challenge to the DMCA over a SHIFT key, had a good chance of going against the DMCA, which would be a bad precedent for the RIAA and other such organizations.

OK, one stoopidity down; a zillion to go…

Amerika Just Got More Stoopider

OK, so there’s this new anti-piracy CD out. The anti-piracy measures were encoded into Anthony Hamilton’s “Comin’ From Where I’m From,” which was released last month (no, I’ve no idea who Anthony Hamilton is….).

On Tuesday (Oct. 7), I saw a news.com article detailing how a Princeton student had figured out how to disable this anti-piracy messure using the hi-tech method of … holding down the SHIFT key while loading the CD (disables autorun, so the anti-piracry program cannot run).

I laughed when I read it, but I thought to myself, “Someone is going to sue this guy for this…”

Yesterday, on Kuro5hin I read a (humor) story about how the Bertelsmann Group (parent of whatever company that released said CD) was suing the student based on DMCA violations.

Judging from the comments on the story, a lot of people were at least initially sucked in because, hey, it could happen. Look at all the other silly (to me) suits filed because of alleged DMCA violations and how crazy the RIAA is about file swapping/pirating and so on.

Sure, it’s a stretch – the SHIFT key, fer god’s sake – but it could happen.

*SIGH*

Guess what?

That’s right.

It happened.

The company that developed the anti-piracy measure – SunnComm Technologies Inc. – is planning on suing the student for potentially both DMCA violations, and for damaging the reputation of the company (its stock has dropped as a result of the disclosure).

So potentially both civil (reputation damages) and crimminal (DMCA violations) suits.

Super.

First of all, this is moronic, and a new low in hi-tech lawsuits.

Secondly, I love that SunnComm may sue for damage to their reputation. Here is a quote from a Reuter’s article:

“SunnComm believes that by making erroneous assumptions in putting together his critical review of the MediaMax CD-3 technology, Halderman came to false conclusions concerning the robustness and efficacy of SunnComm’s MediaMax technology.”

— SunnComm statement

How can a system be robust and efficacious if it can be disabled by that considerably low-tech circumvention of holding down a SHIFT key???

Are these guys morons?

(Hint: Yes! – see next graph!)

In the original Cnet story on the student’s findings, here was the record company’s (BMG) spokesman’s response to the finding:

“This is something we were aware of,” BMG spokesman Nathaniel Brown said. “Copy management is intended as a speed bump, intended to thwart the casual listener from mass burning and uploading. We made a conscious decision to err on the side of playability and flexibility.”

— BMG spokesman Nathaniel Brown

So, they knew about it – and admitted such to the press – yet are still are considering multiple suits against the evil-shift-key-finder.

So, they knew about it, yet still tout their system as robust.

Uh, can you say, “We f***ed up?”

And a couple of other random notes about this issue:

  • SunnComm says they knew about the SHIFT key issue, and their protection was a speed bump of sorts, to deter the casual pirate. OK…which means that the REAL pirates – the ones the RIAA etc. are so worried about – are the ones that SunnComm expects to be able to figure out the circumvention method? Shouldn’t they be more worried about these bad guy pirates more than the casual user?
  • And once ANY CD is compromised, it’s ripped and then it’s in the wild. And then anyone can get to it, so all the copy protection in the world is too late, correct? (Closing the barn door after the horses have fled or whatever the phrase is…)
  • While probably covered by some stupid EULA, isn’t there an issue with loading a program – not just the music – on a computer? Sounds like spyware. And I wonder if this program works on all platforms? And what possible damage this program could do (including simple privacy invasion potential…)

Sounds like SunnComm is trying to spin this issue to make themselves look less idiotic.

Guess what?

Not working…

The Semantic Web – Is This Progress?

First off, a disclaimer: This blog entry is not really about the uber-Semantic Web, just a small portion thereof.

For one, I don’t fully understand it – the whole concept.

For another, I don’t care to discuss it today (even if I did fully understand it).

Understand?

Actually, I read a very thought-provoking blog entry by Gina about ridding your URLs of IDs and extensions etc.

In other words, making them more like English (or whatever language), and less like geekSpeak (spoken at many places, exspecially /.) A step toward the semantic Web.

Examples (paraphrasing Gina’s examples):

  • Bad: http://www.somesite.com/blog/index.php?entryID=123
  • Bad: http://www.somesite.com/blog/123/
  • Good: http://www.somesite.com/blog/why_I_blog/

Long story short, she didn’t like to either give away her file structure or bother people with IDs (123 is an identity column value), and she wanted to give a meaningful URL – “why_I_blog” is more meaningful than “123” (agreed!).

As someone who has built his own blogging tool (implemented locally, only), this was a great article.

I didn’t put a whole lot of thought into the way items were stored (or, more correctly, displayed) when I built the tool (building it was too much fun; honest…), but I have given it a whole lot of thought since then.

As in, a lot (plus tax…)

So, this article hit a nerve.

But I still don’t agree.

Here are some of Gina’s arguments, and my responses:

  • “…[?php.id=123 type URLs are] not good because it includes a file extension (.php) which is sure to change when I port my site to Python CGI or Java Server Pages or flat files…” This is a valid concern, but I don’t put too much stock in this. If you can’t do a code sweep to find all links (twixt anchor open/close tags) and replace, say “.php” with “.jsp”, well Houston, you’ve got a problem. (10/07 update: One issue that was NOT mentioned was that extensions will break bookmarks (index.php is now index.jsp; if pages were both “index” [sans extensions], bookmarks would work. Excellent argument for such, but Gina didn’t explicitly mention it. And I was too stoopid to realize this…)
  • Expanding on the above: The above issue sort of assumes that the same code will somehow be directly ported from your old ASP site to your new PHP site. Nope. At least, that’s been my experience. Usually, the issue is with the database, pulling data from there. That is the part that should be rock-solid.
  • “File extensions expose technical details of the site’s inner workings” As in, hmm, .php3, when are they going to upgrade? and so on. I have several responses:

    • So what? So people can see that you run on ASP vs. PHP. Big whoop. The dorks (us) will always be able to figure this out, so why hide it?
    • Non-dorks don’t even pay attention to URL structure (past the www.blah.com). File extension? What’s that? Oh, it has to be an HTML page to display! (PHP? No, that’s not HTML…). This is mixing up content types and file extensions. Two different things.
    • The method Gina recommends to hide the extension (mod_rewrite) can also be used to – hey! – rewrite the extension!
    • To a much lower extent, extensions are a help to the middle users – not the casual users, not the hard-core dorks, but people that are working on the Web and that “.” extension helps them for whatever reason. Why not?

  • While I agree that the URL that ends with “/why_I_blog” is a more user-readable (NOT more user-friendly; see below), I guess I have to say, “So what?”:
    • Who reads URLs? Dorks. Why do English URLs help me? OK, maybe it’s easier to remember “{base URL}/my_thoughts” than “{base URL}/blog/entry/index.php3?entry=123”, but how does that really help me? How many sites do you know down past the base URL? So how exactly how is this helpful?
    • Let’s say you do remember the “{baseURL}/advertise” link. What if there is a link for, basically, how to advertise on this site, and one for a how-to article on how to advertise (pretend it’s a PR site)? Yes, the links must be unique. Yes, one has to be called – at some point – something dorky to accomodate all the permutations of “advertise” and so on.
    • OK, can be helpful semantically if there is English instead of “code” (much like DNS works – www.whatever.com is easier to remember than 12.34.56.78).
    • Repeat the preceding bullet point and substitute any other language for “English.” Whoops. Unicode to the rescue? Integers (id=123) usually translate better than character-based language (better: NOT perfect or directly, by any means. Also depends on your math…)

  • Semantically-correct URLs might look nice (especially now, when they are uncommon), but this does not help either 1) Favorites/Bookmarks (uses page title, not URL info), and 2) how many people actually link to the full URL (as in “http://www.somesite.com/why_I_blog” as opposed to putting in a HREF (with full URL) and then some phrase (“Why I Blog”) as the link text? Yes, some do, and that would help, but – especially with Gina’s URLs (example: “http://www.scribbling.net/how_scribblingnet_freed_itself_ from_file_extensions_and_internal_ids” – honest). To be fair, she said she is thinking of trimming all post root URLs to 15 characters or less, but that just introduces the following problems:
    • Limits to number of permutions of links you can have
    • What are the rules for cutting down to 15 characters? Left 15 characters (including punctuation/white space)?, up through last word that falls – somewhere on character 15? What? Or will user be forced to have unique titles?

There are other issues, but – on the whole – I don’t see the reason for a semantic URL yet. I like them; I definitely hate long URL with all sorts of params passed, but I don’t see that much of an issue with “..index.php?id=123”

But maybe (gasp!) I’m wrong. I’ll have to think about it.

But I’m glad I ran across Gina’s site and saw what she had to say and how she did what she wanted to do.

Makes ya think…

Unix Tricks

As with most other computer software – OSes, applications, programming languages – I am self-taught in Unix.

This is good and bad (overall, not just Unix-specific):

  • Good: I have lots of skills and experience in figuring out the unknown. I’m not locked into one mode of thinking (“Java is for servlets” or “Java is for JSPs”). I’m not lost without class notes or my course books. Brand-new stuff doesn’t throw me – it’s all been new.
  • Bad: I’m sure I’ve learned some bad habits – no doubt. And being taught (via book, course, or with another user of the software) helps you discover things you’d have never discovered on your own – or it would have taken some time.

For example: Just today, I learned about units in Unix.

How the hell did I not know about this before?

And how cool are units?

Unix continues to surprise me. Well, not surprise, really – more like it continues to amaze me, as I’ve almost gotten used to seeing something new (to me) that’s packed into the OS. Seems to be no end to it. Which is great!

And that’s one of the reasons that I consider myself almost a Unix newbie: I write shell scripts, love the command line, always have at least two terminal windows open…but there’s so much out there.

Take the “cal” command – hell, for a Windows system, this would be a separate app: In Unix, it’s part of the kernel. Yeah yeah yeah, you can use Outlook for this to a degree…but can you find out what day, for example, the Fourth of July fell on in 1776?

Unix: []# cal 07 1776 (a Thursday, I see…)

Again, I’m continually amazed.

And I like…

Update (a couple of minutes later):

I was just going through the man pages on the site I linked above to the cal page.

And I didn’t know about the “-3” argument. (Displays the month specified, as well as the previous and next month)

Holy crap I like this stuff….