Skip to main content

Posts about dgplug (old posts, page 12)

Study, Day 8

French

The app is now buggy, since the last update and crashes on me all the time.
Am at it though.

Python Practice

This is stupid.
I spent an hour just setting up my environment all over again.
This should teach me to do at least a little bit every day.

  • 1 hour of setup
  • 1 hour of tremendous headscratching
  • No practical reasults.
  • Tomorrow hopefully is a better day.
  • The only positive thing is I feel, my mind has begun to crank again.

Python Jumpstart by Building 10 Applications

  • Started watching the videos.
  • Built three tiny apps in rapid succession.
  • Getting my python mojo back.
  • Run out of steam after 3 hours.
  • Ending on a high note, though. will pick up the pieces tomorrow.

Books I’ve Read, July Edition

Lots of fantasy, a lovely book of poetry, a beautifully written nonfiction book.
All this, on July’s list of books :)

July

  • Love Looks Pretty on You, Lang Leav
    (must read. in my imagination, leav is a talented younger sister, who has been through a lot more and writes her advice just for me, in her poems)

  • Working, Robert Caro
    (if you haven’t read the Power Broker, you should
    if you haven’t read the Lyndon volumes, you should
    this book is Caro’s account of the work, that went into those works.
    the ceaseless toil, the thankless years, the people and their stories
    Caro is Caro, master of the craft.
    There are only a few explicit lessons here.
    but plenty if you care enough to read between the lines
    plenty if you make this an annual read, like i will)

  • The Broken Earth Trilogy, N. K. Jemisin
    (if you love fantasy, this is an absolute read.
    world building at its finest.
    The journey she takes me on! The magic she creates! The world she imagines!
    It’s such a harsh world, but gosh darn it, I want to live there.
    Jemisin’s awesome.)

    • The Fifth Season
    • The Obelisk Gate
    • The Stone Sky
  • The Inheritance Trilogy, N. K. Jemisin
    (This was Jemisin’s older trilogy and it shows.
    The language is rougher and the characters drag on a bit
    Minor quibbles though. It was a really good read)

    • The Hundred Thousand Kingdoms
    • The Broken Kingdoms
    • The Kingdom of Gods

P.S. Subscribe to the mailing list to see what I read every month :)


How To Say No to Others, Better!

Last weeks post seemed to have hit a nerve.
Most of you seem to have opened it rather quickly.
And then a few of you, complained! Rather quickly.

“All this is well and good, but I want to say No, to other people!

Well, I can help you with that too!
Eric Barker, of Barking Up the Wrong Tree fame, has an excellent post on how to do just that!

This is how we do it.

1. Notice the no’s: Saying no rarely leads to vendettas or blood feuds. It’s more common and less risky than you think.
People say no to requests all the time and suffer no ill consequences. The sea doesn’t turn to blood and frogs don’t fall from the sky. The requester just shrugs and says, “Okay.”
But you forget those all too easily and train your attention on the 0.02% of the time when the other person blew up and stormed away, never to speak to you again.
So watch your interactions and the interactions of others more closely. Notice all the times “no” doesn’t cause any problems and try to develop a more realistic perspective.


2. Buy time: I’m not sure I can summarize this one right now. I’ll get back to you later.
When you feel pressured for a yes, don’t give the yes — relieve the pressure. Ask for time. This will allow you to calm down and properly evaluate whether you really want to agree or not.
Memorize two of these phrases and make them your default response to any request:

  • “I need to check my calendar; I’ll get back to you.”
  • “Let me check with my husband/wife/partner to see if we’re free that day.”
  • “I’ve got to think about that; I’ll let you know.”
  • “I’ll have to call you back in a few minutes.”

Don’t turn them into questions. They’re statements. And use a pleasant but assertive tone.


3. Have a “policy”: Sorry, but it’s my policy to never summarize the third point.
… suppose a friend asks for a loan you don’t want to extend. Utter the phrase “Sorry, I have a policy about not lending money,” and your refusal immediately sounds less personal. In all kinds of situations, invoking a policy adds weight and seriousness when you need to say no. It implies that you’ve given the matter considerable thought on a previous occasion and learned from experience that what the person is requesting is unwise. It can also convey that you’ve got a prior commitment you can’t break. When you turn down an invitation by saying, “Sorry, I can’t come—it’s our policy to have dinner together as a family every Friday night,” it lets the other person know that your family ritual is carved in stone.


