Sunday, January 24, 2010

I like quarter of an hour chimes - they give a good reference of the course of time. There are some computer programs available which do the task, but it's a pity I was not able to find a nice one for Windows XP which would be free of serious disadvantages.

Some of the programs I tried made latent attempts to connect to unknown internet IP through FTP port for unknown purpose - thanks to Comodo firewall, it caught them all. Others took abnormally big memory after a couple hours of running (memory leak?). Nevertheless the task is very simple to solve it by means of tools already available in Windows: scheduling and playing sound.

One of the easiest way to play a WAV sound file from command line is to use "Sound Recorder":

The option "/embedding" keeps the program running in background, the other keys make it play the chime.wav file and then close.

Now the task should be scheduled: go to menu Start/Control Panel then open Scheduled Tasks/Add Scheduled Task and set it, for example, like this:

That's it for Windows XP - choose a ding-dong sound pleasant to your ear and set up the scheduled task to play it. More complicated variants when, for instance, it plays a different sound for a different quarter can be done easily too.

In Vista sndrec32.exe was replaced with SoundRecoder.exe which does not play WAV files, so the way I made it working was:

to copy sndrec32.exe from an XP machine to the box with Vista;

run it for the first time as Administrator to let it get registered;

start Task Scheduler from Start/All Programs/Accessories/System Tools/ and setup the scheduled task similarly to the procedure in XP.

Sunday, January 17, 2010

Not a new thing but just for the record: copying formatted text from a web-page in Internet Explorer to plane editors as Notepad or Notepad++ leads to a problem - all line breaks and/or indentations are lost in spite of preserving them with <pre> </pre> tags.

A way around is to paste it into WordPad first and then copy from WordPad to any other editor you want. There is no such a trouble when FireFox is used either in Windows or Linux. Read more...

Saturday, January 16, 2010

Highlighting code syntax has become a common way to improve the code readability and is used broadly in different programming language editors. There are some approaches how to show highlighted code in a web page.

I would divide all of them into the three categories:

If the web-site is on ASP (Active Server Pages) or PHP (Personal Home Page) host and all the files and the web page generating code are under your control then highlighting can be handled by a PHP or ASP routine. In PHP, for example, there are GeSHi (Generic Syntax Highlighter) and CHIP (Code Highlighting in PHP); Actipro CodeHighlighter is ASP.NET Control.

If there is no total control over the web-site as it is, for instance, with Blogger then JavaScript highlighter can be a solution. There are many JavaScript highlighters available, here are some popular ones:

They all support pretty long list of languages, easy to install and customize. In general scripts should be kept either on a host or directly in the page and the drawback with the approach is that too many scripts can degrade a web-page performance.

The straight forward way is to use a highlighting tool which generates HTML code, so the code can be copied and pasted directly in a web-page. There are some online tools of this kind, for example: