I was working on some code the other evening and found myself needing a version of PHP’s bcmod function in JavaScript. It wasn’t already available at jsphp.co so I implemented it and posted about it to the ProgClub programming list.
Category Archives: Programming
Apache URL Rewriting Guide and ErrorDocument Directive
Last night I read the Apache URL Rewriting Guide and learned about the ErrorDocument Directive.
OpenID Authentication 2.0
Been meaning to get around to reading the OpenID Authentication 2.0 specification.
MediaWiki Manual:Interface/Sidebar
Been learning how to work with MediaWiki’s sidebar.
Software versioning
Been reading up on software versioning.
Interviewing at Google
I’m sick and tired of seeing Google’s bullshit “this stuff matters” advertising as part of their latest privacy policy update (which I’ve been doing my best to ignore).
As I was complaining about it I thought I’d try and find some examples of their hypocrisy. I’m fairly sure I’ve seen articles before where people said their job for a Google interview was to process gigabytes of web logs. If you’re data-mining web logs to *spy* on people on the one hand and then telling people you’re protecting their privacy on the other hand then you’re a lying sack of shit really, aren’t you?
Anyway, I didn’t find what I was looking for in a big hurry and I don’t really have time for this, so I’m giving up on my little fact finding mission and just going back to ignoring the whole thing.
However, during my web search I found this article, My Job Interview at Google, which seems like a fairly content rich article. I’m particularly interested in the resources that the guy linked to in his post. So figured I’d swing by my blog and make a note so that when I have some free time (hey, could happen) I can go over that post and read the reference material.
Using gzip, or bzip2, or..?
Wanted to know a little more about the pros and cons of different compression tools and strategies.
Found this article A Quick Benchmark: Gzip vs. Bzip2 vs. LZMA and looking at that gzip is a pretty clear winner I think wrt my concerns (i.e. fast compression over high compression). Also found gzip vs. bzip2 which concluded basically the same.
Removing colour code special characters with sed
I want to post-process the output of an ‘ls’ command with ‘sed’ so that I can remove the ‘./’ prefixes that I can’t avoid going into the ls output (this is a result of using ‘find’ safely).
The thing is, if I pipe ls output to sed, then the default –color=auto setting applies and ls detects that it’s not talking to a terminal so doesn’t output colour codes. But I want colour codes, usually, so I need to change the ls command to use –colour=always, which I’ve done. This means I can have colour and also have sed format the ls output.
The problem is then what happens if I want to pipe my output to ‘less’? Then the colour code commands appear as garbage in the output stream. So, usually I want colour codes, and sometimes I don’t.
I found this article, Remove color codes (special characters) with sed, which helped me come up with the following bash alias:
alias noco='sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"'
So now that I have the ‘noco’ alias (short for “no colour”) I can pipe my output through that if I want the colour codes removed, which I can apply before piping output to less.
It’s a little bit annoying that I have to do things this way but I haven’t been able to think of a better way to make it all work and this all seems to get the job done.
SVNIndexXSLT
Today I learned about the SVNIndexXSLT Apache directive that lets you configure an XSLT stylesheet for your Subversion repository. Also found a whole web-site ReposStyle which makes me laugh — seems like overkill having a whole web-site for a repository stylesheet…
phpMyAdmin QueryHistoryDB
The SQL History feature of my phpMyAdmin setup wasn’t working, the history table had been configured correctly as ‘pma_history’ but there was no data being written into that table when I ran queries and the SQL History tab of the query window just showed a blank.
Eventually I figured out that in order for the pma_history table to be populated I needed to set the QueryHistoryDB setting to true. So I did that and now SQL History is working!