A colleague reminded me that it's been over 5 months since the last time I posted something on this blog. I never really have been a blog person, and most likely never will be. Writing a blog post is hard enough in itself, let alone writing it in your non-native language, and things are not that much better in my other blog which is actually in my native language.
What kept me from writing something recently is by no means a secret. I bet most of you have heard about Iran's tenth presidential election which was held in June, and its aftermath. It's not something you want to be part of, or even to observe. In my childhood, Iran was in a war with Iraq ... I barely remember anything from that time, but I could tell what happened in recent months here in Iran (and mostly in Tehran) was worse than the war. War with Iraq ... it was sad, but it was all about militaries, about foreigners, but not compatriots killing each other. Let me tell you, nothing is worse than seeing a 16 years old plainclothes boy (which is of course authorized by governor) hitting people with a baton.
And I'd like to thank everyone in the community which I'm proud to be part of, the PHP community (and PEAR folks in particular). Great guys like Daniel O'Connor, Christian Weiske, Chuck Burgress, Brett Bieber (which unsurprisingly are all elected again to be part of PEAR group for 2009 and 2010) and ... I just could say, Thanks for showing concern and suggesting ways to support.
Thursday, March 12. 2009
The Web is broken for me, and it's all your fault Google!
UPDATE: Just uploaded some screenshots.
Oh wait wait wait! Global? Then there's got to be something wrong with Google's definition of "global". As far as I know Iran is part of the globe, and I believe you have to tell your users clearly if your mileage varies than theirs. Google has to tell web developers that by "globally" they actually mean "the World minus some countries".
Here in Iran we get silly "HTTP Authenticate" popups upon each request to that service; not just clicking on "OK/Cancel" multiple times hurts - but not loading JavaScript libraries will break the web page entirely.
(well there's also some rare ones which works just fine, but come on they don't deserve a separate category
)
As you probably know Google started hosting popular JavaScript libraries back in months. Letting Google be your CDN is quite cool, to quote the project itself (http://code.google.com/apis/ajaxlibs/) using this service:
...your application has high speed, globally available access to a growing list of the most popular, open source JavaScript libraries...
Oh wait wait wait! Global? Then there's got to be something wrong with Google's definition of "global". As far as I know Iran is part of the globe, and I believe you have to tell your users clearly if your mileage varies than theirs. Google has to tell web developers that by "globally" they actually mean "the World minus some countries".
Here in Iran we get silly "HTTP Authenticate" popups upon each request to that service; not just clicking on "OK/Cancel" multiple times hurts - but not loading JavaScript libraries will break the web page entirely.
Here in Iran websites are categorised in one of these three:
- Those which are censored by the government
- Those websites which will throw us "Forbidden" (a.k.a 403) while visiting from Iran, and
- Those innocent ones which don't really believe we Iranians should not use their services, but they just consume hosted files in the services like one Google offers.
(well there's also some rare ones which works just fine, but come on they don't deserve a separate category
So, please stop using Google's service (the other annoying one is Google code which does not let us browse project's pages, checking out from subversion repositories ...)
I call the web "broken", and it's all your fault Google.
Thursday, February 26. 2009
Seven Things
Thanks to Brett Bieber for tagging me in the "Seven things you probably don't know about me" meme. Unlike the others, mine are not interesting, not at all, but here goes...
- I grew up in a small city famous for it's pistachio and rugs. I now live in a big, crowded city which suffers from severe air pollution, Tehran.
- Not too many people know this, but I play Santur, and once was in a concert.
- My first computer was a Commodore 128 at the age of 6 or 7. God knows how many circles I drew.
- Never been in a party or wedding ... I'm actually uneasy in crowded places.
- I don't drink alcohol... yet

- I'm a big fan of Progressive rock... actually, I like 70's.
- I really want to get a PHP user group started here in Tehran.
Thursday, October 30. 2008
MIT/GNU Scheme and Gentoo
It seems dev-scheme/mit-scheme package has been removed from portage, it could be because of files containing executable stacks or something.
If you (like me) need the MIT/GNU Scheme, and prefer not to install packages unless there's an ebuild (thus there's emerge) somewhere, here's the Gentoo lisp overlay, but to my surprise it's not listed at overlays.gentoo.org. This overlay contains dev-scheme/mit-scheme-c, and no, it's not binary.
Simply clone it (and don't forget to pull periodically), and add the directory to your PORTDIR_OVERLAY.
If you (like me) need the MIT/GNU Scheme, and prefer not to install packages unless there's an ebuild (thus there's emerge) somewhere, here's the Gentoo lisp overlay, but to my surprise it's not listed at overlays.gentoo.org. This overlay contains dev-scheme/mit-scheme-c, and no, it's not binary.
Simply clone it (and don't forget to pull periodically), and add the directory to your PORTDIR_OVERLAY.
Saturday, August 30. 2008
The New Laptop
I just picked up a ThinkPad T61 (14.1", Intel(R) Core(TM)2 Duo CPU T9300 @ 2.50GHz, 2GB RAM, Quadro NVS 140M 512MB).
It comes with "Windows Vista Home Premium Ultra blah blah", and I only booted into it once, actually the shop guy did, damn.
When I got back home, the first I did was downloading and burning a Gentoo minimal, and after almost three days I had a Gentoo from stage3 "up & running".
After installing Xorg and nVidia drivers, it was time to choose a DE, and with no surprise I ended up with no DE, just a WM, a tiling one of course, awesome.
Awesome 3 is about to release (and it's RCs are in portage, though hard masked), and it's configuration format is not backward compatible with awesome 2, so there was no point in starting with 2. Usually I don't install hard-masked packages, but this time I did, and actually emerged bunch of them in order to satisfy awesome's dependencies.
And ..., everything is compiled with native march and mtune
It comes with "Windows Vista Home Premium Ultra blah blah", and I only booted into it once, actually the shop guy did, damn.
When I got back home, the first I did was downloading and burning a Gentoo minimal, and after almost three days I had a Gentoo from stage3 "up & running".
After installing Xorg and nVidia drivers, it was time to choose a DE, and with no surprise I ended up with no DE, just a WM, a tiling one of course, awesome.
Awesome 3 is about to release (and it's RCs are in portage, though hard masked), and it's configuration format is not backward compatible with awesome 2, so there was no point in starting with 2. Usually I don't install hard-masked packages, but this time I did, and actually emerged bunch of them in order to satisfy awesome's dependencies.
And ..., everything is compiled with native march and mtune
Friday, July 25. 2008
PEAR bash completion
Lately I've been playing alot with the PEAR CLI. The one annoying thing I noticed the most was its lack of tab completion that I'm used to from the shell. It turns out that this feature is very easy to add, in the bash at least. Here (Update: Now it's in PEAR SVN repository) is a simple tab completion script for the bash. In addition to completing the PEAR commands and their respective options, it can even autocomplete the names of installed packages and discovered PEAR channels. Just source it, and enjoy
Tuesday, May 20. 2008
Book review: “Pro PHP: Patterns, Frameworks, Testing and More” by Kevin McArthur
As the title suggests this book is about advanced PHP related topics, being divided into 5 parts and 21 chapters. The title enunciates the book will cover many different aspects, but you'll get disappointed as soon as you perceive it's only about 300 pages.
First part starts with "OOP and Patterns" and will end up with PHP 6's new features. The Patterns chapter is the first one which disappoints you - you'll wish it was a little more verbose, covering some more patterns and being more than only 7 pages.
The next Part is about "Testing and Documentation", covering PHPDoc and DocBook in it's first chapter. In the next one about "Reflection API" - which I think is one of the best chapters - Kevin goes deep into two complete real world examples. But unfortunately then book disappoints you again, trying to cover some topics like "Development Environment", "Unit Testing", "Deployment" and "Continuous Integration" in just about 20 pages. Kevin just skims through introductory concepts of tools like Subversion, PHPUnit, Phing, Xinc and Xdebug.
The third part is all devoted to SPL. Kevin describes SPL from fundamentals to some advanced topics like "Array Overloading" and "Observer Pattern" in a way you wished that all of the book was written this way.
Part 4 covers another Pattern, MVC this time. Describing what it is, why it's good, and talking about criteria you may consider when choosing an MVC framework. Then it helps you to roll your own MVC framework by recommending to choose from one of the publicly available frameworks. The book also covers Zend Framework as one of those "publicly available frameworks" which meets the most criteria in his opinion.
And the final Part, and with no surprise it's titled "Web 2.0". In my opinion the first chapter of this part is the book's truly weakest chapter, it's about Ajax and JSON and it barely covers anything more than what you'll find in any of the beginner Ajax tutorials. But the rest chapters compensates, "Web Services" and "Certificate Authentication".
All in all I found the book a good one, a good next step if you are already familiar with PHP and looking for a book to extend your knowledge, then this one is a recommended one. But I by one would like to see some practical solutions applied to enterprise level when buying a book titled Pro.
First part starts with "OOP and Patterns" and will end up with PHP 6's new features. The Patterns chapter is the first one which disappoints you - you'll wish it was a little more verbose, covering some more patterns and being more than only 7 pages.
The next Part is about "Testing and Documentation", covering PHPDoc and DocBook in it's first chapter. In the next one about "Reflection API" - which I think is one of the best chapters - Kevin goes deep into two complete real world examples. But unfortunately then book disappoints you again, trying to cover some topics like "Development Environment", "Unit Testing", "Deployment" and "Continuous Integration" in just about 20 pages. Kevin just skims through introductory concepts of tools like Subversion, PHPUnit, Phing, Xinc and Xdebug.
The third part is all devoted to SPL. Kevin describes SPL from fundamentals to some advanced topics like "Array Overloading" and "Observer Pattern" in a way you wished that all of the book was written this way.
Part 4 covers another Pattern, MVC this time. Describing what it is, why it's good, and talking about criteria you may consider when choosing an MVC framework. Then it helps you to roll your own MVC framework by recommending to choose from one of the publicly available frameworks. The book also covers Zend Framework as one of those "publicly available frameworks" which meets the most criteria in his opinion.
And the final Part, and with no surprise it's titled "Web 2.0". In my opinion the first chapter of this part is the book's truly weakest chapter, it's about Ajax and JSON and it barely covers anything more than what you'll find in any of the beginner Ajax tutorials. But the rest chapters compensates, "Web Services" and "Certificate Authentication".
All in all I found the book a good one, a good next step if you are already familiar with PHP and looking for a book to extend your knowledge, then this one is a recommended one. But I by one would like to see some practical solutions applied to enterprise level when buying a book titled Pro.
Friday, December 14. 2007
Calling protected SOAP from Mozilla
Recently I had to write a Firefox extension for a company which provides text messaging web services. The Web-Service is an RPC-Style SOAP one which is written by "Nima Shayafar".
When I got this offer, I didn't think that this one would cause any troubles, as Mozilla has a SOAP implementation landed in it's platform since years (
This Web-Service is protected by basic HTTP Authentication, nothing tricky so far, but to my surprise Mozilla's SOAP implementation doesn't provide any mean to do authentication against an endpoint, and nah, not even a basic one.
Well I thought as this (writing Firefox extensions for protected SOAP Web Services) is not that uncommon situation I may get a good amount of information by Googling, but nothing catchy comes there in results except a thread at netscape.public.mozilla.xml where I found two solutions, one was submitting username/password pair together with URL, and the other one was to make an XHR connection to the endpoint (XMLHttpRequest implementation let you provide login/password for a basic authentication), and as Mozilla remembers that for the browser session, you're there.
The first solution is hmm ... horrible! And the second one, I didn't manage to get it to work.
So I started wondering in other possible ways to overcome this, and guess what? It was damn easy!
You just need to set Authorization header in HTTP request (which is base64 encoded of login:password), but just for that particular endpoint, and how?
You need to use nsIHttpChannel in conjugation with nsIObserverService, register it right before invoking the SOAPCall, and (don't forget to!) unregister it when the call is done, that's it.
Well, it took me an hour to come up with this, and I'm writing it in hopes save someone else "one hour".
Saturday, November 24. 2007
Ohloh API
It's a while since I started using Ohloh API for the facebook app I mentioned in earlier post.
It's a REST-based one with well structured URIs, the only thing that could be implemented better (from the definitions perspective), is the way Ohloh let you know what happened to your request, the response status.
It's now represented in entity-body (<response><status>....</status>...</response>), but IMO using ``HTTP Response Code'' would be a better choice when you're talking about a RESTful web service, data transmitting over HTTP without an additional messaging layer.
Saturday, October 27. 2007
Rock Your Hackers - facebook way
Rock Your Hackers allows you to praise, promote, and in no uncertain terms shout for joy about your favorite free and open source software projects (FOSS) and then share your "Hack List" with your friends (and perhaps fellow hackers)! Wave the banners of your favorite FOSS projects for all your "faceworld" to see.
Here’s how you get started:
1) Add the application
2) Browse for cool FOSS projects (PHP, PEAR, Jaws ...)
3) Add them to your favorites
4) Share your favorites with your friends!
(Page 1 of 4, totaling 32 entries)
next page »

