Skip to main content

Posts about planetpython (old posts, page 1)

A Hundred Days of Code, Day 043

Continuing with the Flask course.

Today I learnt about how to loop, using Jinja loop blocks.
The syntax is slowly becoming clear to me.
Everything python related in enclosed is {% … %} blocks, except for variables which use their own {{ … }} syntax.

What I am still confused on is the relationship between the various files, I am writing. There is html and then there are templates and there are python files themselves. Hopefully that will get clearer in the days to come.
My naïve understanding, right now, is

  1. Some native python code is mainly for launching and running the app.
  2. The html templates pull data from …
  3. The flask python code I write (the routes file, as of now).

I also learnt how to extend templates. I created a base template that basically contains the header and the title, which will now be used by every new webpage I build. Right now, it’s just the home page.
I can see a footer or header or some such persistent element that needs to be on every page, that can be created once and then extended multiple times.

More, tomorrow …

P.S. Looking at that finished app, and knowing my extremely rudimentary Python skills, I feel like an apprentice mason, hammer and a chisel in hand, wondering, how in heck, am I going to carve David?


A Hundred Days of Code, Day 042

Second day with the Flask course.

Beginning to realise that Flask is not a monolithic thing, but consists of a lot of moving parts.
Looking forward to learning what they are as I progress along.

Today I learnt how to set my Flask variable, and create an environment, so that I can run Flask consistently without problems.

Miguel also teaches a simple, yet effective way to combat yak shaving.
You know, where all you want is one simple thing, but then that depends on that other thing, which reminds you that you need that third thing and the next thing you know, you’re at the zoo, shaving a yak, all so you can wax your car.
Just don’t do that other thing.
Focus on what you are doing.
If there is something you need, use a dummy. Mock something up.
This is a very real, meta lesson, that I’ll carry with me for the rest of my days.

So I learnt how to return a web page.
And that got tiring really quickly.
Which is when Miguel introduced me to templates.
And I realise why they are needed.
I created a basic template and also learnt about conditionals in the templating language, Jinja and then I called a stop to the day.
More to follow tomorrow.


The Long Road I took to Learn Basic Python

I have been wanting to switch careers to programming for a long time now.
Just that juggling a part time job, home work, and a broken back, always kept me from somehow giving it the time, that that I needed.

It has been two years now.

My lowest ebb, was September last year, when I caught a really nasty bug, was laid up in bed, for nearly a month and then checked myself into a hospital because I thought I was having a heart attack.1

In the meanwhile, people have learnt stuff, gotten careers and rocketed up their charts while I sit here spinning my wheels.
Or at least I used to think, I was spinning my wheels, until this month.

In my head, I used to be like, why is this so hard for me?

I write this, to remind myself from getting discouraged.
To remind myself of the progress I made, even if it hasn’t been much yet.
To show my future self, that past Jason, was not a fat slob.
He worked his ass off. And he was resilient.
I write this, because I had a few hard days again, but this time I don’t want to slide into a pit of despair once more.

The first thing, I reminded myself, was that everybody’s journey is different.
With my physical problems, it has not been easy to focus.
I have to juggle a ton of things, as a husband, son, consultant, patient and student.
And while it may seem all dark and gloomy, I was surrounded by incredibly loving and helpful people, which has made my journey, a lot easier than it would have been without them. My wife, my mother, my friends … all pillars of support!
So the pace I am at, might be much slower than other people, but it reminded me of something my physio said to me when I was sure, I would never be able to run more than 2 minutes straight.

You might be slow.
You might be fat.
You might be in pain.
But you will be better much sooner than other folks I know.
Because you are doing it.
While the rest are still sitting on their asses, moaning.

The second thing I did, was to take stock of how far, I have actually come.
Yes, I am not as financially well off as I would like to be.
Yes, life has kicked me in the nuts, more times, than I would like to count.
But I dug myself out of poverty.
I am working myself to the best shape of my life.
I could barely walk two years ago, and now I am practically running.
I am steadily inching to being my weight in my early twenties (while being much fitter than I was then)

So the problem is not me.
It might take time.
But I can do this.

And as I am doing this second public round of a hundred days of code, I realise all I have to do is to have no shame about my speed (or my abilities), and be resiient and persistent.

And to remind me about just how far I have come, I write this down.
I started nearly three years ago. I wasted a year, spinning my wheels.
And then I found Kushal and DGPLUG. A more supportive mentor and a more welcoming community, I hadn’t experienced in my life. I am still learning from them. And they still teach me with unending patience. If you are ever on IRC, just come say hi on the #learnandteach channel on Freenode.
I started learning the basics from a kids book, because the big ones were confusing.
I tried learning python after that, but I failed.
I tried lots of books, and online sites, but I just could not get it.
I realised that just learn the syntax and go, does not do a thing in my brain.
Or the excellent Python for You and Me would have been just the ticket.
Then I realised that maybe learning more basics would help.
And that this was not something I could learn in a few weeks or months.
So I studied the raw basics of computer science, so I could understand, what was what.
And then I understood some.
I then took my time and read the biggest non fiction book I ever read in my life. The Lutz Python Book.
And I understood some more.
I went and watched a series of videos by some kid on youtube.
And I understood some more.
Just doing all this took the better part of a year and a half.

Now here I am.
On the cusp of a moment, when I think the dam might break.
Because things make sense faster now.
I can read what other people write and actually understand.
I can think for myself and write short programs.
I can understand what the other folks teach and get it.
From here on, it seems just like a matter of loads of practice.

I write this though, to remind myself, that if this moment is not to be, then I needn’t worry.
I can see how far I have come.
I will do this.
All I need to be is shameless in my learning, patient in my attitude, and resilient in my mind.

P.S. I realised all this was inspired by an old Aurelius quote,

“True good fortune is what you make for yourself. Good fortune: good character, good intentions and good actions.”


  1. Spoiler. It wasn’t. Just an enlarged spleen acting up due to complications from the bug. Still serious. Just not a heart attack :) 

A Hundred Days of Code, Day 006

Journal progam done!
Yay! Find the code over at Gitlab or Github.

The program is a lot more basic than I expected.
It does not let me keep multiple journals :)
But I’m happy with what I learnt.

  • How to put together a program
  • How to use modules
  • Found a little extension in VSCode, called VSCode autoDocstring, that makes typing in docstrings a breeze.
  • Oh, I learnt about docstrings, to help document what I am doing.
  • And brushed up on the basics, loops, conditionals, etc.

Here’s to more happy programming.


#100DaysOfCode, Days 024, 025 & 026 – Watched Videos

Life has suddenly turned a little topsy turvy at work.
No time to work at stuff.

Keeping up my #100DaysOfCode streak by watching the course videos.
Learnt about the Itertools module, learnt decorators and error handling.

P.S.
Adding these posts back to the planet, because more than a couple of you, kind folk, have been missing me.