Archive for the ‘Programming’ Category

2012w38

Sunday, September 23rd, 2012

Patent / Copyright madness

Automated copyright enforcement really seems to work well… NOT!

And Apple is up to no good as usual…

Patent trolls trolling around, but it would seem not without a fight :)

Oh, and if you were thinking of setting up a service which required a login, and you thought you’d protect people’s accounts well, then that might be patented…

Programming

Through this reddit thread (referencing it both for source and because the comments in there are relevant) I was lead to this post sometime this week or last.

And this weekend, while doing the weekly write-up, I re-read the post, and started thinking, because I kindof feel that my own hobby projects very easily fall victim to this. They get shot down because I start thinking of how much stuff I would have to rewrite (things I’ve already solved in previous projects, but never put down the time to make generic enough to reuse) or figure out, and it just takes my edge off wanting to sit down and do it.

But then it struck me, what help me get reinvigorated, what helps me come over at least that hurdle: A moderately quiet place, time enough for a conversation, a good (programmer) friend, and optionally a beer.

Broken gets fixed. Shoddy lasts forever — I wonder, does this mean that, if something is shoddy and you want it fixed, the correct action is to break it? ;)

git

I found myself wanting a way to have a central repository react to pushes based on what branch was pushed (I am working on a script at work, which some of my colleagues are beta-testing for me).

Whilst I develop a new feature I need a way to push that potentially buggy version of the script to a path where the testers can find it, while using a completely different path for the stable version which everyone else could use without any big risk of it messing anything up.

What I ended up with was this:

#!/bin/sh

read _from _to _branchPath
_branch=`basename $_branchPath`

if [ "$_branch" == "develop" ];
then
    cd /path/to/local/repository/on/server
    unset GIT_DIR
    git pull
    git checkout develop
    cp -f ./scriptname /path/to/beta/test/directory/
fi

Two questions on Stack Overflow helped me out tremendously: This and this (and as always, pesa was a big help too)

And since I agree with this post (namely that vimdiff would be a great diff viewer for git) I went ahead and followed the instructions of that post :)

vim

Using vimwiki to track time sounds brilliant. It’s almost enticing enough for me to look into vimscripting to help out. Yet another project I’d like to spend time on :S

Being that paranoid soul I am, and now that I can also call myself a tester, I realize I’ve become even more aware of how many different entry points there are which needs to secured, such as vim’s modelines (protip: use secure modelines

From this post I learnt about license-loader, which I need to look into.

awk

I found this post to be an excellent intro to awk, I am going to spread this around whenever I need to show anyone the basics :)

Misc

This post about 52Hz made me kindof sad :/

On the other hand, this post filled me with some hope.

I think it could be beneficial if this site was more widely distributed, so here’s me doing my part.

Finally, this post was pretty cool, and I immediately thought of at least two people I know who would get a kick out of reading this. :)

:wq

AWK hackery++

Thursday, September 13th, 2012

While I cannot take credit for the solution which follows (the real star is Pontus) what I can do is document it for posterity:

The scenario is as follows: You have a couple of log files, foo.X.log for X in [1,2,..,N-1,N] and you want to watch all of these for a certain pattern, P.

And all of these matching results you want to write to a condensed log, in the format <originatingLogFile>: <lineThatMatchedPattern>

You have figured out that tail -f foo.*.log will yield you all the lines, and separate output from the various files using ==> foo.X.log <==

You might have tried with grep, to get the correct lines, and perhaps even got it to output to the file using --line-buffered but you are not out of the woods, that pesky filename at the beginning of the line is still nowhere to be seen.

grep? where we’re going, we don’t need grep

Every time that tail outputs a line from one of the other files than the last one indicated by ==> ... <== it outputs that pattern again on the line before the output.

E.g.:

$ tail -f foo.*.log
==> foo.1.log <==

==> foo.2.log <==

==> foo.3.log <==

Now, from another terminal, while the tail is still following all three of those logs, let us insert some content:

$ echo "PATTERN, some more stuff" >> foo.2.log

