2007-01-31

What Not To Do

I saw this on thedailywtf.com the other day, and it bears repeating.

This is a severe anti-pattern in php:
$fp = fopen($filename, 'r');
while (!feof($fp)) {
$data .= fread($fp, 4096);
}
fclose($fp);
fopen(); returns null and prints to stdout on failure. feof(null) returns false because php os functions return false and print to stdout on error.

The net result is the above code turns into an instant infinite loop.

And this anti-pattern is clearly visible in the PHP manual.

Updated: typo fixed

2007-01-19

w000000000

Okay, I won. I don't know how, I was up against some serious smart people, and somehow I came out on top.

Fortunately, Ali and Dylan are driving back to Brisbane, and have kindly offered to stick the new machine (to be named "Trinket" to join "Shiny") in their back seat.

Zomgawesome. I was so hyped I couldn't calm down until I'd had a finger of scotch.

2007-01-18

Again With The Horror

Over One Million Lines Of PHP With No Version Control.

HackFest

I'm incredibly buzzed from the HackFest. I'm the kind of person who handles the stress of exam situations quite well. It's one of the only times that I'm completely and totally focused.

And wow, the hackfest was hard. There were things that were superficially easy, and other things that were really quite involved. I got 7 solutions to problems, some worked better than others. My 'break out of a chroot' answer didn't work and I don't know why.

I wrote a completely evil answer to one of the questions, and a mundane answer, I only did it because I knew that 10 out of 100 is better than 0 out of 100. (Maybe the judges will think my 'evil' answer is worth something).

I implements a socketpair() using AF_INET in 3 minutes and 10 lines of python. I'm sure if I were a more competent C programmer I could've done it in C just as quick, but time was getting close.

I'll find out what the license is on the HackFest material. I'd love to publish the questions and my answers.

2007-01-14

Wow, Conf!

Well, that was successful I think. I had about 11 people and 10 laptops around at one point. We didn't get anything actually useful done, but there were a few thing that could be potentially useful that were actually accomplished.

Robert Collins wants my EvilTrackingNet implementation completed in time to be packaged and inserted into ubuntu. That'd be kinda neat, if I could pronounce ubuntu. As it is, he gives me a lecture every time, because apparently I can't pronounce a 'u' and ubuntu has 3 of them.

Wifi is going well. Having Mr Netgear working is a godsend. I'm glad Elspeth convinced me to bring him.

On to tomorrow! Where Elspeth is running a Research Miniconf. Papers are available :).

2007-01-13

Networking :)

As I'm trying to host a few Twisted people over at Randwick Lodge today, I decided to make sure I had the appropriate equipment available. That is to say, wireless internet.

Of course, this is harder than it seems. The hotel resells some kind of NetComm captive portal product, which they've given us just the one account for (it costs $50/wk). So only elspeth's iBook has been logged on, and the rest of us have to suffer.

Which is why it was important for me to bring our wireless router and some cables. The network looks kinda like this at the moment

NetComm Gateway <-wifi-> iBook <-ethernet-> NetGear Wifi Router <-wifi-> 3 more laptops.

Side effect is, if you're in the area of Randwick Lodge, we have an open access point called 'NETGEAR'. :)

Networking :)

As I'm trying to host a few Twisted people over at Randwick Lodge today, I decided to make sure I had the appropriate equipment available. That is to say, wireless internet.

Of course, this is harder than it seems. The hotel resells some kind of NetComm captive portal product, which they've given us just the one account for (it costs $50/wk). So only elspeth's iBook has been logged on, and the rest of us have to suffer.

Which is why it was important for me to bring our wireless router and some cables. The network looks kinda like this at the moment

NetComm Gateway <-wifi-> iBook <-ethernet-> NetGear Wifi Router <-wifi-> 3 more laptops.

Side effect is, if you're in the area of Randwick Lodge, we have an open access point called 'NETGEAR'. :)

2007-01-12

PPTP From Ubuntu

Okay, so I wanted to be able to set up PPTP so I could have some kind of vaguely secure connection while at LCA. I have access to a dozen PPTP servers I can bounce through, and I know they work, but I needed to set it up with the ubuntu laptop as the client.

I'm running feisty, if you care.

Steps! This is how to do it:

  1. $ sudo aptitude install network-manager-pptp
  2. Right click -> Remove on the network icon in your systray.
  3. Alt-f2 -> Run 'nm-applet'
  4. Left click on the new network icon -> VPNS -> Configure
    • Add a VPN with the wizard.
  5. The VPN will not appear until you do this:
    • $ /etc/dbus-1/event.d/25NetworkManager restart
    • $ /etc/dbus-1/event.d/26NetworkManagerDispatcher restart
  6. Left click Network Icon -> VPNS -> The VPN you just created.
  7. $ sudo tail -f /var/log/syslog to discover if it worked.

Yay for guis that make everything easy...

I wish I was being sarcastic. I know how much of a hell setting up pptp clients used to be.

2007-01-08

Twisted ┬ÁConf @ linux.conf.au

It turns out there's going to be a sizable contingent of Twisted hackers at linux.conf.au '07. As such, I'm attempting to organise a Micro Conference on the sunday before the conference.

I'm planning on gathering at where we're staying Randwick Lodge, 211 Avoca St because there's wifi access available, and I'd like to be able to sit down and hack.

JML has mentioned wanting to hack on trial, and while I'm not resistant to that, I'm open to suggestions. :)