Archives June 2013

Saturday, 29th June 2013 - 20:53:33

Oils a bit Overdue

Changed the oil in the car. It's long overdue as you can see by the photo - it doesn't stink yet, but it's pretty dirty.

Friday, 28th June 2013 - 11:34:28

Cutting Shelf

I built some mrore shelving in the shed. We've had this coffee table hanging around in the shed for ages. So I made it into something useful. First I trimmed the lip from around the longer sides, then I set up the panel saw attachment for the Triton MK3 Table Saw and cut the table in half giving me two nice sgelves to use.

Friday, 28th June 2013 - 10:17:15

Cable Hanger Filled

Today I made some cable hangers out of recycled pine playpen secions. This project turned out much better than I anticipated.

It was just a matter of running the play pen section rail up against the table saw to give the length of peg required. I then made a vertical part and "hook" shape to go over a rafter.

Tuesday, 25th June 2013 - 12:02:54

Raspberry Pis

I managed to convince the boss that it'd be better to use Raspberry Pis behind each of our monitoring screens rather than one large PC with one or more multi-port graphics cards. I've prepped an image so that the Pis don't switch off automatically and I've also changed their HDMI driver mode to 2 - so that we can do audio down the HDMI. Other than that - there are a few modifications to xinit files for the pi user to get the browser to come up fullscreen on startup. Fun little project!

Friday, 21st June 2013 - 16:42:00

4.0mm2 Is Not Big Enough

I scored some very heavy duty 3 phase mains cable which I thought might be suitable for my high current transformer project - but upon inspection it's not going to be. It's 4mm2 cable, I'm thinking I need at least 50mm2.

Friday, 14th June 2013 - 15:49:42

Table Saw Lap Joints 1

Had some luck today making some half-lap joints on the table saw using 2" x 4" and 2" x 3" timber. I was inspired after watching a bunch of Jay Bates' woodworking videos on Youtube. He tends to create a lot of 2" x 4" projects with half-laps.

Wednesday, 12th June 2013 - 17:38:41

Some New Cisco ASR 1002-X with 10G

Sweet new kit at work. Cisco ASR (Aggregated Services Router) with 6 gig interfaces and a 10 gig interface.

Monday, 9th June 2013 - 18:02:34

IMG_20130609_153045.jpg

I spent some time stripping paint off and sanding some boards from an old set of shelves with the intent of using them on a small project. When I got all of the paint off I was surprised that it wasn't pine or something like that - it actually looks like maple. So it's really too nice to use for the project I prepared it for.

I started by screwing the boards to a long aluminium straight edge and ripping one side on the table saw. The boards were bowed and not straight, but mostly flat. From there I found a width that matched both of my boards and ripped the other side off, using the newly cut edge against the fence. This way both pieces were exactly the same width.

Then if was onto the work bench for a sanding. This is the first time I'd used my 4" belt sander hand held, it's normally sitting in a jig to use it as a vertical belt sander / linisher. With 40 grit paper on this thing is hard to control! Once the paint was off, I sanded the sequence up to a fine unmarked paper which feels like it's maybe 240 or so. This is the finest I had on hand.

Typically the wood I buy is already sanded, probably to 400. This was good practice anyway. I've always been keen to rip, joint and thickness plane my own lumber.

Looks like I'll go off to Bunnings at some stage and get some pine for the job and keep this unexpectedly nice wood for something else!

Sunday, 9th June 2013 - 08:01:35

Pygments Python Syntax Hilighter

Up early this morning (noisy kids).

I enabled the PowerShell and Shell-Session lexers in Pygments:

