knightly

Blog Archives

Ubuntu 11.10 issues after fresh install

Update: 13-11-2011

I decided to give Ubuntu another try. After downloading and burning a fresh image. I did a clean install. And this time the result was a lot better then the first time. Maybe i just had a bad disk.

Unity still caused me issues. Mainly because i am running a dual monitor setup. And i wan to use a TwinView setup. This just does not seem to work at the moment. So i install GNOME Shell. And that seems to work a lot smoother with two screens. Even my sound issues have been resolved magically. Maybe i should stick with Ubuntu a bit longer.

This weekend i decided to finally try to upgrade Ubuntu to the latest version (11.10). And since the upgrade process was not working out for me. I had no other choice but to do a clean install. No problem. It was time for a clean install anyway.

After fighting my way through a pile of bad rewritable DVDs i finally managed to write to disc that didn’t halt in the middle of the install process. And finished the install quite quickly. No problem there.

The Lightgdm greeting instead of the old GDM interface was nice. I logged in. And then it hit me. O shit they hooked Ubuntu up with the Unity interface. The last time i upgraded Ubuntu that was the first thing i disabled. But my second screen wasn’t activated. So i decided to install the Nvidia drivers first. And then did a reboot.

After the system came back up. The desktop environment didn’t load anymore. And if i waited long enough the whole system would crawl to a halt. Damn! At this point i was getting sleepy. And didn’t want to spend the whole night poking around the system trying to fix this. So a bit of Google magic later i found this. Some issues related to the current Nvidia driver. So i upgraded to the 285.05 version


$ sudo bash
$ add-apt-repository ppa:ubuntu-x-swat/x-updates
$ apt-get update && apt-get upgrade
$ reboot

And after a reboot the desktop was fine again. Nice!

World of Warcraft

After that i installed wine and copied back the old files i already had installed previously. But World of Warcraft didn’t want to start anymore. And although i planned not to play for a while. This got me poking around. And of course couldn’t find a solution. So i downloaded a new game client from battle.net. And started a fresh install. But when the launcher came up. It crashed just like before. Tried it a couple more times. When i noticed it was crashing starting the download. SO i started poking around in the download settings. And disabled peer-to peer. And voila! It started working for me again.

Options > Downloader Preferences
(uncheck ¨Enable peer-to-peer Transfer¨)

Lets remove Unity!

Although i kind alike the Unity interface. It wasn’t running smoothly. And i was having some serious CPU load issues. So i decided to remove it once again. This time. It wasn’t as easy though. I followed the steps in this post. Only to come to the realization that its Gnome 3 i´m dealing with and not Gnome2. O well lets give it a try.

So after messing with the themes a bit. I got the normal look back. Now the only thing annoying left is the bottom bar. That has to go. And preferably moved to the second screen. This was surprisingly easy for a change. Start up DConfig Editor from the Applications menu. And navigate to.


org > gnome > gnome-panel > layout > toplevels

(then change)

monitor : 1
orientation : top

And fix the freaking keyboard

Sound still makes a crackling noise!

But at least i have a desktop that looks reasonably the same as my old and trusted Gnome2 one did.

Lack of better content

Just something funny for a change ;)

Ideas of March

This post has been waiting in my draft list for a few days already. And March is almost over. So better get it out now. Christ Shiflett has an good post about the fact that a lot discussions have moved from the blogosphere to twitter. And this is sad but true. Chris calls for a blog revival. Which i think is a great initiative. And i already blogged a bit more this month then i normally do. I have never been a big fan of twitter my self. Most of the time the stream of information is mind boggling. But i do follow a some interesting people. Which does keep me updated in what happens in the web development world. I prefer a good blog post over any twitter message though.

So Chris Shiflett’s idea is for people to create a blog post called Ideas of March that:

  • Lists some reasons why you like blogs (Read below)
  • pledge to blog more the rest of the month (Working on it)
  • share your thoughts on twitter with the #ideasofmarch hashtag (Done!)



I like blogs because ..
they offer me a platform where i can express my self without any limitations. And because more people tend to have this need to express them self. It leads to a great flow of valuable and creative information. Combine that with the ability to interact with a user base. And you have a great platform for having discussions. No need for rushed answers. You can just sit down and reflect your thoughts in a comment and start a discussion with the author. In short i offers freedom.

