Tag Archives: Code

Fighting AngularJs

I’ve been doing a lot of AngularJs lately.
One fact about angularjs is that, initially you like the magic that comes down with angular, but soon get lost in loose conventions and the freedom it gives.
Well, I’m logging some writes I found interesting, regarding the issue and how to go about it.

http://trochette.github.io/Angular-Design-Patterns-Best-Practices/#/proven
http://www.artandlogic.com/blog/2013/05/ive-been-doing-it-wrong-part-1-of-3/
https://coderwall.com/p/y0zkiw
https://github.com/angular/angular.js/wiki/Best-Practices

I’ve read some till the bottom line, and some not.
Bookmarking them here, to catch later.

Advertisements

Eat Pray Django

Long Ago (or) make it Once Upon A Time, When I had to create a Web Software I had to finish dealing off with all the boring stuff before getting my hands dirty with my ‘Colourful Ideas’. Say,

  • I had to choose a ‘Nice Little database’  ,confuse with sqlite or mysql or postgreSQL or whatthefucksql
  • Once done, have to look up for handy functions to help manipulate the data from db
  • Hey, I’ve even tried writing some of those and believe me that’s the part when I think “Oh I will never try another idea, Never! “
  •  I’m from PHP Family of Wizards  and I worry a lot about selecting ‘what data’ to “what page” .I’ve never come across any frameworks before [I’m a noob, anyway.Apologize].
  • Once done,my mind becomes a monkey changing ideas, So obliged to make an awful lot of code changes to make it run along with my next big thing and this goes on and on, until one fine day, I give a damn to the whole thing and start writing my Maths assignments.

Right now! I’m in Love.

In Love with Django. Be it ‘mysql’ or ‘whatthefucksql’ , Now I just need to modify a couple of lines of code to switch db and  it gets me running with my next  ‘project’ . No more  “SELECT this FROM that ; “.  I define the models and Django sets me all up and gets me anything I need. No more .jsp or .php,  I’ve got these url patterns that handles the request.Selecting data for the request, its never been more easier! I write views to handle requests and render it with a template, capable of cascading. Thats Cool, Isn’t it?

And the cream in here is , I got to seperate data from the logic, and both completely from the presentation which makes them as “REUSABLE” units.  Oh, I like reusability. Nevermind, am a bad programmer,  ofcourse.  Django is Luxury.

Prove Einstein was right!

Hooked into python lately, without much hands on.
Thought of writing an ultra simple module, to help experimenting whether Einstein was right or wrong!

Watch this video if it sounds greek.

I named it ‘syncme’.

Code:

"""
A game that proves quantum theory is correct, infact! - @author joe
"""
from datetime import datetime
## global variable rec_t3
def syncme_rec():
    print "time now is :", datetime.now()
    """ Takes two imput values from user and records time        
    """
    print "=================================="
    input1 = raw_input("To start,tap enter:")
    t1 = datetime.now()
    print "Good Job, tap enter again:"
    input2 = raw_input()
    t2 = datetime.now()
    global rec_t3
    rec_t3=t2-t1
    print "=================================="
    print "Great the frequency is :", rec_t3
    ch = raw_input("Dare to play? y/n")
    if ch=='y':
        syncme_play()
    else :
        exit()
def syncme_play():    
    print "ready to play syncme! Good luck!"
    print "The required frequency is :",rec_t3 
    print "=================================="
    input1 = raw_input("tap enter to start:")
    t1 = datetime.now()
    print "Good Job, tap enter again:"
    input2 = raw_input()
    t2 = datetime.now()
    act_t3 = t2-t1
    print "=================================="
    print "Great! the frequency is :", act_t3
    if act_t3==rec_t3:
        print "Hey, you won, Einstein was right!"
    else : 
        ch = raw_input("Thus proved that Quantum mechanics is correct!, Dare again/record again/no? 1/2/* : ")
        if ch=='1':
            syncme_play()
        else:
            if ch=='2':
                syncme_rec() 
            else:
               exit() 
if __name__ == "__main__":
        syncme_rec()

If you can completely synchronize with your previous attempt(Ofcourse thats pretty tuff!), you can be proud that world is not in the clutches of probability!