Wednesday 20 February 2013

Solved [No FlatPages matches the given query] #Django

After following most of the solutions provided, the most important factor you should consider that is not indicated in the django docs is that of SITE_ID = 1.

By default Django provides on the admin panel for Sites, "example.com" . When adding flatpages one may tend to add his own site and most tutorials will dictate that you use SITE_ID = 1 on settings.py .

What the don't tell you is that "example.com" site is by default 1. SO what you should do is edit the "example.com" site to 127.0.0.1:8000 and there you have it.

Remember to also add
url.py

    # last entry in urls.py. 
(r'', include('django.contrib.flatpages.urls')),

settings.py`

    MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
   
)

    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.flatpages',
   
)

Wednesday 13 February 2013

Inspiring Sentences

Dear Reader,

Today was just the day that I felt that feeling. What feeling? Yea that feeling that makes you feel as if you don't believe in your self. Fear Not, for as I was reading some book I stumbled upon some words.
Words that will fill you with inner peace.

"In the midst of hate, I found there was, within me, an invisible love.
  In the midst of tears, I found there was, within me, an invisible smile.
  In the midst of chaos, I found the was, within me, an invisible calm.
  In the midst of winter, I found there was, within me, an invisible summer.
 And that makes me happy. For it says that no matter how much the world pushes against me, there's something stronger - something better, pushing right back. " -Albert Camus
 
By now I hope you have attained inner peace with yourself.

Until next time Adios...........

Saturday 2 February 2013

Restleness Overcomed by team254

Waking up, its morning and you have this feeling, you don’t want to code, you don’t want to watch a movie,  not even facebook and twitter can help. A little help maybe from De'Angelo maybe will do the trick, but nothing seemed to catch my attention on Quora.

Have you ever been in this kind of situation, man this is the time you remember, hip hop songs like "I Don't Like".  Apparently Kenya is playing in the Wellington7s and we have just won all our 3 pool games and now we are off to the Quarters. So this was news, however no news to actually make stop feeling this feeling, I am calling it this because I don't even know what kind of feeling am experiencing.


I mean Kenya in the past series has been doing good stuff, so qualifying to the quarters isn't something new. We are used to this kind of news. Any way Kenya advances to the quarters to meet South Africa and everyone has their fingers crossed.

Kenya, goes to the Quarters and just defeats South Africa. So how did that happen, I don't know. Then we are off to the Semi and we are supposed to face NZ. Damn!!! This was one heck of a series. The game begins and at half-time we are 14-0, NZ have the lead. Here's the fun part Kenya come to this fulfilling comeback and declare why they are the fighters. Have you heard about the Maasai morans if you haven’t please Google it!!!!! That's how our boys fought and they came home with the .....W......

Kenya comes from behind converts all their 3 tries and the score is 21-19 at the end. We are off to the finals. Who are we to meet ? England...



Kenyan Morans walk into the finals with all their umph alongside and they fall short to two tries from England with 12-0 on the scoreboard, the Morans come in from no where and equalise it to 12-12 at half-time. Now that's a fight, don't you think? Kenya comes again and put's another try and converts it to have 19-12 .

It full time but i don’t understand why the  hooter doesn’t go off, then our player is sin-bined, we have only 5 boys on the pitch and some English player knocks the ball, its supposed to be game over, but game goes on. We finally lose to a try from another English man and since the game was in sudden death mode, the first try commands victory, England takes it.

I don't know what that is supposed to be, but Kenya has just shown the world that they are back and lets see if they will now give us unfair play at LasVegas7s next week. This was Kenya's 2nd time to reach the finals since 2009.

Go Kenya #teamkenya is behind you.......




Sunday 23 December 2012

Was I hacking or being hacked?

Dear Diary,

Its been a week since i last posted anything here. Don't worry folks, its the examination fever and Oh My Gosh!!! as my friend Ponkshi likes to put it, how can i have time to blog when all i could think about is not getting a 'D' on my transcript.

End Of Sophomore
One thing we have to know is that every beginning has to have an end my Sophomore year just came to an end. What an year it has been? Made a lot of cool friends, The 'Mayor' on top of the list, Ponkshi, Biggie, Amateur , Msovti , Alpachino, Reezy and how can I forget the main man , Tom1mt. This guys made my last semester one of the most epic. Come to think of it one of the most epic...

Hackathon
So after, the exams what a better way to relax than to attend a hackathon. All i can remember before starting the hackathon was Einstein saying "Imagination is more important than knowledge." So I come up with this wild idea and I go up ahead and present it, everyone gives me there 5 minutes and at the moment, you feel like you own everyone, because everyone is busy trying to understand what I am talking about.

Hacked
Its time to vote for the best ideas in the building and apparently nobody shows up for my idea. So I hit the 'Mayor' up and i ask him, hey come up and help me out on this one. The Mayor shows up and since he is the lead developer, I ask update him on my idea and he is like. Do you remember when the Winklevoss approached Zuckerberg about Harvard Connect and there was nothing that made it different from Friendster and MySpace? Oh yea I remember.... So without thinking hesitating i saw his point and it hit me, why dont we try something else.

Zuckerberg Effect
So after the Mayor reminding me of that occurence, we did not hesitate and immediately we started working on the our baby. Since the 'Mayor ' is a Pythonista it was definate which language we were going to use. In a minute or so Reezy was in the building and joined our group, he was to handle user experience. Cliff was another Pythonista making us three now, and we were now good to go.

Let the Hacking Begin.
By this time almost every group had gone very far with their ideas, so we new we had to write tonnes of code and finish by morning. We started by doing and analysis and design and we were good to go. 

Codejam
It was one crazy night, because you are chasing time and you are coding and there is something else that is after you, Sleep. At about 3.00 am in the morning, sleep had taken most individual in the group, but we had the 'Mayor' who didn't even stop a bit, not even a wink, all that he experienced were wide long yawns that could swallow you alive. I hope you are getting the picture.

Morning
Its now morning and the 'Mayor' is feeling tired having not slept in the night just doing the design and prototype of the web application and there he was with a complete version of the app.

As I write this i am preparing the presentation our application. So you will allow me to leave you for a bit and when I come back I will show tell you what went down.

For now Adios!


Monday 10 December 2012

Sunshine Boy


-->
Sunshine Boy

Dear Diary,
Today I just woke up as usual and thought about you, you know who. Wait a minute, just had a chit chat with my boy Sikri, and I thought what the hell ! Let me write about this.

Free Man
Its been 28 days since I became a free man. Free from what, mmmh!!! Lets just say am now free. Where was I ? I was telling you about I woke up in the Morning before my mind was blown away to some random thought.

Greatest Lesson
The greatest lesson I have learnt over the past days is that one has to always be true to himself. Where did and how? Trust me through experience.

The Scenerio
Have you ever liked a girl? Hey am speaking for the guys out there. So I take it yes, so you like her and then you happen not to tell her about your feelings but you feel this sudden attraction to her. The feeling is that you want to be with her but you still think its not yet time to tell her the deal.

So the status is you have developed some feeling but you still think its not yet the time because you want her to see you as this good and charming guy that she thinks is her dream guy. What happens next ? You don't make the move. Really, what move is this?

Ever wondered, why soldiers still go to war, and they know that there is a 80% chance that they wont come back to be with their families, well it is because they believe in something and that something is the well bieng of their country and when they die in duty, they are honoured

Maybe thats too technical, I will easen it up for you. Every chess player, knows that every piece in the board is important starting from the pone that can only move one step ahead to the queen that can move in every direction with an unlimited number of steps. So if a chess player thinks that inorder for him to win the game, he has to part with his Queen he will go for it. Remember that everything even if small like the pone is powerful. Why is this the case? Once the pone reaches the other side of the board, it transforms to Queen status therefore giving you an upper hand in the game. At the back of your mind many of you may want all or most of your pones to rech the other side, but here is the catch, you have to sacrifice other pieces. Lets be real, what do we really want in the chess game? it's not many Queens or having the most pieces but to kill the King piece of the other opponent.

Sunshine Boy
Back to this girl you liked and you feel that you cant tell her anything. You are now friends for weeks and still havent told her anything,eventually she opens up and she tells you her stuff and the next minute you are telling her yours.
So at the moment you think you have a better chance with her. Huuuuh!!!! Thats what you think but true to the word what you really are to her is her “Sunshine boy”.

Sunshine boy ” not a word or phrase you would find on a dictionary, but its something my friend described to me. This is a guy, that is close to a girl and if you have been watching them closely, you may think that they are really in a relationship, truth is that its the latter. They spend most of their time together, the guy is always trying to impress her and if a there is some issue the girl wants some help, “Sunshine boy” is always there to take her or assist her.

Why am I bringing up this whole issue of “Sunshine boy”? By the word sunshine I mean this is a guy who is seen with her during the day, and acts as a barrier to other guys tht may seek to ask her out. So the girl goes on with her life, and she goes out with the man who impresses her and this is done on stealth.


So this brings me to why I brought the whole “Sunshine boy” issue into the picture, its because you become one by being friend-zoned in the first place. Reason to you being friend-zoned is that you didn't set you variable global. When you introduced yourself you presented yourself as a friend and clearly, you didn't want to be just a friend in the first place.

So guys, when you think she is the one play your cards well, and then tell her soon enough and most of be yourself. To the ladies, if you have a guy friendzoned just have the audacity to tell him eaarly enough so that he doesn't log to much of his time on charades. 


Until next time
Adios!!!! 

Tuesday 6 November 2012

Zen Of Python

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Saturday 27 October 2012

How to Install Aptana Studio 3 on Ubuntu 12.04 LTS (Precise Pangolin)




1. Install the prerequisites

 In order to  access the Sun JDK, do the following:
sudo apt-get install libjpeg62 libwebkitgtk-1.0-0 git-core
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Note:
libjpeg62 is very important and without it you will encounter errors like this:

An internal error has occurred.
No more handlesNative code library failed to load. (java.lang.UnsatisfiedLinkError: /opt/Aptana_Studio_3/plugins/com.aptana.swt.webkitbrowser.linux.x86_64_1.0.0.1295409059/os/linux/x86_64/libcefjni.so: libjpeg.so.62: cannot open shared object file: No such file or directory)
2. Download Aptana Studio

 You can download Aptana Studio 3 here. Select the "Standalone Version" if not selected and click download.

3. Extract Aptana Studio


sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt


4. Add the menu shortcut



wget http://www.samclarke.com/wp-content/uploads/2012/04/AptanaStudio3.desktop
sudo mv AptanaStudio3.desktop /usr/share/applications/AptanaStudio3.deskto
 For all of you who are security conscious, you can check the contents of
AptanaStudio3.desktop .

Hope this article is of help to you who is reading.