And ..
It’s also a great exercise platform. I myself are not native English speaker. So by blogging in English i tend to improve my own English language knowledge. Plus way more people speak English then Dutch. The second reasons is to improve once writing skills. Not that i have aspirations to become a write one day. but it never hurts to improve your skills.

Besides that it’s a great way to harvest your own thoughts over a period of time. And always have them at your disposal.

So if you read this. Write the Ideas of March post your self. And pledge to do more blogging this month. Some people who have already taken the time to express the thoughts on this initiative can be found below.

http://www.eschrade.com/page/ideas-of-march/
http://allinthehead.com/354
http://jontangerine.com/log/2011/03/ides-of-march
http://www.davidrhoden.com/eecore/index.php/weblog/ideas_of_march/
http://www.cvwdesign.com/txp/article/450/ideas-of-march
http://jeremycook.ca/2011/03/16/ideas-of-march/

Moving to Amazon’s Cloud or not?

Finally back online again. Somewhere today the site went down. And i couldn’t reach the server. Which resulted in me jumping the gun and write an pissed off tweet about Amazon’s EC2 service. Which turned out to be false. After i noticed i tried to login to the AWS dashboard. But instead of my running instance i was presented with a validation screen. I had to validate my account by phone. That’s weird. I came to conclusion to early and thought Amazon had suspended my account for what whatever reason possible. It turns out it’s the annoying Amazon password bug that bit my ass. After poking around i came to the conclusion i have two Amazon accounts on the same email address but with different passwords. One has EC2 enabled the other doesn’t. Good to know. But the site was still down. So on my way home i missed a call from the Amazon support desk (really more companies should act like Amazon does). But got into an email conversation with them later on. After i apologised for the tweet. The Dev at Amazon figured out the server was running out of resources and was swapping. And just couldn’t do much more then that. Only a reboot resolved the issue. Hey! It’s not a micro instance for nothing.

I might as well write a post about the move to the Amazon Cloud late last year. Ever since this website went up in 2008. It has been running on one of my own servers. And this has done the job well for two years. Some people would say if it ain’t broke don’t try to fix it. But i like to try out new things. And running a server isn’t cheap. So if i can find a more affordable way of hosting this site i may be interested enough to move. So where do i move this site too. Some other hosting provider? Let’s try something different and host it from the cloud. I didn’t really want to go over the whole hassle of finding a suitable hosting provider. And i was doing some small project with Amazon Web-services. So my choice was made quite easy. Let’s try the wide array of options Amazon’s Web-services have to offer.

No way i was going to pay a fortune to set something up. So after some reading and some googling of course. I came to the Free Usage Tier page. This basically is a way to get familiar with the AWS system. And it offer quite a nice set of features to use. One year of free usage as long as you don’t go over the limit set for this microsystem.. Read more about the terms here . Some of the highlights are:

AWS Free Usage Tier (Per Month):

  • 750 hours of Amazon EC2 Linux Micro Instance usage (613 MB of memory and 32-bit and 64-bit platform support) – enough hours to run continuously each month*
  • 750 hours of an Elastic Load Balancer plus 15 GB data processing*
  • 10 GB of Amazon Elastic Block Storage, plus 1 million I/Os, 1 GB of snapshot storage, 10,000 snapshot Get Requests and 1,000 snapshot Put Requests*
  • 5 GB of Amazon S3 storage, 20,000 Get Requests, and 2,000 Put Requests*
  • 30 GB per of internet data transfer (15 GB of data transfer “in” and 15 GB of data transfer “out” across all services except Amazon CloudFront)*
  • 25 Amazon SimpleDB Machine Hours and 1 GB of Storage**
  • 100,000 Requests of Amazon Simple Queue Service**
  • 100,000 Requests, 100,000 HTTP notifications and 1,000 email notifications for Amazon Simple Notification Service**
  • 10 Amazon Cloudwatch alarms**

In addition to these services, the AWS Management Console is available at no charge to help you build and manage your application on AWS.

So that looks like a pretty nice offer from Amazon. Of course you don’t have to expect some multi core system waiting for you. But maybe it will do. I was interested enough to give it try. After logging in the place to start is the ec2 control panel. The first thing i did was create a new instance running Debian.