Which results in the first terminal now displaying:

$ tail -f foo.*.log
==> foo.1.log <==

==> foo.2.log <== 

==> foo.3.log <==

==> foo.2.log <==
PATTERN, some more stuff

Ok, so whenever new content is pushed onto any one of the tailed files, we will get notified of it, along with what file it was pushed to (note though, that if we were to push more content into the same file as was previously pushed to (foo.2.log) it would NOT generate another ==> foo.2.log <== line, it would simply append to the ongoing tail:

$ echo "PATTERN, even more stuff" >> foo.2.log

$ tail -f foo.*.log
==> foo.1.log <==

==> foo.2.log <==

==> foo.3.log <==

==> foo.2.log <==
PATTERN, some more stuff
PATTERN, even more stuff

This doesn’t matter much, our solution will adapt to this, but it is a gotcha worth noting (although it should be instantly obvious to anyone reproducing this on their own anyway)

Anyway, with that out of the way, lets get down to business: AWK hackery!

First order of business: We have a pattern we wish to match. This may or may not change at a later data, and sure, we could practice YAGNI (You Ain’t Gonna Need It) but let us prepare for it anyway by assigning the pattern to be matched in the invocation of AWK (this will assume that we have stored the pattern to be matched inside the variable “$_P”):

awk -v pattern="$_P"

Since AWK operates on lines (that is a simplification since one could redefine what constitutes a line) and it won’t remember whatever was in the line if processed in the previous iteration (previous line) we need to store the latest file(name) into which a line was added.

To achieve this we need to detect whenever new content has been added to a new file (i.e. whenever a new line consisting of ==> foo.*.log <== appears.

BEGIN { filename = "" }
/==> .* <==/ { filename = $2; next }

Since BEGIN triggers before AWK starts any processing, it is the perfect place to define our placeholder variable filename in which we are going to temporarily store the filename of the file into which data is presently being entered into.

The next line matches any line containing ==> followed by anything really, followed by <==. Upon encountering one of those lines, we store the stuff between the arrows in the filename variable.

$0 signifies the entire line, and everything inside that line, separated by newlines (start and end of line) or whitespace, is assigned a numbered variable $1 .. $x for x in number of whitespace-separated words in line. (Again, we could reconfigure AWK to not split things on whitespace, but in this case there would be no sense in doing that.)

And just to ensure that we won’t ever match the ==> .* <== line with whatever we put in $_P we tell AWK that once we have stored the filename, we should move on to the next line.

Next on the agenda is to match the pattern:

$0 ~ pattern { printf "%s: %s\n", filename, $0 }

Essentially this tells AWK to look inside $0 (the whole (current) line) for the stuff we have stored in the variable pattern (i.e. $_P) and if there is a match, print it out, first the value stored in the filename variable, then a colon and a space, followed by the entire line that matched ($0) and finally a newline.

Rinse, repeat, until we abort the command with C^c.

Now, this is not the end of the story though. We wanted to write this to a file. But AWK does not write to file until it has processed all of the input, and this will not happen since tail is following and will not end until we kill it (and in doing that we lose it all before it has a chance to be written to file). pesa points out that I got this wrong, go downwards and read his comment for the real deal

Doh!

What we need is a way to tell AWK to write directly to file directly after it has found a match and printed. fflush() is the function to make this happen for us:

$0 ~ pattern { printf "%s: %s\n", filename, $0; fflush() }

Now all we have to do is wrap the whole thing up, redirect to the filename of the condensed log we want to establish:

tail -f foo.*.log | awk -v pattern="$_P" '
    BEGIN { filename = "" }
    /==> .* <==/ { filename = $2; next }
    $0 ~ pattern { printf "%s: %s\n", filename, $0; fflush() }
' > condensedLog.log

There is one big gotcha here though:

If you are starting a tail on log files which are already populated, tail will first output everything from the first log (which is the first file to be read I suppose depends on some system settings (locales comes to mind)) and then move on to the next file, etc. So regardless of the chronological appearence of matching lines in the different files, the first files matching lines will always be presented first.

All matching lines entered AFTER this one-liner has started running, will appear in the correct chronological order.

This simply means that you will have to be prepared for this, and possibly do processing on the condensed log file as well (hopefully the logs you are tailing all have timestamps in them so that sort has something easy to operate on once the lines are entered into the condensed log)

:wq

2012w35

Sunday, September 2nd, 2012

I’ll try to keep this post short, only the most significant discoveries from this week:

git add –patch

This is the biggest revelation I’ve made in quite some time.

What it will do for me is to give me a chance to select “(c)hunks” of modified code inside a file, which I want to add to the coming commit.

If I were more disciplined while programming, that shouldn’t be necessary, but I hack on a new feature, notice a typo in another part of the code, fix the typo and continue hacking.

And then, should I just do a git add <file> the commit message would either need to be “hacked on feature and fixed typo” (ugly) or… I guess I could omit mentioning the typo fix in the commit message…

But with --patch I can now split these two unrelated changes into different commits and have a clean commit history. Awesomeness ensues!

business.txt

Just like the proposal a couple of months ago about a freedom.txt (aw crap, I just remembered I haven’t done anything with that yet…) there is now a new idea, more engineered towards businesses, aptly called business.txt, and I find myself liking that idea pretty much.

:wq

2012w29

Sunday, July 22nd, 2012
Copyright

So apparently just looking at an (web)article of a newspaper (or any web page containing copyrighted content) could mean you are infringing on that publishers copyright… do newspapers actually want to commit that kind of suicide?

I couldn’t decide whether to put this post under “Copyright” or “Censorship” since it involves the MAFIAA using the DMCA to silence things… in this particular case, it would seem, their members own marketing campaigns… With friends like the MAFIAA, who need enemies? :)

Patents

Portable electronic device, method, and graphical user interface for displaying electronic lists and documents now, how could this not apply to every type smartphone, pad, dumb-phone or, for that matter, laptop, in existence? How can such a patent even be granted?

Censorship

Censored by copyright for protesting being censored by copyright, somehow I don’t think that this was how laws were intended to be used when humanity first came up with the concept of rule of law…

Who would have thought that filtering the net may affect more than the specific group targeted by the filter? That’s impossible right?

Surveillance

Facebook is being creepy as hell as usual.

Apparently, Microsoft’s SkyDrive comes with some strings attached

Society

The European Commission intends to make open access all research findings funded by Horizon 2020. This is nice :)
Dunno if EC or UK was first, but UK is thinking along the same lines.

