Skip to main content

Posts about programming (old posts, page 5)

A Hundred Days of Code, Day 012

Started up with a new program.
While the last one dealt with working with text on the internet, this one deals with binary data.
The point to go get some images (lolcats) in my case, download them to a folder and display them.

Watched all the videos today.
More tomorrow.


A Hundred Days of Code, Day 011

Ok the weather app is done.
Er, only it’s not the weather app anymore, it’s just a temperature app.
The program was meant to pull all sorts of details from Wunderground and apparently the site has changed into a different, more complicated (to me) web page.
I did not want to spend all my time, futzing with CSS.
So I figured out how to just pull out the place name and the temperature and display it.

Things I learnt,

  • How to use Requests and Beautiful Soup to scrape and parse web pages.
  • Practiced my documentation skills a bit.
  • Learnt to fend for myself.

The code’s on Gitlab and Github.


A Hundred Days of Code, Day 010

Working on the get tempature / mini weather app.

  • Learnt about type hints.(I intuitively needed this feature as I kept dotting in my editor waiting for stuff to pop up :P glad to know such a thing exists and Python supports it.)
  • Learnt about named tuples. I love anything that will let me name things the way I want.
  • Learnt about sanitising text that we extract from a web page; stripping white space and new lines and crazy characters and what not.
  • Grateful for the batteries included nature of Python. Well, not necessarily batteries included as much as batteries available on demand. Batteries of all shapes and sizes at that. I can only imagine what writing such a program from scratch must involve. To all the generous people, making modules and libraries available to use freely, and to the infrastructure that delivers it, you folk have my undying gratitude.

A Hundred Days of Code, Day 009

Cooking along on the weather project.
Managed to pull down a web page, put it into a object, return in and then create some ‘soup’ out of it.
It handily lets me inspect a lot of stuff, but finding what I want seems to be confusing.
Brains are mush right now.
Will give it another go, tomorrow.


A Hundred Days of Code, Day 007

Started up with a weather app today.
It is supposed to scrape the weather from Weather Underground, parse it a bit and then give you the weather.
Made the template of the app.
For some reason requests does not seem to be recognised in VSCode.
Will do more tomorrow.


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.


A Hundred Days of Code, Day 005

Still working on the journal program.

But made significant progress today.

  • Learnt how to read and write from files (lots more practice required)
  • Learnt how to pass variables around between modules, that are spread across files (still find it confusing. guess that’ll ease with practice)
  • Learnt what all that __name__ stuff is all about. (pretty simple actually. if main is not my name, i refuse to run. you call me in vain1)
  • And finally, learnt what docstrings are. They’re basically bread crumbs I leave for myself and other folks reading the code, to figure out, for example, what a function does, what input it expects, what output it’ll poop out and all that jazz. Basically, documentation for programmers, by programmers.
  • Once I document my code up tomorrow, I will be done.

Here’s to more productive days!


  1. Well, not vain really :) the other use case is to import this file into others 

A Hundred Days of Code, Day 004

After a series of disasters in the kitchen today, I fear my hundred days of code is going to turn into a hundred and one days of code.

My box of new eggs shattered on the floor. My box of old eggs turned out rancid and extremely foul smelling. I had to clean up the whole sordid mess. Not before I boiled a few of the old ones. Now I have a smelly cooker too. The house smells of rotten eggs. My wife is about to puke. I have rotten egg on my hands literally (and on my face, metaphorically). Oh, and the chicken is on the stove, burning.

Putting out all these fires is too much for me, today.
So I am cutting myself some slack, giving myself some grace, goofing off on irc and going to bed.

Tomorrow is another day.


A Hundred Days of Code, Day 003

Still on the Journal program.

Learnt how to split functionality between files, so that I don’t have a giant hodge-podge of code.

Ran out of time. File I/O tomorrow, I guess