2008

If you're a web developer (like me) and need to test a website in good old Internet Explorer 6 but you have Windows Vista or you've upgraded your Internet Explorer to version 7. Then luck is on your side and Microsoft has been so kind to supply Virtual PC for free and an image of Windows XP with IE 6 for free.

All you need to do is download Virtual PC 2004, which is also free, and then download Internet Explorer 6 Testing VPC Image.

Most developers (like myself) will be ignoring Internet Explorer 6 once Internet Explorer 8 has been announced, so we won't have to go through the tedious issues of fixing Internet Explorer 6 JavaScript bugs for much longer (unless specifically requested by a client).

Google's stock prices have recently dropped to a low figure that we haven't seen for quite some time, which is a bit of a worry when the largest technology company is feeling the pressure. Google have announced they have freezed their employee base, they're not hiring any more staff and they don't have any plans to lay off staff (at the moment).

Internally, Google are focusing on their major projects which is their search engine, and adsense amoungst a few more. The biggest change they've made is ceasing all research and development on projects that fit under the 'experimental' or 'fun' category, and those projects which haven't gained any popularity.

Projects which have stopped development include Lively which is a 3D avatars and room chatting socialising application. With the statistics below you can clearly see the little popularity this service has received.

The tech industry is definetely feeling the economic pressure with other companies announcing staff layoffs across the board. Techcrunch have recently announced layoffs have reached over 100 000 in the tech industry alone. AT&T having the largest with 12 000 staff layoffs.

Finance experts report we haven't seen the worst of this economic disaster, but I hope this isn't the case. For tech companies finding it hard to keep an active client base, look for clients that will survive the economic issues (such as supermarkets, and businesses that sell everyday goods and services).

Further readings:-
* Google's Lively Receives A Death Sentence
* Tech Layoffs Surge Past 100 000

I was on the hunt today for some ideas for data visualisation, I went through some of the usual ones such as Tag Clouds, Digg's Lab Visualisations, and more. There was one visualisation that stuck out from the rest called 'We Feel Fine.'


The site can give you a visualisation of people's feelings by sex, age, and location by using different coloured dots. You can customise the data you wish to view as well.


Once you have selected the sort of data you wish to view, you can then click on the different coloured dots to view a person's feelings. The application will then load either a quote or a picture and caption showing that person's feelings.

The application I assume is gathering everyone's feelings by Twitter updates, MySpace status updates and other social media sites that allow users to updates their status.

If you want to validate strings, text, or whatever it may be, validating with Regular Expression is an easy way to determine that the data is valid. Whether it's an application or a web-site, you can validate users' input to ensure it has met all requirements before continuing, or validate your own data.

 
^123$
 

This small example checks whether the data is simply '123', anything else will fail. We use the '^' symbol to show where the beginning of the data is, and the '$' symbol to show where the end of the data is.

 
^[0-9]$
 

The example above will test the data to ensure it is a single number between 0 to 9. '0', '1', '2', '3', and '9' are examples of data that will pass the above regular expression. 'a', '10', and ' 1' are all examples of data that will fail.

So what if we wanted 2 numbers?

 
^([0-9]|[0-9][0-9])$
 

The example above will match 0 to 9 or 00 to 99. The '|' symbol simply specifies 'or' so in affect we have [0-9] for 0 to 9 | [0-9][0-9] for 00 to 99. Because we are using the '|' symbol, we need to wrap brackets around our statement to show where the 'or' statement begins and where it ends.

Now lets work with time.

 
^(1[0-2]|(0?[1-9])):[0-5][0-9]$
 

12 hour format is pretty damn simple now that you know the basics. The first part '1[0-2]' means 1 followed by 0 to 2 (for example 10, 11, 12), 'or' '(0*[1-9])' for 1 to 9 or 01 to 09. The '*' means whatever character before it is optional, so the '0' is optional but can only occur once if it was there.

So this will cover 1 to 9, 01 to 09, and 10, 11, 12. The ':' symbol is exactly that, and the last two parts '[0-5][0-9]' means 00 to 59. '1:15', '9:59', and '12:39' will all pass, but '00:38', '13:32', and '3:83' will all fail.

I'm on a quest to make the ultimate regular expression for date and time, but there's no use giving you the whole thing without first telling you how to get there. Keep an eye on my blog for more posts to come.

Resources
* RegExp - Mozilla Developer Center
* Regular Expression - Wikipedia

Normally you would select an option with a server-side script like PHP which is a lot faster and doesn't require the client's browser to do the work. But on the rare occasion where you need to set an option with JavaScript, here's a small script on how to do it.

 
document.getElementById('select_box_id_here').value
 = 'the value of the one you want selected';
 

This will work if you have constructed the page the proper way. On the odd chance you've used JavaScript to pull in a whole string of HTML then use the method below.

 
var selectBox = document.getElementById('select_box_id_here');
for(i=0; i
<selectBox.options.length; i++) {
	if(selectBox.options[i].value == a_value) {
		selectBox.options[i].selected = true;
		i = selectBox.options.length;
	}
}
 