4. Be a “broken record”: I can’t summarize this. I can’t summarize this. I can’t summarize this.
How do you deal with people who don’t take no for an answer?
First thing to do is say you can’t help them.
The second through seven-hundredth thing to do is repeat the first thing.


5. Use a “relational account”: If I summarized this for you I wouldn’t have time to summarize for others.
Your response should take the structure of: “If I helped you, I’d be letting others down.”


6. Make a counteroffer: I can’t summarize this but I can link you to another blog that will.
What if you don’t want to give a flat no? You want to help but can’t commit to the specifics of what they’re asking for. Here’s what to do …
They want you to donate $487,000. Um, no way. But I can give you $10 …
“I’m not qualified to do what you’re asking, but here’s something else.”
“This isn’t in my wheelhouse, but I know someone who might be helpful.”
You can make a counteroffer to almost any request by offering someone a different resource or the name of someone else who might help.

Like my summary of Eric’s summary?
You should go read his post. It has the why, and the how and tons of examples and references!

P.S. And if you’re reading this on my blog, you should subscribe to the newsletter!


go-bonkers-do-the-work

— via Neil Gaiman

o0moxxie0o asked: Hi I just finished outlining a novel and now I'm worried it's bonkers. Did you ever worry that something you wrote was too much, or just have second thoughts about what you're planning? I'm going crazy over this thing.

I assume that unless it’s bonkers I’m not doing the work.


Study, Day 7

Was on a roll.
Went and finished the whole geography textbook.
My brains are smoking now.

Next step, spaced repetition exercises of all the chapters for two months.

MITx, 6.00.1x, Introduction to Computer Science and Programming Using Python

Did quite a bit of the course’s exercises. I realise now that I should have just downloaded the course from the Open Courseware site and worked on it at my own pace.
The MOOC is excellent, but not for me.
I keep missing all sorts of deadlines.
My life and the MOOC sadly do not get along.

Or maybe, I just do the MOOCs at my pace, knowing that there will be things I will miss, but as long as I get the learning (and I do the practice), I should be fine.

Did up to Week 4 of exercises.
Will tackle the rest next week.


French, Week 12

This was a boring week.
But I kept at it.
If I think, I have made progress, all I need to do is listen to a podcast.
And then I understand how far I still have to go.

Still at the stage where I am adding words to my basic vocabulary and doing review.
But there is steady, incremental progrgess.

RIP, Rutger Hauer


I've, seen things, you people wouldn't believe.
Attack ships on fire, off the shoulder of Orion.
I watched C-beams, glitter in the dark near the Tannhäuser Gate.
All those, moments, will be lost, in time, like, tears, in rain.
Time, to die.

Blade Runner was the first movie I saw, that had a morally ambigous ‘hero’.
And the villain is not bad?
And he saves the hero?
This was the first movie that made me look at the world in shades of grey, in shades of acceptance.

And all that, because of the pitch perfect Roy Batty, speech.
Like Robert Caro writes,

There are sentences that are said to you in your life that are chiseled into your memory.

Tears in rain was the earliest of those for me.
Rest in peace, Rutger Hauer.
And thank you, for changing my life.

Study, Day 6

Did a little bit of french and geography.

MITx, 6.00.1x, Introduction to Computer Science and Programming Using Python

Doing compsci but no notes today, because i am busy learning.
Am going to have to revisit oop sometime again.
will make notes then

But to summarise,

  • i learnt oop
  • i learnt about generators,
    • which to me sounds like a tap on a loop.
    • instead of a bucket of water, i get it by the mug.
    • here’s a mug. here’s another mug. here’s another mug.
    • enough? then i can turn the spigot off
    • no need to fill the whole bucket (run through a whole dictionary, or carry out a huge operation) when I can just take however much I need.
  • i learnt about o notation to figure out how long code takes to run, if want to later optimise stuff
  • sorting lists with sorting algorithms
    • bubble sort
    • selection sort
    • merge sort efficient
  • i learnt how to plot using python

