yes i love technology

Away with Applications: The Death of Desktop

May 15th, 2007 by Pete

There is a great talk that went up on Google Videos earlier this month called Away with Applications: The Death of Deskop. In it the speaker, Aza Raskin points out that no work is carried out actually using the computers desktop. He also points out the failing of desktop applications, that you frequently need to switch between applications, moving content, to achieve even relatively simple tasks.

I think his points are particularly relevant as we move into an age where many traditional desktop apps are being converted to web applications. I see an increasing trend in web applications of people trying to recreate desktop applications like interfaces in a browser-based setting. Aza urges us to rethink what we know about computer interfaces and to come up with exciting and innovative alternatives.

Traditional applications have had more and more functionality added to them to an extent that they have become “a portmanteau of all possible features”, again it is worrying that many of today’s successful web apps could suffer the same fate. The speaker encourages open APIs and Mash-ups as an alternative and a may to combine applications without having to switch between multiple programs/services.

One of the most interesting parts of the talk for me is when the speaker demos some systems that he’s been developing himself, one is a command-line interface for launching applications that uses almost real language commands and auto-complete. The other is an interesting zoomable desktop, which is much more work orientated than the traditional model, it also centres around the concept of “content as content”.

At nearly an hour and a half the video is quite long but I found it extremely interesting, the speaker also looks a bit like Rick Moranis of “Honey I shrunk the kids” fame, which has got to be a good thing.

# Pete Graham

Posted in Tech, usability, videos | No Comments »

It’s internet with a small ‘i’ now

April 30th, 2007 by Pete

When I was doing my Computer Science degree our lectures used to make a big deal about making sure you spell Internet with a capital ‘I’, because it’s important and it’s the name of a thing. Apparently it’s now been decided that it should be spelt with a lowercase ‘i’, I wish bloody linguists would make their minds up!

# Pete Graham

Posted in Tech | 2 Comments »

PHP: Swap Variables One Liner

March 29th, 2007 by Pete

Here's a nifty one liner in PHP which let's you swap 2 variables values.

PHP:
  1. list($a,$b) = array($b,$a);

Much like the PHP XOR swap there's no real reason this is any better than using a temporary variable, but you might be able to impress chicks with it or something.

/* Pete Graham */

Posted in Tech, php, programming | 4 Comments »

Drupal: Hide Navigation on Forum

March 29th, 2007 by Pete

If you want to hide certain Navigational Blocks on your Drupal sites forum(s) here’s how to do it:

1. Go to "Administer » Blocks"
2. Click "configure" on the block you want to hide.
3. On Page specific Visibility Settings click the option for "Show if the following PHP code returns TRUE"
4. Enter the following code in the text area:

PHP:
  1. if (arg(0) == 'node')
  2. {
  3. $node = node_load(array('nid' => arg(1)));
  4. return $node->type != 'forum';
  5. }
  6. elseif (arg(0) == 'forum')
  7. {
  8. return false;
  9. }
  10. else
  11. {
  12. return true;
  13. }
  14. ?>

This will hide the navigation on the forum hompage, when viewing lists of topics and when viewing individual posts (nodes).

# Pete Graham

Posted in Tech, Website Development, php, drupal | 14 Comments »

JS: Unobtrusive Select All Checkboxes

March 26th, 2007 by Pete

I wrote last week about how I’m trying to improve my JavaScript skills. As a small exercise I have written this function for unobtrusively selecting/deselecting checkboxes in a form.

JAVASCRIPT:
  1. function selectAll(box)
  2. {
  3. // get the elements name
  4. var id = box.id;
  5. var name = /^([a-z]+)(_select_all)$/i.exec(id);
  6.  
  7. name = name[1];
  8.  
  9. re = new RegExp('^'+name+'_[0-9]+$');
  10.  
  11. // get the elements stauts
  12. var state = box.checked;
  13.  
  14. // get the form element, search "up"
  15. var form = box.parentNode;
  16. while(form.nodeName.toLowerCase() != "form")
  17. {
  18. if(!form.parentNode) break;
  19. form = form.parentNode;
  20. }
  21.  
  22. // search through forms children for email_ checkboxes
  23. for (i=0;i<form.elements.length;i++)
  24. {
  25. if (form.elements[i].type=='checkbox')
  26. {
  27. // Find checkbox for each member of the group:
  28. if (re.test(form.elements[i].name))
  29. {
  30. form.elements[i].checked = state;
  31. }
  32. }
  33. }
  34. }
  35.  
  36.  
  37.  
  38. // onload stuff
  39. window.onload = function()
  40. {
  41. var email = document.getElementById('email_select_all');
  42.  
  43. email.onclick = function(){
  44. return selectAll(email);
  45. };
  46. }

The Javascript will work on a HTML form like this