Make sure the right region is set in the region box. I logged in after creating my first image and couldn’t find it anywhere. Because the default region was not the one i used. From the dashboard i can just click the launch instance button and it gives me a list of different images to use as a virtual instance. There is plenty of flavour to choose from. I picked a community Debian instance.

The next screen is important because it sets the instance type to use. The Micro (t1.micro) is what i am looking for this time.

The rest of the install is quite self explanatory. At the end somewhere download the private key that will be used for setting up an SSH connection to the instance.

The next thing i did was setup a EBS storage volume for .. well .. storage. I made the choice for the EBS volume simply because it scales well. From the ec2 dashboard go to EBS instance and then create instance. Simply select the size and / or load it up with an image.

That pretty much does it. For the ec2 dashboard. The only thing left to do here is setup an elastic IP address so the instance is reachable from the outside world. This is basically assigning a ipv4 address to the instance. Click the elastic IP link and then allocate new address.

If all is well i should be able to login by SSH.

$ ssh -i [key name].pem ec2-user@[ip address].eu-west-1.compute.amazonaws.com
$ sudo bash

That’s it. I configured the instance using Zend Server and didn’t even bother to setup an RDS storage engine. I just installed MySQL. And used that for the site. Last but not least. Open port 80 on the firewall. This is easily done from the EC2 dashboard. I also opened up ports 10081 – 10083 bound to my home IP address so i can control Zend Server.

I was quite impressed with the AWS interface and the possibilities. But the cost is pretty high. The first month was nearly free. But while traffic keeps growing the cost keeps rising. This ended up me paying more for a single instance a month then for a complete server on which i can run multiple sites. So while extremely easy to use, flexible and just plain cool to work with. It’s not for this site. I thank Amazon for the available possibilities. And the Support i had today. But i am moving back to my own server as we speak.

VMware Workstation Listen to voice of the customer

A while back i was contacted by Vijay Laxmi. Vijay is a Sr Partner Marketing Manager over at Zend Technologies. And she was interested in doing a podcast like interview about the brand new and shiny VMWare & Zend Studio integration. And because i am a big fan of this feature. I didn’t see why not. So we had a few chat sessions. Along the way Joshua Solomin from Zend and Michael Paiko from VMWare joined the party. And after some preparation we recorded the session. Considering i have never been much of a speaker. This was quite fun to do.

Michael send me the end result. And everybody seemed happy with it. After that life resumed and i have been incredibly busy every since. So i kinda forgot about the whole thing. Till Vijay mailed me today (ty! Vijay). VMWare put the recording on their website. And a customer mailing has been transmitted over the wire. Cool stuff!

2011-02-07 VMware-Zend VOC Podcast

Dark theme for Zend Studio 8

Because i was so happy with my new 3 monitor configuration. I decided to refresh my development environment as well. Normally all my files would reside in the Devspace older in my user folder under the /home directory. Now i used a new 500 GB SATA drive and formatted it EXT3. Moving your workspace in Zend Studio has the minor inconvenience that the local settings like fonts / syntax colours are lost. I still haven’t found a way to export this. So i decided to take this opportunity to create a nice new dark theme.. My friend Bart (still no blog?) was friendly enough to let me know how to export the theme related data in ZS. And was nice enough to send me his zenburn theme.

File > Export > General > Preferences

File > Import > General > Preferences

Bart’s zenburn theme:

Most developers i know don’t seem to care much about the colour of their screen and the font they use. But considering the fact that i spend an insanely amount of time behind a screen. It would be nice if this environment i am in all day put the least amount of constrained on my eyes as possible. So i choose to take time and configure this for optimal viewing pleasure. This starts with the font. For years i have been using the Envy Code font by Damien Guard inside my IDE. This all started i think with a post by Jeff Atwood It’s a great font that is extremely easy to read even for terminals. Although still in beta. I advice people to use it when possible.

The second thing i configure are the colour schemes my IDE uses. The standard colour always has a white background. White makes sure things are clear. But staring at a white screen for more then 6 hours always resulted in headaches for me. So the darker the better. And with a dark background you are forced to change the rest as well.

Changing the font is first

General > Appearance > Colors and Fonts
Font : Envy Code R Bold (11 pt)

