Tag Archives: web

How to Download to a Specific Directory using Wget for Windows Tips, Tricks and Tutorials 26 APR 2010

The Wget for Windows application is of course exactly that: the classic GNU/Linux wget application built for Windows command line usage.

Of course, this means that most if not all command line switches are still available to you, just as what they would be had you been running the latest wget from your Linux distro of choice.

The question I’m answering today is how to specify which directory wget is to save what it is downloading to.

Normal usage sees wget placing whatever it grabs in the directory from which it is called.

You can of course specify a specific file to which to save your downloaded web page when downloading a single page by making use of the -O switch, resulting in something that looks like this:

"C:\\wget.exe" -O "C:\\downloadpage.txt" "http://www.download.co.za/index.html"

If however we want to specify the directory to which wget must save its downloaded content to, we need to make use of the -P switch, which the results in a call looking like:

"C:\\wget.exe" -P "C:\\download" "http://www.download.co.za/index.html"

So at the end of the operation specified above, we would be sitting with a file named index.html in the directory C:\\download.

And that’s how you specify to which directory wget must drag its captures down to!

Related Link: http://gnuwin32.sourceforge.net/packages/wget.htm

PHP: Select Random Web Color with One Line of Code CodeUnit 17 APR 2010

HTML or Web colors are defined using a hexadecimal (hex) notation for the combination of Red, Green and Blue color values, commonly known as RGB. The lowest color value possible for one of these “light” sources is 0 (hex 00) and the highest value is 255 (hex FF). The color codes are written as 3 double digit numbers prefixed with a # sign. Technically, the combination of 255 x 255 x 255 possible color codes means that there exists 16 million possible colors using this particular notation.

The quickfire tip for today is the generation of a random HTML color using just a single line of PHP color. Handy if you want to throw a bit of a surprise burst of changing color here and there…

$randomcolor = '#' . strtoupper(dechex(rand(0,10000000)));

The line above will produce a value that looks something like #240BFD, perfect for slotting in any web element’s style you can think of!

Simple, wasn’t it? ;)

Open Source Web Analytics: Piwik CodeUnit 28 DEC 2009

So maybe you don’t always like giving Google all of your data. Perhaps there are some things you’d like to keep to yourself, thank you very much. But what about Google Analytics. That shiny, shiny tool that tells you so much about yourself (well, particularly if you are a website of course).

Well enter Piwik, the open source alternative to Google Analytics.

Piwik is a downloadable, open source web analytics piece of software, with the ability to provide you with real time reports on your website visitors, search engines and keywords used, the language they speak, your popular pages, et cetera, et cetera. Written in PHP and using MySQL, Piwik gets installed on your own webserver and once installed will return a JavaScript tag which can then be used on any website that you wish to track.

What makes Piwik particularly nice is its flexibility. Built on top of a plugin-based framework, it is easily to extend or contract the system by simply removing plugins or perhaps creating your own. Added to this is the fact that all collected data is now hosted in a local database on your machine, meaning that you can use whatever open API you want to in order to grab the information, be it XML, JSON, CSV, whatever!

Naturally the user interface follows the current Web 2.0 example and features completely customisable, draggable interfaces, making it possible in other words to produce a solution tailored completely to your own needs.

In short, this is a great little project that is currently under active development and seems to be blazing through the awards for open source projects. Well worth a look, particularly if you are keen on moving away from Google Analytics and looking to tie in your analytics reports to your own platforms.

For more information about this project, hit the Related Link below.


Related Link: http://piwik.org/