On the other side of the spectrum, i.e. not so nice, if things really are as dire as President Obama would have people believe, wouldn’t the responsible thing to do then, be to secure the infrastructure the hell up, instead of passing laws which any would-be imaginary-or-real terrorist would ignore?

I mean, one of the most idiotic plots in “24” was that nuclear power plants could be remote controlled over the internet. Or in Die Hard 4, that with a couple of taps on a keyboard, the bad guy could redirect a whole bunch of gas to go to the same place at the same time, building pressure, making big badaboom…

Now, if the infrastructure in fact support doing this, remotely, then those who put that in the specification, and those who produced it, and those who installed it, should all be found and tried for dangerously criminal negligence.

Of course, if the end game is to hollow out personal privacy and spy on your own citizens, then it would be better to nibble away on their rights through more new and ineffective laws, which can always be extended later when proven (through a real enemy, someone just being curious, or a false flag operation) not to work.

Justice Department sues telco for daring to challenge its secret demands for private information.

Activism

Targeting Shell with a fake PR campaign. I wonder how long it will be until lobbyists have bought an amendment to some law labeling this sort of activism as terrorism…

Join the Internet Defense League and make sure the internet never loses. Ever. Or, put another way, Rescue the lolcats from the evil clutches of the internet hate league!

Services

Blooie lets you chat online with people who like what you like I am just a tad bit sceptical about this one…

