Archive for the 'Development' category

Changing Jenkins' home directory on Ubuntu

published on August 04, 2011.

I’ve started to play around with Jenkins yesterday and I kinda don’t like that it’s default home directory is /var/lib/jenkins so I changed it to /home/jenkins, so I’m throwing the steps needed out here for future reference.

First, stop jenkins:

robert@odin:~$ sudo /etc/init.d/jenkins stop

Create the new home directory and move existing stuff from the old home to the new one:

robert@odin:~$ sudo usermod -m -d /home/jenkins jenkins

Now, I didn’t manage to set the ENV JENKINS_HOME to the new home, it was always using the old one, so I edited the init.d script:

robert@odin:~$ sudo vi /etc/init.d/jenkins

and in the “DAEMON_ARGS=…” line change JENKINS_HOME env to –env=JENKINS_HOME=/home/jenkins. In the end the whole line reads something like:

DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=/home/jenkins --output=$JENKINS_LOG --pidfile=$PIDFILE"

Update on September 20th: Vranac blogged about how to change the JENKINS_HOME properly

Start jenkins

robert@odin:~$ sudo /etc/init.d/jenkins start

and go to http://server:port/configure and verify that jenkins works as before and is using the new home.

Happy hackin’!

Tags: hack, jenkins, ubuntu.
Categories: Development, Software.

Helping out with Zend Framework 2

published on July 27, 2011.

OK, here are some tips and resources so you can start helping out and contributing to Zend Framework 2.0 :)

First, here’s a nice wiki page with some links on how to start with Zend Framework 2. Be sure to check out the Zend Framework 2.0 patterns tutorial slides and the webinar on the same topic (you need to log in to watch it, but the registration is free, so no excuses).

The development is happening on github, so that’s a nice starting point to get your hands dirty with some code. On the wiki there’s a Zend Framework Git Guide to get you started. Pay close attention to the “Working on Zend Framework” chapter.

As Matthew noted in this thread you can:

Fix unit tests!

Once you forked and cloned the github repo, cd to the zf2/tests directory and simply make the tests there pass! Of course, there are a lot of tests there, so you might want to start with something easy and small; for example I picked the Zend\Dojo component :P

Anyway, once you’re in the tests directory, just type:

robert@odin:~/www/zf2/tests$ phpunit --verbose Zend/Dojo

or:

robert@odin:~/www/zf2/tests$ phpunit --verbose Zend/Dojo/DojoTest.php

and watch the tests pass or fail. If they pass, good, if they fail, try to fix them and make them pass! I tell you, it’s fun! By using the “–verbose” flag you’ll get more (helpful) info about the tests.

Port Zend\Service

I haven’t look into it yet, so just quoting from the mailing list:

  • Port Zend\Service classes that interest you to namespaces, new

    exception usage, etc.

but I believe if you start from the tests for the services too, you should be all set!

Port ZF1 patches to ZF2!

Even if ZF2 is under development, ZF1 is still taken care of: that means, a lot of patches are present in ZF1 which are not in ZF2 (cause they were added after ZF2 branched off of ZF1, obviously…). Some patches will probably not be needed thanks to the rewrite, but some patches will be! So head over to the issue tracker, search for recently (where recently is, say… this year?) resolved and fixed issues, see if they have a patch attached, if yes, open the patch, see if that patch is already in ZF2, if not, add it, issue a pull request, move on to the next issue.

Play with the existing code!

The official Zend Framework Quickstart is also on github, with different features on different branches! Fork it, clone it, test it, make it, break it, fix it… I myself am rewriting a ZF1 based application to ZF2, so you can have a look at that too!

I have also created a few gists about using the new helper loaders/brokers/plugins.

That’s it for now, if I remember/find anything else, I’ll update the post. Of course, if you have to add something, fire away! :)

Happy hackin’! :)

Debugging Zend Framework unit tests with Xdebug and NetBeans

published on July 24, 2011.

I’ve spent this weekend hacking on some unit tests for Zend\Dojo and I ran into an issue where I need Xdebug to, well, debug. Note, that this is not for debugging a Zend Framework application, but for debugging Zend Framework itself. I am using Netbeans + Xdebug to debug regular code, but debugging unit tests was something completely new for me. Turns out, it’s not entirely different from “regular” debugging.

Greatest help to figure out this was Raphael Dohms’ blog post "Debugging PHPUnit tests in Netbeans with Xdebug". Almost worked out fine, but Netbeans complained about a missing index file and the autoload of files was… not really working. After a bit of poking around, the solution was to go to File -> Project Properties -> Run Configuration and set the “Index File” to /path/to/zend_framework_2/tests/_autoload.php - no more missing index file and the autoload works too!

Starting the debug session stays the same as explained in Raphael’s post: click “Debug project” (CTRL+F5), go to the terminal and just type something like:

