Monthly Archives: March 2012

Nothing Productive done.

Advertisements

DevLog: Download status notification

  • After a bit of work, added a download status notification to trial.py
  • The logic is fairly simple –
  • Get the content size of the file by parsing metadata , something like openedUrl.info() and query for getheaders(“Content-Size”)[0]
  • Returns a dictionary – contaning size of file at [0], Now read the file by temporary blocks of memory
  • say block_size = 1 * 1024 (or if you give 10*1024 its just gona affect your refresh rate or loop cycle rate, no much difference)
  • Now read the contents of file block by block and sum it up in file_size_read, Maybe a buffer = url.read(block_size) will do
  • For every cycle of read loop,  ( file_size_read / file_size )* 100  will furnish me the percentage of file downloaded at every refresh, It’s that simple.
  • So polished it, disintegrated the code into reusable function modules and pushed it up

This can also be named as “How To Get Screwed In Numerical Methods Modal Exam Tomorrow”

20 Tips For Your First Job

Found a post, quiet interesting. http://atulchitnis.net/2011/first-job/

  1. Write down everything you do, and be prepared to show it to your manager if ever asked “so what have you done this month?”
  2. A job is not a competition, no matter what you may have heard. Your coworkers are on your team, as is your manager.
  3. This is not school/college. You won’t lose marks because you don’t know something. You WILL if you don’t say so!
  4. Don’t be afraid of stating an opinion – be afraid of NOT stating one. You could be wrong, but won’t know if you don’t pipe up!
  5. Employers aren’t really looking for a bunch of yes-(wo)men. But they aren’t looking for a bunch of revolutionaries, either.
  6. Breakfast is the most important meal of the day, especially if you are young. You will thank me for this advice.
  7. Dare to look beyond your given assignment. “Good enough” never is.
  8. Take criticism of your work as a compliment – your work got noticed! Now fine-tune it to get it right.
  9. If you thought that everything you learnt in college was irrelevant, you are about to get a wakeup call. Never stop learning.
  10. Smile. It makes everything better, every job easier, every person nicer, everyone around you happier. (I never learnt this)
  11. Despite what it feel like, no one (manager, co-worker) is out to get you. If you perform well, everyone wins.
  12. Being better than others doesn’t get you a promotion or a raise. Helping the team to be as good as you, however, does.
  13. There is no tip #13.
  14. Listen. Carefully. Ask questions – the only stupid question is the one you DON’T ask.
  15. It’s always about the team, the work and the organisation – never about you. (I learnt this when it was almost too late).
  16. If you find yourself with no assigned task, either ask for one, or go looking for stuff you can do.
  17. Dress sensibly. Torn jeans and crazy tshirts may seem hep, but lets down your organisation’s image.
  18. Personal hygiene is important. Bathe, brush, shave (if appropriate). Carry & use a comb. People notice & appreciate neatness.
  19. If you see something that needs doing, DO IT! If you see someone doing something that needed doing, pitch in and help!
  20. Enjoy yourself and your work. If you don’t, find out why, and fix it. You will have only one first job in your life – make it count.
  21. While you may ignore all my tips for your first job – don’t ever skip breakfast.

And remember: your parents brought you up to be able to see this day, to see you spread your wings and fly. This is our reward.

DevLog: Moved local inits to git repo

Reminder:Was talking about writing a blog software, down a few posts.

  • Created a blank layout for post display and pushed it to my repo
  • I named it Jplus( Yay! J for- you guessed right!)
  • Need to frame a dashboard, for easy administration, Looking out for more time
  • Created another repo for tracking my flow with python
  • Will be recording My Experiments with Python

Trying to maintain a post per day mode, to keep track of myself.Deep inside I hear it saying  “useless”

Modal Exams running through.No idea of studying, yet it keeps wriggling my mind. Shifting to exam mode will break me up from what I actually want to do, but hey! you’re still a regular engineering student so,Shut up!.

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!

Are we students, stupid?

