Modify CGridView look

The CGridView class in Yii is a state of art solution, that gives you out-of-the-box full model browsing features including filtering, pagination and sorting. The picture would be perfect, if not for default look of grid view, which is a little bit “nasty”! :> It is understandable, as Yii author focused himself on delivering perfectly working framework, that does not necessary have to be pretty in the same time.

However, basing on famous flexibility of all components in Yii, with a help of few simple steps, you can completely change the look & feel of your grid view.

Read More “Modify CGridView look”

Understanding… series of articles for Yii 1.1

Suppose, you place your self somewhere in the middle of Yii 1.1 experience ladder. You’re no longer new to Yii 1.1, but you’re not an experienced Yii developer in the same time. In this case, I strongly encourage you to spare half an hour or so on reading articles in Yii Wiki, that are grouped in this table-of-contents article. These articles contains a lot of useful information, a must-know for all experienced Yii developers, that are mostly not know to those with middle experience

Read More “Understanding… series of articles for Yii 1.1”

Dropdown must use both onChange and onKeyPress events

Bear in mind that when writing JavaScript / jQuery code for handling user changes made to dropdown boxes, you must program your website reaction not only to onChange but also to onKeyPress events. Why? There is a rare situation, where user selects value by clicking dropdown and then using keyboard’s cursor up or cursor down keys. onKeyPress event will be fired in this situation instead of onChange event. And desired effect won’t work, if you put it only to onChange event handler.

Read More “Dropdown must use both onChange and onKeyPress events”

Populate record

You can use CActiveRecord::populateRecord method in Yii to create new record basing on existing one. And, as this descriptions means, you must use it like that:

[code language=”php”]
$data = $this->getUser($id);
$model = new Users;
$model = $model->populateRecord($data, FALSE);
[/code]

instead of (last line):

[code language=”php”]
$model->populateRecord($data, FALSE);
[/code]

because populateRecord creates new model instead of modifying existing one!

Forcing default encoding on all files in Netbeans

A default file encoding for every file in Netbeans is defined at project level — see Project Properties dialog, Sources category. But there’s nothing similar (possible) for particular files without a project. If you’re using Netbeans just as an editor then all files opened from outside any project will be scrambled, because Netbeans is not using UTF-8 encoding by default on all files.

Read More “Forcing default encoding on all files in Netbeans”

Synchronize directories in Total Commander ignoring certain files

The Synchronize directories tool in Total Commander is magnificent and I’m using it very often for all my backup-like and sync-like works. The only thing, that I was missing is an ability to ignore hidden system files or files stored in .svn or .git folders, i.e. hidden version control files. So, I wrote to Total Commander’s author and received immediate response, that this is possible.

Read More “Synchronize directories in Total Commander ignoring certain files”

Correct wallpaper dimensions for different Android-based devices

Even prettiest wallpapers looks pretty ugly when stretched by Android to fit different device screen size. Either used algorithm is poor or I have too high expectations, but most of my Windows wallpapers look like a real crap, when copied to Android and used there as that system wallpaper. Some idea is to prepare own set of wallpapers, especially fit to your device screen size. For this purpose it is good to know, how to calculate it.

Read More “Correct wallpaper dimensions for different Android-based devices”

Where is PHP on QNAP?

Well.. at least on my QNAP TS-210 it is in:

[code language=”shell”]
/mnt/ext/opt/apache/bin/
[/code]

You can validate this by executing:

[code language=”shell”]
/mnt/ext/opt/apache/bin/php –version
[/code]

Which should show version PHP installed on your QNAP box.

Strange Windows 7 folder names

After installing Service Pack 1 over your Windows 7 (or some other update “around”) you may find, that some of your folders has now a strange name. This happen mostly in non-English versions of Windows 7.

To fix this problem, turn displaying of hidden files on, locate desktop.ini file, edit it and remove LocalizedResourceName key from it or delete entire desktop.ini file at all.

Force HTTP 403 error when there is no index file

If you want to display HTTP 403 error (instead of files list) for folder, where there is no index.html or index.php file, then in .htaccess file you must add following line:

Options -Indexes

This works for current folder and all subfolder (unless .htaccess file if any of these subfolders will “locally” change this setting).

WolframAlpha in action

If you don’t know, what WolframAlpha is then consider a Star Trek computer answering your even wildest mathematical and statistical questions. Want to know the population of Far East countries in mid-fifties of XX century? Or statistically how many cities were involved in biggest earthquakes in history?

This and many other questions may be easily solved with WolframAlpha. If you’re still not convinced, then why don’t you take a look at live demo of WA for iPad. Let it convince you!

Disable Program Compatibility Assistant

Windows Program Compatibility Assistant can be a real pain in the ass when you often use programs, scripts or applications that runs just for a second or two and then terminates itself. It can be also painful, when you run some software by a mistake and quickly close it right after starting. In each such scenario you’ll be nagged with a stupid message asking, if you want to run this program again.

To completely disable Program Compatibility Assistant follow these simple steps:

  1. Run Registry Editor (regedit.exe).
  2. Navigate to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\AppCompat branch
  3. Create new key named DisablePCA of dword type and give it 00000001 value

Or… save the following code as a .reg file somewhere:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\AppCompat]
"DisablePCA"=dword:00000001

Then double-click saved file and confirm addition to Windows Registry.

What Agile is NOT?

If you ask Google on what is agile software development you’ll find thousands of results. Let’s then turn the table around and say what agile isn’t.

There’s no agile development, if:

  • there is at least one-man team,
  • iterations are longer than 4-6 weeks,
  • development is not started before the analysis is completed,
  • delivered code is not thoroughly tested at the end of each iteration,
  • each iteration does not end with the production version of the application,
  • progress is measured by lines of code or hours, and not by a delivered results.

And the most important — Agile is not a miracle solution to all your problems! You know:

Agile is not the remedy, the magic cure that will solve all the problems. It will only make them so painfully visible that further ignoring them won’t be possible.

Ken Schwaber, a SCRUM’s co-author

Human population counter

I’ve found a simple and cool JavaScript counter that is able to count current human population and it’s increase every second.

It:

  • takes current date and time,
  • calculates its different toward July 1, 1995 at 00:00:00 (when human population was 5 733 687 096)
  • multiply known “human population increase” factor by the number of seconds that passed since then till now

In this particular (very old — year 1995) example result is printed into form’s text box. With a simple modifications you can have this turned into a actual JavaScript function to return result.

Read More “Human population counter”

God Mode or admin’s power panel in Windows 7

The magic word is Admin.{ED7BA470-8E54-465E-825C-99712043E01C}.

Create a new folder in any folder you like (make it root folder on your first drive or deeply hidden secret dir) and use exactly above string as folder’s name. Folder’s icon will change to confirm that you’ve succeeded.

Double clicking this folder — instead of showing contents of empty directory — will give you an access to a really impressive list of shortcuts to most powerful and hidden features of Windows 7.

Happy hacking, folks!