robert@odin:~/www/zf2/tests$ /path/to/phpunit-debug Zend/Dojo/DojoTest.php

Netbeans will pick up the connection and debugging can start!

Happy hackin’!

Book review - Guide to Web Scraping with PHP

published on May 25, 2011.

It took me a while to grab myself a copy of Matthew Turland’sGuide to Web Scraping with PHP”, but a few weeks ago a copy finally arrived and I had the pleasure of reading it. I planned to buy it right as the print copy was announced, but then realised that php|arch accepts only PayPal as the payment method, which doesn’t work from Serbia, so I had to postpone the shopping for some better times. Fast forward 5-6 months and I found a copy on the Book Depository, which has no shipping costs! Yey!

My overall impression of the book is that it was worth the time and I’m really glad that I bought it. Matthew did a great job explaining all the tools we have at our disposal for writing web scrapers and how to use them. The chapter on HTTP at the beginning and a chapter with some tips and tricks at the end of the book, fit in great with the rest of the chapters, which are full of code examples. For the first reading, I’d recommend reading the book cover to cover, to get an overall view of all the tools presented, but later the chapters can be read independently.

As I said, the first chapter (actually, the second one, the first one is the introductory chapter :p), deals with the HTTP, especially with the parts of it which are needed for understanding, using and creating web scrapers.

The book then continues on different client libraries we can use to send HTTP requests and receive responses. Libraries like cURL or Zend_Http_Client are explained, but it is also explained how one can create his own using streams (the author does note that you’d be better of with an existing one!). For each of the tools it is described, how to handle things like authentication, redirects and timeouts, amongst others…

The second part of the book deals with preparing the documents for, and with the actual parsing of the data from these documents. Again, different tools are presented and explained, which one to use when and why. If none of the parsing tools can help, a most essential overview of the PCRE extension is given, too.

The book is finished with a nice “Tips and Tricks” chapter, which discusses real-time vs batch job scrapers, how to work with forms, the importance of unit testing… IMHO, without this last chapter, the book would not be finished.

I’m thinking hard right now, what bad things could I say about this book, but I can’t think of any. It is a guide, clear and straight-to-the-point, explaining what tools are there, which one to use and how for writing scrapers and that’s exactly what I wanted to know.

Yep, I’d recommend this book to anyone interested in web scraping with PHP :)

DORS/CLUC 2011 recap

published on May 18, 2011.

This year’s DORS/CLUC has been and gone, 18th in the row for the organisers, first one (but not the last!) for me. For those of you who not know, DORS/CLUC is a conference about GNU/Linux and open source, which took place in the nice town of Zagreb, Croatia, in one of the auditoriums of FER (Faculty of electronics and computer science). I attended the conference as a speaker with a lightning talk on PHPPlaneta.net and a regular talk on Zend Framework.

First of all, I’d like to thank Nikola Plejic from NeutrinoDev for having me crash at his place during these couple of days. I hope that I’ll have the chance to return the favor one day :) BTW, if you need some Drupal/PHP/Python work done, you should talk to Nikola, he’s a kick ass dev ;)

The overall feeling I have about this conference is GODDAMN THIS IS AWESOME I WANT MOAR!!!1! Seriously, great organising, great talks, great speakers, great people, great food, great town, great WiFi. Granted, I haven’t attended a lot of conferences so far, but I honestly doubt it can get a lot better than this.

Organisation

I really can’t say anything bad about the organisation. Before the conference the organisers where responsive via email and twitter for any questions/comments I had, the conference website was updated regularly. During the conference they worked hard to keep everything in order, to reduce the delays and to keep the coffee machine full of hot coffee at all times :)

Talks and speakers

The first day had Mark Shuttleworth, from Canonical and outter space as the keynote speaker with a talk generally on open source and Ubuntu. Adnan Hodzic gave one of the best talks about his experience on organising DebConf11 in Banja Luka. Other talks included web and mobile development, OpenStreetMap and some hardcore talks on LXC virtualization and MySQL fatal crash recovery.

The second day had Jan Wildeboer, Red Hat’s evangelist as the keynote speaker, with a great talk on open source. Other talks were about some business wishy-washy (I skipped those :P), databases, open source in academia… Personally, I think the first day was better, but nevertheless the second day was great and interesting too.

Although a bit exhausting, as both days had more than 10 hours of talks, it was really worth it. Now only if I had more hours in a day so I could play around with and look more into all of the stuff I learned here.

In the end, I’m really glad I came here, will be here next year too. If you’re into open source (and you better be! :P), I only can recommend you to check out and keep an eye on DORS/CLUC next year.

Until next time,

happy hackin’!

Tags: conference, dors/cluc.
Categories: Blablabla, Development.
Robert Basic

Robert Basic

Software developer making web applications better.

Let's work together!

I would like to help you make your web application better.

Robert Basic © 2008 — 2020
Get the feed