The above script simply loops through your select box and determines if the current option (in the loop) matches the value (a_value), if so then set the option to selected. The line "i = selectBox.options.length;" simply stops the 'for loop' from checking any further options.

The reason why you have to manually go through the select box yourself is because the DOM doesn't actually know the select box is on the page when you've just dumped a whole lot of HTML into the page with JavaScript. If it's possible to refresh the DOM then let me know, otherwise the above option is the solution to this problem.

You can find a lot of ways to prevent spam from your site these days but I've really tested this method and it has been 100% effective (so far). It will stop automatic bots but a human will be able to work out how to get around it pretty easily (but when do humans have time to do that).

To begin with: this script is written in PHP but you can easily translate it.

 
   session_start();
   $_SESSION["spam_prevention"] = '1';
 

First off, on the page with the form to email to you, declare a unique session variable on this page with any value you want. Why? So when the user submits this form to the script that sends the email, you know the user definitely came from the page with the form, and it's not a bot attacking your email script. So before your email script, test to see if $_SESSION["spam_prevention"] exists.

 
<input type="text" name="spam_prevention"
    style="display:none; visibility:hidden;" />
 

Another method is to put a text field on your form and hid it with CSS. 99.9% of the SPAM bots out there will disregard any CSS styles, and at the same time the SPAM bots will fill out every field within your form. So if this field is filled out, it's a good guess that it wasn't a human that filled it out.

This isn't bullet proof, but it works quite well and it doesn't require the user to fill out any spam prevention captcha fields etc.

Let me know how you go with this script if you try it.

This script will detect if a folder exists as well as create the directories if the folder doesn't exist.

 
	mk_dir_recursive('the/directory/you/want/to/create');
	function mk_dir_recursive($folder_name) {
		if(file_exists($folder_name)) {
			return;
		}
		$folder_name = rtrim($folder_name, "/\\");
		$parent = dirname($folder_name);
		if(!file_exists($parent)) {
			mk_dir_recursive($parent);
		}
		mkdir($folder_name);
	}
 

If you want to create an easy photo gallery, this script will allow you to resize images on the fly. It has a few pros and cons that you should be aware of before you start using it.

Pros
* Simple and easy to use :) - even I can use it.
* It resizes on the fly, so you can modify the code and it will affect all images you pass through it immediately. Great if you're short on storage on your web server, and doesn't require you to re-render all the images if you decide to change the size of the thumbnails.
* You can call this script for any image on your site, the image doesn't have to sit in an actual photo gallery.

Cons
* If you have a high traffic website, this isn't the best solution. You're best off resizing all your images when they're uploaded, not when they're are viewed. If you choose to use this script on a high traffic website, then at least cache the results so your web server isn't creating the same image 1000's of times over.
* This script only works with JPEGs, I'll create a new version (one day) to handle others.
* If you think of more cons, let me know.

The GalleryViewer Script: Download (Right Click > Save Target/Link As)
* Rename the file to galleryviewer.php.

Usage
Create Thumbnail: galleryViewer.php?version=thumb&image=the/url/to/the/image.jpg
Create Resized Image: galleryViewer.php?version=full&image=the/url/to/the/image.jpg

<img src="galleryViewer.php?version=thumb
    &image=the/url/to/the/image.jpg" alt="Thumbnail" />

Full Usage

The query string 'image' needs to be relative to the script.

Just a small tip for some people who might be modifying arrays during a loop, where the array is used in the condition of the loop. Just be a little bit careful on what you do with the array when looping through.

 
var testArray = Array('1','2','3','4','5');
for(var j=0; j<testArray.length; j++) {
    alert(testArray[j]);
    if(testArray[j] == '3') {
        testArray.splice(j,1);
    }
}
 

The above array loop is written in JavaScript, whether you're using JavaScript or not this is still something small to keep in mind. It will produce an alert of '1', then '2', then '3', and then '5'.

The length of the above array is 5, you start at position 0 and testArray[0] doesn't equal '3' so move on, same thing with position 1 (testArray[1] doesn't equal '3'). You then move onto position 2 where testArray[2] does equal '3', so we splice the array at position 2 which removes testArray[2] from the array, making the rest of the array drop down a position.

j still equals 2, so when it loops through again, j will equal 3. When it looks at what position 3 equals (testArray[3]) it will now be '5' as the array's position dropped down by one from the splice.

So we missed out on alerting '4' after going through that loop and you might be doing something important with the loop rather then simply alerting the values, there is 2 ways to get around this. One, put the 'something important' function after the loop in its own separate array. Or two, even easier, if the 'if condition' is true and you modified the array, simply affect the value of j so that the next loop through will be correct (like below).

 
var testArray = Array('1','2','3','4','5');
for(var j=0; j<testArray.length; j++) {
    alert(testArray[j]);
    if(testArray[j] == '3') {
        testArray.splice(j,1);
        j--;
    }
}
 

