I have recently had a scenario where i have needed to set the selected=”selected” parameter of a dropdown box using JQUERY based on data from a database.
The scenario:
When the user decides to edit a job I need the current data to fill in the text boxes and other input fields. One of which is a dropdown list. I need to make sure that the selected option is the option that is saved in the database.
For example a dropdown box of job types:
<select id="jobtype"> <option value="1">Job Type 1</option> <option value="2">Job Type 2</option> <option value="3">Job Type 3</option> <option value="4">Job Type 4</option> </select>
Then the JQUERY to loop through and add the “selected” attribute to appropriate option:
$("#jobtype option").each(function(i){
if($(this).val() == data.jt){
$(this).attr("selected", "selected");
}
});
Note: data.jt is response from an $.ajax call in JSON format.
What it does:
We use the .each function to loop through all of the options within the jobtype select dropdown until the value of on of the options equals the value of data.jt.
Example:
If data.jt = 2
Then the select code would end up looking like this:
<select id="jobtype"> <option value="1">Job Type 1</option> <option value="2" selected="selected">Job Type 2</option> <option value="3">Job Type 3</option> <option value="4">Job Type 4</option> </select>
http://www.we7.com allows you to listen to thousands of albums and songs for free. The we7 Service is powered by adverts. This means each time you listen to a song it plays a very short advert beforehand. The songs are high quality and are not interrupted by adverts whilst playing.
It also allows you to create playlist’s which you can easily share on your blog or facebook etc.
The setup:
Dual booted Windows XP (hdd 1), Ubuntu Linux(hdd 2).
The problem:
After reformatting my linux hard drive to remove linux from and change the file system to NTFS so my Windows installation could use the disk, GRUB boot loader was left behind in the master boot record. However when i came to the task of removing it, i couldnt find out my administrator password thus meaning i couldn’t perform the usual fix;
Usual Fix:
Running the XP setup disk and going into recovery mode, typeing admin password and running “FIXMBR”.
My Fix:
I booted into Winternals ERD 2005 which allowed me access to command prompt so i could use a program called MBRwiz which i ran from a floppy drive. Once in command prompt you will need to change the drive/directory to the one where MBRwiz is saved. e.g chdir A:\
For a full list of commands visit http://commandwindows.com/command3.htm
Let’s say A:\ is your floppy drive and the MBRwiz.exe is saved in the root.
Now type in the command prompt:
MBRWiz.exe
hit enter and type
MBRWiz /Repair=1 /Disk= [<disk number of hdd with windows installation on>]
Download
MBRWiz download link: http://mbrwizard.com/download.shtml
Google Chrome – Google’s browser is out.
“Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.” – http://www.google.com/chrome

Google Chrome Screen shot
Download bar
CCleaner is a FREE computer cleanup program which allows you to quickly and easily clean up your computer. The tool can free up lots of memory on your hard drive and also clean up your registry. It also all has a tool to allow you to add/remove programs from your computer.
Files removed with CCleaner can be completely deleted or overwritten which means the files should be recoverable even after they are deleted.
A full list of features are provided at http://www.ccleaner.com/features
To latest version can be downloaded at http://www.ccleaner.com/download
Screen shots can be seen at http://www.ccleaner.com/screenshots
I’m just starting out with JQUERY/JQUERY UI and have been meaning to start using them for a long time but haven’t had the time to really have a play. I’ve finally found some time and from using the documentation on the JQUERY site i managed to come up with a font slider which increases/decreases the font size of all the text within my wrapper div(could be any element including the body if you wanted) 1em at a time. Here is the code:
The XHTML
<div id="wrapper">
<div id="fontslider" class="font-slider" style="margin:10px;">
<div class="ui-slider-handle"></div>
</div>
</div>
The CSS
body {
font-size:small;
}
.font-slider {
width: 200px;
height: 23px;
position: relative;
background-repeat: no-repeat;
background-position: center center;
}
.ui-slider-handle {
position: absolute;
z-index: 1;
height: 23px;
width: 12px;
top: 0px;
left: 0px;
background-image: url(slider-handle.gif);
}
.ui-slider-handleactive { border: 1px dotted black; }
.ui-slider-disabled .ui-slider-handle {
opacity: 0.5;
filter: alpha(opacity=50);
}
.ui-slider-range {
position: absolute;
background: #50A029;
opacity: 0.3;
filter: alpha(opacity=30);
width: 100%;
height: 100%;
}
.font-slider {background-image: url(slider-bg-1.png); }
The JS
$(document).ready(function(){
$("#fontslider").slider({
min: '1',
max: '10',
startValue: 1,
steps: 10,
change: function(e, ui){
$("#wrapper").css("font-size", + ui.value +"em");
}
});
});
you will need to make sure you include the the jquery library, ui.core.js and ui.slider.js files from
I have also created an example * Package *.
Will hopefully get a demo up online soon as well.









