31st Jan2013

Who is hosting WebDesignBlog.asia?

by Gyro

Webdesignblog.asia is being hosted on a Shared Hosting account from ServerPilot, which includes a Free Domain and loads of other goodies!

ServerPilot offers everything from 99ct hosting to high end dedicated servers for incredibly low prices. The shared hosting servers are running CloudLinux, providing a stable and fast performance for all hosting accounts sharing the server.

Wondering why my websites loads so fast? Do a "dig www.webdesignblog.com", and you will see that this website is actually being served from the CloudFlare CDN, which is integrated into the ServerPilot.com cPanel and FREE!

Be my neighboor, move to ServerPilot! :enjoy:

1059

21st Jan2013

Gitlab service doesn’t run on startup/boot/autostart

by Gyro

I have been using Gitlab for a while now to have backups of all my git repositories on my dedicated servers. Now, I needed to reboot one of them for the first time since I installed Gitlab, and ended up with a ‘502 bad gateway' warning by nginx, when trying to access the Gitlab web interface.

I found this on the github, hidden in a small pull request:

gitlab doesn't start on boot if you follow the install instructions on Ubuntu (12.04 LTS Server -- probably others). Turns out gitlab requires redis-server to be running for gitlab to be able to start. Startup script S20redis-server isn't run until after S20gitlab so gitlab fails to start on boot. Webserver will be up, bad gateway 502 error is usually seen/reported. Starting gitlab manually works (because redis-server has started). This change makes gitlab start after redis-server.

The single line for victory:
# sudo update-rc.d gitlab defaults 70 30

Enjoy :enjoy:

source: github

2995

17th Jan2013

Automatic eBay bidding with JBidWatcher

by Gyro

I found a neat little program, with which you can monitor eBay auctions and make a last minute bid, or actually even last second bid :)

It is called JBidWatcher, and is available for Windows, Linux, and MacOS.

I have installed it on Ubuntu, using the help provided in this thread over at the Ubuntu Forums.

This is an updated version of that post:

Requirements: you must have the Sun version of Java installed.

1. Download the latest version of JBidWatcher (2.5.3pre3) here, but you may  want to have a look on the official website to see if a new version has been released int he meantime… If there is a newer version available please leave a comment to let me know.

2. You can install JBidWatcher anywhere, I created a directory /usr/local/share/java and copied it there.

# sudo mkdir /usr/local/share/java
# sudo cp JBidWatcher-0.9.9.jar /usr/local/share/java

3. Make a bash script to run it.
# sudo gedit /usr/local/bin/jbidwatcher
and paste the following:

#!/bin/sh
java -jar /usr/local/share/java/JBidWatcher-0.9.9.jar

Make the script executable:
# sudo chmod +x /usr/local/bin/jbidwatcher
You are almost set. Just run from command line
# jbidwatcher
and enter your ebay user name and password.

4. You can make a .desktop file for JBidWatcher to have it in your menu:
# sudo gedit /usr/local/share/applications/jbidwatcher.desktop
and insert the following text:

[Desktop Entry]
Encoding=UTF-8
Name=JBidWatcher
Comment=Ebay watching and bidding tool
Exec=jbidwatcher
Icon=jbidwatch.xpm
Terminal=false
Type=Application
Categories=Utility
GenericName=JBidWatcher

It is up to you where to store jar file, the author suggests your home dir.

The site has a Quick Start Guide, available here

Enjoy! :enjoy:

2626

17th Jan2013

Add customized Google Translate to your website

by Gyro

Google translate has a feature called the Website Translator to help you translate your website.

Here is how it works:

  1. Add your website
  2. Customize the way the Google Translate will look on your website, I usually add a google translate dropdown menu to websites.
  3. Add the custom code to your website.
  4. View your website in another language and click on text that has not been translated to your satisfaction, you will see a popup with the option to submit a translation suggestion. Once a translation suggestion has been submitted, you can review and activate it in the Website Translator

