Tuesday, December 18, 2012

/var/log/mail.err: dovecot: Fatal: Time just moved backwards

I had this error appear almost on every reboot in my /var/log/mail.err file. Rather frustrating considering reboots are so infrequent that I would forget that dovecot failed to start and troubleshoot anew IMAP access failure. Well last time this happened I decided to fix the root cause and below is the solution.

As per dovecot wiki this error can appear on some VPS hosts. Resolving this is relatively easy but it's not obvious, the solution consists of installing NTP - Network Time Protocol daemon which keep your time correct and synchronized and then delaying the execution of dovecot service until ntpd service is loaded.

Ubunty/Debian Sollution

Install the ntp package:

# aptitude update
Get:1 http://security.debian.org squeeze/updates Release.gpg [836 B]
# aptitude install ntp

By default dovecot startup script does not require the ntp servicet before it starts, so we must modify it that it waits for the ntp before it starts itself. Edit the /etc/init.d/dovecot startup script and add 'ntp' to the end of '# Required-Start' line like so:

# nano /etc/init.d/dovecot
# Required-Start: $local_fs $remote_fs $network $syslog $time ntp

Delete and re-add the start up script which will place in its proper order in the startup sequence (thanks Linode for help with this):

# insserv -r dovecot
# insserv dovecot

Reboot your system and verify that dovecot is indeed running:

root@shared-hosting-1:~# ps aux | grep dovecot
root      2208  0.0  0.1   3996   796 ?        Ss   23:51   0:00 /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
root      2213  0.0  0.4  10072  2508 ?        S    23:51   0:00 dovecot-auth
root      2221  0.0  0.5  10264  2668 ?        S    23:51   0:00 dovecot-auth -w
dovecot   2234  0.0  0.4   5604  2200 ?        S    23:51   0:00 imap-login
dovecot   2235  0.0  0.3   5464  1940 ?        S    23:51   0:00 imap-login
dovecot   2236  0.0  0.3   5464  1940 ?        S    23:51   0:00 imap-login
dovecot   2246  0.0  0.3   5464  1936 ?        S    23:53   0:00 imap-login
root      2307  0.0  0.1   3356   740 pts/0    R+   23:54   0:00 grep dovecot

Do +1 or share this if it has helped you.

Saturday, December 15, 2012

Verisign/Symantec "Failed to configure CA certificate chain!"

I've deployed a few SSL enabled sites in the past but have never encountered as much trouble as I did with Verisign/Symantec Secure Site SSL certificate. And the thing is it can all be blamed on a poorly formatted Download Symantec Secure Site Primary and Secondary Intermediate CA bundle page. Yes even though it does say the word 'Download' you are actually asked to copy and paste; brilliant considering that if you do so your resulting file is malformed due to additional white space on each line

I did not notice the white space until well into my second hour of frustration and pain. Apache just chokes with "Failed to configure CA certificate chain!" or "Unable to configure verify locations for client authentication" errors. For the substantial premium clients pay to use SSL Verisign certificates I must say I really expected better.

To resolve the issue either manually remove the white spaces or create the chain file by copying and pasting from the 'Get Certificate' page (format X.509) the First Intermediate Certificate: and Second Intermediate Certificate: sections - End Entity Certificate: is your SSLCertificateFile.

Hope this helps you out, feel free to follow me on twitter: @danielsokolows or google plus.

Sunday, December 9, 2012

Ruby on Rails Apache Deployment

Setting up apache + passanger to serve a RoR app on Ubuntu/Debian (VPS Linode)

I'm a Django/Python developer that was tasked with transitioning a Heroku hosted app to a Linode VPS running stock Ubuntu. This turned to be a two day adventure with a lot of dead ends and a fair share of frustration. I had the app running relatively quickly using the `rails server` built in command but could not get apache + mod_passanger to serve it.

I must say that in my opinion RoR cummunity is doing it's self a disservice by not having solid easy to follow deployment instructions - doing a search on ruby on rails deployment returns outdated noise and official page that is of no help.

Below is a quick summary of what I have learned and how I deployed a Ruby on Rails site with Apache on a Ubuntu system running on a Linode VPS. If this blog does help you out I ask that you do +1 or share it; so now let's begin.

Do not use the Ubuntu/Debian system packages

I mean do NOT, this is the route I went which turned out to be like going down a rabbit's hole. The system packages are outdated and even if you get your app working using the build in `rails server` command chances are apache + mod_passnger will still complain with "no such file to load -- bundler/setup" or "Valid types are [:development, :runtime], not nil"

Use the 'Rails Ready' script and follow it to the letter

I forget how I eventually found this but I am soooo glad that I. This magical script compiles and installs the latest version of RoR and either a Ngnix or Apache passenger module. So run it and it will automatically take care of the entire setup process for you. However in the instructions it states to run `passenger-install-apache-module` but it's actually `passenger-install-apache2-module`.

$ wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh
- I picked the build from source option
$ passenger-install-apache2-module

Test and Deploy your RoR Application

In summary: clone or copy your Ruby on Rails application, install it's required gems, test it, then setup the apache configuration as advised after running `passenger-install-apache2-module`.

$ git clone git@github.com:danielsokolowski/<your rails application>.git <your rails application>.ca
$ cd <your rails application>.ca/<your rails application>-form/
$ bundle install
$ rails server
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
=> Ctrl-C to shutdown server
[2012-12-09 00:40:34] INFO  WEBrick 1.3.1
[2012-12-09 00:40:34] INFO  ruby 1.9.3 (2012-11-10) [i686-linux]
[2012-12-09 00:40:34] INFO  WEBrick::HTTPServer#start: pid=6993 port=3000
^C[2012-12-09 00:40:41] INFO  going to shutdown ...
[2012-12-09 00:40:41] INFO  WEBrick::HTTPServer#start done.

Now that we know the app runs on the built in development server we can setup apache using the information provided when we installed passenger; below is an example of the site I was moving over that is a PHP site with a RoR application that is run under a sub url directory.

