Arrow

Posts on this site are never sponsored.

Don’t buy from DVDSoon.com

See the link below to read stories of how people have been ripped off from this Quebec DVD company. It’s amazing how Internet fraud like this can continue. Anyway, I know this isn’t my usual “useful crap” but I used to love DVDSoon and order from them once in a while until they recently ripped me out of $17. Luckily I can get my credit card company to issue a chargeback, but MANY people have lost a lot more and haven’t gotten anything back.

Don’t buy from DVDsoon.com.

—————–

August 7th update: looks like DVDSoon finally died! So what happened? Who knows… maybe one day there will be some news coverage on it.

2007 update: Here’s a Canadian news story (in French) covering the DVDSoon.com fraud.

How to grayscale / greyscale a PDF

I used to work for a school newsletter (actually, more like “donate unheard of amounts of unpaid time”) and you know advertisers… they’re always so last-minute! Last-minute ads are usually OK, unless they require modification, such as grayscaling! How in the world do you grayscale a PDF? I thought it’d be one of the most basic features to include in a terribly expensive program such as Adobe Acrobat, but no, it is nowhere to be found (September 10th update: read on… it actually does exist!). Technically, you can right click each item in Acrobat and “edit” it, but that’s a real pain in the ass, and sometimes it messes up item placement. You could also save the PDF as an image file, grayscale it, then re-PDF it, but that compromises quality and file size, among other things.

Anyway, I asked around to all the graphics artists that I knew, and did all the Google and Google Groups searching that I could. The graphics people said that real artists do their grayscaling before creating a PDF. Well, I was dealing with a time-crunch here! As for Google, I found nothing (maybe my searching skills suck)!

————————
September 10th update:

Looks like there IS a feature built into Adobe Acrobat Professional (I just tested this on version 7.0)! There is no need to buy an extra, expensive piece of software as noted when I first made this post!

Select Tools… Print Production… Convert Colors…

Then, select one of the profiles that do grayscaling (such as one of the dot gains)

You can grayscale a PDF with a function already in Acrobat!

Based on a quick comparison, this already-built-in feature gives slightly worse quality than the Quite a Box of Tricks plugin that I mentioned below… but hey… free is better than not free.
————————

In the end, one of my CGA-Canada cronies (thank you, kind sir aka Mentos Man) discovered this program called Quite a Box Of Tricks. It’s a plugin for Acrobat and works wonders. And by wonders, I mean it’s the only solution I’ve ever found and it is fast and easy. The downside, unfortunately, is that it costs a freakin’ 125 British pounds!

Quite a Box of Tricks: the only grayscale PDF tool I have ever known

So, if you’re reading this and want to create a free tool that will grayscale a PDF, please let me know so that I can update this post. Otherwise, Quite a Box of Tricks is all we’ve got!

Download all files in a directory

Have you ever been sent a web link to a folder containing a bunch of files to download? Well, it’s a pain to continually right-click and choose save as… and gets exponentially more painful as the number of files increases.

I found a free plugin for Firefox called DownThemAll, which will automatically download every link on a page. It will even give you a list of the files so that you can check/uncheck which ones you want. Downloads are even much faster with it. It is a truly amazing tool that I wish I’d found earlier!

And no, I’m not getting any sort of commission for this free plug.

Introducing Punkymoods: Unkymoods redux

My current mood:
My Punkymood

Remember Unkymoods? It allowed blog users to choose their current mood from amongst a whole ton of fun hand-drawn emoticons and display it automatically on their blogs. It was quite popular from 2003-2005 until the creator took the site down.

Well, I’ve spoken to the original Unkymood artist (Marc Lutz) and I decided to bring back the spirit of Unkymoods as… Punkymoods!

How to update multiple rows in mysql with php

Here comes my first geeky PHP post. For people who have basic knowledge in updating MySQL information through a PHP form, you’ll notice that almost all of the tutorials only tell you how to update ONE record at a time. Well, I figured it must be a simple tweak to update multiple records. Unfortunately, I had no knowledge of arrays (which are the keys to the solution) and ended up Google-searching for many hours.

Well, here’s the solution! It isn’t elegant, as I am quite the amateur coder, but it works and contains all the basics that you’ll need.

Note that there is no data validation in this script. For example, if you know that a field should contain integers, you should use something like intval($fieldvalue) when processing the form. Most text fields can be displayed with something like htmlentities($fieldvalue,ENT_QUOTES). If your server does not have the “magic quotes” featured turned on, text fields should be processed with something like mysql_real_escape_string($fieldvalue).

Let’s assume you’re updating book information about different courses (as I was trying to do).

Here is the file to display and edit the book information:

<?php
// connect to the database
mysql_connect(hostname,username,password);

// select the database
mysql_select_db(database) or die("Unable to select database");

// run the query and put the results in an array variable called $result
$result = mysql_query("SELECT * FROM table ORDER BY course");

// start a counter in order to number the input fields for each record
$i = 0;


// open a form
print "<form name='namestoupdate' method='post' action='update.php'>\n";

// start a loop to print all of the courses with their book information
// the mysql_fetch_array function puts each record into an array. each time it is called, it moves the array counter up until there are no more records left
while ($books = mysql_fetch_array($result)) {

// assuming you have three important columns (the index (id), the course name (course), and the book info (bookinfo))
  // start displaying the info; the most important part is to make the name an array (notice bookinfo[$i])
  print "<input type='hidden' name='id[$i]' value='{$books['id']}' />";
  print "<p>{$books['course']}: <input type='text' size='40' name='bookinfo[$i]' value='{$books['bookinfo']}' /></p>\n";


// add 1 to the count, close the loop, close the form, and the mysql connection
++$i;
}
print "<input type='submit' value='submit' />";
print "</form>";
mysql_close();
?>

Here is the file to update the information (called update.php as referred to in the previous file:

<?php
// connect to the database and select the correct database
mysql_connect(hostname,username,password);
mysql_select_db(database) or die("Unable to select database");

// find out how many records there are to update
$size = count($_POST['bookinfo']);

// start a loop in order to update each record
$i = 0;
while ($i < $size) {
// define each variable
$bookinfo= $_POST['bookinfo'][$i];
$id = $_POST['id'][$i];

// do the update and print out some info just to provide some visual feedback
// you might need to remove the single quotes around the field names, for example bookinfo = '$bookinfo' instead of `bookinfo` = '$bookinfo'
$query = "UPDATE table SET `bookinfo` = '$bookinfo' WHERE `id` = '$id' LIMIT 1";
mysql_query($query) or die ("Error in query: $query");
print "$bookinfo<br /><br /><em>Updated!</em><br /><br />";
++$i;
}
mysql_close();
?>