JavaScript arrays are commonly used by developers and making them empty is also used in practice. Here I am describing 4 ways to empty an array in JavaScript:

1. Use splice() method
2. Set length to zero
3. Using pop() method
4. Set array to new empty array

Read More

You can hide or remove controller name from url in Yii 2.0 through configuring rules for urlManager component. You can hide controller name from url even if your pages are generated dynamically using database after reading this article.

First of all you have to enable pretty permalinks. After that let’s try to understand how to configure application rules by simple examples.

Read More

Below is the code snippet to change HTML5 placeholder color with CSS which are used in form input and textarea fields. The explanation and uses notes are further explained.

/* WebKit browsers */
::-webkit-input-placeholder { 
    color: blue;
}

/* Mozilla Firefox 4 to 18 */
:-moz-placeholder { 
   color: blue;
   opacity: 1;
}

/* Mozilla Firefox 19+ */
::-moz-placeholder { 
   color: blue;
   opacity: 1;
}

/* Internet Explorer 10+ */
:-ms-input-placeholder { 
   color: blue;
}

Read More

Tags and tag cloud in WordPress are terms that quickly tell readers what a post is about and a useful way to group related posts together. A very few years ago I used to thought that tags are tricky things that are placed by bloggers to confuse people (:-D)! But soon I got familiarize with this one and so I thought to write a blog post to let readers and WordPress beginners to be familiar with tags and tag cloud.

Read More

Yii 2.0 framework has a major improvement over version 1.1. Creating SEO friendly URL in Yii 2.0 framework has been a lot easier. All is just turning pretty url ‘on’ to your Yii application and writing very few rewrite rules in htaccess file, enough to hide index.php from your URL and to make them SEO friendly.

Read More

Either newbie or experienced developer, everyone occasionally stuck with a situation that it’s  event binding runs in a loop or multiple times and it runs unexpected and we are unable to find the bug because we bind the event only one time but in practical it binds so multiple times.

Read More

Either newbie or experienced developer, everyone occasionally needs a quick jQuery snippet that selects and deselects multiple checkboxes by clicking “Select All” checkbox (exactly like in Gmail). Here are two code snippet that perform the same action. You can use either of them.

We are creating two functions (in each code snippet).

Read More

To run PHP from command line in windows you just have to add php executable file path to system variable correctly. If you have installed XAMPP, and want to use command line to run PHP on Windows, here is this helpful article for you.

I have already installed XAMPP in my local pc having windows 7 OS. The most important part is setting path system variable and after learning the steps I described below along with pictures, you will be able to do the same for other OS and programming languages too.

Read More

event.preventDefault() vs. return false is a very important but confusing topic that which one should be used and for what. When we want to prevent other event handlers from executing after a certain event is fired, we can use one of these two techniques

Read More

[ Page 21 of 32 ]