Remember to check out:
{LESS}.app @ http://incident57.com/less/
{LESS}
Ruby based CSS compiling. Advanced CSS rules and such.
Tuesday, February 09, 2010
Saturday, February 06, 2010
Tools for JavaScript optimization
This is an oldie, but I was cleaning my link collection and thus I better store these here:
http://code.google.com/closure/
http://code.google.com/closure/
L-Systems in Python
I thought this would have been much harder. Here ya go, simple and probably a bit sucky L-System in Python. Expand in your favourite 3D package to create what you need based on output:
It should be obvious you need to go through the returning string and visualize it as appropriate. But that's for another day.
Update: More comprehensive examples are now on StudioE18 blog:
Simple L-system generator
Visualizing L-Systems
#
# L-System Generator
# Janne Kaasalainen
# 7.2. 2010
#
class LSystem:
ruleDictionary = {}
def __init__(self):
self.ruleDictionary = {}
def setBase( self, aBase ):
self.systemBase = aBase
def addRule( self, aReplace, aWith ):
# Add the rule to tule array
self.ruleDictionary[ aReplace ] = aWith
def iterate( self, aBase, aIterations ):
if aIterations > 0:
replaced = ""
for i in aBase:
replaced = replaced + self.ruleDictionary.get(i,i)
aBase = replaced
return self.iterate( aBase, aIterations-1 )
else:
return aBase
### Example Usage ###
system = LSystem()
system.addRule( "A", "AB" ) # A is replaced with AB
system.addRule( "B", "A" ) # B is replaced with A
iterations = 4
axiom = "A"
print "Starts with base A"
print "L-system with " + str(iterations) + " iterations: " + system.iterate( axiom, iterations ) It should be obvious you need to go through the returning string and visualize it as appropriate. But that's for another day.
Update: More comprehensive examples are now on StudioE18 blog:
Simple L-system generator
Visualizing L-Systems
Friday, February 05, 2010
Friday, January 08, 2010
On Magic
“Make no little plans. They have no magic to stir men’s blood and probably themselves will not be realized. Make big plans; aim high in hope and work, remembering that a noble, logical diagram once recorded will never die, but long after we are gone will be a living thing, asserting itself with ever-growing insistency. Remember that our sons and grandsons are going to do things that would stagger us. Let your watchword be order and your beacon beauty. Think big.”
—DANIEL BURNHAM, CHICAGO ARCHITECT. (1846-1912)
—DANIEL BURNHAM, CHICAGO ARCHITECT. (1846-1912)
Monday, December 21, 2009
Reminder : Try this someday
Enrique Gallar tweeted a link about VirtualAwesome:
VirtualAwesome is a cross-platform applications framework for advanced computer graphics and new user interfaces. It is built on top of a powerful graphics core (OSG) and has a strong emphasis on multi-focus interaction. This means, next to regular mouse, keyboard and tablet input, it supports multiple people interacting with multiple pointers/fingers at the same time.I'd better play with it some when I find time from my current projects. Sounds interesting.
Sunday, October 18, 2009
Automatically download and convert MythTV recordings for Nokia N900
The previous post dealt with converting video on a Mac to a format that Nokia N900 can handle. It turned out to be a brief about the software available for the task as the device itself seemed to be versatile enough to handle all the tested videos. To push things little further, I'll now try to:
Sounds simple? Let's see. But at first, I'll assume there is a working MythTV install running on a server of some sort. Mine is a Mythbuntu 9.04 system, but I trust there are no big differences between different Linux based servers.
Installing MythExport is easy, just make sure you have the needed repositories available and install it via apt-get. It does ask ask a few additional question upon install such as directory into which it puts the exports. Perhaps the trickies part is where the installation process asks for a password but does not tell what the password is for. It is for MySQL. Settings can be done via web browsers, but one should remember to start the daemon first:
If you have a custom Wwwroot, you need to create a symbolic link to mythexport, but note that the exact path may depend on a system so check it before copy-pasting:
Now, directing your browser to http://server/mythexport should return a list of files. This is not what we want, but hey, this is Linux, what did you expect? This sucker probably needs libapache-mod-perl2 but it's not installed as a dependency. I installed that, but the next thing needed was to enable *.cgi support in mythexport directory. So, modifying /etc/apache2/sites-enabled/mysite I added:
After this the web interface started to work. Usability wise the page is a disaster, but at least it works. I recommend browsing the net to get some grasp on how to fill in the fields and then testing the system to see how it behaves. In any case, you want create a user job that can then be triggered via MythTV front-end. For me, this didn't work out straight out of the box, as there were errors in AtomicParsley (via /var/log/mythtv/mythexport.log). Of course, there is yet another dependency that seemingly needs to be installed; ffmpeg. So, sudo apt-get install ffmpeg off you go. Heck, why not install lame at the same time too. And all the other codecs that come to mind.
This is quarter of a file size of N900, so those who are into hifi may want to adjust settings here and there.
- Have MythTV publish an RSS feed of its new recordings
- Have the recordings be in format that Nokia N900 can handle
- Download the recordings automatically to the device via a Mac
Sounds simple? Let's see. But at first, I'll assume there is a working MythTV install running on a server of some sort. Mine is a Mythbuntu 9.04 system, but I trust there are no big differences between different Linux based servers.
- MythExport: A script that converts recordings and provides and RSS feed
- Automatic: A Mac RSS client that downloads enclosures to directories
Installing MythExport is easy, just make sure you have the needed repositories available and install it via apt-get. It does ask ask a few additional question upon install such as directory into which it puts the exports. Perhaps the trickies part is where the installation process asks for a password but does not tell what the password is for. It is for MySQL. Settings can be done via web browsers, but one should remember to start the daemon first:
- sudo /etc/init.d/mythexport start
If you have a custom Wwwroot, you need to create a symbolic link to mythexport, but note that the exact path may depend on a system so check it before copy-pasting:
- ln -s /usr/share/mythtv/mythexport mythexport
Now, directing your browser to http://server/mythexport should return a list of files. This is not what we want, but hey, this is Linux, what did you expect? This sucker probably needs libapache-mod-perl2 but it's not installed as a dependency. I installed that, but the next thing needed was to enable *.cgi support in mythexport directory. So, modifying /etc/apache2/sites-enabled/mysite I added:
- AddHandler cgi-script .cgi .pl
- directory tag + directory
- Options +ExecCGI
- close directory tag
After this the web interface started to work. Usability wise the page is a disaster, but at least it works. I recommend browsing the net to get some grasp on how to fill in the fields and then testing the system to see how it behaves. In any case, you want create a user job that can then be triggered via MythTV front-end. For me, this didn't work out straight out of the box, as there were errors in AtomicParsley (via /var/log/mythtv/mythexport.log). Of course, there is yet another dependency that seemingly needs to be installed; ffmpeg. So, sudo apt-get install ffmpeg off you go. Heck, why not install lame at the same time too. And all the other codecs that come to mind.
However, after all these there seemed to be an error with the ffmpeg command line option as well. It might be worthwhile to see the error log issue and copy paste it to command line to better understand what is going wrong. In this case, there was a command line switch missing (-ar 44100 to set audio sample rate). I ended up using this custom configuration (with file extension .mp4):
- -y -acodec libmp3lame -ab 128kb -ac 2 -ar 44100 -vcodec mpeg4 -b 600kb -mbd 2 -flags +4mv+aic -trellis 2 -cmp 2 -subcmp 2 -s 400x240
This is quarter of a file size of N900, so those who are into hifi may want to adjust settings here and there.
By the way, using command line tool "top" should show you nicely what's going on in the system. Video encoding is processor intensive operation, so it's not done too quickly. In any case, none of this is really too helpful yet. So far we've configured a user job that needs to be launched manually. I could have just as well dragged the recording to a converter that would have uploaded it to a mobile device. This is a no-no, we need something to automatically launch the user job once a program has been recorded.
MythTV front-end can be used to run the user job automatically. Go to Utilities/Setup -> Setup -> TV Settings and find a screen where you can assign jobs to be ran after the recordings. It may be possible to do this via MythWeb as well, though I didn't yet come to check if the advanced options get saved as defaults.
After all this, we need to set up the RSS feed reading on a client machine. Any feed reader you wish to use should work OK, of course. I'm a fan of NetNewsWire, but for this I chose to try Automatic. I simply made it to check the RSS and download straight to N900 video directory. It should be noted that I'm not fully aware what happens if the N900 is not mounted and Automatic tries to download items to it, but that's a subject for another post and another day.
I should point out that MythWeb UI, while functional, is a horrible mess and should be re-designed. Also, wouldn't it be logical that MythWeb UI would provide the RSS links itself? If anybody is willing to work on usability matters, contact me and perhaps I could lend a hand as well.
Anyhow, enough about ranting and let's enjoy this system what we can.
Links:
Coding Curious Automatic
Addendum: One could always adapt this to iPhone/iPod touch by using iTunes as an RSS client. Or, with N900, use a client on it to directly subscribe to the RSS feed and thus negating the need of having a computer in between the device and the MythTV server.
Addendum: One could always adapt this to iPhone/iPod touch by using iTunes as an RSS client. Or, with N900, use a client on it to directly subscribe to the RSS feed and thus negating the need of having a computer in between the device and the MythTV server.
Converting Video for Nokia N900
This post is about converting video for Nokia N900 on Mac and I hope that it can be used as a partial solution for more automated home media networking alongside MythtV. While this stuff ought not to be hard, it may easily take a moment to dig up the right software to do the work and find the right settings for the conversion to play on the device. Thus, I'll use this as a quick checklist for later conversion needs. As a source I'll be using an old aikido clip that was made for a university course on multimedia production and a CG animated test clip.
Multimedia Support:
This information is available via Forum Nokia. The screen size is 800x480 pixels and at that resolution the video playback is said to go up to 25 fps. Now, let's take a look at an example video that was proved to run on the device:
Now, I had to go through several pieces of software to find a simple way to do conversions. The task could be accomplished with Quicktime Pro or actual video editing suites, but I deemed those overkill for the task at hands. However, it was rather surprising that other issues popped up with most common applications:
All of the utilities mentioned above produced working clips. None of the apps seemed fully optimal, though. It might be a nice idea to be really able to set up device profiles to which videos could simply be assigned to. In any case, both Handbrake and MPEG Streamclip do support presets. Video Monkey something to keep eyes on, if it gains easy to create profiles for other devices it could well become one of my favourites.
Personally, I'm somewhat divided between MPEG Streamclip and Handbrake. Handbrake GUI is much more polished, but it does seem its preset system, cropping and scaling are still more mysterious than those on MPEG Streamclip. Handbrake also has a command line client, that could be used for more complicated or automated tasks, which is a definite plus as it allows, for example, watch folders.
Links:
Handbrake
Forum Nokia
Video Monkey
Evom
MPEG Streamclip
Multimedia Support:
- Video: 3GPP, AVI, Flash Video, H.264/AVC, MPEG-4, WMV
- Audio: AAC, AAC+, eAAC+, M4A, MP3, WAV, WMA
This information is available via Forum Nokia. The screen size is 800x480 pixels and at that resolution the video playback is said to go up to 25 fps. Now, let's take a look at an example video that was proved to run on the device:
- Resolution: 800x480, MPEG4 (.mp4)
- h.264, 25 fps
- AAC-Stereo, 44,100 Hz
Now, I had to go through several pieces of software to find a simple way to do conversions. The task could be accomplished with Quicktime Pro or actual video editing suites, but I deemed those overkill for the task at hands. However, it was rather surprising that other issues popped up with most common applications:
- Evom: Successor to iSquint. While this application seemingly worked, I didn't find an easy place where to crop and resize the videos.
- Video Monkey: Successor to VisualHub. Same issues as with Evom, though it does seem that the missing features will be addressed later on. There are already interface elements that would seemingly lead to required features.
- MPEG Streamclip: Streamclip has saved me a few times in the past, and yet again it was found to be a working solution. It does appear complex, however, but revealed options can help to fine tune the encodings further.
- Handbrake: Originally meant for DVD back-upping, Handbrake has recently added features to convert movie clips from computer as well. It
All of the utilities mentioned above produced working clips. None of the apps seemed fully optimal, though. It might be a nice idea to be really able to set up device profiles to which videos could simply be assigned to. In any case, both Handbrake and MPEG Streamclip do support presets. Video Monkey something to keep eyes on, if it gains easy to create profiles for other devices it could well become one of my favourites.
Personally, I'm somewhat divided between MPEG Streamclip and Handbrake. Handbrake GUI is much more polished, but it does seem its preset system, cropping and scaling are still more mysterious than those on MPEG Streamclip. Handbrake also has a command line client, that could be used for more complicated or automated tasks, which is a definite plus as it allows, for example, watch folders.
Links:
Handbrake
Forum Nokia
Video Monkey
Evom
MPEG Streamclip
Monday, September 28, 2009
Playing with Arduino
I've been interested in electronics for quite a while. In fact, I chose my university back in '98 based on the thought that it would be fun to be able to make little things for oneself. As it turned out it wasn't really my thing to work with the circuit designs and design field got my attention. However, with little kits like Arduino one can play with very little knowledge about deep math involved and easily create simple devices.
I ran into Arduino the first time in Ars Electronica 2006 and played some with Basic Stamp and MAX/MSP while staying at Media Lab. With little knowledge one can get these things running fast. The first experiments with Arduino took only a few hours after which I had my first working prototype.
Here is a little board of mine, something really, really simple. It just turns on a led to a given brightness based on sensor input (ambient light and proximity). While this is both mechanically and software wise rather trivial, it gives quite a few possibilities to bring information technology past the computer screens.
Friday, September 18, 2009
Some notes and links
I've been playing with a few personal projects of mine (Arduino and some mobile media stuff for home) and thus ran into following links for those designing and implementing projects in mobile space:
Then some more visual links to serve as notes:
- jQTouch - A jQuery plugin for mobile web development on the iPhone, Android, Palm Pre, and other forward-thinking devices.
- PhoneGap - PhoneGap is an open source development tool for building fast, easy mobile apps with JavaScript.
Then some more visual links to serve as notes:
- Tungsten - That rarest of species, Tungsten is a compact and sporty sans serif that’s disarming instead of pushy — not just loud, but persuasive.
- Logo Jr Black
- Heroine
Subscribe to:
Posts (Atom)