On the one hand, getting in touch with people who like what I like, Free Software, Programming, vim, etc. etc. Great! Buuuuut, how is this not willfully and intentionally putting yourself inside a filter bubble, and only exposing yourself for the types of opinions you yourself already hold? If two people say the same thing, isn’t one of them redundant? I remain a little unconvinced.

Command line

At work this week I needed to get a file from server1 to server3, and the only connection between the two was through an intermediary server, server2. Oh yeah, the only way to communicate between the servers where ssh. Sure, a three step approach was possible (scp file server2: ; ssh server2; scp file server3: ) but the file on server1 could get updated at times, which would mean yet another upload, so a simpler process was needed, a shell script with something along the lines of this:

cat $file | ssh user@server2 "ssh user@server3 \"cat > $file\""

Thanks go to pesa for coming up with the solution.

Programs

TMSU is a program which allows you to tag your files, and then perform queries on the tags, filtering out all files not tagged according to the queried constraints. Neat!

ownCloud is getting more interesting with every passing day.

I never really thought about the fact that you could do lots of things with locate such as adding flags, or configuring directories or files to disregard.

I found an expect-like utility named empty. Funnily enough I found it by checking out the examples of the Zenity fork: Yad.

Cuttlefish: Execute actions when specific events are triggered.

I am also currently trying out this vim statusline.

Throught this question I learnt about fold.

Development

Really nice ELI5 article about how flood fill works, using Zombies and Cats, and Python.

Reading this post and seeing the example resume I agree that what catmoon ponders about would be pretty cool.

Of course, the program should know what skills I have, and only select the relevant out of that set, based on the skills extracted from the job listings. At least that’s how I’d design it, as there is no good reason to lie about what you know and don’t know.

And now I finally grasp how two create quines!

When you screw up, and commit sensitive data to a git repository, this seems like a rather good way to handle it.
Oh and of course, if that sensitive data was a password, CONSIDER THE PASSWORD COMPROMISED AND CHANGE IT!

I had heard about the “Rosetta Code” before, but never got around to checking it out until this weekend, which is when I found this rather intriguing piece of Perl code.

I have to admit to being rather impressed about what one can do with html/css/javascript and some javascript libraries these days.

And although very cool, I still have yet to find a personal use for PhantomJS :/

Text books used in education should be written like this.

Other news

RasPies can now be ordered in bulk.

Here’s to the misfits.

Dunno what it’s good for, but it is pretty.

Stochastic, nerdtastic restaurant bill splitting.

Astronomy Picture of the Day har a pretty sweet image this week.

:wq

2012w26

Tuesday, July 3rd, 2012

Last week (yeah I know, this post is a little late) was pretty stressed out with a looming deadline but not-at-all-that-late on Friday afternoon, everything came together and all my assigned test cases had been executed, yay! :D

