I wasted a good few hours trying to find a good solution on how to save an echoed string with sudo. I tried “sudo echo ..” and lots of different combinations before I made it work.
More
Get custom taxonomy name from post id with get_the_terms
December 9th, 2011, No Comments, Wordpress, by Joakim Ling.If you’ve registered a custom taxonomy it’s a bit different to get data from than how you’d normally do for categories.
More
Update time and timezone in Linux from command prompt
December 2nd, 2011, 1 Comment, Linux, by Joakim Ling.The system time is often a symlink to the file /etc/localtime or the time zone file on the time zone directory. The definition for time zones can be written in short form as UTC±n (or GMT±n), where n is the offset in hours.
More
Replace html tags with regexp
November 29th, 2011, No Comments, PHP, by Joakim Ling.Regular expressions are an easy way to match or replace pieces of your content, but can be tricky if you are new to it. Here are a few examples to replace html tags.
More
Documentation: PCRE – Perl-compatible regular expressions
November 29th, 2011, 1 Comment, PHP, by Joakim Ling.The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl, with just a few differences. Some features that appeared in Python and PCRE before they appeared in Perl are also available using the Python syntax, there is some support for one or two .NET and Oniguruma syntax items, and there is an option for requesting some minor changes that give better JavaScript compatibility. from original documentation PHP PCRE
More
Rewrite/redirect URL tips using the .htaccess file
November 21st, 2011, 1 Comment, Apache, by Joakim Ling.This’s where you’ll work the magic to get the URL structure you want in the most optimized way possible. Some of the most common used rewrite usage are to shorten long URLs to short-friendly, protect your self against hotlinking, transforming dynamic ?page=title§ion=foo to friendly /title/foo/ or redirecting missing pages and much much more.
More
Zend studio performance issues (typing lag)
November 9th, 2011, No Comments, PHP, by Joakim Ling.One of the most common used IDE for PHP developers is Zend Studio for Eclipse. Great for lazy programmers as that is consider being a plus nowadays. Have a reliable refactoring, testing, debugging and integrated with subversion is a must if you want to increase your development time. Well who has time to look for all those FIXME and TODO?
But I’ve noticed that sometimes I get performance issues, specially with typing lag. Being a fast typer there is nothing more annoying then a machine slowing you down.
More
Remove slug from custom post type
November 8th, 2011, 16 Comments, Wordpress, by Joakim Ling.In WordPress 2.9 custom post type was introduced, that opened a new world for many WordPress developers. I’ve come across a painful issue when it comes to removing the slug and not destroying the rewrite rules for other post types. This only concerns those who are using %postname% as permalink structure and want to add a custom post type so that the urls for them are in the same way as normal posts and pages: http://siteurl/%custom_post_type_title%/.
More
Action, filter and hooks in WordPress
November 3rd, 2011, No Comments, Wordpress, by Joakim Ling.In WordPress almost all customization are built on hooks. Plugins use them to add scripts and stylesheets to the header and themes use them to add flexibility. Sounds great and it is, but it will take some time to get your head wrapped around it. Hope this helps a bit.
More
WordPress custom page templates not showing
October 27th, 2011, 2 Comments, Wordpress, by Joakim Ling.I was confused for a good hour with this problem, scratching my head. My “Page template” drop down had disappeared. Before start digging to deep in WordPress I made sure the files were still in my theme folder, checked that head comments that define a template not gone missing or had been messed up, even checked file permissions so that the files are readable and that the theme is still active, still no drop down.
More
Rename database in MySQL
October 26th, 2011, No Comments, MySQL, by Joakim Ling.There is no easy way to rename a database in MySQL. But there are a couple ways it can be done.
More
Vi editor, how to search, replace, copy and paste
October 25th, 2011, No Comments, Linux, by Joakim Ling.If you’re a PHP developer you most likely heard of “LAMP”, it stands for Linux Apache, MySQL and PHP or Perl. In all Linux/Unix systems there is an default text editor called VI, very simple but could be hard to use if you are new to Linux.
More
How to configure Subversion svn with Apache
October 24th, 2011, No Comments, Apache, Linux, by Joakim Ling.This tutorial will show step by step how to configure Apache, how to password protect and create your first repository.
More
Search query more secure from Google
October 20th, 2011, 1 Comment, SEO, by Joakim Ling.As many of you already know, Google will soon make all users that are logged in use google.com over ssl (https), so we’re talking about everyone who has a Youtube, Gmail, Google+ and all other services that are connected with Google.
Doesn’t seem like a big thing, which is not. But Google makes a very nasty thing that will make all searches on https://www.google.* lose its search query and therefor not traceable.
More
Use hosted jQuery CDN
October 18th, 2011, No Comments, jQuery, by Joakim Ling.There are several reliable content delivery networks that are free to use to host your jQuery file. These are widely used and the chance that the client has it cached in browser are high. Both Google and Microsoft are available for public use.
More
Multiple backgrounds with CSS3
October 17th, 2011, No Comments, CSS, by Joakim Ling.One of many great features in CSS3 is the multiple background support in one single element. Web designers can now define as many layers as they want, with a simple comma separated list.
More
How to block/allow IP addresses behind a load balancer with htaccess
October 14th, 2011, 1 Comment, Apache, by Joakim Ling.When it comes to restrict your website, there are many ways to achieve that and one of the simplest methods is with your htaccess file. But it can be a little bit tricky when you’re in a cloud environment such as the Amazon Cloud and you are using the Elastic Load Balancer.
More
PHP 5.3 complaining about insecure authentication with MySQL 4.1+
October 13th, 2011, No Comments, MySQL, PHP, by Joakim Ling.A lot of you have recently upgraded to PHP5.3, and one of the new things is the MySQL connection. If you are using the old authentication you will have to update your password encryption. Otherwise it will throw a warning and not able to connect.
More
Cross browser border radius even for IE
August 19th, 2011, No Comments, CSS, by Joakim Ling.Rounded corners is something new in CSS3, therefore we have some compatibility issues especially with Internet Explorer up to version 8. But of course there are ways around so you don’t have to use images everywhere you want a round corner.
More
HTML5 header structure – header, hgroup and h1-h6
August 3rd, 2011, No Comments, HTML, by Joakim Ling.The <header> and <hgroup> tags are new for HTML5, we all know that <h1> – <h6> has vital importance in SEO to get keywords ranked on search engines such as Google.
But it’s not as easy to understand the use for the new tags.
More