HTML:
  1. <form method="post">
  2.  
  3. <!-- Select all check box -->
  4. <input id="email_select_all" type="checkbox" />
  5.  
  6. <!-- list of check boxes -->
  7. <input type="checkbox" name="email_1" value="1" />
  8. <input type="checkbox" name="email_2" value="1" />
  9. <input type="checkbox" name="email_3" value="1"  />
  10. <input type="checkbox" name="email_4" value="1"  />
  11.  
  12. <input type="submit" value="Send Message" />
  13. </form>

As long at the select all checkbox has an id of "something_select_all" and the checkboxes have id's of "something_"followed by a number then this will work. No inline Javascript is required all the JS can be put in a separate file.

Note: If any Javascript Gurus are reading that have pointers about how I could improve this function then please put your suggestions in the comments.

# Pete Graham

Posted in Tech, javascript, Website Development, unobtrusive | 2 Comments »

SQL: Selecting Specifying Multiple Field Values

March 22nd, 2007 by Pete

Here are 3 different ways to perform a DB select when you want to specify two or more values for a field.

1. Use th OR operator

SQL:
  1. SELECT * FROM people
  2. WHERE (first_name = 'pete'
  3. OR first_name = 'paul');

2. Use a Regular Expression

SQL:
  1. SELECT * FROM people
  2. WHERE first_name ~'^pete|paul$';

3. Use an array

SQL:
  1. SELECT * FROM people
  2. WHERE first_name = ANY('{pete,paul}');

Note: These should all work in PostgreSQL, I suspect the SQL may need altering for 2 and 3 to work with MySQL.

# Pete Graham

Posted in Tech, regular expressions, database, sql | No Comments »

PHP: Remove Values from Array

March 22nd, 2007 by Pete

If you need to remove elements from an array that have a particular value(s) here’s a neat way of doing it without any looping:

PHP:
  1. // our initial array
  2. $arr = Array("blue", "green", "red", "yellow", "green", "orange", "yellow", "indigo", "red");
  3. print_r($arr);
  4.  
  5. // remove the elements who's values are yellow or red
  6. $arr = array_diff($arr, array("yellow", "red"));
  7. print_r($arr);
  8.  
  9. // optionally you could reindex the array
  10. $arr = array_values($arr);
  11. print_r($arr);

This is the output from the code above:
Array ( [0] => blue [1] => green [2] => red [3] => yellow [4] => green [5] => orange [6] => yellow [7] => indigo [8] => red )
Array ( [0] => blue [1] => green [4] => green [5] => orange [7] => indigo )
Array ( [0] => blue [1] => green [2] => green [3] => orange [4] => indigo )

Pete Graham xXx

Posted in Tech, php, arrays, programming | 11 Comments »

Bill Gates Urban Myth

March 21st, 2007 by Pete

There’s an Urban Myth that Bill Gates is so rich that if he was to drop a $1000 bill on the ground, it's just not worth his time to bend over and pick it up. Now it is true that he wouldn’t pick it up, however the real reason for this is he was wedgied multiple times as a child and now has a phobia of picking things of the floor.

Bill Gates Sitting at his desk

  • FACT: In the hilarious 1990s comedy Bill and Ted wedgieing a person is referred to as giving someone a Melvin
  • FACT: You can escape the Grim Reaper by Melvining him!

The Wikipedia Wedgie page is well worth reading.

# Pete Graham

Posted in Tech, Bill Gates, wedgie | No Comments »

My volatile relationship with Javascript

March 20th, 2007 by Pete

I started work in web development in 2004 at this point in time JavaScript was hugely unpopular in terms of web trends, this is probably because it was mostly used for annoying pop-ups, animations and whole list of other horrendous Internet crimes. I can recall having a King Herod style culling of all JavaScript from the TCAT website, my first main project.

Recently due to the popularity of AJAX web applications JavaScript’s popularity seems to have exploded again! I’ve had to brush up on my JavaScript skills for some of the User Interface work on phuser.com. Whenever I do JavaScript development I never feel as comfortable as I do with PHP or CSS. It’s definitely the weakest weapon in my web-dev arsenal.

I think it’s time to put my JavaScript prejudices behind me and get my hands dirty with some serious JS development. Now I’m not a JavaScript novice, I’ve got a few DHTML tricks up my sleeve I learnt back in the day. However I rarely write my own JavaScript, if I need a function I’ll look for one someone else has written.

When I’ve needed to learn about Javascript in the past I’ve always find it surprisingly hard to find good quality decent resources (compared to other Web technologies). I shall be posting links to any JavaScript articles/tutorials that I find particularly useful on this blog.

Articles

# Pete Graham

Posted in Tech, javascript, Website Development, usability | 3 Comments »

My Favourite Electrical Connections

March 19th, 2007 by Pete

People seem to love my lists. Here is one of my favourite electrical connections:

  1. Scart Socket
  2. USB Port
  3. 3.5mm Stereo jack
  4. Double phono
  5. 2.5mm Stereo jack
  6. Parallel port
  7. Ethernet
  8. PS/2

sweet scart leeds with technical information
/* Pete Graham */

Posted in Tech, scart, electrical connections | 2 Comments »

« Previous Entries