Delphi TreeView with checkboxes

Delphi’s TListView supports checkboxes out-of-the-box. You just have to set Checkboxes to True and iterate through TListView.Items to find, if particular item have Checked property set to True. You can even enable your own OnCheckboxClick event (not available by default) — I wrote about it here. But very similar to TListView‘s TTreeView does not support checkboxes by default at all.

So, you have to craft entire solution yourself.

Read More “Delphi TreeView with checkboxes”

ListView’s OnCheckboxClick event

Unfortunately, the TListView object does not have a specific event fired, when the Checked state changes for a TListItem (an item in the ListView). If you need to react in such situation, you have to mimic this behaviour yourself. Here are some tips on this.

Every Delphi’s Guru will probably think about subclassing and catching windows messages here. If you’re one of them — at delphi.about.com you’ll find an example. But, there’s an easier way to achieve the same.

Read More “ListView’s OnCheckboxClick event”

Read and write ID3Tag in Delphi without any extra components [updated]

There’s an (probably very) old About.com Delphi’s article on how to build simply MP3 Player using only TMediaPlayer component available in every Delphi edition. Since powerful XAudio is no longer offcially available to Windows developers and other MP3 players or components are quite expensive, when it comes to pay for the license, then this could be a good alternative. But, this article catched my attention for a completely different reason — reading and writing ID3Tag v1 in MP3 files, without using external libraries, just the pure Delphi code.

Read More “Read and write ID3Tag in Delphi without any extra components [updated]”

XAudio SDK for Delphi

XAudio SDK probably is (or at least was) the most powerful, yet freeware Software Developer Kit for playing MP3 files in Delphi. It offered outstanding possibilities. Let’s say that fifty (!) events, you could use to write any MP3-related software in Delphi is enough good mark. And there’s more. That is why, it was really pity to me to discover, that this library is no longer available neither to Windows nor free. And finding replacement is really hard, if not impossible.

Read More “XAudio SDK for Delphi”

Convert string into key-value array

I was looking for a function or solution, that would convert a string into associative array, i.e. respecting both keys and values. To be successfull, such function would have to operate on two delimiters. One for separating each key-value pair from surronding one. And second — for spliting keys from values. Which is, where PHP’s build-in explode function fails. Lucky I am, my two favorite uncles — Uncle Google and Uncle Stack Overflow — helped me in this case as well.

Read More “Convert string into key-value array”

Automate compare in folder sync tool in Total Commander

To automate compare phase (first step) in folder sync tool you should:

  1. Set the parameters as you need them.
  2. Click on the folder button in the top left of the sync dialog to save these settings.
  3. Create a button with the c:\totalcmd\totalcmd.exe /S=S:=backup command.

The := instead of just /S=S:backup causes an automatic start of the comparison.

Of course you must adjust path to reflect your location of Total Commander.

Currently you can automate the compare step, not the copy step. It is considered to risky to be automated.

Over hundred cool icon sets for your website or application

Here you have three different pages, each holding links to 25+ beautiful icons sets:

There are 109 total icons sets presented on these three webpages. Most of them are free. Some of them are devastating beautiful, some have medium quality. But, put together, makes a strong icon sets compilation, in which nearly anyone should find something interesting for his or her current project.

Fix for multi-rename tool bug in Total Commander

If you use Multi-Rename Tool in Total Commander to batch-rename only folders and if all folders are numbered with dot after number (example attached and below) then multi-rename tool will treat all folders as filenames — i.e. it will “see” everything before dot (two characters in above example) as actual filename and all the rest, after dot, as file’s extension. Here is a quick fix for this situation (it actually may not be considered as bug).

Read More “Fix for multi-rename tool bug in Total Commander”

Simple way for hiding your email address

They say that SPAM bots are really good these days and can figure out your e-mail out of many “traps”.

I wonder, if they can catch it out of something like this:

<a
    href="mailto:me.nononono@domain.nononono.com"
    onmousedown="this.href=this.href.replace('.nononono','')"
    onkeydown="this.onmousedown()">
contact me</a>

I prefer to think, they don’t and that they’ll crush their ugly spammy teeth on this! :]

Problems installing Google Earth client or plugin

Sometimes any attempt to install Google Earth standalone program or a plugin for your favorite browser ends up with error message: Error during execution of GoogleEarth.exe. Cannot find specified file. If you’re installing a plugin, directly from your browser, you can see an additional message saying that installation failed with error number 9. I don’t know, what exactly causes this to happen, but found an easy workaround for this.

Read More “Problems installing Google Earth client or plugin”

Application works fine on localhost but fails on web server

If you ever run into situation, that your application works fine on localhost (or one of webhosting) but fails completely on webhost (or another server) then first thing, you should look for, is to check, if you don’t have an extra XHTML line in on of your files that you’re loading using include or require.

Meaning, that your loading and PHP-parsing these files. Because problem doesn’t exist, if you’re loading this files as simple text files, using file_get_contents for example.

Situation, I’m talking about most times causes a PHP syntax error saying, that there is an unexpected T_STRING in first line of one of the files used in an application.

Read More “Application works fine on localhost but fails on web server”

Simple page rendering class

I have created a simple CPage class, which I use in my non-Yii projects for easily rendering views, templates and whole pages using object-oriented approach. This class can render given contents into given view and embeded it in a selected layout file. These are very limited versions of Yii framework’s view and layout rendering mechanisms. I have also added a simple alerting system, this time taken from Twitter Bootstrap.

Read More “Simple page rendering class”

Simple function for drawing HTML dropdown list from various sources

If you’re still lurking in the darkness of writing code with pure PHP and not using any framework then in this post you can find some nifty function, useful for drawing a HTML list boxes.

Basically it tries to render (draw) a <select> element basing on input data provided in $source variable. It can be either a list (key=>value) or string, where values and items’ texts are separated with delimiter. Such string can be provided directly or read from file. In this case you only provide path to a file (source of data).

Read More “Simple function for drawing HTML dropdown list from various sources”

Grouping controllers without using modules

Basic Yii application’s route consists of controller and action. Sometimes you have to add an extra separation layer, to group controllers and actions belonging to separate groups. Not everyone know, that you don’t have to use modules for this purpose. Controllers subdirectory can also be a considerable option. For me, this was a nifty discovery, so I decided to write this down as a personal memo.

Read More “Grouping controllers without using modules”

Multi-site multi-language Markdown-styled WordPress network

I’ve set myself quite big goal. To setup:

  • multi-site WordPress network (with top-level domain mapping),
  • with multi-language support,
  • that will use Markdown,
  • with auto-generated table of contents, based on headers and
  • with “coming soon” / “under construction” page for not ready sites.

To achieve my goal, I needed a bit tweaked version of WordPress (network) plus a bunch of plugins.

Read More “Multi-site multi-language Markdown-styled WordPress network”