Huh! I’m past one day for completion of web technology lab record. Forced down to waste time on it, I came across this very strange thing! perhaps queer to me?

They have written algorithm for a html source code. Yes, that’s true!

Personally I don’t even classify html as a programming language, of course its a way of putting content and its structure and thats why they named it as markup language.

And Algorithms for putting content in a format? Seems like * have lost their mind students have gone insane (pardon if am a bit rude, but hey! I’m wasting time on this boy!).

Worser-Students had written them.

And worst- It has a Start the program and End the program!

  • Is the whole of anna university writing algorithms for html?
  • Algorithms for Javascript,JSP- thats perfect. Ofcourse they solve problems and we need algorithms, but this?

Hope we are not a herd of dumb-boxes.

Dumbest Story, you would’ve ever read

Everything he could hear was nothing,but a nightingale sing. And notably, he was in that typical Friday Last Hour Class of Compiler Design.
For all those who nod of how a nightingale sang in a friday class: Its coz he was fast asleep, into the world of dreams.

And Aawww! that nightingale voice turned into a typical, not so sweet voice, quiet familiar one. It took a minute to get his sense and realize it was actually the lecturers voice and he was not actually was in a wonderland!

So finally when he managed and stood up, All he saw through that blurred view was- A board, A Man standing beside with a Chalk, And no nightingale anywhere around, and a snippet –

for(i=1;i<50;i++) {
c=i*7;
}

By the time he realized that all he had to do was optimize the snippet by removing the * from the expression, without modifying the result.

So lets come to senses, What we do now!

– The code does nothing, except finding the multiples of 7 upto 49*7
– There are three different ways you could handle this
– One by how we learnt tables, our sweet little shortcut method when we wrote them at 1st std, add 7 every step
-So that will lead to something like this

for(i=0;i<50;i++) {

   c=c+7;

}


-That will do pretty fine! but if mr.Nightingale looks for a solution without actually modifying the strategy itself,to eliminate * , a double loop will do!(thanks to lucia, for making me change this!)


for(i=0;i<50;i++) {
sum = 0 ;
for(j=0;j<7;j++) {// j is just a namesake variable to produce 7 iterations
sum = sum + i;
}
}

– This eliminates *, but what if mr. Nightingale looked to reduce the code significantly! Lets take this

for(i=1;i<343;i+7) {
i;
}

-Its that simple!

Now that poor guy couldn’t actually go and explain all these methods! So he sat and snored off to his neverneverland! To his nightingale symphony!

Object! Object! Object!

One thing that kept  blocking my  ‘To Do’ list was writing a blogging engine. Thats because it would be cool. Adding up ,I wanted to enhance my command over the language.Thats pretty how I learn a new language.

So on one fine day, I set out to cross it out from my list, when I realized I was already a bad OOP perciever. Thats obvious b’coz the only object oriented programs I’ve written in school and college contained a class called box (or something analogous). Construct it width height width blah blah blah. Inherit it. Overload it. And apparently that tiny box doesn’t do ANYTHING!

Thats how the ‘sparkling neon bulb’ of writing a blog software implementing Object Oriented Concepts came up.
What else? So plan it up.

  • My blog will contain posts. Thats what a blog is all about.
  • It will contain properties like time it was posted, Who posted, Title, etcetera…
  • It has to encompass some operations too that would manipulate its properties uuuuhhh say, like GiveMeSomeValues(), GetMyValues(),GetMyValuesSpecifically(), PushMeToDatabase(), etcetra…
  • If am not wrong, A Post can be an object in my blog.
  • If a post is an object, I’d have to create an array of objects to retrieve GetMyValues() of all the posts.Again,If am not wrong.
  • So it has to interact with database object that will have its own properties like connect() getValues(), etcetera
  • Comments, the part I Like the most, can also be made as an object, if not essentially too! with its own properties and operations.
  • Still stuck with dilemma. Am I going the right way? Am I making it complicated? Might not be a good start for an beginner of OOP.

After all its from mistakes that we learn!