# /srw/www/<your rails application>.ca/apache-httpd.conf but linked as /etc/apache2/sites-avaiable/<your rails application>.ca

# RoR as per the `passenger-install-apache2-module` https://github.com/joshfng/railsready/blob/master/README.md
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18
PassengerRuby /usr/local/bin/ruby

<VirtualHost *:80>
 ServerAdmin support@danols.com
 ServerName <your rails application>.ca
 ServerAlias www.<your rails application>.ca development.<your rails application>.ca
 # Answering to server alias `development.domain.tld` allows one to develop the site on a development server utilizing 
 # same apache-conf file that will be used on live server. To make this work one only needs to update domain DNS 
 # records for `development.domain.tld` to point a development server and `www.domain.tld` and `domain.tld` to a
 # production server.

 # Canonical - prefix www to `domain.tld` but not `something.domain.foo` - however www prefix is no longer popular
 #RewriteEngine on
 #RewriteCond %{HTTP_HOST} ^w+.w+(:d+|)$
 #RewriteRule !"" http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]

 # Authenticated access to this project, this is only used during development server to prevent unauthorized access. 
 # As a fallback you should have default auth requirement enabled in the global Apache `/etc/apache/conf.d` settings.
 # We also prevent serving of the password logins file however again this is only used for development client access.
 Redirect /apache-logins.htpasswd /
 <Location />
     AuthType basic
        AuthName "Development Area"
        AuthBasicProvider file
        AuthUserFile /srv/www/<your rails application>.ca/apache-logins.htpasswd
        Require user jeremy

 # DocumentRoot where PHP / HTML Files are served from.
 DocumentRoot /srv/www/<your rails application>.ca/        

 # Ruby and Rails application form module - to find your GEM_HOME run 'gem list -d bundler' 
 <Location /<your rails application>-form/>
  RailsEnv development
  #RailsEnv production
  RailsBaseURI /<your rails application>-form
  PassengerAppRoot /srv/www/<your rails application>.ca/<your rails application>-form/
 # Apache log file location and settings; keeping log within project is not recommended as site can be on many servers
 ErrorLog /var/log/apache2/<your rails application>.ca-errors
 CustomLog /var/log/apache2/<your rails application>.ca combined
 # common redirects
  #Redirect permanent /gapps/ https://www.google.com/a/<your rails application>.ca/
 #Redirect permanent /analytics/ http://www.google.com/analytics/


Thursday, November 15, 2012

A tip for relatively sized Html input elements using `em` units

And why I use Yahoo! (YUI3) Reset CSS Now

For better or worse when doing front end development I prefer to use percentages and em as the unit of size when styling. This approach could be a bit tricky but with proper experience and the use of css screen size conditionals does allow for one rendering base for multiple screen sizes.

As base I set px font-size only on the <body> html element and then afterwards use em to style all other elements; of course using pixel based units where it makes sense. This allows for example the quick changing of the font-size just on the body tag and having all the header resize accordingly.

One annoyance that I experienced was that input radio and check buttons didn't honour the font-size of the body and I always just worked around the issue by explicitly styling the input radio or checkbox buttons height to a em value that made it look good.

However, today by pure accident I discovered that adding font-size: inherit to the input styling fixed the problem: the height of the element is the font-size of the body element which equates to a proper effective 1em.

This to me is something that should be in a reset style, but the Eric Meyer's reset style sheet at meyerweb.com that I have been using for years dosen't have it. After reviewing all the other options at CSS Reset site the only one that addressed this issue is the Yahoo! YUI 3 Reset Sheet – and so with confidence that is the one I use now.

Wednesday, October 31, 2012

Installing Debian unstable safely with APT pinning

Using Aptitude to list and install backported or unstable packages

Early into my linux Debian web server administration, out of necessity and after a lot of trail and error and reading I worked out the right preferences that keeps my systems very stable and yet with the ability to install the occasional backported or unstable package. My package management utility of choice is `aptitude` but these settings will also effectively work for `apt-get` and before I begin do +1 this if you find it useful.

The above shows the available version of Django with their respective APT pinning numbers: 990 being the stable version and selected by default when installing, 400 being the backported version, 50 being an unstable version, and 100 pinning for our already installed version.

During normal installation the stable default is always selected, however now I also have an option to easily see other available versions by viewing the information provided at bottom of the package details. Based on the displayed pinning I can tell any backported versions and the unstable version available and review the potential conflicts it could create in a straight forward way.

Setting it all Up

There are four things that need to be edited, the default pinning release needs to be set, the sources need backports and unstable added, lowering the pinning priority of backports/unstable packages, and the aptitude display settings needs to be modified to display pinning.


Create a ' /etc/apt/apt.conf.d/10defaultrelease' and make it's contents as follows:
Apt::default-Release "stable";

Update package `sources.list`

Edit your /etc/apt/sources.list to add unstable and backports sources so it looks something like this:

# deb cdrom:[Debian GNU/Linux 6.0.0 _Squeeze_ - Official Multi-architecture amd64/i386 NETINST #1 20110205-14:45]/ squeeze main

deb http://ftp.us.debian.org/debian/ squeeze main
deb-src http://ftp.us.debian.org/debian/ squeeze main

deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main

# squeeze-update, previously know as 'volatile'
deb http://ftp.us.debian.org/debian/ squeeze-updates main
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main

# squeeze backports
# http://backports.debian.org/Instructions/
deb http://backports.debian.org/debian-backports squeeze-backports main

# unstable
# http://wiki.debian.org/AptPreferences
deb http://ftp.us.debian.org/debian/ unstable main
deb-src http://ftp.us.debian.org/debian/ unstable main

# non free ex. sun java
#deb http://ftp.us.debian.org/debian/ squeeze non-free
#deb-src http://ftp.us.debian.org/debian/ squeeze non-free

Edit `etc/apt/preferences` pinning file

If the file doesn't exist do create it, if it does modify it to add lower pinning the default 500 for unstable and backports packages as follow:

# Package pinning priorities
# See http://wiki.debian.org/AptPreferences and http://manpages.debian.net/cgi-bin/man.cgi?query=apt_preferences
# In nut shell highest PIN gets installed
# Pining default are as follow which are in addition to our settings:
#   990 - for version that are not installed but DO belong to our `APT::Default-Relase "stable"` setting.
#   500 - for versions that are not installed and do not belong to the target release
#   100 - for packages that already installed, this also means other versions of same package
#     1 - for experimental packages; packages with "NotAutomatic: yes"
# Our Pinnings
#   400 - backports that can safely be installed without the need to update other packages
#    50 - unstable packages, install forced in the details screen, can result in conflicts

Package: *
Pin: release n=squeeze-backports
Pin-Priority: 400

Package: *
Pin: release a=unstable
Pin-Priority: 50

Add pinning information to Aptitude

By default Aptitude does not display any pinning information however this can be changed and once done a pinning number will be displayed when one view the package details, add the following file `/etc/apt/apt.conf.d/100guiconf`:

Aptitude::UI::Package-Display-Format "%c%a%M %p %Z %v %V %i";

That's it. It is worth pointing that this setup has worked for me over the past 3.5 have years without any issues

It is even able to handle a scenario where a previously installed unstable is upgraded to a stable backported higher version correctly as can be seen with the above example of the Django package.

Monday, October 8, 2012

How to child proof a fireplace

DIY - Do it yourself fireplace child guard

Our wonderful 8.5 month old Sofia has become a crawling race car with an untamed thirst for exploration. And so with the cold nights approaching we needed to child proof the fireplace. This however proved to be more difficult than would reasonably expect, I've checked the local Toys "R" Us, Walmart, and even a Canadian Tire with no success for a ready to use product.

Internet search was more fruitful and returned a few online stores one could order from, however in all honestly they didn't look too sturdy to me. So I build my own relatively quickly and inexpensively.

Materials needed is a privacy plastic lattice - the smallest hole pattern - a few screws and anchors; tools needed are a drill, and a handsaw if you don't have the lattice cut at the store - that’s it. The construction consits of screwing the lattice into the wall and the final product is easiest explained through following pictures.

Feel free to +1 this post if you found it helpful.

Thursday, October 4, 2012

Hide People from "Have You in Circles"

How to manage/remove people that added you from your "have you in circles".

One could call it spam, and so I am - people/profiles following you that clearly have no reason to do so, even if you don't follow them back still show up in your "have you in circles" section. There is a way to completely hide that section, block the person or ignore them. The first two are drastic, the ignore option is the best and recently.

Here is how to Ignore somone on Google+ :

  • Click on your "Notifications" box
  • Find and click "Added you on Google+"
  • In the list that follows find the person and click 'Ignore'
  • Log Out and view your profile to verify it worked.
  • To see full list click More circle notifications »

See the not very helpful Google Help Page for more information. Also do +1 this post as that helps me immensely.

Wednesday, September 26, 2012

Do it yourself microFit Solar Panels

One home owners experience with microFit

***a posting and project in progress***

microFit is an Ontario program under which the government will pay you a premium for any electricity you generate back to the grid through renewable sources. It started in 2009 and offered an amazing 80.2¢/kWh for electricity generated by rooftop photovoltaic panels. The demand was so high that to keep the program balanced in 2012 the rate was lowered to 54.9¢/kWh - 31.5% lower and I would bet the rate will continue to declined as the program is now under yearly review. Assuming an average 13¢/kWh electricity cost in Ontario the rate is still appealing and makes the investment worthwhile financially and of course environmentally.

It must be said that if you yourself are considering microFit then do not wait - apply yourself or have it done by a company on your behalf - once you get a approved your rate is locked in for 20 years and you have 6 months to complete the project. Furthermore, because these contracts are against specific locations, a property with one could become very desirable in the future as electricity costs continue to rise.

Quick Rule of Thumb Return Mulipler

To get your yearly dollar revenue (for microFit at 54.9¢/kWh) multiply your faceplate in KW capacity by 572. That is a 10KW system would generate $5720 a year. A local Kingston renewable energy company did a microFit package for me and using their numbers the multipler conversion rate works out to 635.

Determining your brake even point

One way to decide on the size of your solar panels photovoltaic system is to analyze your yearly electricity costs and work backwards form that. This will determine the estimated minimum system size needed to brake even - at the end of the year have a net electricity costs of zero; let's dive in using numbers from my projects numbers except my target is to cover almost all our utility costs:

Yearly total utilites: $5000
Rebate per kWh:        $0.549
kWh Needed:            $5000 / $0.549

Based on the above 9107kWh in a year must be generated to result in $5000 revenue which would offset our utility costs.

Converting required kWh into kW faceplate capacity

This step is a little tricky as the total kWh produced is based on location, system setup - inclination, azimuth, static or one that tracks the sun - and faceplate kW capacity. The best resource to assist with this is PVWATTS a US resource with data point for some Canadian locations.

Once you find your location click the 'Send to PWatts'. On the next screen enter your roof angle and direction [link to some android iPhone app for this] then click 'Calculate' button. On the following page locate yearly kWh and divide it by 4000 (or whatever value you entered for faceplate capacity) to how many kWh you can produce per 1kW; for our home's Kingston, Ontario location the numbers are as follows:

DC Rating (kW):          4.0
DC to AC Derate Factor:  0.77  
Array Type:              Fixed Tilt 
Array Tilt (degrees):    45
Array Azimuth (degrees): 180
Yearly kWh Production:   4165
kWh to kW Conversion:   4165/4000

Now to get faceplate kW we divide 9107kWh by our rate:

Required Faceplate kWh:  9107/1.04125

Calculating the number of Solar panels and surface area required

Monoycrystalline photovoltaic cells are the most efficient type – followed by polycrystalline then thin-film panels - and a panel like the microFit qualified Sharp panels average between 230-240W per panel. Calculating number of panels required is easy:

Required Faceplate kWh : 8746 
Wattage per Panel  : 234W
Panels Needed  : 8746 / 234
           =  37.21 or 38 panels

And now to get the rough surface area required:

Panel Dimensions:  64.6 x 39.1 x 1.8”
Panel Area:  2525.86 inches square = 16295.8 cm2 = 1.62958 m2
All Panels Area: 1.62958 x 38
   = 61.92m2

Will it fit on the roof? Surface area required.

One can use Google Earth to estimate the surface area of the roof – do keep in mind that the slope of the roof won't be taken into consideration hence your actual size would be a little bigger. If you can see the roof from the street a more accurate way would be to count the number of shingles width and length wise and time it by dimensions of one shingle, in my case the calculations were as follows:

Shingles width wise: 24
Shingles height wise: 34
Number of Shingles: 24x34
   = 816
Shingle width:  33cm
Shingle height: 14cm
Shingle Area:  33 x 14
  = 462 cm2
Total Roof Area:  462 x 816
   376992 cm2 = 37.70 m2

Based on that my roof area is insufficient for the required faceplate capacity. It can roughly support 37.70 / 1.63 = 23 panels. The good news is one can use the garage's roof area but in my case I there is plenty of roof 'on the other side' to utilize altough at a much more flatter angle.

How much will it cost?

Do it yourself installation there are microFit kits 5KW at around $11,000 and 10KW at $21,000 as long as you do the work yourself. Now this potentially could mean you don't qualify for the microFit content requirements. There is also the cost of the extra meter hook up.

more to follow eventually – contact me or comment if you have questions

Further Reading

Found this excelent guide by our Kingston Hydro LDC worth a read as part of the planning process: Guide for Distributed Generators. On that page one call also find the required forms to fill out for a Connection Offer.

The linked guide is absolutley worth a read to learn things such as:

Hourly Ontario Energy Price – The Wholesale Market 
In Ontario, there is an open wholesale market for electricity administered by the Independent 
Electricity System Operator (IESO). Throughout the day and night, Ontario electricity suppliers 
submit offers to sell electricity and wholesale buyers submit bids to buy electricity. The IESO then 
uses these offers and bids to match electricity supply with demand, establishing the Hourly Ontario 
Energy Price (HOEP) paid by wholesale customers. This spot market energy price changes from 
hour to hour, day to night, from season to season, and for short periods in response to high levels 
of demand or sudden changes on the IESO-controlled grid. Every five minutes, the IESO calculates 
a new spot market price by balancing the supply of electricity with demand. As demand increases, 
more expensive offers from generators are accepted, which raises the price of electricity. As 
demand drops, only the less expensive offers are accepted, which reduces the price.  

Wednesday, September 19, 2012

Maximum Logrotate Compression with bzip2

A Tip for squeezing a little more free space from a VPS

Our web design VPS with Linode has been rock a solid solution over the last 4 years. It currently hosts multiple client sites, freeswitch, mail agent, wireless security camera feeds, and in the past even a Minecraft server and FreeNet; all these services eat up precious hard drive space and with only 20GB the wall can be hit early.

However this measly 20GB does comes with a kick ass IO rate that beats even some dedicated servers

Stop blabering and get to it

Linux logs everything, these logs grow overtime, systems run 'logrotate' to archive and delete old logs - the settings are very liberal and tweaking them could save gigabytes of space, 1.1GB in my instance. Modify your /etc/logrotate.conf as needed but the important bit is compressing by default and using bzip2 instead of gzip to do so.

# see "man logrotate" for details
# rotate log files weekly

# keep x weeks worth of backlogs - default 4
rotate 2

# Archive log files by adding a YYYYMMDD instead of simply adding a number.

# create new (empty) log files after rotating old ones

# uncomment this if you want your log files compressed

# use bzip2 whith higher compression than gzip
compresscmd /bin/bzip2
uncompresscmd /bin/bunzip2
compressoptions -9
compressext .bz2

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    create 0664 root utmp
    rotate 1

