Skip to main content

Posts about blog (old posts, page 83)

A Hundred Days of Code, Day 029

Awfully proud of myself today.
I wrote little program to scratch an itch, I had.
It’s still rough, but it does what I want it to, and that makes me happpy.
I go to Poetry Foundations’ Poem of the Day ever so often to catch a poem.
And I wondered, what if the daily poem showed up in my RSS reader everyday?
I searched and unfortunately couldn’t find a feed.

So I did the next best thing.
Armed with my newly acquired, Python knowledge, I set out to see if I could just get a link to a new poem daily.
And what I ended up doing was writing a program, that scraped the webpage metadata for the date, compared it to today and if it was, created a baby xml feed for me, that I have now put into my reader.

It’s a blank entry. The title takes me to the poem foundations page, so I don’t miss a day.
I put the program on my linode and then scheduled a cron job that runs the script once a day and moves the xml file to the appropriate place.
Today’s run was brilliant. Let’s see if it holds up tomorrow.

Right now it just overwrites the current item, since that is all I need.
But I could also look at building a list of daily items, if I so desire, later.
I need to just show up every day, for this positive ratchet to continue.
Like Seth says,

The hard part is “steady.”

Anyone can go slow. It takes a special kind of commitment to do it steadily, drip after drip, until you get to where you're going.

The code as usual, is here on Gitlab and Github1

  1. I still have to document it. But I will save all that for another day. More practice to do! 

A Hundred Days of Code, Day 028

This probably will be a few days of bike shedding.
I finally came up with a problem, I want to solve for myself and then realised, I don’t know enough command line fu to integrate my stuff with my operating system, the way I like.
So I am going to spend time, learning how to use the bash shell.
Been searching, copying and modifying scripts for far too long now.
Best to get this skill in my kitty as soon as I can possibly learn it.

P.S. Learnt enough in a marathon 12 hour session to be dangerous, to know what I want and look it up.


Help the folks, who need your help the most at this hour!

Donate to Goonj to help our daily wage earners and labourers.

trees reflecting in a pond

click to embiggen

The time will come
when, with elation,
you will greet yourself arriving
at your own door, in your own mirror,
and each will smile at the other’s welcome,
and say, sit here. Eat.
You will love again the stranger who was your self.
Give wine. Give bread. Give back your heart
to itself, to the stranger who has loved you

all your life, whom you ignored
for another, who knows you by heart.
Take down the love letters from the bookshelf,

the photographs, the desperate notes,
peel your own image from the mirror.
Sit. Feast on your life.

— Derek Walcott, Love after love.

Pair with these beautiful odes to the poem and the poet.

P.S. Subscribe to my mailing list!
Forward these to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.

A Hundred Days of Code, Day 027 (Python Beyond The Basics - Object Oriented Programming)

Realised that while I do know rough and tumble basic Python, I have a long way to go before I can do things or even understand things.

Half of my frustration writing, is because I cannot do the things, I want to do, and I struggle along and by the time, some generous friend shows me or I find the answer on the net, I realise that I don’t know this part of Python at all!
I have a vocabulary problem. I know to talk like a child, not communicate like an adult.

So I have decided (let’s see how this pans out) to spend Saturdays learning something new about Python. Do some deep work.
Probably once I know enough this time could be spent working deeply on a project.
The realisation is that I need to do both, study as well as practice to learn as fast as I can.

To that end, I went and learnt about classes in Python today.
I used David Blaikie’s Python Beyond The Basics - Object Oriented Programming to get up to speed.
This was an excellent, class on the basics of classes and their implementation in Python.
I can honestly say, I know a lot more about reading and understanding Python code now that I have been through this class.
Classes, the Three Pillars, Subclasses, Exceptions, Debugging … all the basics are there.

Now, to put this knowledge to good use, in the coming weeks.

A Hundred Days of Code, Day 026 (Grokking Algorithms)

With my area in near-quarantine, I was too busy rushing around, making sure family was ok.

Had a lot of patches of free time, in the middle of things though.
So I decided to read about algorithms.
I know I need a good base in the future, and knowing about the turtles that underlie my new world.

I decided to start small, and picked up Grokking Algorithms.
I loved it.
It taught me about the big low hanging basic problems that folks need to solve using computers and the patterns / recipes / algorithms we use to solve it.
Problems like how to sort stuff (selection sort, quicksort) And how we can break down a big problem into a set of similar problems that get smaller and smaller and solving them all using a single solution from the inside of the problem onion, outwards, or from the smallest Matryoshka doll to the largest. (recursion)
And how lists function and how to find the most efficient way to get from point A to point B.
It covers a set of the basic algorithms in use today and has plenty of pointers to more efficient ways of how things are done in the real world and also where to find more advanced problems.

It’s engaging, teaches its points with stories and pictures and has exercises to ensure you are paying attention.
I loved it.
I loved it so much, I finished it in a day :)
If you are just beginning and you want an easy way to understand what all this computer stuff is made of, this is a very good book.