Aug 16 2008

Adding hints

Sometimes it is not totally obvious what you are looking for the user to enter into a text box.

Take this one here:

It is not obvious what we are looking for in this form, By email might is probably an email address. In person is probably an address. Online? That could also be an email address, a skype name, a msn messenger account name, a website…. you get the idea. Other, well, that could be anything, but what is that second box for? To be fair, the form has values in it telling what should be done, I removed those for the sake of the example. That is indeed one way of doing it, but that means that someone has to select all of the text and delete it when they get to that box. I don’t know about you, but I find it a little annoying when I have to do that… So, I started looking for a solution, and I found one that uses jQuery (my javascript library of choice). I could have written it myself of course, its not that hard really:

if(form.input is empty) {
   form.intpu.value = form.input.text
}
if(form.input is clicked){
   form.input.value = ""
}
if(form is unclicked and value = ""){
   form.input.value = form.input.text
}
if(when form is submitted and form.input.value == form.input.text){
   form.input.value == ""
}

I decided to modify that slightly, so that if the form was filled with the value found in text it would be lighter than normal, so:

if(form.input is empty) {
   form.intput.value = form.input.text
   form.css("color", "#999")
}
if(form.input is clicked){
   form.input.value = ""
   form.css("color", "#000")
}
if(form is unclicked and value = ""){
   form.input.value = form.input.text
   form.css("color", "#999")
}
if(when form is submitted and form.input.value == form.input.text){
   form.input.value == ""
}

Here is the final result:

Oh ya, a bonus is that when they hover over it and have javascript turned off it will show the hint as well, and it is screen reader friendly! Accessability is good!

If anyone wants the code I can post it.


Aug 12 2008

Updated Wordpress

I finally decided to update wordpress and the plugins that I use to go with it. The update seemes to have gone well, and I believe that my site is still working fine. My theme still seems to be working too… though I think I need to figure out the Newer, Current, and Older Post links a bit better because

I really don’t like how they show up at the bottom there when you are cycling through the posts. I also found out that the version of wordpress you are running is found in a meta-tag on your site… Might as well have it written down in plain sight (in the footer maybe? No, the number in my footer has nothing to do with versions, it is the number of times that Wordpress hits the database to generate the page…). I think I am going to hack that part of the code out of Wordpress. The offending bit of code:

<meta content="WordPress 2.6" name="generator"/>

You wouldn’t even need to be clever at all to hack my blog if it were out of date, a lot of the vulnerabilities are made public, a simple search for Wordpress + 2.3 + vulnerabilities would turn up a bunch of hits (and it does):

… about 157,000 for wordpress 2.3 vulnerabilities.

You probably would not get the same amount of results if you used cuil.com instead (burn!).

Ok, I think I am done ranting about this for now.

Time for some learning:

Zinc Oxide is important.


Aug 11 2008

Why implement PHP in Java?

First of all, why not? Everything else can run on the jvm (yes… even c#), so why not php? Well… I certainly don’t see why not… Java is a fairly robust language with a pile of different libraries and (as you saw if you clicked on any of those links) languages that can run on it. It is ideal!

Don’t like php’s random function? Why not use Java’s? Not your cup of tea? Use ruby’s instead, or python’s, or  write one in COBOL if you are really brave.

It also means that you can implement the functionality in Java, the database transactions in Ruby, then write all of the presentation in PHP, no clearer MVC separation than that eh? Admitedly it might get a bit confusing and I may be over exaggerating about the possibility of these implementation’s cross communication abilities… but it would be great if you could (I might test it later…).

http://www.caucho.com/resin-3.0/quercus/index.xtp

Go check it out!


Aug 6 2008

Xampp Virtual Hosts

One of the tools in my tool box is xampp, which seems to work better than trying to install everything bit by bit (at least it did at work). One thing I never considered was setting up virtual hosts for each project, I always worked from a folder so that to access the site I went to:

    http://localhost/sitename

That is fine, but what happens when you are working with a site that needs to be the root site (ie: it has links like /page_name.php which bounce you out to the root)? In that case you need to set up a virtual server. In xampp they have separated the files out to ‘make it easier’ on a user to find what they want. Sometimes this is not the case… so here is how to setup a virtual server (at least it worked for me) on Windows Vista (and XP, and with some small modifications Linux and Mac as well).

Find the httpd-vhosts.conf file, it should be:

    C:\xampp\apache\conf\extra\http-vhosts.conf

if you installed it in the default location.

Then go to the bottom of that file and add:

<VirtualHost *:80>
  ServerName http://sitename.127.ca
  DocumentRoot C:\xampp\htdocs\sitename
</VirtualHost>

if that doesnt work, then there might be something in the http.conf files that is stopping access to that folder, in that case, add

 <Directory C:\xampp\htdocs\sitename>
    IndexOptions +FancyIndexing NameWidth=*
    Options Includes FollowSymLinks Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
 </Directory>

So, you have:

<VirtualHost *:80>
  ServerName http://sitename.127.ca
  DocumentRoot C:\xampp\htdocs\sitename
  <Directory C:\xampp\htdocs\sitename>
    IndexOptions +FancyIndexing NameWidth=*
    Options Includes FollowSymLinks Indexes
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

While you can probably put the site in any folder on your computer, it makes sense organizationally to keep them all in the htdocs folder (at least it does to me…), so that is why the example uses the path

    c:\xampp\htdocs

You should now be able to access your site by going to:

    http://sitename.127.ca

For why 127.ca see this site.


Aug 4 2008

Job Search Results

One feature that everyone was always pushing us for in Jobba the Site (other than the ability to save your resume) was something simmilar to Monster’s Job Search Agent, where you could save certain job searches as your favourites and then it would notify you when there were new posts under that search.

Now, in theory this is a good idea, you don’t have to come to the site periodically to find out if there is anything good for you, but in practice it is not really that good. I had one set up for Junior Developer on Monster so that I could find out when there were jobs that matched that search. Good idea right? Not really…

Some of the more interesting results:

Tax - Manager - US Corporate Tax Services
Program Manager - Ice Rink
Mechanical Engineer
General Accounting Specialist

Hmm, not really what I was looking for. Originally I had tried to do this with Entry Level Web development, which as it turns out was even worse with it sending me results like:

Coordonnateur courrier / Courrier coordinator
Spécialiste de la paie / Payroll Specialist
Entry Level Marketing and Sales ***** APPLY TODAY, START TOMORROW!
Entry Level Print Based Advertising - Start Immediately
CONFUSED ABOUT WHAT TO DO WITH YOUR DEGREE
Seeking Top Performers to Fill Openings as an Account Manager! Start Now

Wow, all those opportunities! I especially liked the ones that were all in caps! Like they were yelling at me to get a job, theirs! In the end, I found my new job with a simple Google search. Google: 1, Job Sites: 0. I hope we can change this with Jobba the Site, but that feature will be one that is added later, if at all since it seems to be so hit and miss. To be fair, it did actually give me results that were good, but those seemed to be outweighed by the ones that were random and had nothing to do with what I was looking for.