Monthly Archive for September, 2009

Switch safari to a develop mode

Picture 8

Just launch at terminal this string:

defaults write com.apple.Safari IncludeDebugMenu 1

defaults write com.apple.Safari IncludeDebugMenu 1

Textmate Regular Expressions

20.1 Introduction

A regular expression is a domain specific language for matching text. Naively we could write a small program to match text, but this is error-prone, tedious and not very portable or flexible.

Instead we use regular expressions which describe the match as a string which (in a simple case) consists of the character types to match and quantifiers for how many times we want to have the character type matched.

For example normal letters and digits match literally. Something like \w will match word characters, where \s will match whitespace characters (space, tab, newline, etc.). The period (.) will match any character (except newline).

The basic quantifiers are the asterisk (*) to specify that the match should happen zero or more times, plus (+) for one or more times, or a range can be given as {min,max}.

This alone gives us capabilities like finding words (\w+) or finding an image tag with an alt argument (<img.*alt=".*">).

Matching longer text sequences is one thing, but often we are interested in the subset of the match. For example, in the above example we may want to replace the alt argument text. If we enclose part of the regular expression with parentheses, we capture that part in a variable that can be used in the replacement string. The format of the replacement string is described at the end of this section, but to refer to the first capture, we use $1, $2 for the second etc.

So to change the alt argument text we could search for (<img.*alt=").*(">) and replace that with $1Text Intentionally Removed$2.

Note that in the examples above .* is used. The asterisk operator is however greedy, meaning that it will match as many characters as possible (which still allow a match to occur), so often we want to change it to non-greedy by adding ?, making it .*?.

Continue reading ‘Textmate Regular Expressions’

Some geek humor

Q: Why do programmers always mix up Halloween and Christmas?
A: Because Oct 31 == Dec 25!

MORE

Siggraph 2009 – V-RAY in realtime on GPU

Motion Field Texture Synthesis

Promethe’s AIR 2.0 Sneak Peek

Tonight I attended the “TonTon Flexeurs” (TTFX) meeting with Lee Brimelow and Mike Chambers. While Lee explained all the things that can be done to extend the Flash Platform using the ByteArray class, Mike presented a few of the latest as3corelib library features and a sneak peek of AIR 2.0. AIR 2.0 – codename “Athena” – will feature a lot of new system related updates. Discover a few of them (including a worldwide exclusive!) right after the jump…

Continue reading ‘Promethe’s AIR 2.0 Sneak Peek’

Some geek–humor

null

more

Static Event Dispatcher

///	STATIC DISPATCHER ///

private static var
	_dispatcher:EventDispatcher;

public static function
addEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean=false, p_priority:int=0, p_useWeakReference:Boolean=false):void {

  	if (_dispatcher == null) { _dispatcher = new EventDispatcher(); }
  	_dispatcher.addEventListener(p_type, p_listener, p_useCapture, p_priority, p_useWeakReference);
}

public static function
removeEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean=false):void {

  	if (_dispatcher == null) { return; }
  	_dispatcher.removeEventListener(p_type, p_listener, p_useCapture);
}

public static function
dispatchEvent(p_event:MovieEvent):void {

  	if (_dispatcher == null) { return; }
  	_dispatcher.dispatchEvent(p_event);
}

Markless AR with a palm tracking


Some Sky Fortress Concepts

device sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchdevice sketchblue printsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsketchsu 27su 27su 27su 27su 27 &amp; metall slug tanks