Gmail has introduced a new feature called 'Mail Goggles' which will activate at a certain time at night (assuming a late Friday or Saturday night) when you might have had a drink or two. Mail Goggles will ask you some simple maths questions before you send an email, which might give you enough time to think about the email you're about to send.

This feature will be annoying and I hope there will be an option to deactivate it, one day it might save you from sending an email to an ex-girlfriend, or your boss that you might regret the next morning.

Will 5 simple maths questions really make you think twice before the email is sent?

If I ever receive a nasty email, and I'll be honest and say I have received a couple in the past, I normally walk away and don't respond immediately. In general, don't write emails or chat messages when you're not in such a good mood and you won't get into trouble.

To any IT developers, this is old news, or you may not have put 1 and 1 together. Web applications are slowly taking over the desktop application market as more features and tools are added to desktop browsers.

We‘re often used to installing all the necessary software after installing our operating system, but these days all the software you used to install can be found a "click away" on the Internet. Which only requires an Internet connection and a browser.

Webtops, online office applications and communication applications have been around on the Internet for quite some time now, and we will be influenced soon if not already to follow this trend.

Why? Because it‘s simpler to the average user. IT developers will not make the transition as quickly but soon will.

Anything that a desktop application can do, a web application can do better.

Current & Twitter have teamed up for the very first time to integrate real-time Twitter messages (aka "tweets") over major portions of a live television broadcast of the next presidential debate.

Current will broadcast as many of your debate tweets as possible right over the candidates, in real time, on their live broadcast.

How to PARTICIPATE:
1. Tune in on October 7th at 9pm EST/ 6pm PST for the Live Presidential Debate. Find Current TV on your local cable/satellite provider or come here to watch the live stream of our broadcast.
2. Make sure you’ve registered with Twitter to participate.
3. During the debates, chime in by including "#current" in your tweet. Example: "This discussion about universal healthcare makes me want to pop some pills! #current"
4. We won't be able to air every single tweet on TV, but you can see all of the #current tweets by searching #current on Twitter search.
5. If you have any questions about participating, send us a tweet @current.

For more information, visit Hack the Debate.

At the moment, Adobe are making a Flash plugin for the Apple iPhone with their belief that if they make it good enough, Apple will publish it. Unfortunately for Adobe and the rest of the world, the likely hood of Flash being available on the iPhone will be very slim.

To begin with, the applications that are available to download through Apple's iPhone App Store are making millions of dollars for Apple and a little for the developers making the applications. If Flash was available on the iPhone, it would be able to avoid the whole App Store process and developers can sell their applications themselves and receive 100% of the sales.

There would be very little chance of the iPhone ever having Flash available unless there is another phone that is taking a substantial amount of the iPhone sales away, and of course this phone runs Flash. In my own point of view of the iPhone, the only 'wow' factor is the interface which has been replicated on Windows Mobile phones already.

The iPhone has a lot of restrictions and I believe it is only popular because of Apple's Marketing strategies, and the popularity they gain with younger audiences. I have an iMate JasJam which has more features then the iPhone and it's nearly 2 years old, so I'm expecting more features will be available in the latest models which puts the iPhone lower on the features list.

What is TinyMCE?
TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances. TinyMCE is very easy to integrate into other Content Management Systems. Please visit their website for more details.

 
tinyMCE.init({ //settings go here });
 

Starting TinyMCE

 
tinyMCE.triggerSave(false,true);
tiny_mce_editor = tinyMCE.get('your_textarea_name');
var newData = tiny_mce_editor.getContent();
tinyMCE.execCommand( 'mceRemoveControl', false, 'your_textarea_name' );
 

Getting the Textarea Text and Closing TinyMCE
The new data that the user would enter into TinyMCE is now stored in the variable newData.

You need to specify a trigger save like this for 2 reasons:-
* You can't simply get content from your textarea once TinyMCE has taken over it, as the text in the textarea isn't actually stored in that field name you know.
* You need to remove the control properly so that TinyMCE doesn't make another instance of the same textarea, or otherwise you will run into issues.

This dominant company is ahead of it's market because of three reasons, competitive pricing/marketing, support, and because they keep up with the latest trends of the communication. Dell are always looking at new ways to advertise or keep in touch with their potential customers by trendy communication methods.

The latest trend they're using is Twitter, a short message service that alerts you on what people and companies are doing. Dell has listed all their twitter accounts at http://www.dell.com/twitter for everyone to peruse.

Currently, only tech-savvy people use twitter (slowly growing out of this trend), but you will find that the majority of people who are ordering bulk lots of computers (5+) are the tech-savvy people. So to be able to target those users is definitely an asset to the point of view of Dell.