Archive for the 'pimp' Category
Programmer-relevant whitespace in python
A comment was made at #rsparlyredux along the lines that while python’s enforcement of proper indentation stops people from not indenting at all, it also stops them from adding extra indentation, and sometimes extra indentation can be useful for the programmer. IIRC the example was OpenGL, where a common pattern in C is:
gl_start(TRIANGLE); gl_add_vertex(0, 0, 0); gl_add_vertex(0, 1, 0); gl_add_vertex(0, 0, 1); gl_end();
If you tried to do this using python’s standard syntax, it would complain that the indentation of the middle lines is unnecessary. However, you can actually do this in python, by turning the block of code into one logical code line – it’s maybe 5% extra typing when you’re dealing with this edge-case, but I consider that a fair trade for 10% less typing under normal circumstances:
gl_start(TRIANGLE); \ gl_add_vertex(0, 0, 0); \ gl_add_vertex(0, 1, 0); \ gl_add_vertex(0, 0, 1); \ gl_end()
(semicolon to separate multiple statements on one line, backslash to keep the whole thing as one logical line, so internal whitespace is ignored)
Edit: there is an even more pythonic syntax for this sort of thing. I’m not sure the stock GL library has been updated to support the with
statement yet, but in theory:
Edit edit: A lovely Rory had the same thought, and has actually written the code to make it work, see first comment /o/
with gl_start(TRIANGLE): gl_add_vertex(0, 0, 0) gl_add_vertex(0, 1, 0) gl_add_vertex(0, 0, 1)
(gl_end() is called automatically at the end of the `with` block)
Posted November 26th, 2011 by Shish, in software, tech
Dwarf Fortress
One of my dwarves suffered a crippling spinal injury while out hunting for food; he was carried home alive, but unconscious, and has since slipped into a coma with no signs of recovery, lasting a year so far.
If he wakes, he’ll find that he has no living friends or family, and no legs to walk to the social room to make new ones; his entire life will consist of being spoon fed mushroom pulp by the nurses, slowly going insane, and dying of old age.
The alternative is to flood his room so that he drowns in his sleep.
What do I do? :S
(Incidentally, Dwarf Fortress is an incredible game — possibly the only one I know of with enough detail and interacting elements in it for plot to emerge out of nowhere… (Nethack is perhaps a more detailed world, but the AI is pretty limited, with no scope for creating narration-worthy communities))
Posted December 25th, 2009 by Shish, in pimp, software
On linux and hardware
Because the world doesn’t have enough anecdotal evidence already:
On my gaming / media PC (custom built):
Graphics card, NVidia 8600 GT: ubuntu detects my monitor’s native resolution, runs ok using the standard drivers, and pops up a message asking if it should download the accelerated drivers automatically; windows runs at 640×480 until you install accelerated drivers from CD or google.
GPU accelerated h264 decoding: Linux yes, windows no.
Webcam, labtec thing: linux works out of the box; windows requires drivers from CD, and then the drivers crash whenever they’re used (and sometimes when they aren’t)
Extra USB ports: Linux PCMCIA worked in a fraction of a second (it was running faster than I could look at the “connected hardware” screen), windows PCI worked fine after 5 minutes of “you have new hardware!” “It is a PCI card!” “The PCI card has USB ports!” “There are 4 ports!” “Each port is USB!” “The USB version is 2.0!”…
TV capture card, Hauppage PCI thing: Ubuntu works out of the box, windows requires googling for drivers, and those drivers install crappy utility software.
Phone (Sony Ericsson k750i) as a modem: Ubuntu detects that the phone can be used as a modem, and pops up a message asking for phone service login details; windows detects the phone can be used as a modem, haven’t yet figured out how to use it.
Phone as USB storage: Linux works out of the box, windows requires googling for drivers.
Phone as bluetooth remote control for media player: Ubuntu works out of the box, windows works out of the box (No problems, no glitches, no googling for drivers; well done microsoft!)
And for the other PC (IBM thinkcentre):
Graphics (onboard intel 865): Ubuntu 9.04 broke 3D acceleration, all other distros and other versions of ubuntu work out of the box; windows works after googling for drivers
Sound (onboard intel something): Linux works out of the box, including features like disabling onboard speakers when external speakers are plugged in, and disabling external speakers when headphones are plugged in; windows works without advanced features after googling for drivers (and these particular drivers are a bitch to find. I suspect that I might not even have exactly the right ones, hence the feature lack :-/)
Network (onboard intel thing): Linux works out of the box, windows works after googling for drivers… yes. For those who haven’t spotted it, the /network card/ requires downloading drivers using /the network/ :-P
Network (atheros based wifi): Linux works out of the box, windows requires separate drivers
Posted June 26th, 2009 by Shish, in pimp, software, tech
Opera: still awesome
Needing an impromptu web browsing kiosk, I wonder if opera has any options which could be useful; so I try opera –help, and the first thing I see is -kioskhelp. Trying that option, it seems that it has all the features I need built in \o/
It also has a presentation mode, so with a little CSS you can have a web page which works equally well in a browser or as part of a slideshow~
And it’s still smaller and faster than firefox :P
Posted November 7th, 2008 by Shish, in pimp, software
An adventure~
Coniston’s network card died, and I was the nearest employee; thus, my turn to run up to the datacenter and replace it /o/
This would be easier if I had parts, or the tools to attach them -_-
Wilkinsons do screwdrivers though, which is useful \o/ Though they are cheap and bend when you attempt to unscrew things with them /o\ Even less usefully, it seems that wired networks are dying off — All the high street stores had shelves full of wireless cards, but at best 2 or 3 ethernet models, and those were 10/100 v_v
After trying a few shops and being pointed back and forth, I ended up at yoyotech, which seems to be a place of at least some clue; the sales dude (Brian, apparently) asked if I was using linux, and googled to see if the model of card was sufficiently supported~
Having bought it (and a second of another brand, just in case), I was off to the datacenter /o/ The trip was relatively short and uneventful, aside from a youth in a shopping center throwing a big enough tantrum for the police to take note :-/
The DC itself was relatively normal, with coolers and cables and such; the part exchange went well once I’d figured out how to get the side panels off, and what to do with the switch bolted to the side o_O
On the way home, the train was declared unfit for human transport, so we all had to get off and wait for the next, which was much more crowded :( But then I was home \o/
Posted April 7th, 2008 by Shish, in pimp, reallife, tech
Scaling~
More scaling with Travmap
LightTPD is win. Apache + mod_php + mod_python + mod_perl = 100MB per process, of which there are 10. Lighty does all the same stuff, in a single 30MB process \o/ Switching over has made travmap fast again, leaving a proxied apache behind to run the more complicated, less popular things~
Posted July 25th, 2007 by Shish, in pimp, software
For the web developers out there~
This bit of css is so beautiful I am physically weeping tears of joy just thinking about it.
Posted July 17th, 2007 by Shish, in pimp, site
Debconf Photos
The hostel we were in first seemed to be falling apart (where it had been built in the first place) — note chicken wire instead of railings :-/ Also, being in the furthest possible room (all the way along the hall, fifth floor) was argh. And their breakfasts sucked too.
In comparison, the teviot building was awesome. It has space toilets, nice halls. There was a strange thing in the attic.
Teviot is also awesome as a student building. It has 4 bars, and a nightclub which plays lovely music (with cute advertising :3). Even the toilet graffiti was more interesting than I’ve seen anywhere else. They also have an arcade.
Also, I went up a mountain.
The edinburgh bike shop is notable for posters and banana holders.
The night venue was quite nice, and had an organ.
The sever room was predictably messy.
Posted June 26th, 2007 by Shish, in event, pimp, reallife
Debconf 7.2: Cable Monkey
First day, waking up at 5am, I spent much time packing cables, and failing to sleep.
Eventually, everyone else woke up, and we went for breakfast — the hostel only does “continental breakfast”, which is apparently a slice of toast and a cup of tea :-/
Then to the main venue, where we spent much time wandering and deciding what was to go where, and I crimped my first ethernet cable ^_^ And then several more, and the novelty wore off. I also learned about fire safety laws, and that it’s really hard to cover a historic building with cables~
Posted June 10th, 2007 by Shish, in event, pimp, reallife