The depressing stuff (a.k.a “:(“)

A study has concluded that the “Non-Practicing Entities” formerly known as patent trolls costs money, a whole lot of money… who’d have guessed? …

 

And facebook did yet again what any popular service for which the “users” doesn’t pay a dime; changed their service without any warning, bu giving every “user” a facebook.com email address and making it the default contact email.

It sure smells a lot like the “Man-in-the-Middle” attack the previously linked to, outraged, post makes it out to be.

Then again, I can’t really understand how people can still get outraged by any of the shit facebook does. And its not like there aren’t other reasons for wanting out. Coincidentally, masses of people abandoning fb might be the only way to get them to stop frakking around with the “users” so much.

(And yes, I have consistently marked users up using quotes, because as Andrew Lewis so eloquently put it: If you’re not paying for something, you’re not the customer, you’re the product being sold.)

 

Former United States President Jimmy Carter thinks that the US is “abandoning its role as the global champion of human rights”. Not sure if that is really news to anyone, but I guess it gets a little more weight when it comes from a former President who also so happens to have won the Nobel Peace Price (then again, so did Obama, for “not being Bush” so maybe that isn’t all that impressive…)

 

And more corruption and subverting of the public good going on while the USTR and MPAA plans what I suppose to become the next ACTA (i.e. developed in secret without any chance for criticism), the TPP.

And while on the subject of ACTA, the EU commissioner wants the European Parliament to fall in line (I guess it is bad PR to always have the EU look divided… too frakking bad…)

 

If you are an Apple user, and you are using Orbitz to book hotels, please be aware that if you just boot into Windows for a quickie to do the bookings, you may save a buck or two

 

The more I think about it, the more I feel that no matter what the IETF decides, web servers (coughApache*cough*nginx*cough*LightHTTPd*cough*) should just go right ahead and implement HTTP Error Code 451 anyway. Pretty sure I will make a point to be able to serve such a response if I ever dabble with web-apps again anyhow. Because people getting angry with ISPs, which are just following the law, is fruitless. If people instead direct their anger towards the people guilty of the poor laws (i.e. politicians deep in the pockets of certain four-letter-acronym organizations, most of which having headquarters in the US) I imagine things could begin to change.

(Yes, that would mean having to vote for someone else and potentially get screwed over (depending on your political views and what you believe to be the “right” way to conduct a society) in other pieces of policy)

 

I get her point. Seems kindof hopeless, damned if you do, damned if you don’t :(

The funnier stuff (a.k.a “:D”)

Pontus showed me a cool SSH shell called ZSSH with built-in capability to transfer files, within the shell. Yes, I know of scp, but I also know what a pain in the ass it is with one-time-logins.

 

A cool (perhaps not very useful, but very visually pleasing) tool is gource. It parses version control commits, and presents them visually (see PHP, Python, OpenOffice.org, or why not MySQL for visuals)

 

Want to make Python and Erlang talk to eachother, try Erlport.

 

Finally, while I was working at Gnutiken, I had the good fortune of sitting next to Andreas Nilsson, and I know I say this about a lot of my friends, but he’s one of the nicest guy I know (I guess I have truly lucked out with my friends), but there’s one thing where he and I don’t see eye to eye.

As a designer, user interface/experience wizard etc. his stance is that the concept of files in a computer must be eradicated from the user experience.

I disagree, and this post goes a way better job at explaining my thoughts than I would ever had been able to.

:wq

2012w25

Sunday, June 24th, 2012

Quite a while since I wrote a post now, I’ve not been sick or anything, but there has been a lot of work abound, and outside work I prioritized sleeping over writing. But now I’m back for the moment, so let’s get down to business :)

Since last time I’ve come up with new ways of abusing awk, such as having it find the highest value from a command outputting in the following syntax:

\t<characters, integers, fullstop>: <integer>\n

To make it a little more different, the command also spits out a header, as well as an additional newline after the end of output.

I just now, while writing this, came up with a different solution, which doesn’t use awk:

theCommand | grep -v '^[^ \t]\+' | tr -d ' ' | cut -d':' -f2 | sort -r | head -n 1

but what I ended up using was:

theCommand | awk 'BEGIN { highest = 0 } $0 ~ /^[ \t]/ { if ( $2 > highest ) { highest = $2 } } END { print highest }'

In this case, from what I can gather, awk is the more efficient solution. One process versus five.

Update: As Werner points out, the if statement isn’t really necessary (which also makes it possible to cut out the BEGIN statement as well):

theCommand | awk '/^[^ \t]/ && $2 > highest { highest = $2 } END { printf "%d\n", highest }'

Utilities

  • ditaa (a.k.a DIagrams Through Ascii Art) makes it easy to generate nice-looking diagram images from… rather nice-looking ASCII diagrams
  • docopt, a command-line interface description language, which also seems to support generating the parser for the CLI being described
  • Peity for generating different types of charts using jQuery and <canvas>
  • Ghost.py interacting with web pages, programmatically

As of late I have been thinking a great deal about backups and the project which seems the most interesting to me is Duplicity.

Random tech stuff

Other random not-so-techy stuff

What I pass for humour

:wq

2012w21

Sunday, May 27th, 2012

Since I always try to end things on a positive note, let’s start with the… hrmmm, “less positive” things first:

Before reading this thread please note that patents on trajectories probably DIDN’T kill this satellite, but come on… patentable trajectories?

UK police will start, or already has started, copying the contents of detained suspects’ cellphones, and will be keeping those contents regardless of if any charges are ever pressed…

With that out of the way, let’s check out these really cool things I found:

Eldy seems to be a nice project aimed at making computers more suitable for elderly. And it even has a tarball for installation on GNU/Linux :)