Second up are some general text editor colours

General > Editors > Text Editors
Line number foreground : #787878 (120, 120, 120)
Current line highlight : #35353D (53, 53, 61)
Background color : #25252D (37, 37, 45)

And finally the PHP syntax coloring

PHP > Editor > Syntax Coloring
Decprecated : #000 (0, 0, 0)
Fields : #FFFFFF (255, 255, 255)
Heredoc : #008282 (0, 130, 130)
Keyword : #DE5727 (222, 87, 39)
Multi-line comment : #557F5F (85, 127, 95)
Normal : #FFF (255, 255, 255)
Number : #FFCECE (255, 206, 206)
PHP tags : #DE5727 (222, 87, 39)
PHP Doc : #FEC601 (254, 198, 1)
PHPDoc Comment : #FEC601 (254, 198, 1)
single line comment : #FEC601 (254, 198, 1)
static fields : #FFFFFF (255, 255, 255)
static methods : #FFFFFF (255, 255, 255)
String : #B3C0C8 (179, 192, 200)
Task Tags : #FEC601 (254, 198, 1)
Variable : #0B91B7 (11, 145, 183)

The result can be viewed below

There are much more configuration options to do but for now this is what i came up with. Setting up the theme is a since in ZS. But one thing bothered me. The function / property name highlighting when you select an element inside the IDE. Was a very light colour. And this made it impossible to read the contents of the selection.

So after searching for a while and setting every possible setting in the configuration tabs. I finally figured out how the set the colour for these two actions. This is done from the Annotations setting in the Text editors panel under the general tab. The two options to change are PHP elements read / write occurrences.

For now i settled with a dark colour. But maybe i will change this in the future since it is not very readable

That’s it for now. This of course only sets up the PHP environment. The syntax colours for XML, HTML, CSS and Javascript still have to be changed. But i will leave it at this.

Extending my desktop

Although i am blessed with a nice double 22 inch monitor configuration. I have had this spare monitor sitting on my desk for a while Just asking to be added to the setup. Yesterday i gave it my first shot. It didn’t really go as planned but the result is fine for the moment.

Over the past years i have been a happy user of Compiz and the emerald theme manager. So these were two things i wanted to keep. Well that’s not going to happen. After playing around with xorg.conf for a couple of hours i just couldn’t manage to get the configuration i was looking for.

1. Single X Screen on the left
2. Two twinview screens on the right.

I managed to get Compiz to work with the 3 monitor setup. But this resulted in either having one large desktop extending the two 22 inch monitors. Or 3 screen using Compiz but with no possibility of sharing data between the screens. That just sucked. I have to admit this is one thing that just works better on Windows.

So the next was Xinerama. This meant switching Xinerama to “1″ in the config and restart X. Voila! Everything works. Well not everything. I have no Compiz effects and no emerald themes. So it’s slightly more ugly looking but it functions perfectly. So i will be keeping this config for now. Until i can either figure out how to get 3 monitors working using Compiz. Or get some effects / cool themes working while using Xinerama.

Best wishes

As the year is coming to an end. I realise i haven’t posted anything this last month. And i have load of things on my mind. But no time. I’ll be heading over to a friends house for the remaining part of this year. So i wish everybody a good and happy 2011. Don’t drink to much and be careful with fireworks.

On a side note: did anybody check out the new php.net layout? i think Hannes and Co are doing a great job!

(to see the new layout go to php.net/my and flip the beta switch at the bottom of the page)

Moving from Subversion to GIT

Last weekend was a PFZ meeting. And for this day a few interesting workshops were planned. I mainly was looking forward to the GIT (Git for Subversion Users) talk by Stefan Koopmanschap. And the Dependency Injection presentation by Berry Langerak I didn’t make it too the last one. But learned a lot while doing the GIT workshop with Stefan.

For the last few months i have wanted to take a look at git. But it just never really took the time to sit down and do it. So this opportunity was there at the right time. Although my laptop died halfway through the workshop. I still was able to make it through the whole session together with Joost van Veen. Thanks man. We had a great time. And it was eye opening. Stefan gave a good talk. Helped out where possible. And besides a small Github glitch. It was a successful day.

So successful that i decided to make the switch from Subversion to GIT. Below are some of the steps i took.

