Saturday, February 08, 2014

I am still alive

It's been almost two years since may last post.
Blogs are good. They intended to be the source of sharing knowledge, and they truly are.
I should overcome my laziness on writing the stuff that I know to public, though. That was the true spirit and should be remained among us as hard-core developers, geeks and hackers...

Friday, July 20, 2012

Cross-App model calling in Django

Let's assume we have two apps in our Django's Root directory. Something like this:

Now, you want to connect the models in profiles and courses together. For instance you have a Course model in course-app and a Student model in profiles-app.
The way you can design, will be something like this:

class Student(models):
    first_name = .....
    last_name = .... 
    course = models.ManyToManyField("courses.Course" , null = True , blank = True , related_name = "student")

class Course(models.Model):
    name = ....
    date = .... 

Attention to "courses.Course" !! The pattern is : [app_name.model_name] . Do NOT use [app_name.models.model_name], or you will get some sort of nasty errors..     
That's it ..

Saturday, July 14, 2012

The MAIN difference between Hackers and Academicians

For The Record:

I'm going to tell you about the MAIN difference between these two cults, after almost 10 years of being around both communities ..

Hackers learn things when they NEED to, Academicians learn them in advance, so "maybe" they need those stuff later.
So folks .. If you are following the Zen of Hack, don't be disappointed if you see some Academic addicts try to impress you by advanced algorithms,etc.
Just relax, ask them for some tutorials and references, and ACE them ...

Wednesday, August 17, 2011

Twitter Integration

The main reason that I blog scarcely is due to using Twitter a lot . I use it almost every day and I'm so addicted to it.
I decided to integrate my Twitter account with my blog. So everyone can see what I'm doing and what's my idea on everything ...
You can check me out on the right side of the blog, whenever you check out this page or can follow me on Twitter .

Thursday, July 28, 2011

why there are "few" females in startups

A very short and intuitive post:

Do you wanna know what's working in a "world-class" startup look like? It a loop over ( Coding -> Beer -> Coding -> Beer -> Coding -> Beer) until you faint. Then you will deliver the demo, get some funding, grow, celebrate your success with Beer and writing some code again. That's why there are "few" females in startups and girls don't like Nerds. This a "Masculine" area, seriously !!

Monday, June 06, 2011

Play Framework, an agile Java EE framework

I've just discovered Play Framework , an Agile-style web framework for Java EE which reduces the amount of pain of developing to almost zero !! Just look at its functionalities and MVC patterns, specially View part :

A web app in 10 minutes using Play framework from zenexity on Vimeo.

Tuesday, May 10, 2011

Django VS Tomcat; A productivity perspective

Attention: This post is not accurate. I was just a Tomcat noob on those days...

These days I'm fully obsessed with developing Apache Tomcat and Django at the same for two separate projects.
It's provided me a comprehensive view over development life-cycle for both of these technologies. I'll explain pros and cons of them soon, but there are some prominent points which are undeniable. For an experienced programmer, the rate of productivity in Django is about 5-10 times more than Tomcat (If, for example, we consider the development time as a base ranking). Although Tomcat is not a complete web framework like Djnago and doesn't provide such functionalities (It's a so called Web Container), but the differences still matter, I guess.
Now, I think I do know why Paul Graham told great hackers prefer to choose Python over Java, and why most recent startups choose python/ java/ Scala/ Erlang, etc. for their development. It is the first time that I have such a great practical experience and I highly recommend to try to develop two different technologies by comparing them from productivity perspective. It will be a mind blowing experience.
I'll go into technical details soon ....

UPDATE:   Now, after a while, I can say that they are not comparable by any means. Comparing Django VS. Tomcat , from Productivity perspective, is like comparing F-22 VS. C-46 aircrafts !!

Friday, February 18, 2011

Goodbye academia, I get a life.

