About CSS specification
The CSS team recently published first commercial working draft of CSS4. The CSS spec changed just after the release of CSS3. As we know CSS3 is making its way slowly and suddenly W3C launched first official draft of CSS4. So, CSS3 and CSS4 may go hand in hand. Demand for new module makes CSS4 to start their release early. Selector module is an example of it.
New things about CSS4
Pseudo-elements
The first thing we can notice in CSS4 is Pseudo-elements are absent. Don’t worry though, pseudo elements will be there in the future releases of CSS4. New spec might come into different module, or they can merge it into previous modules itself.
UI state pseudo-classes
This class allows you to implement style elements depending on their state and checked items like radio elements, checkbox elements and half a dozen more.
Read the rest of this entry »
Disqus comment system was causing javascript errors, which in chrome console looked something like this:
Uncaught Syntax error, unrecognized expression: [href=edit-comments.php?page=disqus]
It caused unmovable widgets, screen-options didn’t open and other related javascript issues in admin panel.
After some researching it turns out, there’s a simple fix.
In /wp-content/plugins/disqus-comment-system/disqus.php, find:
href=edit-comments.php?page=disqus
and replace it with:
href=”edit-comments.php?page=disqus”
Cheers
Yesterday, I showed you how you can keep local installation of phpmyadmin from logging you out every few minutes. I took one more step and edited configuration to not ask me username, password at all. Now phpmyadmin never asks me for mysql username and password.
Keep in mind if you follow this tutorial anyone would be able to access your database using phpmyadmin unless you deny access via apache configuration. Don’t do this on production servers.
Steps to follow:
Now, you’ll never have to enter username and password in phpmyadmin.
Cheers!
Recently, I got frustrated being logged out every few minutes (24 minutes, to be precise) from phpmyadmin on my localhost. I make some db changes, write some code and when I get back to phpmyadmin, I would see my session had expired. To fix this, I changed the configuration so that my session would expire only after 24 hours of inactivity.
Steps to follow:
- Copy the following code at the end of /etc/phpmyadmin/config.inc.php:
$cfg['LoginCookieValidity'] = 60*60*24;
ini_set('session.gc_maxlifetime', $cfg['LoginCookieValidity']); |
This will let your session expire only after 60*60*24 seconds, that is one day.
Cheers!
The new admin bar in wordpress 3.1 is one good feature to have but sometimes its unwanted. For example you might already have some other kind of top bar with which admin bar may interfere. You can remove the admin bar by putting the following code in /wp-content/YOURTHEME/functions.php:
if(function_exists('show_admin_bar')){
show_admin_bar(false);
} |
I came across this weird error in unserialize() where it refused to unserialize the serialized data. After hours of trying different things to solve it, finally converting the encoding worked.
The solution to the problem is to use the following function instead of unserialize():
function safe_unserialize($str){
return unserialize( trim( mb_convert_encoding( $str,'auto','UTF-8' ) ) );
} |
Cheers!
As you probably know, Twitter completely ditched basic authentication method on August 31st, 2010. It now supports only OAuth method of authentication which complicates the coding process multiple folds. Scripts which were previously 20 lines long now span several files.
While there are numerous advantage of Oauth like client doesn’t need to know your password, increased security etc, lots of twitter clients which used basic authentication stopped working right away after Aug 31st.
However, there had to be someone to the rescue. This time it’s http://www.supertweet.net/. They act like a proxy between twitter and your app, converting all basic authentication requests to oauth requests. So practically, twitter will be getting oath requests and your app would still be making basic authentication requests. This would help the twitter clients or php scripts to still use the same code and function just like before.
Documentation:
http://www.supertweet.net/about/documentation
The process is pretty simple and you should get through everything without a hitch.
You just have to change the API url from http://api.twitter.com/ from the application settings or PHP code to http://api.supertweet.net/.
If you still have problems, post it in comments.
Cheers!
Caching is one of the most important things to keep in mind when you are developing a website which is expected to get large amount of visitors. Most web developers neglect caching, some even don’t know correct ways to implement it.
In this tutorial, I’ll show you how to enable browser cache of static files simply using htaccess file. Basically server adds the Expires header to file-type you specify. Expires header will make sure the browser stores the file locally and use the same file until the time mentioned in expires header has passed.
Before we move ahead, please make sure apache’s mod_expires is loaded. You can check it using phpinfo() under ‘Loaded Modules’ section. If you don’t find it there, you can see this tutorial to enable mod_expires.
Copy the following code and paste it into .htaccess file in your website’s root directory.
# Turn on the Expires engine
ExpiresActive On
# Expires after a month client accesses the file
ExpiresByType image/jpeg A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/plain A2592000
# Good for one week
ExpiresByType application/x-javascript M604800
ExpiresByType text/css M604800
ExpiresByType text/html M604800 |
Explanation:
ExpiresActive On turns on the expires engine. ExpiresByType image/jpeg tells server to check if MIME-type of file is image/jpeg. If yes, set the expires header.
Read the rest of this entry »
You can enable or disable any apache module using a2enmod and a2dismod. You don’t need to edit the conf file for that unless you are having some problem with this method. The syntax of these commands is really simple:
To enable a module:
To disable a module:
sudo a2dismod module_name |
Read the rest of this entry »
We can check the php configuration, apache’s loaded modules and all other kinds of PHP configuration using a simple function called phpinfo(). Create a file called infophp.php in your web’s root directory and put the following code in it:
This would output all the php configuration info and apache information. You can pass on an argument to phpinfo() to limit what information is displayed. You can checkout the phpinfo documentation here.
PS: This is a beginner tutorial for absolute beginners.