Make a Difference and Switch to Green Webhosting

The Internet itself is a very large place, and it can be quite difficult to determine just how much power is being used to keep it going. With the state of green house gas emissions as they are, it’s about time someone started taking the initiative combining the Internet with greener sources of energy.

According to The New York Times, there are at least 30 billion watts of electricity that are used, just to power the Internet. That’s a lot of fossil fuels that are being used. One would think that with the forward thinking of those who use the Internet, there would be more sources of green energy available. Sadly, that doesn’t seem to be the case. In fact, the energy consumption is actually increasing, with more and more people gaining access to the Internet from their homes as well as taking it with them on the go on their smartphones and mobile devices. This is a steadily growing problem that needs to be taken care of.

The earth photographed from the cassini space craft. Such a fragile jewel in the big void of the universe. Take care of it. (Foto: NASA)
Climate change is a serious concern that has been slowly altering the normal temperatures of the planet throughout the year. The greenhouse effect is making summers a lot hotter and winters a lot colder, which further increases the use of fossil fuels. Consumers are likely to turn the settings of their HVAC systems up even higher, which uses even more energy. Coupled with the increased use of the Internet during these times when people want to stay inside, it ends up being a circular problem with no end in sight.

That’s why we need to start reducing the energy consumption of the Internet by seeking alternative sources. There are several web hosting service providers who have started to use sources of green energy for just this reason. They are capable of still providing the same quality service while still saving the environment in the process. If you want to see changes being made, consider switching to and supporting green hosting in any way you can. It could soon become the standard by which we use the Internet and save the environment even further.

Web hosting services offering green hosting:

Some of the web hosting services out there that use green energy include Ecological Hosting, Green Geeks, and Hetzner. Ecological Hosting has been in the business of web hosting since 1999, and have made it their mission to provide services that interfere with the environment as little as possible. They rely on solar energy and other renewable resources in the services that they provide to the world. Green Geeks has been in the business for over forty years and has always made it their goal to have a positive energy footprint on the environment, through the use of wind power. Hetzner Online has provided many web hosting services through their choice of green energy, allowing more users to feel better about not harming the environment further.

CSS: How to create a three column layout without tables

In modern web design the use of tables got a bit outdated recently since they render slow and therefore do not contribute to a positive user experience. To everybody who is used to design his web projects with tables this might be annoying. However, CSS shows an easy way out here. You simply can mimic the behaviour of a table using division elements which contain each other in combination with CSS style sheets. The following example illustrates how this works. We want to reach the following requirements.

  • The page shall be divided in three colums
  • The central colum will have a fixed width
  • The remaining columns adapt their width dynamically

This layout can be very usefull if you want to see your content centred on the screen while the remaining white space is used for ads. The following code sample does exactly what has been required above:

