My talk was entitled “PHP and Web Services: Perfect Partners” – the slides are on slideshare if you want to take a look. There was also a talk about android development by Alex Reid, including a live coding demo which went surprisingly well! Judging by the various events that were plugged and discussed on the night, at the main event and in the pub afterwards, this is a diverse and vibrant technical community – so if you are in the northeast, get along to Supermondays!
Tag Archives: tech
Open Office Presenter Console
I discovered that this plugin is now available through apitude – simply install the package openoffice.org-presenter-console and it should all work splendidly! I use the presenter console when I am speaking (which is quite often) to show the time and the upcoming slide, its a great tool.
Word Count
Counting Lines
The biggest problem with counting lines is remembering the name of the utility, since its called “word count” and not “line count”. I tend to use this for doing things like piping grep to wc and counting the lines to give me an idea of how many occurrences of something there are. I also use it to count errors in weblogs or really anything else that I could do with summarising. The syntax is something like:
grep -R TODO * | wc -l
Using a count like this is especially good for things like auditing code, where I need to know how prevalent something is – or refactoring, where I’m looking for how many of a particular pattern are outstanding. Counting lines is also very compatible with my habit of making lists in text files.
Counting Words
This is the feature that the utility was originally designed for, and as you can imagine, its pretty good at that. As with most things, this blog post started life as a text file and when I got to this point I saved it and ran:
wc -w wc_article.txt
It outputs the number of words (272) and the name of the file, which is useful if you’re giving it a pattern to match.
Word Count
Its a really convenient and versatile little program; I use it often and I hope others will find it useful too.
Contributing to Projects on GitHub
Register on Github
To do anything useful I first needed to sign up for an account. Github has a range of accounts but I found that with one of their free accounts I would be able to get started and contribute to the project. This gives me a project space of my own and a user to tie all my activities to.
Set up SSH Key
In order to authenticate against the github servers, you need to set up an ssh key and give them your public key so they know you are you. You’ll then need to tell git to use this key whenever it makes contact with the github servers. I do quite a bit with ssh and ssh keys myself so I was comfortable with this step. Even if you are totally new, its still pretty straightforward and they have a great howto on github itself which will help.
I had issues with git not picking up that it needed to use a non-standard ssh key, but I found the answers in this entry on the git website. In a nutshell, set up an ssh alias, set the key in there and then use the alias instead of the actual URL when giving the repo location to git. This now works like a charm for me.
Fork the Project
Now, github uses “fork” where I might choose to say “checkout” – fork in my world means something else completely. But in this case you’re just making your own copy of the project repository. This is where you will commit your changes to and it retains its link with the original repository making it easy for anyone with commit access to that to pull in your changes. Patch files are nowhere to be seen, and although I was wary at first, this is project collaboration at its most painless, I’m impressed! Forking was relatively simple and again there was great documentation on the github site. In particular I recommend that you take the time to follow the bit about adding an alias for the “upstream” repository – this made committing my changes to the main joind.in repo really easy.
The forking instructions linked above also gave a description of how to actually use git, how to get my changes applied to my local repo, and how to push them to my remote repo on github itself.
Make a Pull Request
Once I’d fixed a few things, I was ready to push the code back to the main project so that Chris could consider it for inclusion. This is done by making a pull request from the main project page – you can add a comment about the changes you are supplying to help the maintainers to manage all the incoming patches.
Go Forth and Contribute
It was easier than I expected to get set up to contribute to a project using github, so find something you want to improve and/or be involved with, and do it. I began by fixing the docs for joind.in, which was a great place to start since it allowed me to make a useful contribution without touching the code in the first instance :)
Screen in Ubuntu Karmic
In Karmic Koala, Ubuntu 9.10, the packages are still there but they’ve changed names! So if you want to use screen with Ubuntu Karmic or later, install packages byobu and byobu-extras, and uninstall screen-profiles and screen-profiles-extras (they were broken on my system after upgrade anyway) and you should find everything works as expected. To run screen with the new features, you should run “byobu” instead – although screen commands seem to work to detach and reattach the screens that result, weirdly.
I’m mostly posting about it because I have been very frustrated and there’s no way I could have guessed, or probably ever will remember, what these packages are called. Apparently a byobu is a japanese room screen … you learn something new every day!
Silencing Curl’s Progress Output
To silence the additional output, use the -s switch – but be aware that this will also silence any error messages as well! Something like this:
curl -s http://lornajane.net | grep PHP
This will enable you pass into grep just the output you would usually see on your terminal. Hope this is useful to someone!
Cookies and Curl
Storing Cookies in a Jar
Quite enchantingly, its traditional to call a cookie storage a “cookie jar” which makes a lot of sense when you think about it! To do this with curl, use the -c switch:
curl -c lj.txt http://www.lornajane.net
If you now examine the resulting file, lj.txt, you’ll see that it contains all the details of the cookie. You can edit this if you want to (health warning: only do this if you know what you are doing! If you need to test something though, its useful), and then submit the next request with that cookie attached – exactly as your browser would.
Making Requests with Cookies
To make the next request with the cookie, simple replace the -c with a -b to dip into the cookie jar and sent all relevant cookies for this domain with your request, like this:
curl -b lj.txt http://www.lornajane.net
As I say, I was using this with a web service, where it made no sense to use a browser as I also needed to pass data with the requests. You might also like to refer to my curl cheat sheet previous post.
New Camera: Fuji Finepix F70
The camera is a birthday/christmas gift from my parents, since I’m taking increasing numbers of photos these days and our 3-year-old Fuji Finepix F650 is on its last legs! I have been looking around and although there are a few other things in the same kind of market, I read an astonishingly detailed review of the F70 and, considering how much I had liked the previous fuji, decided that this would be a good bet.
Its smaller than the last one while having a lot more resolution, I’m not really a camera geek but it does some funky things that I quite like. Even left entirely in auto mode, the photos are much better quality – especially in low light which was always an issue for the old camera! The scene presets are there and useful as ever. It has some strange settings where it takes multiple photos of the same thing to provide more detail – for example the mode which is pretending to be shallow depth of field takes a bunch of photos and then sticks them together in software, with interesting results:
I’m still getting to grips with the different settings, and am attempting to join in with the daily shoot which is an exercise in taking a new photographic assignment every day. I’m running at less than 50% success rate but I am taking more photos than I would have otherwise so its good in any event I think! One thing I really want to crack is taking recognisable photos of people … so far the only person I seem to do well with is my toddler niece (perhaps because she doesn’t fear the camera the way the adults do?)
So, thanks mum and dad – and if you’re interested in following my photographic adventures, my photos are on flickr.
Sound Issues with Kubuntu Karmic Koala
sudo aptitude remove pulseaudio
When I restarted Skype, everything seemed to work as expected – for reference I have a thinkpad T400, if you’re having the same issues, then hopefully this will help!
Email As a Means of Social Communication
When I write an email, I’m usually (mostly) doing that one thing, and the result is quite joined-up. Anyone who has had the experience of trying to carry on a conversation with me over messaging when I’m doing multiple things knows that I can easily lose the thread of an explanation and I often find I have to read back the logs of a conversation to be able to keep up.
When someone takes the time to write an email, the reader can’t interrupt or divert the writer and so the writer is able to express their points at their own pace. Email is also easier to re-read and reformat, if you are the kind of writer that doesn’t necessarily think of everything that needs to be said in quite the order it ought to be said.
When someone is emailing asking me to do something, I won’t lose an email (you’d be surprised how often I lose things people ask me to do on IRC, its on a par with asking me in the pub). Admittedly, my inbox can be several months deep but when I have time to attend to your query, I will – and that goes for social correspondence as well.
Finally, and most importantly, it enables me to stay in touch with people whose committments don’t fit around mine in terms of online availability due to work, life, or timezones.
I’m quite enjoying a slightly more formal exchange of the written word with those friends who are emailing me while I’m on these little jaunts – you know who you are and I don’t enjoy being away from home so those little messages are welcome, thanks :) And for everyone else – next time you are lurking online looking out for someone, take the time to write an email instead – and let me know how it works for you.