Import-Csv -Path New-VMs.csv | `
ForEach-Object {
New-VM -VMHost $_.VMHost -Name $_.Name -Template $_.Template -Datastore $_.Datastore
}

[timd@fedorabox ~]$ yum install eric
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
You need to be root to perform this command.

update wiki_wikipage set article = replace(article,'</code>','{/code}');

Saturday, 8th June 2013 - 12:17:13

Pygments Python Syntax Hilighter

Today I looked at an issue I was having with the syntax hilighting on my site. The way it currently existed, you needed to exit the blog entry html directly to get code in the post using a <code> tag. I've now switched to code in square brackets. This means that the you can add code snippets in the GUI editor, however, TinyMCE comes along and says "I'm helping" and replaces all of your spaces with nbsp and all of your carriage returns with break tags. So, I've found you need to reverse that with a replace prior to parsing the code in pyments. The end result is pulling a bunch of stuff out, parsing and hilighting, then putting it back.

Pygments Python Syntax Hilighter Rules!

        lexer_string = ''
if match_obj.group(3) is not None:
lexer_string = match_obj.group(3).lower()
if lexer_string in ['c','cpp','c++','cpplexer']:
lexer = CppLexer()
elif lexer_string in ['py','python','pythonlexer']:
lexer = PythonLexer()

#include <htc.h>
#define _XTAL_FREQ 20000000
__CONFIG (CP_OFF & CCPMX_RB0 & DEBUG_ON & WRT_OFF & CPD_OFF & LVP_OFF & BOREN_ON & MCLRE_ON & PWRTE_OFF & WDTE_OFF & FOSC_HS);

void putc(unsigned char dt);
void led_digit(unsigned char digit, unsigned char position);
void led_readouts(void);
void led_integer(unsigned int number);
void led_raw(unsigned char raw);
void led_hold(void);
unsigned int get_adc(unsigned char chan);

    bcf       STATUS,RP1
bsf STATUS,RP0 ; Select Bank 1 of data memory
movlw 0xD7
movwf OPTION_REG
bcf STATUS,RP0
bcf INTCON,GIE ; Disable all interrupts.

Friday, 7th June 2013 - 21:36:27

Cisco 857W ADSL Router

Decommissioned the old Cisco 857 ADSL router and the Linksys SPA3102 ATA/Router today. The new cable box has both router/wireless and also incorporates an ATA.

I'd still like to put together an Elastix system at some point and use the SPA3102 as a voip to copper bridge/trunk (piggiebacked on the current ATA).

Thursday, 6th June 2013 - 21:33:29

IMG_20130606_200944.jpg

Today I put some extra NICs I bought from eBay about a month ago into my ESXi hosts giving them 4 ports each. The photo is a patching to play with vlans and vlan trunking between the Cisco switch and the vmware virtual switches.

Monday, 3rd June 2013 - 21:01:45

Loot 2

My order from Rockby Electronics arrived today. Lots of Triacs for new mains switching goodness. Some LM35Z temperature sensors as well as some RJ45 connectors with inbuilt magnetics and some SOT-223 NPN transistors to make the minimum order.

Sunday, 2nd June 2013 - 09:20:49

Second Winter Has Come

Day 62 in don't starve. This game is addictive! The second winter has arrived just as a dog attack arrived too unfortunately.

Saturday, 1st June 2013 - 12:10:47

twitterbird

Ooops. I's got a big bug in my twitter API code for the site =/

$ psql
Type "help" for help.

=# select count(id) from mytweets_mytweet;

count
-------
62479

(1 row)

EDIT:

It turns out that I was relying on a DB constraint that didn't make it through the server migration - so the code was just jamming records in after each Twitter API GET. The insert is wrapped in a try/catch so that it will not bail when there is an integrity error (duplicate keys). With the field not set with a unique constraint - the code just keeps happily sticking records in there... All good now.

Saturday, 1st June 2013 - 00:21:46

Django

I've spent today hacking in some new features for the gallery. Unfortunately, not public facing. Just stuff to assist in uploading photos.

The most comprehensive change is the new photo selector and having a stockphoto (django module) photo attached to all blog posts. There was some messing about with column types and casting and alterting tables in postgres to make it play nice. The field for an article image used to be just a character varying field, it's now an integer field with a proper foreign key relationship to the stockphoto module.

In the admin section, there is now a nice jquery-ui based dialog for selecting from group to gallery to photo and updating the field. This is much better for photos because the standard django select widget is not up to the task. I mean it works fine, but you really don't want to have to choose through a list of "IMG_1235.jpg" etc etc - you really want a thumb.

Getting this custom functionality was just a matter of overriding the admin template for that app by creating an <app>/templates/<app>/<model>/change_form.html/. Secondly, the forms.Widget widget is wrapped so that we can append whatever we want in the admin section - in my case just a text box and a "browse" button. The real work is done in jquery code in the template.

Sadly, updating jquery-ui has borked a few things like tag autocompletion.

Daily archives