Jul 2 2008

The worlds most secure login screen ever!

Go ahead... try and stump this one

[sarcasm]Not only is their customer support top notch, their login screen is super secure. [/sarcasm] It just begs to be attacked.

http://acer.custhelp.com/cgi-bin/acer.cfg/php/enduser/acct_login.php?p_userid=[emailaddress]&p_next_page=myq_upd.php&p_iid=[6 numbers]&p_created=[10 numbers]

Ya… its all done as a query string…


Jun 29 2008

Dynamic Images with PHP

You may or may not have noticed that my headerchanges slightly everytime you load the page. If you want to check it out, go ahead I’ll wait.

Ok, so now that you have checked it out, I will show you how it is done using php (I’m sure that some of you are curious).

Here is the code:

Most of it is self explanatory, but some of the interesting lines are 9, where we create the image with the set width and height and store it in a variable called $im, then on 11 we fill the image with an rgb value (0,0,0) in this case. Line 14 then creates a variable using teh ImageColorAllocate function, which was previously used to fill the background. This variable is later used to colour the text that is added to the image. We also have to tell the browser what kind of image it is (line 16), this unfortunately means that it is more difficult to add to a webpage (without it spitting out header already sent errors). To get around those errors, you display the image using:

<img src="imagegenerator.php" alt="My image" width="760" height="150" />

Finally we built the rest of the image on line 25 and display it on 27 using the ImagePNG function (because we told the browser it was a png on line 16). Nice and simple.


Jun 23 2008

Batch Editing Photos with Phatch

My dad was looking to edit some photos to be able to send more than just a couple through email. He needed something simple, all he really wanted to do was either lower the quality or shrink the image (make the file smaller than the 2 mb that it started as). The other requirement was that it runs on his eeePC which is the linux version.

There were many options out there, and eventually he did settle on something that was already on the system (what appears to be an equivalent to MS Paint). I however found something way more interesting to play with. It is called Phatch (cleaver name eh?). And yes, it works on Windows too (since Kris was complaining about her large number of overly large photos).

The interface is simple, and I am sure that even a trained monkey could use it, so there is no excuse not to try it out. Well… maybe if you are on a mac there is already a program for this seing as it is monopolistic and all, or you are still running dos or something silly like that… no… wait, you can use the command line too, nevermind… even you DOS traditionalists can use it (ok, don’t quote me on that one, I don’t think it really works in dos… but seriously, upgrade your system). Infact, as I write this post I will be installing it on vista (here’s hoping that it works, or I will look like a dummy (more so than usual)).

First you have to get Python from here. Or if you are on Linux you probably already have it installed (or use apt-get install python). For some reason python does not add itself to the path variables in Vista (not sure about other versions of Windows). Thats not a problem though because python associates all of the .py files with python so all you have to do is double click them (booya!).

Next, you need to install wxPython (Python bindings to the wxWindows cross-platform toolkit) from here. For Windows scroll down and find the one that is suited for your version of python (2.5 is the latest one as of this post) you will most likely want the Unicode version (as it says on the page). Then I am asuming at the end of the install process you want to leave everything checked except the viewReadme (unless you will be using it to write software).

Finally if you want to install pil (Python Imaging Library). Which is available here. Once again, download the one for the version of python that you downloaded (pil 1.1.6 for python 2.5 for me). Install that (there were some “could not create file” messages for me, but we shall see what happens). It all works by the way.

If you are on Linux there is one more step and that is to install findutils. Which is apparently used to add search functionality to programs.

On ubuntu all I had to do was download the .deb file and install it from there.

Now you are ready to install phatch from here (at the bottom of the page beside the number 2).