sipml5: The world’s first HTML5 SIP client.

If you have a dataset with subjective ratings, and some known preferences, could you use that to discover other brands of scotch you might enjoy?

Start sending dates the correct way, i.e. ISO8601.

MomentJS seems to be the JS library to handle all your datetime needs.

This was a pretty cool idea: 3D QR codes only accessible at certain times of day

Perhaps this should be spread around more to decrease the risk of misunderstandings?

And finally some programming-“related” things:

Programmers are optimists: This can be read as a quip about the deficiency in programmers with always overestimating their abilities and underestimating the problem, but the last lines paint the post in a somewhat different light ;)

Funny quotes about programming languages :D

:wq

2012w18

Sunday, May 6th, 2012

The scripty stuff

This week I finally managed to crack a problem I’d been trying to solve for a couple of weeks, namely how to only print the foobar errors, and the ensuing stack trace of these errors from a logfile:

awk 'BEGIN { section = 0 } /foobar/ { section = 1; print; next } /^[A-Z]/ && section == 1 { section = 0; next } section == 1 { print; next }' logfile 

Looking at the solution, I am kindof ashamed that it took me that long to get a workable solution…

I also found this neat little oneliner in a comment on reddit: echo "something long and space separated of which you want the last word" | rev | cut -d ' ' -f 1 | rev. Then again, I’m sure that awk could have done this with a little $(NF-1) magic or something like that.

The headache-inducing stuff

All since my netbook broke down, I’ve thought about two things: restoring the netbook/replacing it, and how to create some form of backup infrastructure which should be better than what I have in place today.

As for the backups, the “system” I have today is couple of USB-disks which I at times plug in and sync files to. That and most of my projects and config-files are in various git repositories all synced to the laptop/server-in-the-wardrobe which I made sure to backup after the netbook died, especially since the laptop/server disk is much older than the netbook disk was.

Another thing which bothers me with the current solution is that I have no off-site storage. And that would be nice to have. Belt AND suspenders of course, and off-site storage comes with its own set of problems such as trust in the offsite storage maintainer.

I think the solution will take the shape of a GNU+Linux box and Unison and possibly aided by incron. Not sure yet, will have to think more about it.

There are some other requirements which I have just barely scratched the surface of or not even begun thinking about yet, for instance it would be nice to be able to backup my parents stuff as well on a regular basis as to keep their stuff safer as well.

And as for the netbook, although it was a nice little machine, the keyboard was getting a bit worn out, and at times it was rather underpowered with its single core 1.6GHz atom processor, so the direction I am looking in now is towards something like this.

The stuff screwing over society

Now there’s truly no way in hell I’ll ever use Skype again.

Nothing new under the sun I guess, but it lends credibility to the Skype quip above.

This sure is some level-A grade retarded society we are constructing for ourselves…

Samsung Galaxy S3: The first smartphone designed entirely by lawyers, a great read about a truly depressing matter which probably is closer to the truth than we imagine. On the other hand, my personal opinion is that the midnight blue version looks pretty damn sweet.

SaaS and other crap where someone else is in control sure is a honking good idea, isn’t? Well, I guess it is if you’re the one in control, but I guess you won’t ever get my business…

The cool stuff

And I also managed to find some posts which touched the hacker in me, such as this post about how one could go about generating pseudo-random numbers (don’t use the algorithms, just be inspired by them) or how this guy started shaving bytes off of his “hello, world!” binary.

I immediately thought about FSCONS when I read this, and I didn’t feel at all worried about people thinking the same about our conf :)

Until the other day, when I read about its inclusion into git, I’d never even heard about git subtree, but this post makes a compelling case for looking into it.

