Linux shutdown command variants

shutdown -r now
resets and restarts the computer

shutdown now
turns some machines off (which is technically called a halt)

shutdown -h now
shutdown and halt/turn machine off

Can't call arguments.slice() in JS

Javascript is a wonderful language, full of twists and turns. I was surprised that I could:


arguments.length

but not


arguments.slice()

It turns out it's because arguments is not a real array, but a function, which you can access like an array, e.g.:


arguments[0]

To do a slice() op on it:


var args = Array.prototype.slice.call(arguments, 1);

Debugging concurrent javascript in Firebug using QUnit

QUnit queues up all the javascript tests, then runs them. This means you get an accurate picture of how long the tests take to run sequentially, but you have to be very careful about multi-threaded execution. When testing DiSCO, I had to keep using QUnit.stop and .start() whenever I had an asynchronous event between tests.

Also, when setting breakpoints in Firebug, be careful to set them inside the test functions as your code will be operating in two different timeframes. Below t0 is the test setup timeframe and t1 the test execution timeframe.


------- |-t0--- |-t1---

Using SVN hooks to run QA tests on Javascript

Read a great primer by Amaxus on Using JSlint with Subversion hooks. There were a few bugs, largely created by missing \ characters in the published source. My working version is published zipped up below.

Multithreaded wget alternative for Linux or Mac OS X

Happened across aget today. The source is available from http://www.enderunix.org/aget/aget-0.4.1.tar.gz.

To compile under Mac OS X (10.6 Snow Leopard), you need to add -D_DARWIN_C_SOURCE to the gcc compile flags in the Makefile.


# EnderUNIX Aget Makefile
# http://www.enderunix.org/aget/

OBJS = main.o Aget.o Misc.o Head.o Signal.o Download.o Resume.o
CFLAGS = -g -W -D_DARWIN_C_SOURCE
LDFLAGS = -pthread
CC = gcc
STRIP = strip

all: $(OBJS)

Metadata Tools for Production £5m competition

Registered with Walt Disney studios for PR material

When I do get round to film reviews, I thought it would be nice to be (legally) allowed to show some stills from the film with my review. I'm discovering that many of the big studios have dedicated PR sites that you can register and download preview content from.

Here's a shot from the latest 'Cars 2' movie:

A shot from Cars 2

Executing cygwin (unix) commands from Windows batch files (.bat)

Here's a batch file that executes a few cygwin (unix) commands from Windows.


@echo off
rem get (DOS) current working directory
set inputDir=%~dp0
rem change slash direction for cygwin
set result=%inputDir:\=/%
echo.Processing directory %result%
echo.
echo.DiSCO (php and js)
rem execute a cygwin script using bash
bash --login -c 'cd %result%; wc -l `find ../receiver/classes/DiSCO ../receiver/js/lib/DiSCO -name "*.php" -o -name "*.js"`;'
echo.
echo.WITO client (js)
bash --login -c 'cd %result%; wc -l `find ../receiver/js/global -name "*.php" -o -name "*.js"`;'
pause

Innovation policy through experimentation

I read a great blog post from Hasan Bakhshi at NESTA entitled Innovation policy through experimentation and commented:

Transdisciplinary collaboration

I was asked recently to contribute some thoughts under the heading of "Transdisciplinary collaboration". How do you encourage two different communities of innovators to work together? Is there anything that collaborators can do to deliver better projects when working across sector boundaries?

For me the critical thing is translation. I believe:

  • a single message for two communities doesn't work. We have to describe the challenge for each community in a language it understands;

Alex Stanhope is a Technology consultant to the UK Creative Industries and Venture Catalyst. This is my personal website.
Bristol | Lightenna | ManKind Project | goodkarma
All material copyright (c) 2006-2010 | Website by Lightenna, featuring N.Design's GlossyBlue theme.
Syndicate content Syndicate content