A visionary article which tells the same thing that I told before.
Now, I'm pretty sure that my previous thoughts on science was a raw illusion. Reality is much more different than story books.
Now, I'm so glad that I know it with my body and soil. I do believe that startups world is more challenging and wild, but has more connection to the real-world. Nevertheless, I still love science as my main source of reason and cognition to universe. I BELIEVE in science, not because it's just science, but because I have no other source of trust ...

Monday, December 27, 2010

a programming semester

Next semester is a semester, full of programming courses. Distributed Systems (Erlang), E-Commerce project (J2EE and Django), Software architecture with Java (J2EE), Operating Systems (C and Linux kernel's manipulation) and a project on Distributed Information Systems (CORBA,REST,RMI ).
Honestly, this is the first time in my life that I have such an exciting semester. Let's face the real-world applications with academic approach . What are they supposed to teach that a typical-wanna be  hacker doesn't know ??

Tuesday, December 07, 2010

My presentation on DMMS

Here is my presentation on distributed Multimedia systems . I didn't mention the references in my slides. So, if you need them please let me know :)

Friday, November 05, 2010

my LinkedIn and Twitter account

I added my LinkedIn and Twitter account to the right side of the blog . I use these services a lot , so you can be connected with me more within this way ...

Sunday, October 31, 2010

my sight into CS world was worng ?

I didn't blog recently . The main reason was due to the context switching from doing pure CS foundation to more real-world-based applications . If some of the best criteria (based on Joel Spolsky's essay ) for being highly productive programmer (i.e. hacker in my term) are to be  :
  1. Being Smart
  2. Get things done.
I definitely did wrong at the second part , and I don't like it .

Something should change , not in word but in action ; Those changes has already begun  ...

Thursday, June 10, 2010

What Uppsala taught me

The first year at Uppsala University has finished, and like always, I started to think what was the gain of this year .
I think the most important aspect of studying in Uppsala was that they taught me HOW TO PROGRAM MATHEMATICALLY !! This is not a simple matter , specially to a student who had Electrical Engineering background and not Computer Science . Of course, they didn't teach me step by step on how to do it, but they provide some proper infrastructure to achieve this goal .
Unfortunately , I learned it a bit late (mid of May was the "Aha" moment to understand the whole concept ), but when I look back , I'm satisfied with my progress . Besides of some difficulties that this major (Scientific Computing) has , it is very worthwhile for people who want to mix their science/engineering capabilities with high-level mathematical programming . I don't know how I wanted to learn these stuff if I didn't pursue this major , but I know that it changed my perceptive to science itself.  For instance , I always wondered how I can implement a very long formula which expresses a physical rule ! Now , I not only know how to do that , but I can observe the most computationally consuming parts that affect the whole relation .
If you are interested in these stuff , I can explain it in future posts ...

Friday, May 21, 2010

Artificial Life

YES !!
At last , Craig Venter and his team made it after 10 years .
I am so so excited , I even can not type these words ! Craig had a lecture in my university (Uppsala Uni.) this winter and gave a long lecture about their discoveries .
WOW ... this is amazing ; What other things creationists need to believe in evolution ??
I love science , I do love it  . It moves humbly without any exaggeration ...  

Sunday, May 09, 2010

Knowledge and Simplicity

Everything should be made as simple as possible, but not simpler.
Albert Einstein

The Most important thing , I've learned here is to simplify stuff as much as you can "understand" every single detail of it . That's it , no more ....

My conclusion is so close to what Albert Einstein has told before !! But I didn't understand it till I figured out a concept in "Reinforcement Learning" during "Machine Learning" course . I'm used to give up or neglect very tricky and hard problems before , but for the first time in my life (yes,it's sad) , I decided to change my mind.
And guess what ?? By only spending one hour on one page , the result was awesome and I did understand the whole chapter afterwards .

The moral result : NOTHING is hard ; Some stuff just need more focus and dedication ...

That's it friends :)

Saturday, March 20, 2010

Fuzzy image Dilation and Erosion

One of the generic approaches to fuzzy Morphology is the Fuzzy Dilation and Fuzzy Erosion . Based on an trouble that I faced with during the Fuzzy image Analysis course , I decided to publish the Matlab code , based on the paper by "Bloch and Maitre" on "Fuzzy mathematical morphologies: A comparative study" . This is just the implementation of Definition 1 (page 1344 ). Needless to say that next definition are the same to Def 1 . Just play with the parameters :)

