Posts

Showing posts from November, 2005

removeAllChildNodes, getImmediateChildren (JavaScript)

Two functions for working with nodes via the W3C DOM (while they have only been tested on web pages, there is no reason why they won't work (with minor modifications) with anything that implements the W3C DOM and uses JavaScript/ECMAScript). function removeAllChildNodes(node) { if(!node || !node.childNodes) return; var nodeCount = node.childNodes.length; for(var i=nodeCount-1;i>=0;i--) { node.removeChild(node.childNodes[i]); } } function getImmediateChildren(node, tagName) { if(!node || !node.childNodes) return; if(!tagName) tagName = "*"; var elements = document.getElementsByTagName(tagName); var nodeCount = elements.length; var children = new Array(); for(var i=0;i<nodeCount;i++) { if(elements[i].parentNode == node) { children[children.length] = elements[i]; } } return children; } Imagine the following HTML: <div id="foo"> <ul> <li>Item 1</li> <li>Item 2</li...

The Uniform Server - Portable Apache / MySQL / PHP/Perl

The Uniform Server - run a web server off your external drive (for Windows based PC's). A useful way of developing your websites, no matter what PC you are using. No need to install anything. Server is Apache and includes MySQL, PHP and Perl. Can be used as a production/live web server (just copy the files over to the server hard drive). Edit (17-Jan-06) : Site is down, but you can still get it from SourceForge.net: Uniform Server . Tags: Web Developer Blog , Portable Development , Portable Web

ipconfig /all

If you run ipconfig /all in the command prompt in Windows it shows detailed info about your network adaptors. You may want to then print that information off. However it is in a command prompt window (where copying and pasting isn't exactly easy). Here is a batch file that opens up notepad with the information. When you close notepad, it then deletes the ipconfig.txt file that was created. ip.cmd ipconfig /all > ipconfig.txt & start /wait notepad ipconfig.txt & del ipconfig.txt Edit (27 Nov 2005): This can be set up as a doskey macro to replace existing command, can pass on parameters that ipconfig accepts. So if you run this in the command prompt window, then type in ipconfig /? , it will show the help in notepad. doskey ipconfig=ipconfig $* $g ipconfig.txt $T start /wait notepad ipconfig.txt $T del ipconfig.txt Tags: Web Developer Blog , IPConfig

Validating with the W3C

The W3C has several useful validation services. Most are for the standards they have developed, but there is also one for web feeds (Atom / RSS). These are the ones I know of. (X)HTML / MathML (plus some favelets you can add to your bookmarks) Link Checker (checks for broken links) CSS (Cascading Style Sheets) Feeds (Atom / RSS) P3P (Platform for Privacy Preferences) RDF (Resource Description Framework) XSV (XML Schema Validator) SVG (Scalable Vector Graphics) Tags: Web Developer Blog , W3C Validation

Portable Development

There are quite a few freeware applications that run on an external drive. These sites have a list of them. The advantage of them is that you do not need to install anything (except maybe to get the files to copy to the drive). When you use these applications you can develop your applications or websites on any (Windows 2000/XP) PC that can read your drive. Portable Apps (a suite of applications, including Firefox, Thunderbird, FileZilla) Portable Freeware TinyApps.Org (not all of these applications are portable, but quite a few are). An example of how portable development can be done is web development. If you follow the instructions at Apache/MySQL/PHP on a usb flash drive , you can run an Apache Server off of your drive, so you have a portable web development environment. If there is a text editor you like and it is portable (for example SciTE ) you can edit your pages and test them with PortableFirefox without ever installing anything, then upload them to your site using P...

The Ultimate getElementsByClassName

The Ultimate getElementsByClassName . Originally written by Jonathan Snook, this function has been improved by Robert Nyman. A very useful function if you want to get elements that all have the same class name. Supports searching for elements with multiple class names (i.e. class="one two"). Tags: Web Developer Blog , CSS , JavaScript

PDF Database Report (MyGeneration)

PDF Database Report is a template for the MyGeneration code generator. It uses iTextSharp to generate the document. The report includes tables, foreign keys, indexes and views. Details for each column (name, data type, is nullable etc) is shown for each table and view selected. Tags: Web Developer Blog , MyGeneration , iTextSharp