Drag and Drop table content with JavaScript

Content of HTML table cells can be dragged to another table cell or another table. It isn't difficult to define onMouseMove handler and change top / left element styles to move the object. In case with tables, you will have to determine somehow destination table cell. Attaching onMouseOver handler on table cells will not work, because browser doesn't fire events to the elements beneath the dragged object.

328 responses so far

AJAX progress bar

With few lines of JavaScript and CSS you can make simple AJAX progress bar. JavaScript will periodically ask for progress value and server will respond with XML. Progress value should be extracted from the XML and displayed as width of the DIV element.

29 responses so far

Week list for the current date in PHP

This post shows two examples of how to find the week list for the current date. Input parameter is date, and the output is date list from Monday till Sunday. First example is done with classic algorithm while second example uses ISO week date format.

7 responses so far

How to install mplayer in Fedora Core 12

Before mplayer-gui installation in Fedora Core 12, you will have to add RPM Fusion repositories. After that, yum will resolve all dependencies and mplayer will be installed in a minute.

10 responses so far

Fedora VPN client and routing

This post is second part of "Configuring VPN client". After completion steps in previous post, VPN will work with starting pppd and manually adding route. With a few PHP lines and configuration of ip-up.local file, VPN connection can be automated and reduced to only one script.

No responses yet

Write to a log file with PHP

As you certainly know, PHP can be used for command line scripting too. In my case, I caught myself writing log PHP function many times so I finally decided to write Logging PHP class. After Logging class initialization, first call of lwrite method will open log file for writing. Log file will be closed implicitly when PHP script ends.

15 responses so far

Adding table rows & columns in JavaScript

With insertRow() method you can insert a new row at the specified position in HTML table. After row is created, use insertCell() method to insert a table cell. Wrap this methods in JavaScript functions and you have code to dynamically add new rows and columns in the HTML table.

6 responses so far

JavaScript dialog box

If you need JavaScript dialog box, and you aren't satisfied with prompt, confirm, alert or window.open, then this page is right for you. Dialog box is emulated with two DIVs. First DIV will overlay whole page (transparency is styled to 60%) while second DIV will be positioned to the page center. That's nothing new but JavaScript code is short, well commented and closed in own namespace (for easier integration with other frameworks).

22 responses so far

GNOME - always on top

How to permanently set application window to be always on top in GNOME? Yes, you can right click on window header in GNOME, and check always on top. Unfortunately, after closing window, this setting will not remain. In three steps, I will show how to set calculator (gcalctool) to stay permanently above ...

No responses yet

JavaScript date validation

JavaScript date validation can be done in many ways, like month range testing, then day range testing (depend on month) and so on. I suggest simpler solution. Take day, month and year from string to create a Date object. Compare day, month and year with day, month and year extracted from the Date object. If they aren't the same, than the input date is not valid.

6 responses so far