Here is the code :

        Fuzzy Dilation and Erosion
        Copyright 2010 Vahid Rafiei .        
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        GNU General Public License for more details.
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
        MA 02110-1301, USA.

% Settings

%% Define v
if strel==1


%% define mu

hold on


% mu and v is ready

%% Definition 1

% Dilation



for a = alph
  for x=1:numel(mu)    

plot(mu,'Color', 'red');
hold on
title('Dilation (Def. 1)');

% Erosion

for a = alph
  for x=1:numel(mu)    

plot(mu,'Color', 'red');
hold on
title('Erosion (Def. 1)');

Cheers ,

Sunday, February 21, 2010

Meditate in Science

After years of thinking about what's exactly the difference between super succeed persons (Science in my concern) and ordinary people , I've come up with this :
"You have to Meditate in Science .... There is no other way".
The set point was an article in Newyork Times ; This article is about the importance of Practise and hard working which is not new of course . The difference starts by this sentence :
Mozart played a lot of piano at a very young age, so he got his 10,000 hours of practice in early and then he built from there.
 This is exactly what I want to talk about : 10,000 hours ! If you spend 3 hours a day on an specific work , it takes about 10 years and if you devote more ,say 6 hours per day , it takes 5 years to be master in your stuff .

This kind of devotion needs a self-disciplined mind and a powerful motivation , and that's why I say you have to meditate in science . In meditation you almost cut your communications with around world and just concentrate on your breath, for example . But if you extend this mindset to your specific interest (any interest , from music to science ,etc.) and start to meditate on it , you'll get there so sooner as you imagine .
Again , it needs hard self-discipline, but as soon as you start it, you will get used to it little by little . Inertia occurs when you want to start something, but after that stage, another inertia needs to stop you ; and in your situation you don't need second type of it anymore :)

Good luck on your journey ...

Saturday, February 13, 2010

New mapping technology from Microsoft.

This is what that changed my viewpoint to Microsoft Research for ever !!
This fantastic brand-new technology from Microsoft is exactly what I though about in Visualization course . I wanted to mix the same idea with Google Map , but I didn't know how to start :)
Anyway , Microsoft implemented it comprehensively , and I'm really excited about it . This is a glamorous technology that delighted me deeply .

Well done :)

Where is the privacy Google BUZZ ?

Lately , the Google company have presented their new brand product , Google Buzz . Though, it seems that Buzz is an interesting technology , the level of privacy is awful ! As soon as I award this problem, I turned it off . Mail address is a key in privacy and personal stuff and Google should think about it more conservative . I Hope they fix this problem soon ....

Update 1: This is the first attempt of Google to fix the problem .

Monday, February 08, 2010

So long till now

OOPS ! It seems that I'm not an active blogger anymore !! I think it's because of social networks like Facebook and Twitter . They are really addictive .

Not really important .... I'll be active more by the end of February and the nature of posts tends to be more technical and less personal . 

Monday, January 11, 2010

TODO list for 2010

For coming year, I want to do some interesting works and I publish them here to reinforce my motivation !

1- I've decided to open source some of my projects . I'll do it little-by-little . I think they are 7-8 projects . I want to actively contribute to open source world. I don't want to shame when I face the sentence "Speak is chip, Show me the code " anymore !!

2- I've decided to switch to "Front-End" world (mostly JavaScript) for fun , beside of my main area of interest (Computer Vision).

3- This year is a so critical year or me . Lots of works are waiting to get done. Fortunately , I've become more self-disciplined nowadays, and this rises my expectations ....