<style type="text/css">
.container {
    float: left;
    width: 100%;

    width: calc(50% - 490px);

    width: 980px;

    width: calc(50% - 490px);
<div class="container">
<div class="columnLeft">
<div class="columnCenter">
Central Column
<div class="columnRight">
Right Column

To calculate the width in CSS dynamically the calc() function is used. It allows also to subtract a width in pixels from a width in percent. In case you want to have a empty column you should add a space like in the example, otherwise it will not render properly in some web browsers.

Help, My Server Reboots Randomly! What Could Be the Causes?

There are times when misfortune strikes when you least expect it. Server reboots can make your life a living hell. At first you might panic a bit as you try to find out what causes the server to reboot on its own. It is hard to keep calm when your system has become unstable. There are many reasons why a server reboots randomly. When it happens to your server, check out the tips below and find out the real cause of the reboots.

Check Wattage of Power Supply

One of the reasons why servers become unstable is the lack of juice that flows in the system. The power supply is one of the most important components in the server because it delivers the needed power for the other parts of the system to work. A defective or inadequate PSU can cause random reboots or hangs. Common issues with a power supply include stopping to work; output is not the specified wattage, or overheating. There are also times when the output is less than the total energy consumption of the components.


Picture of a Google Data Center (Foto: Google)

Look at the Bios Settings

There are times when problems with the BIOS can cause random reboots. That’s why it is vital that you check the BIOS setting to rule out the BIOS as the root of your server’s problems. There are instances when an empty BIOS battery has made a system instable. You can also program the boots and shutdowns of the server through the BIOS settings. Sometimes a problem with the server can be solved by updating the BIOS.

Monitor Temperature of the Server

Another issue that you should consider when your server reboots randomly is overheating. When your system overheats, the server will crash or reboot on its own. You should monitor the temperature of your system and find out whether it is overheating or not.

Check Power Connections

There are times when the connection of the server to the electricity supply is the problem. Make sure that it is plugged in properly into the outlet. You should also check if the mains lead is plugged completely into the back of the system. If the server is plugged into a UPS, make sure that the UPS is not the problem. Try to plug the system directly into an outlet and see if the reboots still occur.

Check Transistors of the Motherboard

Random reboots can be caused by bad hardware. Check whether all the transistors of the motherboard are okay or if they are burnt. If you find burnt transistors, you can either replace them or replace the motherboard as a whole.

Check the RAM

The server might be rebooting because it lacks RAM. You might not have noticed, but one of your RAMs might not be functioning anymore. Test your RAMs to find out if they are still in good working condition.

If you have gone through all the above and still experience random reboots, then the last resort is to remove all the components and connections, and rebuild the server. This is to ensure that the cause of the reboots is not loose connections.

Linux: How to clone and split screens using Xrandr

XRandr is a very handsome tool to deal with multiple screens in Linux. It allows to clone split, clone and re-arrange the output. It has been developed as official user-interface for the RandR protocol which serves to configure the X11 server. It is a bit difficult to use. However, if you know some magic commands and create aliases the tool may still do some magic as will shown below. For the too trick we assume that you are using a laptop with a VGA port where an external screen is plugged in.

In the first exercise we just want to clone this external screen:

xrandr --output LVDS-0 --auto --output VGA-0 --auto --same-as LVDS-0

After executing that line you should just have a exact copy of your screen on the external one connected by VGA.

I the second exercise we want to split the screen between the Laptop screen and the external one.

xrandr --output LVDS-0 --primary
xrandr --auto --output VGA-0 --mode 1920x1080 --right-of LVDS-0

This example adds the external screen right of your laptop screen. With the –left-of option you can add it at the opposite site.Make sure that you have to choose a resolution which is supported by both screens.

Get the NTP time in a C++ programm via a simple socket

If you are writing an application it sometimes my be useful to have the exact time. Usually the time of the operating system is not synchronized. However, there is a very old protocol which available which allows servers so synchronize themselves: The Network Timing Protocol (NTP). It uses UDP port 123 for its communication. There is a huge network of free NTP time servers available in the web. The following example program connects to such a timing server and retrieves the NTP time from that server. For that it opens a simple socket connection in C++. The program can be compiled executed as it is here without any changes and also calculates the difference between the NTP time to your current system time. Furthermore you also learn how to use sockets in C++. We create a simple massage here, sent it via a socket to the NTP timing server and then receive the reply which is the desired time.

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <string.h>
#include <iostream>
void ntpdate();

int main() {

 return 0;

void ntpdate() {
// can be any timing server
// you might have to change the IP if the server is no longer available
char *hostname=(char *)"";
// ntp uses port 123
int portno=123;
int maxlen=1024;
int i;
// buffer for the socket request
unsigned char msg[48]={010,0,0,0,0,0,0,0,0};
// buffer for the reply
unsigned long buf[maxlen];
//struct in_addr ipaddr;
struct protoent *proto; //
struct sockaddr_in server_addr;
int s; // socket
long tmit; // the time -- This is a time_t sort of

// open a UDP socket
s=socket(PF_INET, SOCK_DGRAM, proto->p_proto);

//here you can convert hostname to ipaddress if needed
//$ipaddr = inet_aton($HOSTNAME);

memset( &server_addr, 0, sizeof( server_addr ));
server_addr.sin_addr.s_addr = inet_addr(hostname);

 * build a message. Our message is all zeros except for a one in the
 * protocol version field
 * msg[] in binary is 00 001 000 00000000
 * it should be a total of 48 bytes long

// send the data to the timing server
i=sendto(s,msg,sizeof(msg),0,(struct sockaddr *)&server_addr,sizeof(server_addr));
// get the data back
struct sockaddr saddr;
socklen_t saddr_l = sizeof (saddr);
// here we wait for the reply and fill it into our buffer

//We get 12 long words back in Network order

 * The high word of transmit time is the 4th word we get back
 * tmit is the time in seconds not accounting for network delays which
 * should be way less than a second if this is a local NTP server

 tmit=ntohl((time_t)buf[4]); //# get transmit time

 tmit-= 2208988800U;
 std::cout << "NTP time is " << ctime(&tmit) << std::endl;
 std::cout << "System time is " << (i-tmit) << " seconds off" << std::endl;

The Link Building Strategies which will hold in 2015

In a nutshell, link building is getting other websites to link to your website to improve the site’s rankings in search engines. Take note that Google will punish your site if you have too many spam links. Be careful how you implement your link building campaign. You might raise a red flag, and this can affect your page ranking. Below are useful tips in coming up with your link building strategies in 2014.

Avoid Link Networks

One of the most important tips to help you formulate link building strategies in 2014 is to avoid link networks. Google consider links from link networks as low quality and will be bad for your own website. The search engine giant has warned against the use of such schemes, and that’s why you should avoid them.

Stop Guest Blogging

Since the start off 2014, Google has turned its attention to guest blogging, especially the low-quality ones. The search engine considers the practice to be spammy and no longer good unlike in the past. Guest posts that have inauthentic or rehashed content are greatly discouraged by Google. So it will be a bad idea to consider guest blogging as part of your link building strategy.

Do not provoke your site getting hit by the Penguin: The so called penguin algorithm by Google punishes sites with spammy link building approaches.

Directories have Less Impact than before

Automated directory submissions should be avoided and must not be part of your link building strategies in 2014. When you use such service, you don’t have any control on where your links will come from. The practice provides more risks than rewards.

Questions and Answers are Good for Link Building

Question and Answers sites, such as Yahoo Answers and Quora, are good for link building. You can also use the sites as sources of inspiration for contents of your blog. You can check the top questions on Yahoo Answers and look for ones that you can answer better. Then write a blog post with as much helpful info as possible. After posting the article, summarise your post as an answer to the question in Yahoo Answers and leave a link to your blog post.

Write Unique Content

Unique content is one of the tried and tested ways to earn traffic and back links. That’s why it should be included in your link building strategies in 2014. Quality content will attract shares, links, and traffic.

Write Testimonials

You can earn media links when you write testimonials. Just make sure that you don’t overdo it. You must also do it for products that you actually like. This will ensure that you give out a genuine feel about the product and not just a generic testimonial.

Do Social Marketing

Link building strategies in 2014 and 2015 must include social marketing. Social networks allow you to engage your audience and in turn they will share links from your website that they find interesting. You should be more active in your social networks, especially Google Plus.

No Follow Links Counts in Link Building

In general, Google doesn’t give any importance to No Follow links. The website doesn’t get any Page Rank benefits from them, but that doesn’t mean that they are unimportant. A link is still a link, and they can bring traffic as long as people see them. Plus, other search engines might handle No Follow links differently.

Add a Blog to Keep Website Fresh with New Content

Content is king when it comes to online marketing, and there’s no better way to have fresh content than running a blog. That’s why starting or maintaining a blog should be one of the link building strategies in 2014 and beyond.

The Colorfull World of Digital Currencies

While the author James Rickards is already predicting the collapse of our current monetary system in his book “The death of money” the web is working at an alternative. You might have heard of these digital currencies already which are currently emerging and disappearing again in the web. You certainly have read already about Bitcoin, the pioneer among these currencies which has reached already a quite wide range of acceptance meanwhile. Some years ago the first pizza has been sold for this freshly coined digital money. Meanwhile you can buy almost anything for Bitcoins.

Meanwhile there are many more and some already have disappeared again. The three big players at the moment are Bitcoin, Litecoin and yes, you are reading correctly Dogecoin. While Litecoin only technically differs from Bitcoin Dogecoin is going a step further, bringing a social component in the world of internet money. The Dogecoin community has gained more than 80 000 members which are organizing social and charitiy events. They have been supporting some water project in Kenya, sent the Jamaican Bobsled team to the last Olympic games in Russia and even sponsored their own team at NASCAR. If money can be fun then Dogecoin is the monetary system which got closest the that maxim.

What all these cyber currencies have in common is that they are organized on a peer-to-peer base like application like Skype. This means that there is no central authority issuing the money but the money is created based on a mathematical algorithm. Everybody can participate in that process which is called mining. In the wild days of digital money you could do so just with your PC or your laptop. Meanwhile things have changed there. To mine a reasonable share of the coins which are issued on has to buy some special hardware which is difficult to get. If you are one of the lucky guys who manged in organizing such a device you can just watch your magic machine creating your own money which you can use to buy real goods. If you mine enough you can even buy a house. In the last years there has been a dramatic gold-rush concerning this new form of currency.

The year 2012 has been the year of Bitcoin, if you boght them before you were well off. Then 2013 could be called the year of Litecoin. How about Dogecoin then? It has been found end of 2013 and was accompanied by a incredibly wave of media coverage. Meanwhile it has survived long enough on this colorful market to be the next coin to skyrocket. Some technical changes implemented by the developers team recently might support this development. Who knows but maybe 2015 will become the year of Dogecoin in this unpredictable world of digital money.

Howto wait for multiple threads in C++

Whenever you have to deal with threads in C++ you should think of using the boost libraries which offer high end solutions for dealing with threads and creating thread-safe applications. A really nice feature on top of this are thread groups which allow you to manage multiple threads very easily. The following code snippet illustrates how to wait for multiple threads using such a thread group.

  #include <boost/thread.hpp>
  #include <boost/thread.hpp>

  void myFunc(int param)
 	std::cout << "Hello world" << std::endl;

  int main()
   int numberOfThreads==4;

   boost::thread_group thread_group;
   for(int counter = 0; counter < numberOfThreads;counter++)
       thread_group.add_thread(new boost::thread(myFunc,5));


   std::cout << "Done!" << std::endl;

The code executes the function “myFunc” in a separate thread which is added to a thread group. This happens four times. The trick of executing the threads simultaneously is done by the join_all() command. The program waits until the last thread has finished and then is done. There is no magic about threads at all using boost. It is straight-forward and easy.

How can I backup a MySql Database or export it to a file?

Imagine you have a large MySql database and want to backup it or backup your wordpress blog which also uses a MySql database. There is nothing easier than just using the handsome mysqldump command. It writes all the information to a sql script which you then can use to restore the databases at any machine you want. It is only two steps to create the script and restore the database.

To export the database just use the following command:

 mysqldump -uroot -pmypassword  --all-databases > backup.sql

In that case just all databases will be backed up. Of course the command also offers options to backup single databases.

If you want to restore the database you have backed up later you can doing by the following even shorter command:

mysql -u root -p < alldb.sql

One common error mysql dump might throw is the following one:

mysqldump: Couldn’t execute ‘show fields from `general_log`': Can’t create/write to file ‘/tmp/#sql_63f9_0.MYI’ (Errcode: 2) (1)

If you get it do not panic! It is usually simply a permissions issue or a problem with discspace. You must make sure that the “mysqld” user has the permissions to write its tmp directory (in this example it is /tmp). If not your will get this error.

If you verified that you really have enought disc space and futhermore the permissions are correctly set but exporting your sql database still does not work there might be another cause for the problem:

You might get this error if you are using an older version of mysql in combination with a newer version of a Read Head based linux system (e. g. Fedora). There have been bug reports that the OS does not allow mysql to the directory /tmp. This is really odd but in my case really was the cause of the problem! The solution here is also an easy one, if you find it:

vi /etc/my.cnf 

Then add the tmpdir variable to the [mysqld] section:



In a last step just restart the mysql deamon:

/sbin/service mysqld restart

You will not believe how smooth the export feature is now working. Enjoy!

Find and Replace all occurrences of a word with VIM

This post will be short one. If you have to work at remote servers with really slow internet connections and also have to edit files there you might get stuck with VIM. Yes sure, this program does not have a graphical user interface but it is extremely powerful! Do not underestimate it. One of the most common tasks for a text editor is finding and replacing a word or a entire pattern of course. Since VIM commands are a bit cryptic sometimes they are easy to forget if you do not use them on a daily base. The following one does replace one pattern by another one in the entire file. If your file is large this saves you a lot of typing!

%s/orignial pattern/new pattern/g

Thats it. If you want to use special characters you have to put a “\” in front of them.

A space in vim can be replaced using “\s” or if it is more than one space “\s\s\s”

For tabulators you can use the pattern “\t”.