Have finished all the videos and will now move on to the problem sets.
I had so much fun, I actually was sad to watch Prof Grimson’s last video.
The course has given me a really good grounding on the basics.
And should help me start my journey.
While I understood the what, MIT 6.00.1x gave me a good grounding on the how and the why.

Study, Day 5

Did some geography for 12th in the morn.
Slow, steady, iterative progress there.


MITx, 6.00.1x, Introduction to Computer Science and Programming Using Python

exceptions & assertions

Exceptions

  • What happens when program execution comes across something that it did not expect?
    • like you could go beyond the bounds of a list
    • i try to reference a variable that isn’t there
    • i mix data types. (i dun dis :P 'a'/9)
  • This is basically Python telling me, ‘I don’t get this! Whatcha talkin’ bout Willis?’
  • Python has a whole host of errors, the names of kinda give me clues to what it thinks the problem is. There are
    • SyntaxError (I boo booed typing somewhere, Python does not ‘get’ me)
    • NameError (Can’t find a variable. Did I put it in? Did I call a module correctly?)
    • AttributeError (Errors with classes. Am I calling them wrong?)
    • TypeError (Am I doing string operations on numbers? Or vice versa?)
    • ValueError (Something is wrong with my results. Is it in a form the program understands?)
    • IOError (something that happens when i make boo boos with files)
What do I do with exceptions?
  • Fail silently (like fart silently and then look about innocently)
    • bad idea, though, really bad idea :)
  • Return a “error” value
    • make sure that you have code that can check for and handle the values you choose
    • makes code a little clunkier
  • Just stop execution, and signal an error condition
    • in Python that’s called raising an exception like so,
      raise Exception("Good God! You’re dividing letters with numbers?!")
Dealing with Exceptions. How do I handle them?
  • Use the try & except keywords.
  • As in you’re telling Python, ‘try’ this code. If everything works well, great!
  • But if there’s an error, jump to the ‘except’ clause, and execute what is in there
  • And then carry on with the rest of the program
  • I can then get fancy. I can have multiple except clauses.
    • one to handle typos
    • one to see if my input is valid
    • one to handle division isssue
    • and a final one as a catch all, if all else fails.
  • There is also an else that i can pair with a try
    • the else will execute code if try block it is associated works, with out any exceptions.
    • like ok, try this. all worked? then go that else block and do that thing and then carry on with the rest of the program
    • to my mind it kind of is the main program, because this is the part that always executes.
    • so as I iterate, i keep removing things from try and move them down to the mandatory else clause
  • And then there is finally
    • executed after try, except and else
    • even if they raise errors or cause a break
    • useful for cleaning up after a mess :P (close a file for e.g.)
    • like ok, here’s a booboo, but I better put everything back in it's place and undo stuff if I can
    • like do no harm.
Exceptions as control flow
  • turn the idea of exceptions on its head
  • instead of waiting for errors and catching them and then raising exceptions
  • we could check ourselves for expected values and raise our own exceptions if results don’t match expectations :)
    • like if i am unable to produce a result that is consistent with the specifications of a function
  • to do that we use raise
  • we raise exceptions
    • like raise iAmDisappointedinYouError("You should have written this better")
    • or more likely you want to raise an existing known error like raise TypeError("You need to enter a number! For the love of God, enter a number!")

Assertions

We can take the idea of proactive exception raising, to another level.
We can defensively program so that we prevent situations that lead to unexpected results.
This idea is what we call an Assertion

  • Remember those docstrings we typed where we expected a certain of inputs and guaranteed outputs?
  • you can think of assertions as the bouncers who enforce them
    • i assert that this should be true. if not, raise an exception
  • you can use the assert statement that in turn will raise an AssertionError if conditions aren’t met
    • could be on inputs (typically, mostly used here)
    • on an intermediate stage of the program
    • if i want to be really careful, i can use it to check output too
  • having these checks makes it a lot easier to locate the source of a bug
    • because if an assert fails, the bug most probably should be just before we called this function
  • Where should you use assertions?
    • so spot bugs as soon as they are introduced and clarify where they happen
    • as a supplement to testing
    • filter and check input
      • check types of arguments or values
      • check that invariants on data structures are met
      • constraints on return values are met
      • violation of constraints on procedure (no duplicates in a list, for e.g.)