Follow

Anyone else having trouble with actually sitting down to write? I have a good topic but I'm finding it hard to make time for writing. After I look after my responsibilities, I don't have much impetus left.

@bradfonseca I find it really hard. Last year I tried to write one post per week, and gave myself permission to have 4 weeks off. I did OK, and now when I'm trying to get one every two weeks it feels more relaxed.

Picking one from the long list is hard. I wrote some Python to just pick one at random and I write about that for a minimum of 10 minutes. Sometimes I then discard it and pick another, sometimes I discard it and quit for the day, sometimes I keep going, and it's done.

But it's hard.

@ColinTheMathmo
I like your idea of randomly picking a topic and just writing on that for 10 minutes to see where it goes. My challenge is having a big enough list to choose from.

I'd love to see your Python code for the topic randomizer.

@bradfonseca Choose random line from given file in Python 2:

#!/usr/bin/python

import random,sys

line = 'No lines given!'
p = 1.0
n = 1
filename = sys.argv.pop(0)
while sys.argv:
filename = sys.argv.pop(0)
handle = file(filename)
this_line = handle.readline()
while this_line:
r = random.random()
if r<p:
line = this_line
n+=1
p = 1.0/n
this_line = handle.readline()

print line,

Not exemplary code, but does the trick.

@bradfonseca Here is an incomplete list of things I might blog about:

solipsys.co.uk/new/ThingIMight

There are extras there too that need culling, but there's plenty to choose from.

I don't try to be profound, I just share stuff I know and hope that some people find it interesting.

@ColinTheMathmo
"Not exemplary code, but does the trick."

That's the beauty of Python. You can hack together something relatively quickly to get a computational job done.

I may borrow your code for personal use, if I have your permission.

@bradfonseca The challenge is preventing hacked-up code from growing into something you want to deploy, without ever going back and making it maintainable. It's great for quick hacking jobs, but sometimes that's a trap.

@ColinTheMathmo
That is always the risk with quick-and-dirty programming hacks, no matter what language you use. You deploy something and it works after a fashion but it's a mess when you look at the code and you can't easily maintain it.

@bradfonseca That's why it's important the third time you visit code to back off and look at either (a) freezing it, or (b) reworking it "properly".

Classic problem with managing any project.

@bradfonseca You may certainly use the code, with all the usual caveats.

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko