Archive for category Coding/Development

Ubuntu 11.04 fsck/MOTD bug/issue

Recently this message popped up on the MOTD of the Ubuntu servers on EC2:

*** /dev/xvda1 will be checked for errors at next reboot ***

After proceeding to do a fsck and restarting, the message still kept appearing. After some debugging with wk, it apparently was due to a stale fsck-at-reboot file left around causing the message to keep popping up.

Here are the steps I used to make sure they stopped popping up again:

sudo touch /forcefsck
sudo shutdown -r now
sudo rm /var/lib/update-notifier/fsck-at-reboot
cd /usr/lib/update-notifier/
sudo ./update-motd-fsck-at-reboot
sudo rm /forcefsck

Thanks wk!

, , , , , ,

No Comments

Installing MySQL 5.5 on Ubuntu 11.04 (Natty)

Steps I used to get MySQL 5.5 working on Ubuntu 11.04 AMD64 (behind Aptitude’s back sadly since it’s still not packaged up due to copyright statuses..):

  • Download the following from here.

mysql-common_5.5.13-2_all.deb
libmysqlclient18_5.5.13-2_amd64.deb
libmysqlclient-dev_5.5.13-2_amd64.deb
mysql-client-5.5_5.5.13-2_amd64.deb
libmysqld-dev_5.5.13-2_amd64.deb
libmysqld-pic_5.5.13-2_amd64.deb
mysql-server-core-5.5_5.5.13-2_amd64.deb
mysql-server-5.5_5.5.13-2_amd64.deb

  • Run the following to remove older versions of MySQL client/server:
sudo aptitude remove mysql-client mysql-client-5.1 mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1 mysql-server-core-5.1
  • From the directory you downloaded the files above to:
sudo aptitude install libmysqld-dev
sudo dpkg -i mysql-common_5.5.13-2_all.deb
sudo dpkg -i libmysqlclient18_5.5.13-2_amd64.deb
sudo aptitude install zlib1g-dev
sudo dpkg -i libmysqlclient-dev_5.5.13-2_amd64.deb
sudo aptitude install libdbi-perl libdbd-mysql-perl
sudo dpkg -i mysql-client-5.5_5.5.13-2_amd64.deb
sudo dpkg -i libmysqld-dev_5.5.13-2_amd64.deb
sudo dpkg -i libmysqld-pic_5.5.13-2_amd64.deb
sudo dpkg -i mysql-server-core-5.5_5.5.13-2_amd64.deb
sudo dpkg -i mysql-server-5.5_5.5.13-2_amd64.deb

Took me awhile of messing around to get the sequence right, hope this helps!

Reference/links from blog post/comments here.

, ,

7 Comments

Redirect HTTP to HTTPS on IIS behind an AWS ELB

In recent times I’ve had to handle the Microsoft stack (.NET) among other things. One of the things I’ve faced recently was redirecting traffic hitting the application running on IIS behind an AWS Elastic Load Balancer (ELB) from HTTP to HTTPS. Fairly easy on the Linux stacks which had nginx in front as a reverse proxy (just add a rewrite rule on your HTTP host to HTTPS), but after tinkering around a bit, finally got the correct rewrite rule working (with the help of IIS7′s .htaccess conversion utility).

The transform code you would want to stick into your Web.<transform>.config (was for a ASP.NET MVC project):

    <rewrite xdt:Transform="Insert">
      <rules>
        <rule name="HTTPS rewrite behind ELB rule" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions>
            <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
          </conditions>
          <action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" />
        </rule>
      </rules>
    </rewrite>

This assumes you have the IIS URL Rewrite module installed on your IIS server.

References:

http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7?page=1
http://serverfault.com/questions/304621/endless-redirect-loop-with-aws-elb-and-wordpress-site-using-wordpress-https-plugi
http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/index.html?SvcIntro.html

, ,

No Comments

Shrinking VMware VMDK files before distribution

Recently been researching and testing with VMware images for the deployment of our application at work which turned out to work pretty well (Ubuntu + Java 6 + MySQL + Glassfish). However, one thing which became bothersome was the overgrowing .vmdk images which didn’t seem to reduce in size even after file deletions were made in the virtual disk itself.

Again, Google came to the rescue for this, linking me to this site which gave a 2 step process for doing the shrinking. Do note that the instructions are for those who are using Windows as their host OS.

,

No Comments

Obscure Java error

Got a “java.lang.InternalError:Can’t connect to window server” while trying to get Glassfish up and running on a Mac G5 running Mac OS X recently at work which was pretty odd as our application and Glassfish do not fire up any GUIs. After some googling, problem was fixed by adding a ‘-Djava.awt.headless=true’ to the list of system variables.

Although it was fixed relatively easily, it seems rather odd that Java would actually try to access the X server even though I was running it through a SSH terminal window (PuTTY)..

No Comments

Eclipse IDE 3.3 (Europa) released

EclipseIf you’re developing in Java and have not used Eclipse before, you don’t know what you’re missing out. :)

Probably would test out the Web Tools project of the Europa release as web services and distribution seems to be my domain at work in recent times..

No Comments

Javascript setInterval() issues

I decided to use AJAX calls to get the browser to make keep-alive calls every 2 minutes (using setInterval) and somehow stumbled into an issue where it makes the call once, and then stops. After talking the Javascript and Flash god in the office, we found out that it was because the script goes out of scope and thus stops looping as it should.

A quick fix for this can be found here. It’s been working for me without any adverse effects since. ;)

No Comments

More geek humour

Came across quite a few recently..

No Comments

Error 1305

That was the error code which I encountered while trying to install Python on the server at work which ran on Windows Server 2003. The installer actually executed but threw that ‘setup file could not be found’ error just after selecting the destination directory for the install. Initial googling for this gave results which were along the lines of ‘clean the CD as it may be dirty’ didn’t make much sense since it was being installed from the hard disk itself!

Mr sysadmin AsenDURE didn’t have an answer for it either, so I went back to do more googling which one of them actually fixed it. Although the installer (msi) file was on the hard disk locally, it was in a network share which Windows Server 2003 disapproves of. After moving the file to an unshared directory, the install process was completed without any issues. That’s Windows I guess. ;)

Another thing which I’ve learnt after the first week is not to run services/applications which were built for *nix on Windows. I had heaps of problems in migrating CVS to SVN which would never have been an issue had it been a *nix box.

No Comments

MozSearch plugin

AsenDURE messaged me on MSN yesterday about having a search plugin for any site integrated into Firefox. After having a look at it, I gave it a shot and now this site has a search plugin which you can install into Firefox 2.0 and search directly from the search bar. ;)

Following the steps from here, your currently selected search plugin (by default Google) would glow blue when it automatically detects a search plugin. And the following screenshots on how to add and use it are rather self explanatory.

Adding it:
MozSearch_1

Using it:
MozSearch_2

There should be a 16×16 icon image for it, but I don’t have one for it now though. ;)

No Comments