• Subscribe to the RSS feed! RSS icon
  • Subscribe by Email
  • home
  • blog
  • dev
  • Recent Posts

    • Automatically upload screenshots in XFCE4
    • Zend Framework full page cache tips
    • No more Wordpress
    • Xdebug is full of awesome
    • Creating a chat bot with PHP and Dbus
    • A year in review: 2011
    • Notes on shell scripting
    • Listening to Dbus signals with PHP
    • Configuring 2 monitors with xrandr
    • A quick note on Dojo's data grids and dojox.data.HtmlStore
  • Recent Comments

    • Robert on Zend Framework full page cache tips
    • Stephen S. Musoke on Zend Framework full page cache tips
    • David on Zend Framework full page cache tips
    • Anon on A quick note on Dojo's data grids and dojox.data.HtmlStore
    • James on Communicating with Pidgin from PHP via D-Bus
    • Robert on A Zend Framework 2 EventManager use case
    • Jowee on A Zend Framework 2 EventManager use case
    • Jurian Sluiman on A Zend Framework 2 EventManager use case
    • Jurian Sluiman on A Zend Framework 2 EventManager use case
    • djozsef on Webkonf 2011 recap
  • Tags

    php, about, random, framework, zend, example, ubuntu, blog, site, zend framework, book, conference, me, python, wordpress, apache, introduction, lamp, linux, open source, review, script, setup, signals, ape, community, contributing, dbus, dojo, events, hack, mysql, netbeans, pidgin, plugin, pyqt, security, shell, svn, talk
  • Categories

    • Blablabla
    • Development
    • Free time
    • Places on the web
    • Programming
    • Software
    • Uncategorized
  • Archives

    • February, 2012
    • January, 2012
    • December, 2011
    • November, 2011
    • October, 2011
    • September, 2011
    • August, 2011
    • July, 2011
    • May, 2011
    • April, 2011
    • March, 2011
    • January, 2011
    • December, 2010
    • November, 2010
    • October, 2010
    • July, 2010
    • June, 2010
    • April, 2010
    • February, 2010
    • January, 2010
    • December, 2009
    • November, 2009
    • October, 2009
    • August, 2009
    • May, 2009
    • March, 2009
    • February, 2009
    • January, 2009
    • December, 2008
    • November, 2008
    • October, 2008
    • September, 2008

Archive for the 'Free time' Category

Benchmarking pages behind a login with ab

by Robert Basic on November 9th, 2011

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
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

example.com	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:

#!/bin/bash

COOKIE_JAR="/tmp/ab-login-cookie-jar"

echo "Logging in..."

curl -c $COOKIE_JAR -d username=user -d password=h4x0r http://example.com/login

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

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

ab -n 10 -c 10 -C PHPSESSID=$PHPSESSID http://example.com/loggedin

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.
Comments: None.

PHP User Group, Novi Sad, Serbia

by Robert Basic on March 24th, 2011

For almost a year now, whenever time allows it, I'm working on a side project of creating a community of PHP programmers from around here. One of the first steps was, is, a website called PHPPlaneta about which I wrote back in October. After bringing this website to a relatively steady position, time has come to take another step: creating a PHP User Group! I'm really good at naming things so it is called "PHP User Group Novi Sad", or pugns for short.

Actually I really don't know what one has to do to create a user group, but I'll just improvise along the way. So far, the date, time and the place for the first meeting is set: April 5th, 6PM, in a local coffee shop by the Danube river. A website thingy is also up: pugns, which is currently just a simple HTML page, but things will improve on that front too. The page of pugns is intentionally under a "directory", because I'd love to host information about other PHP user groups from around here on the phpug.phpplaneta.net (sub)domain. It'd be nice to keep all relevant information under one "roof".

Sooo... This will be an interesting ride, hope it'll turn out fine :)

Of course, if anyone has some advice, tips and tricks about organizing user groups please do share them, that would be highly appreciated :)

Tags: meeting, pugns, user group.
Categories: Blablabla, Free time.
Comments: 1 comment.

2009 in a few words

by Robert Basic on January 2nd, 2010

In 2009 some good stuff happened and some bad stuff happened. All in all, a crappy year. Hopefully, this year will be a lot better...

I graduated on June 26th, the topic was a Python desktop application that communicates with a web service; both sending and receiving data is possible. Started working on July 1st at Online Solutions as a PHP dev and started to "officially" give back to the Open Source community by joining the ZF Bug Hunt Days - so far few minor patches submitted and applied. Wrote a review on a ZF book and another one on jQuery and PHP is in the drafts.

