Programming @ 22 August 2008, “No Comments”

Recently I was reading about programming with threads in Borland Delphi. There is very good tutorial written by Martin Harvey: Multithreading – The Delphi way but is seemes, that demon.co.uk is dead, so I would like to share offline version of this great tutorial. Hope Martin wouldn’t mind bout that. All copyright goes to Martin Harvey. And I just make some kind of mirror.
Here is the table of contents:

MySQL is powerfull enough to make almost anything in web development. Even wikipedia uses it. Of course, I am not guru to understand and make such a big system. But even most of small projects need optimisation. By optimising MySQL queries, you get faster responses from server, smaller database size etc. Size does matter when you use MySQL databases on shared hostings.

There is small article on MySQL optimisation in linuxformat.co.uk wiki

What I did learn from this article:

  • SELECT password FROM users WHERE Username = ‘myuser’ LIMIT 1;

    Always select just fields which you will need in current situation, SELECT * … is not good in most cases. If field by which you filter data, is unique, use LIMIT 1 statement.

  • Create fields with as small data types as it is possible. Good example with age field. It is better to use TINYINT UNSIGNED than INT (who lives negative years and reaches 255 year old? )
  • When database has lots of data, you can check is your schemata is optimised with query:
    SELECT * FROM table PROCEDURE ANALYSE();

    It will show you optimal field data type by analyzing records (look at Optimal_fieldtype column)

  • Add Index to most searchable columns:
    ALTER TABLE tablename ADD INDEX name(column)

    MySQL Index is similar to book’s index.

Here youll find CP to unicode converter written by me. I needed such utility for MS-DOS. Yes, MS-DOS doesn’t support unicode, but what to do if you need to convert from windows-1257 to Unicode. Yes, there are some converters written for windows. Some of them are shareware. But I didn’t find any freeware to batch convert lots of files at a time. Well there are linux sollutions such as enca but it didn’t work as I expected. So I written little conversion utility by myself.