jQuery Dual Listbox

22 Jul

Last week looking for a list box that allows to select multiple items I found a very useful jQuery plugin called Dual Listbox. As the author describes it, it allows us “to have two <select> elements, and be able to easily transfer <option> elements between them…”

This is the list of the features:

Ability to either move items from one list to another or copy items from one list to another
List filtering, including a display of how many items are showing out of the total
Moving a list of selected items from one list to the other with a button.
Moving all items from one list to another with a button.
Moving single items by double-clicking on them.

All you have to do is and give the elements the control ids. After that, a simple javascript statement takes care of everything else.

Here’s a simple example of the HTML:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<div>
    <table>
        <tr>
            <td>
                Filter: <input type="text" id="box1Filter" /><button type="button" id="box1Clear">X</button><br />
                <select id="box1View" multiple="multiple" style="height:300px;width:300px;">
                    <option value="1">item one</option>
                    <option value="2">item two</option>
                    <option value="3">item three</option>
                    <option value="4">item four</option>
                    <option value="5">item five</option>
                </select><br/>
                <span id="box1Counter" class="countLabel"></span>
                <select id="box1Storage">
                </select>
            </td>
            <td>
                <button id="to2" type="button">&nbsp;>&nbsp;</button>
                <button id="allTo2" type="button">&nbsp;>>&nbsp;</button>
                <button id="allTo1" type="button">&nbsp;<<&nbsp;</button>
                <button id="to1" type="button">&nbsp;<&nbsp;</button>
            </td>
            <td>
                Filter: <input type="text" id="box2Filter" /><button type="button" id="box2Clear">X</button><br />
                <select id="box2View" multiple="multiple" style="height:300px;width:300px;">
                </select><br/>
                <span id="box2Counter" class="countLabel"></span>
                <select id="box2Storage">
                </select>
            </td>
        </tr>
    </table>
</div>

and the javascript part could be something like this:

1
2
3
$(document).ready(function(){
    $.configureBoxes();
});

The plugin can be configured by adding a JSON object as the options parameter. The list of the available options is here

You can find a demonstration of the plugin here

For more information please refer to the project’s home page

Acer TimelineX Review

15 Jul

I recently purchased a TimeLineX 5830TG-6402 and I have to say I’m a happy customer.. so far. Here’s a little review based on my experience.

Performance

I deal a lot with virtualization, and I had my doubts about the i5 (2nd gen), but I am running 2 Fedora 15 Linux virtual machines with 1GB RAM and a dedicated core for each and the laptop has no slowness what so ever. We’ll see soon how it reacts when importing massive databases. The host OS is stock Windows Home Premium 64b. I’m using the original 6GB RAM, but I may max it out to 8GB later on. With the two vms running + windows 7 + IDE development tools, I still have about 2GB of RAM free. Another upgrade I might consider is changing the 5400RPM hard drive to a 7200RPM although it’s not a huge priority for me — works fine as is. Haven’t played many games on it yet, but Borderlands seemed to run fairly smooth using all the max settings (will post actual FPS later when I have time to do more benchmarking).

One thing I found remarkable was how cool this laptop runs. GPU peaked around 42C while in Borderlands (with max settings), and runs idle around 38-39C. For contrast, on my PC, I have an ATI 4870 which runs around 60C Idle, and 85-90C in-game (note, my resolution is much higher on PC). Still finding a compatible CPU monitor to read its sensor information — will follow-up with updates later.

Aesthetics / Mobility

The outer shell, keyboard plate and palm rest of the laptop are aluminum, despite what one Amazon reviewer said. It’s a light and mobile laptop considering the size of the screen. The screen is crystal clear and easy on the eyes. Haven’t tried it outside on a sunny day yet.

I will say, that I am a person who appreciates a good keyboard since I spend hours a day typing. This Acer laptop keyboard is almost as nice to type on as my Razer BlackWidow Ultimate Mechanical. Of course, my jumbo BlackWidow is still far superior but it weighs about 6LBs by itself. I’m not a huge fan of laptops with number pads, but it doesn’t take up too much space in this laptop’s key layout.

Overall, I have to say, I’m impressed with the bang I’ve gotten for my $799 bucks and would recommend to people looking for a good laptop for work and play.

Browsers: Web developers’ nightmare..

13 Jul

We web developers will die waiting for the day when the whole world uses one single browser. IMHO, Internet Explorer is the worst thing that has ever happened in the history of mankind :) . Why does it always have to behave different? We don’t know. Sometimes we miss a small detail in our code but some others, IE just want to mess with us.

We’ve been working with the jQuery theme roller in the last days and we made a small modification to save the selected theme in a database. That way logged in users would always see the last theme they picked up.

We had this this issue that whenever the user changed the theme and then refresh the page, the old theme was loaded again and saved in the database. It was this “small detail” in our code I mentioned before, but it turned out the ajax call that saves the theme was working different on IE and Chrome.

We were using the same PHP script to retrieve and save the theme and IE was caching the ajax call, something that did not happen in the other browsers.

The solution was to add {cache: false} to the ajax call.

Many thanks to Tavo for helping out.

That Google Plus, Dropdown

10 Jul

Am checking this Google Plus, awesome stuff! As with anything new I see, I would like to know how it’s made and how it works.
I really like how they took care of drop down boxes, so I set out to see how I would go about making it.
Few things I noticed, they don’t use images for anything other than close button inside of tool-tip. Then they handled scroll-bars very nicely, at least on Chrome. (haven’t checked on FF). Lastly, simplicity and elegance of it.
Continue reading

PHP 5.4 is almost here! Array Dereferencing

10 Jul

Remember how I told you PHP 5.4 was around the corner?
Well, the first alpha release is out and along with Traits there are also other significant enhancements such as the Improved Zend Engine memory usage and performance and the adding of Array dereferencing support.

So, what does “dereferencing” means?
On a previous article called Fluent Interfaces in PHP I explained how objects can be dereferenced in PHP >= 5.
Continue reading