The main reasons for me to make the switch

  • Distributed structure make it easy to work from any place. connected or not.
  • Stashing
  • Speed and cleaner folder / file structure
  • Real tags

That’s all for now. but this list will grow. I am sure!

Setting up a GIT server

I decided to go for my own GIT server instead of Github. That’s just the way i like it. Full control.

$ aptitude install git-core

Now all we have to do is create a user for git operations. And set the correct permissions.

$ adduser git
$ mkdir /home/git/.ssh
$ chown -R git:git /home/git/.ssh
$ chmod 700 /home/git

If we want to create a new remote repository. We log in on the git server through SSH and setup a new repository like this.

$ ssh git@git.domain.tld
$ mkdir repository.git
$ cd repository.git
$ git –bare init

That’s all. we now have all we need to connect to git remotely and do some work. But now first we need to import the old Subversion repository. I have found two solid methods for getting the job done.

Import a SVN project into GIT with git-svn

First of install git-svn

$ sudo aptitude install git-svn

Before we start the importing. It’s good practice to create an author mapping file. So the SVN commiter names match the GIT ones. This is done by creating a simple text file like so.

$ touch authors.txt
$ echo “m0s = Thijs Lensselink ” > authors.txt

Importing the existing tags and branches is done by adding the –stdlayout switch

$ git svn clone –stdlayout -A authors.txt svn+ssh://user@svnhost/repository repository.git

The problem with this method is that tags and branches are not created properly. I decided to go for the second method down here.

Import a SVN project into GIT with svn2git

For this to work we first need ruby and some gems packages.

$ apt-get install git-svn ruby rubygems
$ gem install svn2git –source http://gemcutter.org

Create the local repository and import the files from SVN

$ mkdir repository.git
$ cd repository.git
$ /var/lib/gems/1.8/bin/svn2git svn+ssh://user@svnhost/repository –authors ../authors.txt

Show the current selected branch

$ git branch
* master

Show all branches. Notice the trunk branch

$ git branch -a
* master
trunk

List all tags

$ git tag -l
v1.0
v2.0

That seemed to work pretty good for almost all projects. Some projects didn’t have the main trunk in SVN. So to import these just add the –rootistrunk switch.

And while this info is still available in my brain at the moment. I will write down some of the workshop material for future reference.

Setup local Development environment

Create directory somewhere that will serve as the local repository. And run init to create the basic git project structure.

$ mkdir [project name]
$ cd [project name]
$ git init

Now we have a fully functional git repository. We can do anything with (add, commit, tag, branch, push, etc.) The first things to do when starting out is setup the user name and email address of the developer using this repository. This is good when looking though the GIT project logs later on. Also handy to set the core editor to the most convenient editor available.

$ git config –global user.name “Thijs Lensselink”
$ git config –global user.email “email@lenss.nl”
$ git config –global core.editor vi

The repository exists out of a origin and a master branch at this moment. The origin refers to the current repository location. And the master refers to the current repository state. Like HEAD in CVS and SVN. Let’s add a file for testing.

$ touch index.php
$ git add index.php (or add *)
$ git commit -m “Commit something”

Working on a local repository is nice. but we want to save it on a server of course. For this we need to set a repository location. We can do this in two ways. We can overwrite the origin or add a new location. Let’s try the first one.

$ git remote add origin git@git.domain.tld:repository.git

Setting up the remote git repository and push the changes

All changes to this repository are made locally so far. Let’s try and push them to the git server. The only problem here is. I haven’t found a way to create repositories remotely. So we have to log in to the server here and create the repository.

$ ssh git@git.domain.tld
$ mkdir repository.git
$ cd repository.git
$ git –bare init
$ exit

Back on the client side we can now do a push an see what happens.

$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 232 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.178.24:foo.git
* [new branch] master -> master

if you get this error:

error: src refspec master does not match any.

This means there is no master branch yet. This happens when the repository was created with the –bare switch. You have to commit a change first before you can push anything to the remote repository server.

That’s all. We now have a working GIT server and local repository. All that is left is to do some serious development work. On the other hand, before i forget. i will use this space to rehash Stefan’s workshop for future reference.

Tagging