/var/log/btmp {
    create 0660 root utmp
    rotate 1

# system-specific logs may be configured here

There are also specific application/services log rotation settings in the /etc/logrotate.d directory. Apache by default keeps it's logs for a lengthy 52 weeks! This can be changed by modifying the /etc/logrotate.d/apache2 file as shown below:

/var/log/apache2/*.log {
        # rotate 52
        create 640 root adm
                /etc/init.d/apache2 reload > /dev/null

Be legendary and do social like this post as that helps me immensely and do follow me on twitter: @danielsokolows.

Tuesday, September 11, 2012

Google Analytics or Adwords Reverse Lookup

Locating the administrator of a Google Analytics account

For whatever reasons a client might have not been granted access to their Google Analytics information by their former developer. This normally is not an issue as developer are mostly a friendly bunch and when asked will grant proper access, but what if the former developer's identity is unknown or lost? - yes rather unlikely scenario but this has happened to us and it can happend to you.

Google Analytics tracking ID reverse lookup by ewhois

On the surface ewhois is your typical look up service with the one and important exception is that it allows tracking down the administrator of analytics tracking code. This can be accomplished due to the fact that site tracking codes contain a common id representing the parent account.

Danols Web Engineering Google Analytics tracking codes are UA-12420089-X where X is the unique id of a tracked site. Based on this fact ewhois is able to return other related sites from it's database.

Now with a bit of luck (that the designer is using the same account to track their own site and that ewhois's database contains the information) and some detective work it easy to find the developers business site and their contact information.

Please social this post if it has helped you.

Wednesday, August 22, 2012

Setuptools' ``include_package_data`` option does not work

MANIFEST.in not honoured during install phase

The python package setup procedure appears to be a mess, you have setuptools, distutils, and distribute (distutils2?). All I set out to do was to fix the installation setup.py in django-simplemenu package which was omitting the non-python module plain locale directory but instead got myself involved a 3 hour roller coaster; I am sharing my findings in hopes of helping you, so if you are reading this do +1 this.

Including sub directories and non python files as part of package

There are two ways: MANIFEST.in file and package_data setup.py option. The latter is Pythonic but doesn’t do recursive includes - so you would have to list every sub directory - and can not include files in the root top most folder; sure once could write a python function to do this but why the complexity? MANIFEST.in with its file/directory pattern matching and with the setup.py's ``include_package_data`` option fits the bill:

    If set to ``True``, this tells ``setuptools`` to automatically include any
    data files it finds inside your package directories, that are either under
    CVS or Subversion control, or which are specified by your ``MANIFEST.in``
    file.  For more information, see the section below on `Including Data

The problem is that does not work, files specified in MAIFEST.in weren't being copied during install. After searching and trial an error the solution was to use distribute (or distools) instead of the old setuptools package. So if you are having issues import distuitls rather then setuptools.

My django-simplemenu setup.py

from setuptools import setup, find_packages 
   # your system should use distribute which is successor to setuptools 
   # and distutils, http://stackoverflow.com/questions/6344076/differences-
   # between-distribute-distutils-and-setuptools
   # 'distribute' imports itself as 'setuptools'
package = __import__('simplemenu')

    install_requires=['distribute'], # let's require the enhanced setuptools
    author='Alex Vasi , Justin Steward , Daniel Sokolowski ',
    include_package_data=True, # this will use MANIFEST.in during install where we specify additional files
    # Below is not needed as we are utilizing MANIFEST.in 
    #package_data={'simplemenu': ['locale/en/LC_MESSAGES/*', 
    #                             'locale/ru/LC_MESSAGES/*']
    #              },

My django-simplemenu MANIFEST.in

include LICENSE
include README.rst
recursive-include simplemenu *.py
recursive-include simplemenu/locale *
prune simplemenu/migrations

Tuesday, August 21, 2012

Verify Google+ Local Pages

But old style Google Places pages are still out of luck

Early this month Google introduced functionality to verify the new Google+ Local pages - not the old style Google Places which will be eventually migrated - but the new Google+ pages that must be created under the Local Business or Place category.

The process is simple consists of having a Post Card with a unique pin mailed to your businesse's address. Once that is accomplished your brand page will look something like Sleepless Goat Café Google+ Local Page and more importantingly it will be unified accross Google's Search, Google Maps, and Google+.

Business utilizing the former Google Places will be eventually transitioned to Google+ Local. For more information please see the oficial FAQ and discussion threads here and here

Google Places Administration Page

For those of you that asked below is a screen shot of the old style administration page for Google Places that will eventually be phased out. If you have one of those you can access it by clicking 'Get Started' button located at http://www.google.com/places/ page.

Wednesday, August 15, 2012

Linphone and VoiceMail Issues

Echo Limiter Prevents FreeSwitch Voicemail Functionality

If you experiencing issues while trying to leave a Voicemail due to 'Your recording was below acceptable levels' or similar errors try turning off the recommended 'Echo Limiter' in Linphone's settings.

I experienced this problem on the latest version of Linphone for Android when calling my FreeSwitch setup. Testing from a land line and with other soft phones worked as expected, changing 'record-silence-threshold' and 'record-silence-hits' FreeSwitch's mod_voicemail settings had not effect, and hence through the process of elimination the culprit was determined to be the 'Echo Limiter' setting.

Saving you hours and hair; so do +1 this.

Monday, August 6, 2012

SPA3012 Dial Tone Length Duration

Change or Increase the Length of Dial Tone

I have the Cisco SPA3102 and when attempting to setup a conference I found the default 10 second dial tone duration was not long enough - the fast busy would kick in before I finished searching through the phone directory.

To change the duration follow the below instructions:

  • Login into the VOIP box
  • Select 'Advanced' mode
  • Select 'Voice' tab
  • Select 'Regional' sub tab
  • Under 'Call Progress Tones' modify the 'Dial Tone' default entry's 10 second delay to whatever duration you wish.

Monday, July 30, 2012

OVH Free Dedicated Server Benchmarking

Beta server a power beast with shortcomings

OVH is a hosting company out of Europe making it's entry into the American market. As part of their (brilliant) buzz marketing strategy they are giving away 10,000 free servers. They do limit the number they give away per day so do hurry and visit http://www.ovh.com/ca/en/ to get yours; a twitter account is required

Once I entered a code Twitted to me the server was up an running within half hour; at first glance it is a power horse:

  • CPU: Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
  • Memory: 16 GB DDR3
  • Hard disk 2x 1 TB - SATA2

However my basic benchmarking for IO resulted in 1.9 MB/s copy speed, now that is very sub part performance compared 60+MB/s I am getting out of my Linode VPS and is border line unusable.

Network speed test with wget downloading a Debian ISO wasn't too impressive either, it averaged 1.75M/s (it did have nice high speed spikes), whereas my Linode VPS averaged 4.52M/s for the same file at the same time.

One must keep in mind this is a beta test and I would assume things to improve - or perhaps things are crippled to curtail abuse, either way I look forward to playing with this free dedi server and testing it more.

Benchmarking Log

login as: root
root@'s password:
Linux ns4000035.ip-198-245-60.net 3.2.13-grsec-xxxx-grs-ipv6-64 #1 SMP Thu Mar 2                                                                                                                                                             9 09:48:59 UTC 2012 x86_64 GNU/Linux

server    : 217000
ip        :
hostname  : ns4000035.ip-198-245-60.net

Last login: Mon Jul 30 11:53:34 2012 from s72-38-184-18.static.comm.cgocable.net
root@ns4000035:~# cat /proc/meminfo
MemTotal:       16335912 kB
MemFree:        16056976 kB
Buffers:            3412 kB
Cached:            28068 kB
SwapCached:            0 kB
Active:            49324 kB
Inactive:          17552 kB
Active(anon):      35412 kB
Inactive(anon):      160 kB
Active(file):      13912 kB
Inactive(file):    17392 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1051064 kB
SwapFree:        1051064 kB
Dirty:                56 kB
Writeback:             0 kB
AnonPages:         35236 kB
Mapped:             6272 kB
Shmem:               180 kB
Slab:              22992 kB
SReclaimable:       8092 kB
SUnreclaim:        14900 kB
KernelStack:         952 kB
PageTables:         1596 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     9219020 kB
Committed_AS:     170460 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      112620 kB
VmallocChunk:   34359623668 kB
DirectMap4k:        2048 kB
DirectMap2M:    16691200 kB
root@ns4000035:~# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
stepping        : 7
microcode       : 0x1a
cpu MHz         : 3400.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov                                                                                                                                                              pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm c                                                                                                                                                             onstant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf                                                                                                                                                              pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_                                                                                                                                                             1 sse4_2 popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts d                                                                                                                                                             ts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 6784.23
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
stepping        : 7
microcode       : 0x1a
cpu MHz         : 3400.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov                                                                                                                                                              pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm c                                                                                                                                                             onstant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf                                                                                                                                                              pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_                                                                                                                                                             1 sse4_2 popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts d                                                                                                                                                             ts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 6784.53
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
stepping        : 7
microcode       : 0x1a
cpu MHz         : 3400.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov                                                                                                                                                              pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm c                                                                                                                                                             onstant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf                                                                                                                                                              pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_                                                                                                                                                             1 sse4_2 popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts d                                                                                                                                                             ts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 6784.54
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
stepping        : 7
microcode       : 0x1a
cpu MHz         : 3400.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov                                                                                                                                                              pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm c                                                                                                                                                             onstant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf                                                                                                                                                              pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_                                                                                                                                                             1 sse4_2 popcnt tsc_deadline_timer xsave avx lahf_lm arat epb xsaveopt pln pts d                                                                                                                                                             ts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 6784.53
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

root@ns4000035:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1               10G  676M  8.9G   7% /
tmpfs                 7.8G     0  7.8G   0% /lib/init/rw
udev                   10M  172K  9.9M   2% /dev
tmpfs                 7.8G     0  7.8G   0% /dev/shm
/dev/md2              921G  7.0G  868G   1% /home
root@ns4000035:~# dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 103.268 s, 1.9 MB/s
root@ns4000035:~# wget http://cdimage.debian.org/debian-cd/6.0.5/amd64/iso-cd/debian-6.0.5-amd64-CD-1.iso
--2012-07-30 12:13:10--  http://cdimage.debian.org/debian-cd/6.0.5/amd64/iso-cd/debian-6.0.5-amd64-CD-1.iso
Resolving cdimage.debian.org... 2001:6b0:e:2018::138, 2001:6b0:e:2018::163,, ...
Connecting to cdimage.debian.org|2001:6b0:e:2018::138|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://napoleon.acc.umu.se/debian-cd/6.0.5/amd64/iso-cd/debian-6.0.5-amd64-CD-1.iso [following]
--2012-07-30 12:13:11--  http://napoleon.acc.umu.se/debian-cd/6.0.5/amd64/iso-cd/debian-6.0.5-amd64-CD-1.iso
Resolving napoleon.acc.umu.se... 2001:6b0:e:2018::173,
Connecting to napoleon.acc.umu.se|2001:6b0:e:2018::173|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 677380096 (646M) [application/octet-stream]
Saving to: `debian-6.0.5-amd64-CD-1.iso'

100%[===================================================================================================================================================================================================>] 677,380,096 1.75M/s   in 2m 35s

2012-07-30 12:15:47 (4.17 MB/s) - `debian-6.0.5-amd64-CD-1.iso' saved [677380096/677380096]

Sunday, July 29, 2012

Linode is Truly a Great Hosting Company

Migrated to new cluster no questions asked; got performance boost!

I have been using Linode as a hosting provider since July, 2010 after I outgrew WebFaction's shared plans. Overall I have been extremely happy with the service, reliability and support, so happy in fact I have prepaid for over a year.

Lately however I have been reaching my memory limit and hitting the swap space; running for fun a Minecraft server will do that.

It quickly became apparent that any disk IO would bring the sites served from that VPS to a crawl. Doing some IO benchmarking tests revealed a worrisome statistic:

root@)root@shared-hosting-1~>$  dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 26.3025 s, 7.7 MB/s
rm: remove regular file `test'? y

That is correct, lously 7.7MB/s copy test. Having access to Linode and burst.net servers I run the same VPS benchmark on them with following results:

Linode VPS #1

root@klisrv01~>$  dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 3.15058 s, 63.9 MB/s
rm: remove regular file `test'? y

Linode VPS #2

root@klisrv02:~>$  dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 13.6833 s, 14.7 MB/s
rm: remove regular file `test'? y

Linode VPS #3

root@klisrv03/>$  dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 13.4197 s, 15.0 MB/s

Burst.net VPS #4

root@klisrv04:~>$ dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 3.72182 s, 54.1 MB/s

Burst.net VPS #5

root@269622:~>$ dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 4.51529 s, 44.6 MB/s
rm: remove regular file `test'? y

I forwarded the above along with a polite support ticket asking to be moved and with no objection was offered a migration to a new cluster. The migration itself was super easy - just press the big notice button - and resulted only in about 30 minutes of downtime.

Post migration results

The moment of truth we have been all waiting for, ... running the above benchmark command results in:

root@shared-hosting-1:~# dd if=/dev/zero of=test bs=64k count=3k oflag=dsync && rm test
3072+0 records in
3072+0 records out
201326592 bytes (201 MB) copied, 2.41932 s, 83.2 MB/s

Just freaken gorgeous! Absolutely monumental, increase works out to be over 10 times more than before migration.

Final thoughts

If awesome service is important to you do give Linode a try, I am always tempted to go dedicated server or find a cheaper VPS - but what I would be saving in costs or getting in extra hardware specs I would be trading for excellent support and reliability, and that in my books is not worth doing a switch for.

The reason I have access to two burst.net servers is that we gave them a try as a cheaper alternative a while back and decided against: burst memory = bad and hardware stability issues.

Do you use my referral code: 7d884fa5262b62b8735502da003fee34061db49b so that I do get a small kick back for a sign up.

Wednesday, July 4, 2012

Disable Ctrl+Space Opera Keyboard Shortcut

How to disable the the "Go Home" keyboard shortcut in Opera

This is the most anoying Opera browser shortcut as whenever typing I have more then once accidently lost my work due to this "Go Home" shortcut. The previous button will only work if the form is initialy empty but if you are updating a post, or a comment it restores that and so you loose your work, hence most counter productive keyboard shortcut.

Disable this productivy killer by doing the following steps:

  • Click 'Opera button' on goto to 'Settings' > 'Preferences'
  • Go the 'Advanced' tab
  • Select 'Shortcuts' at the bottom of list on the left
  • Select 'Edit' next to the 'Keyboard setup' list
  • In the search window type 'space ctrl'
  • Press 'Delete'
  • Press 'Ok'
  • Add me to your G+ "Cool" Circle

Disable "Back" - backspace keyboard shortcut

Don't even get me started on this one - symptom Opera has focus but you think you are in Putty and press Backspace and loose the latest blog you were writing - I will leave you Opera one day!

  • Click 'Opera button' on goto to 'Settings' > 'Preferences'
  • Go the 'Advanced' tab
  • Select 'Shortcuts' at the bottom of list on the left
  • Select 'Edit' next to the 'Keyboard setup' list
  • In the search window type 'backspace'
  • Locate 'Platform Windows-Unix-MCE, Backspace'
  • Press 'Delete'
  • Press 'Ok'
  • Add me to your G+ "Cool" Circle

Monday, July 2, 2012

Google rel="author" and rel="publisher" Conflicts

How to fix rel="author" tag image that is no longer appearing.

Today I noticed that Google stopped showing my head shot next to the Kingston Web Design search result; having this is crucial as it does increase click through rate for obvious reasons we do not need to go into. My authorship has been working and headshot was appearing in search results since mid April of this year.

After lengthy debugging with Google’s Rich Snippets Testing Tool I was able to determine that rel="publisher" and rel="me" now seem to conflict with each other when on the same page; a verified rel="publisher" link makes the rel="author" link fail verification.

Surprisingly and unexpectedly having a plain link to your Google+ brand page prevents your head shot from appearing - the author profile is being reported as verified yet the profile image is no longer displayed. One must completely remove any links to a Google+ Brand Page for the head shot to funciton.

Until Google starts displaying G+ brand page profile images or fixes the above issues I have pulled Danols Web Engineering G+ link from the home.

Is Google getting ready to extend the rel="publisher" functionlaity?

My spider senses are tingling and I am going to say a definite "yes". It is only logical that rel=publisher and Google+ brand pages would function similar to author pages. The positive effect of a head shot next to a search result on the click through rate is significant and there are over 1M Google+ brand pages waiting to benefit from it.

Another peculiar thing that I have noticed upon that supports the above is that if one crates a rel="publisher" that links to a personal G+ page it acts as a rel="author", that is the Rich Snippet Testing tool shows the author’s head shot; it seems rel="publisher" has precedence over rel="author".

I do look forward to Google displaying Danols Web Engineering logo rather then my own face, and I hope it will be sooner than later.

Tuesday, June 26, 2012

SERP Position Forecasting Indicator

Potential trending using the "Position in search results" statistics

Recently in the last 2 days our website Danols Web Engineering has achieved 3rd position for "kingston web design" keyword phrase so I have been waiting for my SERP (I finally learned what that stands for!) to stabilize.

Reviewing the Google Webmaster tool reports I noticed that the sister phrase "web design kingston" in Google Webmaster tools had a few impressions from the 6-10 spot; the site ranks 13th. Intrigued by this I kept reducing the time range untill I got this:

Now Google sorts the above statistic by impression column hence even though they are not showing the exact number (nothing stopping them from doing so) I can conclude that the 6-10 has the most impression.

Thinking out loud here this means two things to me, well maybe three:

  1. Google is testing a new algorithm and a small percent of people are seeing the site ranking higher.
  2. Google is testing the sites quality by placing it higher in results and analyzing visit pattern to the site.
  3. Google is ranking my site higher but I am hitting a search data cluster that hasn't updated yet.

Now 1, 2 seem unlikely from the sheer fact that these tests are performed on miniscule percentage of search volume and the keyword phrase has a low search volume which would make statistical testing hard - hence me thinks it's number 3 or some 4 option that would mean the rank is to rise!

If this pans out perhaps then one could daily pull the 'Position in search results' statistics and with some confidence predict if a site would drop or raise. This would obviously be hindered because exact data is obscured by Google.

And with the last statement we might also have a reason why Google is obscuring that data - knowing it exactly would allow for clear direct tracking of what works and what doesn't in the SEO world.

As teaser below is a screen shot summarizing legendary raise of Danols Web Engineering site from obscurity to front page. I do look forward to completing a post on that as I kept the journey and progress very scientific.

Bussiness Cards and Coffee Mugs

Self Branding your Bussiness Successfuly for $58.42

So for the past hour or so super excitedly I have created Danols Web Engineering branded mugs, business cards, pens, and notepads.

Anyone with a bit of time and attention to detail can make their way using the edit controls and create professional results as seen below. With the promotion discount that was running at the time I was ordering my total cost for 250 business cards, 2 notepads, one pen and mug was a low $51.70 a saving of $35.29!

Have your own fun at brand marketing your business and visit Vistaprint, this link contains my refferal number which gives me a small kickback if you do purchase items.

Tuesday, May 29, 2012

Minecraft Server on Debian

Running Minecraft Server on a Linode Debian Instance

If you are having issues following the official wiki then you are not alone - I found it much too generic and could not get the 'init.d' startup script to work. Following is a step by step guide to quickly set up your on game server running on Debian/Ubuntu distribution.

Install Java

We are going to install OpenJDK which for all intents and purposes is equivalent to Sun java but without licensing issues. Execute below commands under root or using sudo.

# aptitude update
# aptitude install openjdk-6-jre-headless

Download and Install Minecraft Server

We are going to download and install into '/usr/local/minecraft' as per the Debian FilesystemHierarchyStandard.

# mkdir /usr/local/minecraft
# cd /usr/local/minecraft/
# wget http://dl.bukkit.org/latest-rb/craftbukkit.jar

We are installing the bukkit minecraft version rather then the vanilla one, it is fully comptabible with the vanilla server but lets your run plugins to effectivley manage your server

Server Settings

Create the server's server.properties file. I suggest you at least modify the 'motd', and 'level-seed' so that your world is a little personal to you.

# cd /usr/local/minecraft/
# nano server.properties

#Danols Minecraft Server properties
level-seed=Artomix #http://seedhunter.blogspot.com/2012/03/jungle-island.html
motd=you must survive

Automatic Startup

Compared that what is posted on the Minecraft Wiki the below is a simple startup script using Debians/Ubuntus start-stop-deamon utility, it does not have the update server, or run file system in memory option; in my opinion Java+Linux do a good job system caching on demand and any speeds from running in memory

The server is run under user 'minecraft-server' and group 'daemon' to increase security - this account and group is created as follows:

# useradd --home-dir /usr/local/minecraft-server --no-create-home -g daemon --shell /bin/false minecraft-server
# groupadd daemon

Create the startup script as follows

# cd /etc/init.d/
# touch minecraft-server
# chmod +x minecraft-server

Paste the following code into the script and make sure to modify the DAEMON_ARGS setting to reflect your memory allocation.

# Provides:          minecraft_server
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Minecraft server debian init script.
# Author: Daniel Sokolowski

# You can use this as a template or symbolic link it into `/etc/init.d` on Debian system

# PATH should only include /usr/* if it runs after the mountnfs.sh script
DESC="Minecraft Server"
SCREENNAME=minecraft-server # the session screen game given

# the -Xincgc options enable incremental garbage collector which slows 
# execution but makes  more memory efficient. 
# -Xmx1024M is the recommended minimum

DAEMON_ARGS="-DmS $SCREENNAME java -Xincgc -Xms32M -Xmx304M -jar /usr/local/minecraft-server/$NAME nogui" 
 # Lowest memory limit used was about 80M on fresh start.
 # For screen we use `-DmS` instead of -dmS since -D dosen't detach the screen so our pid 
 # file created by start-stop-deamon is correct. 

# Exit if the package is not installed
#[ -f "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Function that starts the daemon/service
  # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon -c $DAEMONUSER -g $DAEMONGROUP -u $DAEMONUSER --start --verbose --background --chdir /usr/local/minecraft-server/ --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- $DAEMON_ARGS
        echo "start-stop-daemon -c $DAEMONUSER -g $DAEMONGROUP --start --verbose --background --chdir /usr/local/minecraft-server/ --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- $DAEMON_ARGS"
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.

# Function that stops the daemon/service
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        sleep 5s
        return "$RETVAL"

# Function that sends a SIGHUP to the daemon/service
do_reload() {
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
        return 0

case "$1" in
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        # If do_reload() is not implemented then leave this commented out
        # and leave 'force-reload' as an alias for 'restart'.
        #log_daemon_msg "Reloading $DESC" "$NAME"
        #log_end_msg $?
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        log_daemon_msg "Restarting $DESC" "$NAME"
        case "$?" in
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                # Failed to stop
                log_end_msg 1
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3

Activate the startup script and start the server by executing the following commands:

# update-rc.d minecraft-server defaults
# /etc/init.d/minecraft-server start

More Resources

Visit Bukkit for a wealth of information and plugins and feel free to contact me at webdesign.danols.com

Saturday, May 26, 2012

SIP Voip Multiline Client

Receive call from multiple SIP accounts using one client.

Finally found a decent free, no hidden costs, and open source VOIP multi line line client Linphone.

It works rather well, doesn't look like dogs breakfast, hasn't crashed yet, and best of all it's also a multi platform client - it will run on your Blackberry, Android, iPhone, Windows and Linux. So in a nut shell if you have multiple sip accounts or run your own PBX system like FreeSWITCH it does the job, and it does it well.

Yes you can thank me, but real thanks should go to Yasuro's Blog, I just got legendary googlefu.

Wednesday, May 23, 2012

Directory Size Overview in Linux

Visual console based directory size overview

If you google how to get directory size list in linux you most likley find a page that tells you to use the following command:

du -sh * | sort -nr

Or to limit only to the top 10:

du -sh * | sort -nr | head -10

However this is cumbersome and not very visual. There are two awesome solutions to this dillema: NCurses Disk Usage and Midnight Commander; the former just let's you explore the sizes of yoru folder whereas the latter is a complete and very popular system explorer which comes with an options to calculate directory sizes.

To calculate sizes in Midnight Commander press 'Shift +' to select all and choose 'Command' > 'Show directory sizes'

These programs are available as Debian packages and I suggest you install both.

Tuesday, May 22, 2012

Opera SOCKS Proxy Setup Issues

SOCKS error: Connection closed by remote server

When setting up SOCKS only proxy in Opera web browser make sure to specify the IP address instead of your fully qualified domain name (FQDN). Using a host name will not work and Opera simply fails to connect to the proxy server.

Sample working setup screen shot with a Dante proxy server , note that HTTP, HTTPS, FTP, SSH options are left blank.

Bug DSK-364301 has been filled with Opera, if it has been a while since this post and the issue still not fixed feel free to add your word of encouragement by emailing DSK-364301@bugs.opera.com :)