Robert Basic's blog

Archives for November, 2011

Upgrading to Fedora 16

by Robert Basic on November 12, 2011.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

Decided today to upgrade my laptop to Fedora 16, which was released a few days ago. I first switched to Fedora (with XFCE as the desktop environment) from Ubuntu in August, I think. An excellent decision as it is working really great for me. XFCE is also great, really happy that I made this switch.

Anyway, the upgrade from Fedora 15 to 16 went smoothly (although a bit slow, thanks to my shitty internet connection), using the PreUpgrade script/process. I was a bit sceptical about doing an upgrade and not a cleanstall, but gave it a shot after all (note: every time I tried a dist-upgrade with Ubuntu it failed miserably). PreUpgrade was downloading stuff for a bunch of hours and (about) an hour of installing them, the upgrade was… Done. Fedora 16 just booted up and I was using my laptop just as before.

I did the post upgrade steps from the above linked article, but the yum distro-sync step failed; it was complaining something about a “Transaction Check Error” for a libdvdcss package. I simply disabled the software source, re-run the distro-sync, it did it’s thing and then re-enabled the source.

The second thing that “wasn’t working” is that Apache and MySQL were not starting on bootup, so I ran chkconfig for both of ‘em:

$ chkconfig --levels 235 mysqld on
$ chkconfig --levels 235 httpd on

Lastly, grub was upgraded to grub2. It was working fine, just that it was showing the grub menu on startup, which is a bit silly given that I’m running only one OS on this machine. Anyway, added the following lines to /etc/default/grub:

GRUB_TIMEOUT=0 # I actually edited this line, from 5 to 0

and ran:

$ grub2-mkconfig -o /boot/grub2/grub.cfg

I also thought for a while that there was an issue with my wifi, that it’s dropping connection randomly, but it only happened once, so I don’t know what to do with it.

Happy hackin’!

Tags: fedora, grub2, upgrade, xfce.
Categories: Development, Software.

Contributing to Zend Framework 2

by Robert Basic on November 10, 2011.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

Today a pretty big news hit the interwebs: as of today, the CLA is not required any more to contribute to Zend Framework 2! This means anyone can issue pull requests and submit patches to the new version. Note that if you want to contribute to Zend Framework 1, you still need a signed CLA. I’ve decided to write a quick post with additional information and links, to make it easier getting started with the contributions!

Back in July I wrote a post on helping out with Zend Framework 2, so consider this post as a second part of that post ;)

The development is on git. The original repo is, while the one on Github is a mirror which gets updated twice a day. Not that it matters much, as everyone forks the Github version and sends pull requests against that.

The issues are kept on a Jira instance: Please make sure you are actually on the Zend Framework 2 project, as we have a separate project for ZF 1. Create an account on Jira and off you go. If I’m not mistaken, it is connected to the ZF wiki, so you can use that too.

All ZF2 related stuff on the wiki is located in it’s own section. It’s full of goodies, so take your time to browse it.

We hold biweekly IRC meetings: every second Wednesday, 17:00 UTC. The next one is going to be on November 23rd. Prior to each meeting we set up an agenda, vote on it, decide who will be moderator and then just discuss whatever is there to discuss. The meetings are held on the #zf2-meeting channel, on Freenode. All agendas and logs from previous meetings can also be found on the wiki.

We have a separate #zftalk.2 IRC channel devoted to discussing all things ZF2!

Subscribe to the mailing lists; you’ll be especially interested in the “Contributors” section; all big and small things are discussed there.

A new “thing” introduced to the ZF ecosystem are the RFCs. We’re using those when a new architecture is discussed or a rewrite/refactor of an existing component is to be done.

New components need to go through a proposal process. The proposal process is rumoured to get an overhaul, but (hopefully!) it won’t be going away.

There is also a blog set up, so be sure to subscribe to the feed.

Great and exciting times are ahead of us and I welcome all new ZF contributors! :)

Happy hackin’!

Tags: cla, contributing, zend framework 2.
Categories: Development, Programming.

Benchmarking pages behind a login with ab

by Robert Basic on November 09, 2011.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

Tonight I decided to relax a bit and what better way of relaxing is there for a geek then to do some bash scripting?! So for fun and no profit I decided to try and benchmark pages with ab, Apache HTTP server benchmarking tool, which are behind a login. Turns out, it’s pretty easy after reading some man pages ;)

ab’s help pages gives a few possible leads. We can POST data with the -p option, which would be great if we would like to benchmark the login process itself. But, we want to test the page after the login. So we’ll need the ab’s -C option, which allows for passing cookies in cookie-name=value pairs.

The login process itself is done with curl as it allows us to POST data to a server and store cookies received from the server in a cookie jar. curl writes the cookies in a Netscape cookie file format, whatever that is. Sample line is:

# Netscape HTTP Cookie File
# This file was generated by libcurl! Edit at your own risk.	FALSE	/	FALSE	0	PHPSESSID	[RANDOM_SESSION_ID]

From this output we’re interested in the [RANDOM_SESSION_ID] cookie value, as the cookie name is simply PHPSESSID and we can just hard-code it. To get the value, we use some obscure *nix magic: grep and cut. grep to grep the line with the PHPSESSID cookie and cut to cut out the 7th column from that line. Easy!

Now that we have the value of the cookie, we just pass it along with ab and done! We’re benchmarking pages behind a login.

The entire script is:



echo "Logging in..."

curl -c $COOKIE_JAR -d username=user -d password=h4x0r

echo "Getting the session id..."
PHPSESSID=$(cat $COOKIE_JAR | grep PHPSESSID | cut -f 7)

echo "The session id is:"
echo "=================="

ab -n 10 -c 10 -C PHPSESSID=$PHPSESSID

The script is also on Github here.

Tip: use ab’s -v option to test for HTTP codes and/or redirects to see if you are really on the page you want to be.

Happy hackin’!

Tags: ab, benchmarking, console, cookies, curl, script.
Categories: Development, Free time, Programming.