Enjoy :enjoy:

1716

15th Jan2013

Install php-gd on Ubuntu without recompiling php

by Gyro

For some reason one of my client's website stopped showing captcha codes for the mad4joomla component, the server is running nginx with php-fpm instead of Apache.

Looking at the error.log, I got

 [error] 21110#0: *100 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to undefined function imageantialias() in /var/www/clients/client1/web1/web/components/com_mad4joomla/sec/im4.php on line 39"

Time to check the server, that function is supposed to be part of the GD library.

First, I checked if GD was loaded:
# php5 -m | grep -i gd

gd

ok, so GD is there… now on to the function.

# php -r "var_dump( function_exists(‘imageantialias'));"

bool(false)

hmm… :wooty:

So, on I went to google, trying to find out how I can get imageantialias() to work (again)… to my surprise I actually stumbled upon a post talking about the exact same issue, while using the same server setup -- Ubuntu with ISP Config. The solution presented was to recompile php, which I was reluctant to do.

After some more searching I came across this amazing little page (http://nossie.addicts.nl/php5-gd.html) which I am going to post (slightly modified) right here, mainly because it looks like that page could be gone tomorrow…

Getting bundled php-gd working on Ubuntu without having to recompile php

Like many other people out there, I ran into the problem that the version of php-gd shipped with Ubuntu (and Debian) is different from the version used by many other distributions.
The version Ubuntu uses misses some functions like imagerotate and imageantialias, which are needed by an increasing number of software projects.

One solution to this problem is recompiling PHP with the bundled version of GD.
It is not particularly hard to do, but there are a reasons not to do it, one of them being that it is not neccesary.

The following steps solved the problem for me.

Install what is needed to do this:
# sudo apt-get install php5-cli php5-gd rpm mc

Check what version of php you are running (php5 -v). In my case it was 5.3.2-1ubuntu4.7
Go to rpmfind.net and search for php-gd-bundled
Download the version that matches your PHP version and architecture, php-gd-bundled-5.3.2-1mdv2010.1.x86_64.rpm in my case.

If you have installed mc (midnight commander) and rpm, you can use mc to open the downloaded .rpm file (start mc, goto the .rpm file and hit enter)
Inside the .rpm file you will see CONTENT.cpio, navigate to that and hit enter. Goto usr/lib64/php/extensions, there you will find gd-bundled.so.

The original php5-gd is installed at /usr/lib/php5/20090626/gd.so (for my installation), backup the original gd.so, and copy the gd-bundled.so to that location and rename to gd.so (you can copy files with F5 in mc).
The new gd.so expects to find libjpeg.so.8, this was not present on my system, but that can be sovled by creating a symlink from the installed libjpeg.so
On my system I found /usr/lib/libjpeg.so.64.0.0
Create the symlink with:
# ln -s /usr/lib/libjpeg.so.62.0.0 /usr/lib/libjpeg.so.8

This is it, restart apache and you should be running with the bundled version of gd.
# php -r "var_dump(function_exists(‘imageantialias'));"
Should return bool(true) this time.

Now, if there is an update of the php5-gd package, your modified version gets overwritten. To prevent this from happening, you can hold the php5-gd package so it will not be updated.
# aptitude hold php5-gd

I hope this will help you as much as it did me!

Enjoy :enjoy:

51624

14th Jan2013

Using rsync to backup a remote folder onto your computer via SSH

by Gyro

I've been having a hard time remembering the correct way of doing this, so I figured I write it down…

Backup the "folder":
# rsync -avz -e ssh user@remotemachine:/some/folder/ /backup/some/folder/

When using a different ssh port (xxxx is the ssh port number):
# rsync -avz -e ‘ssh -p xxxx' user@remotemachine:/some/folder/ /backup/some/folder/

When there is a space in the folder name, you need to put single or double quotes around the folder name:
# rsync -avz -e ssh user@remotemachine:/some/folder/'with a lot of spaces'/ /backup/some/folder/'with a lot of spaces'/

Some cool commands you can add:

--delete
will remove files from the destination folder that are not present in the origin

--progress
shows a nice % progress on the current file

# rsync -avz -e --delete --progress ssh user@remotemachine:/some/folder/'with a lot of spaces'/ /backup/some/folder/'with a lot of spaces'/
This will download the content of the remote folder with a lot of spaces to your local machine with a folder of the same name, while deleting any file that is inside your local folder and not in the remote folder, and it will give you some details to the files being downloaded.

1885

14th Jan2013

Search Engine Friendly SEF URLs for Virtuemart 1.1.9

by Gyro

While I still hate joomla, today I stumbled across a neat solution to have virtuemart 1.1.9 use SEF URLs.

All that is required to make it work is turn on SEF URLs in the Global config, disable the suffix, and copy a file into your components/com_virtuemart folder.

You can get all the details here

Enjoy  :enjoy:

1456

10th Jan2013

Why I hate Joomla – Episode 1: URL suffix

by Gyro

Today I had really good fun with Joomla, that is, if you consider cursing and face-palming to be fun.

I have been using CMS systems since 2000 when I first installed php-Nuke. Shortly after that I used xoops to create a website for my clan, xoops is still one of my favorite CMS systems actually, even though WordPress is simply the best IMHO.

I did use Drupal, and actually liked when the developers split and Joomla was born. Now, I have started hating Joomla shortly after it was released. Main reason being their elitism in the forum, it seems that everyone has to comment but no-one actually comes up with genuine solutions. I would never even open their website again, had I no customers with Joomla websites, but since I do, I am on and off forced to deal with this piece of sunshine CMS.

So, now to the 2nd reason of probably 100+ to come:
I have just spend about 4 hours searching for a solution to get Joomla 1.5 to add a trailing slash (/) to the URL, instead of the default .html suffix. I found quite a lot of threads on the Joomla forum discussing how one could add a trailing slash instead of the .html suffix, and once again each thread was gang banged by Joomla Gurus making dumb a…smart comments, and a solution was nowhere to be found, unless you want to use a plugin. I swear, I would have slapped a few of them, were they near me when reading their useless comments… of course I can use a plugin like sh404 that completely hijacks your site and URL structure, but I was looking for the solution, not a work around!

So, after those 4 hours I finally got my Geany out of the bottle and did a few in-file searches, to find the files with the lines that does all the magic.

It is the router.php located in includes/router.php, open it and look for the function &build($url), and change the following within that function:

if($app->getCfg(‘sef_rewrite'))
{
//Transform the route
$route = str_replace(‘index.php/', ", $route);
}

To this:
if($app->getCfg(‘sef_rewrite'))
{
//Transform the route
$route = str_replace(‘index.php/', ", $route).'/';
}

Next, open libraries/joomla/document/html/renderer/head.php and look for this:

 if(!empty($base)) {
$strHtml .= $tab.'<base href="‘.$document->getBase().'" />'.$lnEnd;
}

change the above to this:

 if(!empty($base)) {
$strHtml .= $tab.'<base href="http://'.$_SERVER[‘SERVER_NAME'].'/" />'.$lnEnd;
}

You may have to modify this part a bit (maybe https, or if Joomla is installed in a sub folder, etc.), basically you should have your Homepage URL in the baseurl meta tag in the head section of the source code. :)

That's it! It really is that simple :shock: which makes me even more furious :shout: … I mean appreciative… thinking about all the super smart comments I found in the Joomla forum. I was about to go back to the Joomla forum to post my solution and tell those "Joomla Gurus" how full of sunshine they are, but then I remembered that I got this blog.

Oh, you need to disable showing the URL suffix in the Global Configuration, of course!

Enjoy! :hehehe:

p.s. Operating a blog is a fine form of anger management… :crazy:

2952