I also came across a, to me, new data structure: the XOR linked list. Now, it has a couple of drawbacks, and I don’t think I’ll find much use for it, ever, but as a concept it is a very interesting idea, and just goes to show that XOR is frakking awesome.

I thought this was a pretty cool thing.

While I don’t have any problems with my ISP hijacking DNS requests right now, it is nice to know for posterity that there are ways around it ;)

If you are going to use JSON, and need comments, this seems like a reasonable way to go about it.

While I haven’t decided what I think about Go I really liked this blog post on how to create a grass mowing agent which derives the most optimal way to cut the digital grass in a simulated world.

Hopefully I ain’t the only one who finds this hilarious ;)

This is actually quite neat: Instead of adding “lorem ipsum” paragraphs all over your design, tweak the word list in the script, include it in the mockup, and markup all places which need filler content. Done.

In the latest issue of DatorMagaZin there was an article about FUSE which caught my eye, and having read the article my interest was piqued, so I just had to go look at the list myself, and truly, have you seen all the cool filesystems people have come up with? Frakkin’ awesome!

The food for thought stuff

Oh yeah, finally remember to treat everyone the way you’d like people to treat your own mother

:wq

2012w15

Sunday, April 15th, 2012

This has been a pretty rough week, but I guess there is nothing less to expect when deadlines are drawing near.

This week I found myself wanting to count all the occurrences of “foo”, but ONLY if they occurred BEFORE “bar”:

awk 'BEGIN { fooCount=0; stopCounting=0 } /bar/ { stopCounting=1 } /foo/ && stopCounting=0 { fooCount = fooCount + 1 } END { print fooCount }' <myfile>

And despite the quite hectic schedule, I did manage to help a colleague with a little scripting, and those are two things which almost always sets me in a better mood: scripting (problem solving), and helping others (of course, if I don’t manage to be of any help, that kindof defeats any positive mood change I get from scripting, but in this particular case it all worked out really well in the end) :)

And now for the mandatory collection of links from this week:

  • This must be a joke right? The US can’t really, for real, be irritated with Australia for preferring national service providers over American ones, right? Especially when it could come down to storing data about Australian citizens, or in other ways vital to the government. This has to be a joke right?
  • I wonder if this is something most programmers can relate to or if it’s just me
  • This post could have been written by me… well, not as articulate, but the spirit of it. What’s even more interesting is the response this triggered on HackerNews.
  • QArt Codes is where QR codes, Solomon-Reed error correction, some extra calculations and your imagination mix together ;)
  • Hilarious post making fun about certain governments and their want for even more snooping laws, especially about conducting surveillance in in-game chats…

:wq

2012w13

Sunday, April 1st, 2012

This week has been stressful. Mostly due to the fact that we have an upcoming deadline and problems have a tendency to appear just at that time to exacerbate things further…

But with problems resolved, and tests underway, I found some time to help a colleague out with a script to automate some pretty tricky measurement tests.
This included doing some expect-scripting.

In this particular instance I needed to get a bunch of parameters sent to expect, and treat them as a single string. Ordinarily something like ./foo.exp "some space separated parameters" would have worked, but quoting would be a hassle, so if I could avoid that it would be great.

So I learnt about Tcl’s lrange (up to that point I’d only worked with lindex) and constructed something along the lines of set foo [lrange $argv 3 end] (the first three parameters were other things).

This week I’ve also had the pleasure to read about some pretty cool people this week:

Of course, there are people in the other part of that spectrum, people who doesn’t seem to like the ugly truth or who’d just like to kill off the Internet in its present form.

Now, if you’re still a Firefox user (these days it seems people have all jumped on the Chrome bandwagon) and you still don’t understand why it could be good idea to use NoScript, RequestPolicy or BetterPrivacy, Collusion, from Mozilla might visualize it for you. For my part, with those add-ons activated, there weren’t any surprises, but just for fun I turned them off, only leaving collusion on. Frak me! A whole lot of stuff happening behind the scenes.

I also sniffed out a new timeline library which uses jQuery and is powered by JSON.

:wq