Ok, moment of truth, I am downloading it, and I will try to install it as soon as I unzip it (if you cannot unzip the file get 7zip and you will be able to do so no problem. Inside the unzipped folder there is a folder called Phatch, this is where the program is run from (mine is at C:\phatch\phatch). And here is the running program:


Moving on…

Once you have what appears to be a working program you can start the magic. Click on the plus sign like it tells you to (see what I mean about monkeys?) and you are confronted with this screen:Phatch Actions

This screen contains what I can only assume are the “most common actions” that the author of the program uses. If all you are doing is changing the size you are fine. So, click on Scale and you are given the options for that action as you can see here:

Scaling options

Each one of the rows that you see here (the last one of which is highlighted in blue) is clickable and editable. In the image I have left the standard settings but you can change them if you want. Once you have chosen all of the things you want to do to the images (or image) add a save action to the end (if you forget phatch will remind you (I think)), choose the options for saving it. Where you want to save them, what you want the files to be called, the type of file (I suggest png as it is quite portable and has really good quality). Then click the play button (Execute the Action). You can actually just leave it all alone and it will automagically use the same file type, and create a folder with _phatch on the end. The end result will be a new folder in the location that you decided full of your creations. Beautiful.

But, we are not done! Thats right, there is more. Once you are happy with the result of all of your tinkering, you can save your Action list for later. If you want to be even more creative, you can do File -> Export -> Action List Droplet. This makes an executable that will carry out all of the actions that you have used in this action list. This means that you can send your action list to a friend and tell them to drag and drop a folder onto the executable and they will get the same fun actions done to their photos. Apparently it just links phatch up to your script and runs a windowless version of python. I think I prefer to just open up phatch and drop a folder on it instead. You need to install the Python Win32 Extensions (which can be found here the one in the big green box) to be able to do this. You might have to restart Phatch after you install this. I am about to find out. The answer appears to be yes.

Here is my Cool Action List Droplet. Try it out!

Apparently it needs python to run, but mine cannot find pythonw. Fortunately this is easy to fix by adding python to your path variables.

Control Panel -> System -> Advanced (Settings) -> Environment Variables (at the bottom)

Look in the System Variables box (the bottom one) for the variable called Path select it, click on Edit and add:

;C:\Python25

To the end of it. Click Ok and then close all of those windows. You should be good. Though apparently mine is still not for some reason. Oh well, all I have to do is look for pythonw (which is in the python folder (C:\Python25) and click it when it asks me to and all is good. I am not really sure why this is a problem (probably a different version of python than this was written with), and I am not about to fix it myself seing as I do not know python. I might inform the author of this small problem though.

Oh ya, and if you want to share with your friends that are not on Windows you can just send them the .phatch file. Like so.

Here is the end result of my phatch file if you don’t want to try it out.


Jun 22 2008

JQuery and Wordpress

I was making a new template for my site. I was originally going to make it all curvy and web 2.0… but I figured, since I am not the best at the visual design of things I went with this. I like it.

While I was making it, I was looking at using jQuery to do the curvy web 2.0 things. Now, if you have not used jQuery before, you should check it out, it is simple and there are a million plugins for it. There is one for corners (which I was going to use), there is a lightbox one, so on and so forth. It is also really small, the version included with the latest wordpress install is 1.2.3 which is about 30 KB. The latest version is 1.2.6.

Since I was not going to make it all curvy I decided to add an easter egg to my blog using jQuery.

At first I kept getting the error:

Error: $ is not a function
Source File: http://localhost/blog/
Line: 22

That is apparently because Wordpress uses a lot of different javascript libraries and apparently they have done a bit of rewritting. instead of using the $(”") to start your jQuery javascript, you use jQuery(”"). This took a bit of searching and testing to find out, but in the end I got that figured out. It was then on to the code to make the easter egg work. Here it is:

jQuery(document).ready(function(){
 jQuery("h4").click(function(){
  jQuery(this).fadeOut("fast", function() {
      jQuery(this).html("π").fadeIn("fast");
      });
  });
});

Step by step:
1 -> Load this when the page loads
2 -> Whenever a h4 is clicked (there is only one here so its fine to do it this way)
3 -> Fade out what we clicked on fast
4 -> fade in pi

Nice and easy (and it looks cool too). This could be put to much more practical uses like translations or possibly a slide show of images (fadeIn pause fadeOut, fadeIn next image). For now it will just be a small easter egg that I added to my site.

Oh, and apparently the google syntax highliter has decided not to work in this version of wordpress so, I am now using wp-syntax instead.

Oh ya… and you have to have these lines in your code before you call any of the jQuery functions.

<script src="./wp-includes/js/jquery/jquery.js" type="text/javascript"></script>
<script src="./wp-includes/js/jquery/jquery.corner.js" type="text/javascript"><!--mce:1--></script>

(PI is an inside-ish joke by the way)

Edit: You do not need the jquery.corner.js part… unless you want fancy corners.. you would also have to download it too… if not you will get an error.

Ok, I think there is a bug somewhere, if you click through using the page links, and do a search the pi thing will work. If you rely on the cache (go to the same page by clicking on the title link of a post/page) it does not work at all. (At least in FF3)


May 14 2008

Indiana Jones Hat!

Indy Hat

You know you want one!

Here it is in action:

Get one here