Category Archives: Programming

Programming

PHP developers should try Python.

PHP and Python both are dynamic typed language, so there is no point the discuss anything related in this aspect. Exception is first class citizen

Prints ‘Caught’ Let’s look at PHP:

Better functions Imagine you can write functions like this

Short-lived vs Long-lived Almost all PHP scripts are short-lived, including most frameworks, which… Read More »

Laravel for Django developers, part 2

Global functions I am seeing a lot of framework specific global functions but don’t know where they come from, such as “view()”, “redirect()” etc etc. ORM Again, as mentioned in part 1, since we are creating migration files first, then we won’t be able to define FK relationships directly point to another model. According to… Read More »

Laravel for Django developers, part 1

Project Structure After setting up the quickstart project, I feel the project structure is quite different to Django. In Django a lot of code are organised in “app” domain, but it seems to me that multi-app is not something out-of-the-box in Laravel: https://laracasts.com/discuss/channels/general-discussion/laravel-5-multi-app-or-modular-applications Instead, it seems the apps in Django is more similar to the… Read More »

Laravel for Django Developers, prelude.

Reality is a b**ch, Python/Django jobs are scarce in New Zealand, despite how awesome the framework it is, managers and architects still choose PHP frameworks such as Silverstripe over Django, besides, Silverstripe is a CMS, not a framework. After 5 years of dedication to Django framework, I struggle to find Django jobs in New Zealand.… Read More »

One goal reached, a few days late

I sorta set myself some goals randomly and one was trying to reach 5k points on Stackoverflow before 2016, but I was a few points short before the new years eve. This morning at mid January 2016, 25 more points added to my profile so I am over 5k goal now.  

What’s wrong with this statement?

This morning I made a code change to log some stuff in a core package and created a pull request, the change was very simple: from

to

One of the team lead pointed out the statement has a problem, and it was a life saver, but I won’t tell you why just yet,… Read More »

Python OpenCV Facial Detection On OSX

Just a code snippet to demo Python script using OpenCV

Installation: pip install numpy (sometimes you might need to run as sudo) brew tap homebrew/science brew install opencv export PYTHONPATH=/usr/local/Cellar/opencv/2.4.7.1/lib/python2.7/site-packages/ download the xml file https://warai.googlecode.com/files/haarcascade_frontalface_alt.xml and place it in the same folder.