PHPUnit to display function name as it tests

Just a quick tip.

Hope someone will find it beneficial.


The logging bit is what I am talking about. It will read the test function name and display.


If pass it will show [x] Add action can be accessed for the function public function testAddActionCanBeAccessed(){ … }
Else F [ ]


vim – My favorite minimalistic .vimrc configuration


Change Django DeleteView behaviour

I am sure CBGV(Class Based Generic View) is a bless and there is a lot to learn and find and learn and find and dig and learn.

Anyway, I was looking for an easy hack to override the DeleteView. Actually I didn’t want to delete the object as it does, instead I wanted to set a flag as deleted for the object.

Django DeleteView calls its function delete(), which is basically this,

So, all you have to do is override delete function and your logic.

Here is an example, I have an appointment model,

When I delete an appointment, it should update the status to ‘deleted’ instead of deleting it.


Some useful git aliases

Add the following snippets to your .bash_aliases and make sure .bash_aliases is uncommented in your .bashrc.


undefined method `vbguest’ in ubuntu

I am trying for last half an hour to create a basic vagrant box. But I am continuously rejected by saying

undefined method `vbguest’ 

Let me give you a few background of my setup. I was using Ubuntu  12.04 but was tired of their mac looking features. So I installed xfce Desktop. (May be I should have done a clean install of Xubuntu)

Now here I have my box file, I have virtualbox from apt-get. I installed vagrant from apt-get but Lo,

undefined method `vbguest’ 

This is what I did:

I purged vagrant, sudo apt-get purge vagrant

I installed vagrant through ruby gems. sudo gem install vagrant, then sudo gem install vagrant-vbguest.

But now I have two short-cuts for vagrant. In /usr/bin and /usr/local/bin.

The vagrant command is looking in /usr/bin but the working vagrant is in /usr/local/bin.

I went to remove the /usr/bin and create a symlink to /usr/local/bin/vagrant but it removed both.

So I just re-install vagrant from the apt-get and Lo it works fine.

Simple email validation in python

Email validation is lot more complicated than it seems.  A real validation will take this pretty looking regex to implement. 

So here is a very very basic email validation to your rescue,

All it does is checking:

  • must have ‘@’ and ‘.’
  • at least one character before ‘@’ [yes I know about the '_', as I said, its very basic]
  • at least one character after ‘@’
  • at least one character after ‘.’

Interview questions for pyton and php programmers

I have been using this format for my interviews previously and it greatly helped me.
Since I am trying to create a new blog, I was thinking of publishing something that will have some use for programmers. So I am sharing my interview checklists. Hope that will help you all.

  • Tell me about yourself
    • Team player
    • Self motivated
    • Enjoy learning and sharing
    • Pragmatic
    • Social
  • What do you enjoy most in your current job
    • Coding kata   
    • Book club  
    • Technical Presentation
  • What’s the biggest challenge you’ve faced in your work
  • Why do you want to leave your current job
  • What is your present boss like
    • Good forecasting
    • Innovative  
  • Why do you think you are best match for this job
  • What do you know about our company
  • What can you bring to the company
    • Agile
    • TDD
  • How long  do you expect in stay in the company
    • Progress
    • Contribution
  • What are your greatest strengths
  • What is your biggest weakness
  • Where do you see yourself in five years time
    • Keep progressing to senior role
  • Give me an example of a difficult team situation you had to deal with
  • Give me an e xample of a product or concept you found hard to understand
  • Give me an example of something you are very proud of
  • Give me an example of a change or improvement you made to development or testing processes in your organisation
  • Give me an example of a time you performed well in a team
  • Give me an example of a time you showed initiative
  • Give me an example of a time you demonstrated creativity
  • Give me an example of a time when you demonstrated leadership
  • What is the most challenging piece of work you have undertaken and why? What were the challenges and how did you overcome them?
  • Aside from your day to day project work have you made a broader contribution to the technical advancement of your team as a whole?
  • What new technology, either inside or outside of work, do you find most exciting and why?
  • Why are you interested in the role?
  • What aspects of the role interest you the most?
  • What can you offer us?
    • I have great energy going through complicated problems
    • I am a great team player
    • I love playing with new technology and sharing
    • I assure best practice in working

Python Topics:

  1. Python ?
  2. Property,
  3. Data structures (list,tuples, set, dict)
  4. File processing
  5. Exception handling
  6. Itertools
  7. Iterators
  8. Generators
  9. Decorators,
  10. @classmethod vs @staticmethod
  11. List comprehension vs generator expression
  12. Builtin functions ( )
  13. Special method
  14. Function as first class object
  15. Lambda
  16. Testing
  17. Debugger (pdb)
  18. Multiple inheritence
  19. Multi-threading vs Multi-processing
  20. Re
  21. Setup script,
  22. Glossary

Django Topics:

  1. Django design philosophy,
  2. New features
  3. Django ORM (query especially)
  5. Django settings
  6. URL dispatcher,
  7. Reverse
  8. Reverse url matching
  9. Model manager
  10. Caching,
  11. Abstract  base class,
  12. ORM limitation, stored procedure
  13. User profile
  14. Signal,
  15. How djagno process a request
  16. Request and response
  17. Fixtures
  18. Generic view,
  19. Middleware,
  20. MVT
  21. URL patterns/ URL Naming/ URL template tag
  22. Template, model and table inheritance
  23. Internationalization
  24. Forms
  25. Test framework,

Programming Architecture:

  1. Dependency injection
  2. Separation of Concern 
  3. Single Responsibility Principle  
  4. Design patterns
    1. singletone
    2. factory
    3. decorator
    4. observer
    5. template
    6. State
    7. Iterator

Others from CV:

  1. scrum-ban
  2. rabbitmq
  3. celery
  4. fabric
  5. OOC in java script
  6. load balancer

More Questions:

CSS questions:


Javascripts questions:


Mysql questions:

PHP questions:

Programming Exercise:

  1. prime number
  2. factorial
  3. fibonacci

Unable to connect to node rabbit@

My whole day spent by doing
I have updated my Perl5, updated Erlang. Re-installing Rabbitmq etcetra etcetra.
But at last I found a work around to get my Rabbitmq working yet know idea why it has happened in the first place.

Try locating schema.DAT and remove.
Restart your computer and here you go.

locate scheme.DAT
sudo rm -rf schema.DAT

Hope that helps.

Clean up deleted remote branch in GIT

Suppose you have multiple users working on the repo and a user has deleted some unused branches. The other user might still be able to see the remote branches using git branch -r, which is unexpected.

To clean up deleted remote branch use git remote prune origin, the code will delete all stale tracking branches under origin.

Also some other important command for pruning:
git gc --prune=now, gc works as defragment for git files
git remote rm origin, Remove the remote named . All remote tracking branches and configuration settings for the remote are removed.

Installing mysql for python throws mysql_config not found

I am just re-inventing the wheel here. I had this article on this site but the previous hosting was expired and my database file was corrupted, so I had to do this again. And I also know at least one person will be looking for that information soon, so I am contributing to the community again in some simple steps,

    Download the latest version of MySQLdb
    Locate mysql_config locate mysql_config
    Open site.cfg and update mysql_config path
    Run sudo python build
    Run sudo python install

Now if you import MySQLdb in your python CLI it should just work fine. Let me know if you still have some problem. I will try to reshape my reinvented wheel.