** Any suggestion guys ??

Thursday, December 17, 2009

a one-day trip to Malmo

Here is some pics of my one-day trip to Malmo city , south of Sweden .

You can see the pics in Flicker .

Friday, December 04, 2009

IEEE and LinkedIn activities

I updated my IEEE and LinkedIn accounts !
IEEE has always been a must for me , and on the other hand , I've recently decided to involve in LinkedIn activities more .
Honestly , I didn't know that LinkedIn is social network (embarrassing , yes ) !!
If you are a "Techie" and you want to connect with me , please drop me a line .You can find me easily by googling me ...

Thursday, November 12, 2009

A seminar at Scientific computing

Today , Dr. Frank Ham from Center for Turbulence Research, Stanford University attended a seminar in Uppsala University and gave a lecture on "Large Eddy Simulation on Unstructured Grids" . You can find the abstract of it here .

There is no doubt at all, that Computational Fluid Dynamics (CFD) is one the most complicated science that we have ever made ! And maybe that's why many of the most brilliant minds are working in this or related fields .
I was interested in two aspect of this lecture : the Visualization stage and the backbone GRID infrastructure of the their project .
Surprisingly , they need the technology 100 times faster than what they have now (Nov 2009) by the end of 2017 !! It means an enormous progress in both hardware and software . Can they achieve this ?? I don't know , but I hope so ....

Monday, November 09, 2009

The second period

For the second period , I chose two courses :
"Scientific Visualization" and "Computer-intensive Statistics and Data Mining".

In Scientific Visualization course, they focus on VTK library and consider this huge library as a high level abstract one . I mean they don't concentrate on "under the hood" computer graphics basis; instead, they train students how to think from a level upper to determine the problem specifications and apply visualization techniques to demonstrate the results.
Another point about the course is that the formal programming language for this course is Python !! Oh my goodness ! It was one of the best news I had ever heard :)

But the second course is more interesting ; it's about "Statistical Pattern Recognition" ; thought, the primitive 8 lecture (out of 21 lectures) is about "random number generation, Monte Carlo , and Bootstrap techniques" . A nice point about this course is that We have to do our project in "R programming language" , which is an amazing language with exceptional capabilities for Statistical Programming .

Nevertheless , I have to try hard to dominate all of them . It takes 99% perspiration :)

Thursday, October 15, 2009

Favorite picture

Licensed by NASA

This is the most inspirational picture I've ever seen !!
It will (maybe) become my permanent Desktop background . I changed my Facebook's profile picture too !!
As you can see it's so mysterious , weird, lovely.... Something about our pure curiously to unknown areas (I don't mean Theology bullshits, I mean absolutely Nature) . Something which rises from your inner whispers, Something that forced our ancestors to move out from their caves ....

Sunday, September 13, 2009

About me these days

1- My classes have started since Aug 31. Here , the educational system is very packed . I mean each semester is divided into about two "2 months period", and normally you pick up two course per period.
Well , in my opinion , it's a good method for hacker-minded people (or self-taughts ones). You just focus on two topics and finish them , that's all ! Like a hacker who wants to penetrate a new stuff !!

2- My research interests are shifting to "Data mining / Visualisation", but it's not clear at the moment... I'll write about it later.

3- Human beings are the same any where :) I knew this, but I can see it here more ...

Sunday, August 30, 2009

A Heavenly Voice

oh my goodness !

I've just discovered this heavenly voice by surfing the web during
last weekend !! Her name is "Jessica Mauboy". She is Australian and I'm her fan from now !! You can see one of her nice music videos :

Sunday, August 16, 2009


I joined the Facebook today !!
I want to become more familiar with web2 technology ...

You can find my profile here :)

Update :
First Impression : Facebook is so amazing !!

Thursday, August 13, 2009

Uppsala Pics

Here is the first pictures that I took on my arrival to Uppsala city .

Please see them at Flickr !!