Let start by looking at the way git creates tags. First of there are two types of tags lightweight and annotated. The lightweight version is nothing more then a pointer to a specific commit. It’s like a branch that doesn’t change. Annotated tags are a bit different then their lightweight version. And for sure different from the tags in Subversion. A tags in git contains the following data

  • checksum
  • tagger name
  • email + date
  • tag message
  • GPG signed

Creating an annotated tag for version 1 looks something like this

$ git tag -a v1.0 -m “Creating a tag”

Dispaly a certain tag

$ git show v1.0

I haven’t had time to look into working with signing of tags. So maybe i will add an entry about that later on.

Branching

A repository can have multiple branches. And switching between branches is a since in git. Branching is much like
it is in Subversion.

Create a new branch from master called foo

$ git branch foo master

Display all branches available. The current branch is highlighted by the * sign

$ git branch
* master
foo

Changing branches in git is a piece of cake.


$
git checkout foo
Switched to branch ‘foo’

There is not much more to branching.

diff, merge and delete branches

When adding a new feature to an existing code base. It’s good practice to create a branch before you start editing. And after everything is done and the change is stable. The branch can be merged back into the master.

First let’s check if there is a difference between the newly created branch and the master.

$ git diff foo master
diff –git a/touch.foo b/touch.foo
deleted file mode 100644
index 257cc56..0000000
— a/touch.foo
+++ /dev/null
@@ -1 +0,0 @@
-foo

Some changes have been found so let’s merge them in the master branch

$ git checkout master
$ git merge foo master (or git pull foo master)
Already up-to-date with 12d2f9cebaf71a580b021a8eeddc38f267b69e53
Trying simple merge with 4d3dff7e0d2a26302a5884e763fd7a48f5ab4437
Merge made by octopus.
touch.foo | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 touch.foo

with git pull it is possible to import branches from other repositories

When done with the changes. And everything is pushed to the remote git server, we can remove the ‘foo’ branch

$ git branch -d foo
Deleted branch foo (was d9a8c76).

That’s all for branching right now.

Stashing

One of my personal favorite the stash command. Imagine working on a project. And somebody asks you to make a small change. In subversion i needed to do a new checkout and work on that. This can be quite slow and cumbersome. In git this is solved elegantly by using the stash command.

$ git stash
Saved working directory and index state “WIP on master: 648f347… foo”
(To restore them type “git stash apply”)
HEAD is now at 648f347 foo

This saves a copy of the working state and let’s you do changes on a fresh base. After your done get back to your work by doing

$ git stash pop (or apply)

With pop you push the stash back to the master. With apply the changes will first be applied to the master before restoring the work state.

Working with other repositories

Clone a repository from a remote GIT server

$ git clone git@git.domain.tld:repository.git ./project2

Clone a local GIT repository

$ git clone ./project ./project2

Now it could be possible a friend or a remote community member without write access made a few changes to his / her remote repository. And wants them on the global remote GIT server. This can be done by pulling the code.

First add the new repository location

$ git remote add friend git://githubaddress

And then fetch the remote changes

$ git fetch friend

This only fetches the changes. but does not apply them to the master. Apply them

$ git pull friend master

updating remote repository

$ git push friend master

That’s all i can remember right now.

NSD unknown key/algorithm

As i was trying to get ready to convert my SVN repository into a GIT repository. I noticed one of my DNS slave servers wasn’t responding. A look at the log files showed something was wrong.

The master server showed:

[1289693117] nsd[6899]: error: query tsig unknown key/algorithm

While the slave displayed the following message

[883615032] nsd[6624]: error: xfrd: zone [ domain ] received error code REFUSED from [ ip address ]

After an hour of searching Google and not hitting any useful result. I rebooted the machine. And was presented by forced hard disk check. The damn thing seemed to be out of sync. And when rebooted. The date was off by a few centuries.

So after resetting the date and restarting NSD. The problem was resolved.

$ date -s ’14 NOV 2010 01:37:00′
$ /usr/sbin/nsdc update > /dev/nul 2>%1
$ /usr/sbin/nsdc patch > /dev/nul 2>%1
$ /usr/sbin/nsdc rebuild > /dev/nul 2>%1
$ /usr/sbin/nsdc reload > /dev/nul 2>%1
$ /usr/sbin/nsdc notify > /dev/nul 2>%1

Stop ACTA