I ain't making plans for this year, cause I have failed miserably to realize my most important plan for 2009; I'll just improvise throughout the year.

Dear 2009 - up yours. 2010 - bring it on.

Happy new year!

Tags: about, fail, me, random.
Categories: Blablabla, Free time.
Comments: 2 comments.

Posterous

by Robert Basic on December 2nd, 2009

Yes, I have another web social networking thingy. I opened a posterous account. All those links, images, videos... which do not have their place here, will be posted there. That way, this blog will be always for development stuff and on rare occasions some longer personal writings.

You can find my posterous account at http://robertbasic.posterous.com/.

That is all.

Tags: random.
Categories: Blablabla, Free time, Places on the web.
Comments: None.

Ze Balkanic Tweetup

by Robert Basic on May 31st, 2009
Image representing Twitter as depicted in Crun...
Image via CrunchBase

It all started with this. Just another bored tweet from yours truly after the Sunday lunch. Followed by tweets like this and this and this and this and this. I'll just blame the fact that it's Sunday afternoon for the low response and that we geeks do have a life! (well, most of us... some of us...)

What's the point?

To meet. To really get to know those people behind the avatars and tweets and funny names like "Swizec".

Who can come?

Despite the "Balkanic" part in the name, anyone can come, no matter from where you are. Be friendly and don't hate the geeks (geeks run the world, so, beware). One rule only: you have to have a Twitter account. On the list below you'll read later are my friends from Romania, Hungary, Slovenia, Croatia, Bosnia and Serbia. If you have a friend from these countries and I don't know her or him, do not worry, she or he, can come too. As long as they have a Twitter account.

When?

In autumn. September, most likely, during a weekend, when no sane person should be working. Our dear Anca had a knee surgery recently and will have another one sometimes in July and we shall wait for her to fully heal and recover! (the hashtag is #wewaitforanca).

Update: I created a twtPoll on when to organize the #balkanictweetup Please give your vote!

Where?

Budapest, Hungary. Well, that's one suggestion. But it can be somewhere else. As long as we are together :-* It would be great to last at least one night (2 days that is), but I'm fine with more, too. One day is not possible. I expect lots of you guys there and it would be impossible to drink beers with all of you in one day only (oh yeah baby, we're gonna have lot's of beers). So, it would be great to find a cheap hotel where there are those fancy conference halls.

What will we do?

Chat (IRL!!!) and eat and drink and goof around and laugh and cry and sleep (NOT!) and take pictures and go do stuff and most importantly, we'll TWEET!!!1 There will be one special event that will be important for everyone to attend: we'll sit around in a big freakin' circle and introduce - stand up, say hi my name is Robert, aka @robertbasic and sit down (no need for the "and I'm a Twitter addict" part, we all know that).

We also can give talks on some silly topics. We can show off our works. We can sing odes to the Twitter Bird. We really can do what we want. The sky is the limit.

Other stuff of interest

The official hashtag is #balkanictweetup.

The Tweetup tagline is "Bring netbooks and beers."

The official #balkanictweetup Twitter account is @BalkanicTweetup.

Send all your ideas, comments, appeals to zebalkanictweetup at gmail dot com

I spent all my money on beers and women so if a good Samaritan wants to support us with buying a domain and hosting for this event that would be, like, very nice of you. You would have your own page on the official #balkanictweetup page where we praise you and your good deeds. The domain is bought by Vlad Georgescu. Thanks Vlad!

I am too lazy to make the list of my friends I promised earlier, so there will be no list for now. Sorry.

He, who likes this silly idea, drop me a love letter to zebalkanictweetup at gmail dot com with your real name (yes, Jozef, I mean, Swizec, you too!) and your Twitter username. I'll make a list based on that.

I gotta run now. Please, share your thoughts in the comments below.

Love,
Robert :-*

P.S.: Due to insane amounts of spam, I'm moderating the comments, so please wait while I approve yours. Thanks :)

Reblog this post [with Zemanta]
Tags: random, tweetup, twitter.
Categories: Blablabla, Free time.
Comments: 10 comments.
1 2 3 4 5 › »
Robert Basic © 2008 — 2012
Design & graphics by: Livia Radvanski
Coded by: Robert Basic
Home page last updated on November 30th, 2009.
Frameworks used: Zend Framework, Dojo, 960 Grid System