Sunday, October 13, 2013

console colours on RedHat linux

or, how to turn them off. You need sudo or root:

chmod 000 /etc/profile.d/colorls.*

That's a global disable but honestly, dark blue text on black? It's been bugging me for years. RedHat-derived Linux has been shipping with the ls command aliased to /bin/ls --color=auto for an extremely long time though I don't remember anyone asking me about it.

Alternatively, if you want to customise this kind of thing, this article might be a good starting point.


Saturday, October 12, 2013

Web Design: Responsive Image Sizes

Put this in your CSS:

img {
     max-width: 100%;
     height: auto;
}

- making sure it doesn't get overridden at some point in your more specific CSS classes.

This is a prime technique for sites that have some big feature image, usually on the front page that needs to be there when someone looks at it using a smart phone etc. The image will scale on nearly everything except IE8 - for which webdesignerwall offers a specific solution.

Friday, October 4, 2013

a development process for Max MSP or Max for Live

back on the Max jag again - I am building & re-building a small set of patchers to help me create music/soundtracks for some performance works I've been asked to help out with.

One of these - basically a sample-player which uses soundfile markers to determine playback - has been around since 2006 in various forms. I even wrote a helper app for it using Libsndfile, before Patrick Delges' sfmarkers-v0-4-1 object was around (or before I became aware of it's existence).

I think I just rewrote it for the seventh time - it's definately acting in a more consistent manner now. AIFF only - there just seem to be endless uncommon & weird problems getting markers out of WAV files. I also created an M4L version, which was instructive in the problems that embedding in an Ableton project solves (memorising specific setting per-instance of the patch) - and also the extra problems it brings up (access to presets & automation).

The need to move this patch/instrument between a few different Macs sent me off to finally look at version control for Max.

more on this in a minute...

Tuesday, August 20, 2013

Arduino: Motion sensor, making it work

I had some problems getting this PIR motion sensor, which I'm pretty sure is the same as this working well, connected to either an Arduino Duemillanove or a Teensy 2.0 micro. It seemed to trigger randomly or not at all. Based on a clue from the Sparkfun comments on the item: provide the sensor with it's own or extra power as the micro board might not be providing enough volts to drive it properly.

This approach seems to provide the answer: power the PIR sensor with the positive side of a 9v battery, (disconnecting it from the micro board's power), whilst leaving the rest of the circuit (like this) in place.

In hindsight, I'm assuming the problem I had stemmed from the Arduino itself using up all the juice available from the USB connection to the computer. Powering the board from a DC adapter with current to spare would help too.

With a movement/presence detector like this, adding a big LED or a buzzer to your circuit and sketch, indicating when the sensor detects movement will help a lot when testing.


dual-powered: the PIR sensor connected to a Teensy. 9V battery for the sensor, an old phone charger provides +5v via the Teensy's mini USB connector.

Saturday, August 17, 2013

Arduino: Configuring on Linux

You want to install the Arduino development environment on a linux machine: there is the standard download and there are distro-specific installers available. There are also some instruction on setting up your environment linked from the official pages.

The route I followed on my usual distro (Centos 6) was to install Java, then the Arduino download. There were still a couple of non-functioning parts: errors from the rxtx library about lockfiles and greyed out serial port menu in the Arduino IDE.

These are RedHat/Fedora/Centos permissions issues that can be resolved easily:

* edit /etc/group

* add your username to the uucp, lock and dialout groups

That should fix it by giving your user the required access to the computer's lock directory and serial ports 

Wednesday, June 26, 2013

RFID tag collision

What happens if you try to identify 'something' by pinpointing it with an RFID tag - but in too-close proximity to another tag? By the look of things - unpredictability:

http://www.technovelgy.com/ct/Technology-Article.asp?ArtNum=57


Monday, April 8, 2013

monitor websites with websec & cron

Websecretary is not a new piece of software but is still the best free off-the-shelf page monitoring solution that I've been able to find.

It's really as simple as this:
  • un tar the archive, 
  • alter the config file (url.list) - add your mail addresses and the URLs would want to watch
  • run the script (./websec) - it will grab initial copies of your pages
  • run it again later & it will indicate any changes that have occurred
This instant gratification is seductive - running from cron is a little more complicated & this is obviously software which you will want to run on a scheduled basis most of the time - monitoring pages & alerting you to any changes automatically. Aside from the fact that 'cron doesn't run as you' (which I always seem to have forgotten about when I need to setup a new job)  there's a couple of things you need to do for websec in particular:

Let's set it up 
As in the man page - websec's data dir is actually ~/.websec/ - something not immediately obvious after the ease of running interactively like above. The essential components:
  • url.list - the config file
  • ignore.list - configurable stuff to ignore & not count as a change
  • archive - containing copied of the watched pages which are fetched & stored so they can be diff'ed
- need to live in in the above data directory (even if you don't have any ignore data - it needs to be there). So a recipe for for the setup is:

  • configure your websec
  • run it once so it can store initial state (in the archive directory)
  • copy all the files/dirs noted above into  ~/.websec/
  • make sure that the directory which contains the scripts (websec & webdiff) is in your PATH
reate your scheduled job. In cron, something like:

59 * * * * /full/path/to/websec > /dev/null 2>&1

or, if you want the full output for testing etc:

09 * * * * /full/path/to/websec 2>&1 | mail -s "websec run" your@email.dot.dot

Although you still need to full path to the command in there, it's smart enough to find webdiff (if in the same directory) & also to find the data dir (in this sense, cron IS 'running as you' :) )

Wednesday, January 9, 2013

osx86 hibernate problems

Specifically addressing an issue that occasionally arises on my eeePC running OSX 10.6 Snowleopard: it tries to start from a hibernate image (i.e. the screen shows a greyed-out image of the Mac desktop with a segmented progress bar along the bottom) - which never completes restoring & freezes at some point near the end.

The quick solution: boot in safe mode (just like a real Mac - hold the shift key until the silver screen with your disks in the center appears). You can type commands at this point which are arguments to the Chamelon boot loader: in this case try:

WakeImage=(name of a non-existant file) - then hit return

You should now have booted normally...

Longer-term solution: conce you can startup and login normally, the following commands in a terminal:

sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage

i.e turn hibernation off (should still sleep OK on lib close etc) and also free disk space by deleting the hibernation image file (roughly the size of your RAM).