How to setup pushover alert on logon event in Windows

In this post I’ll show you how to configure Pushover with Windows server. In this specific case it will notify you when someone logs onto your machine. Read More…


Log model error after save

This code:

$model = new SomeModel();
$model->attributes = $attributes;
Yii::log("errors saving SomeModel: " . var_export($model->getErrors(), true));

Will log:

2014/07/31 22:57:59 [info] [application] errors saving SomeModel: array (
  'date' => 
  array (
    0 => 'Date cannot be blank.',

How to position element absolute but inside its container?

This trick will help you place element inside its cointainer using absolute positioning. Very often you want to be very precise when placing elements. It is very hard/impossible when you anchor to entire window because browser resizing is messing everything up. To avoid this, simply set relative positioning to the wrapper element. Check demo.

Read More…


jQuery UI dialog with form fields passing data into single input

I’ve recently ran into this scenario: there is a single input field with dimensions in a height x width x depth format. What we can do to force/guide user to use propper format? Read More…

San Tzu

Simpliest way to obfuscate e-mail address using jQuery

Here is a simpliest jQuery code to protect e-mail addresses on your website from spam bots. Just put this in a script tag into the head section:

$(window).load(function() {			
	// anti spam
	var r='random-string';
	$('.'+r).each(function() {
	var $this = $(this),
		value = new String($this.text());
		value = value.replace('['+r+']', '@');
		$this.replaceWith($('<a></a>').text(value).attr('href', 'mailto:'+value));

Now replace random-string with any really aleatory set of characters eg. dhhIDu338

And here is the HTML part. Publish every e-mail address on your page using this code:

Contact: <span class="random-string">johndoe[random-string]</span>

How to programmatically select option in a HTML list using jQuery?

This is very simple solution to select specified option in a HTML select list.

You just need to use the val function on a select element to set it’s value. It’s simple like that:

$('select#identificator').val('value of existing option value');

Check working example on the JSFiddle:


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()-&gt;assetManager-&gt;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.

Read More…


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.

Read More…

Next Posts

Konrad FedorczykHi, I'm Konrad!
I spend my time mostly on coding web related stuff. I hope you'll find my articles helpful.