Linux #3: Search and Replace

Search and Replace text in one File To search a string in a file and replace all occurrences of it with a different string use sed: sed -i 's/string/replace/g' file With this command all occurrences of the text string in the file file will be replaced with replace. Search and Replace text in all Files in a directory To replace all occurrences of a string in all files in a directory recursively use sed in combination with find:

Low Adsense link unit coverage

My adsense link unit coverage is low. A lot lower than the coverage for the other adsense ad units so I tried to figure out what is going on. Google has this to say: For link units, coverage reflects the number of link units that showed ads after the user clicked on a term in the link unit. Coverage for pages displaying link units is typically much lower than for the other kinds of ad units, because it involves user clicking.

Netbeans: PHP autocomplete

In Netbeans PHP autocomplete does not always work because the type of a variable is not clear. Below you can read how to hint the type thus allowing for autocomplete to work in Netbeans with PHP as well as it does with Java.

WordPress: link image post to parent post

This post explains how to change the linking behavior of image posts for the WordPress default theme twenty eleven.

If you upload a gallery in WordPress and insert it in a post, each of these images will get their own post. In this post, only that image will be displayed (and some meta information) and if a user clicks on it the next image in the gallery will be displayed if you use the WordPress default theme twenty eleven.

And here is the problem: the user does not expect to be taken to the next image in the WordPress gallery. Most likely a user just came from a search engine and wants to read the post that belongs to the image (and you probably want the user to do just that as well).

Talk #4: Moving WordPress to production Server

Oftentimes it makes sense to set up and develop your WordPress page locally and then move it to a remote server once everything works. This prevents downtime of the live page in case something goes wrong, makes development easier and is just good practice in general. Here is a short description how to move WordPress from a local computer to the production server. Exporting and Importing WordPress Database and changing the website url # 1.

Talk #3: PHP – Comma Separated List from Array

After we discussed how to create a comma separated list in twig last week, this week I will show you how to do the same in plain PHP. Simple Comma Separated List in PHP without trailing comma The easiest way to get a String in PHP from the elements of an Array joined by some character is to use the implode function: $my_array = array('string1', 'string2', 'string3'); $comma_separated_list = implode(", ", $my_array); // $comma_separated_list now holds the value "string1, string2, string3" from the array $my_array As you can see, implode takes an array and returns a string containing its elements separated by a character of your choice which in this example is a comma.