<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>minimeta material &#187; Hacking</title>
	<atom:link href="http://blog.minimeta.de/topics/hacking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.minimeta.de</link>
	<description>a tiny bit beyond - in no particular order</description>
	<lastBuildDate>Fri, 21 Aug 2009 11:24:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Another Plugin for the Extjs HtmlEditor</title>
		<link>http://blog.minimeta.de/2009/08/another-plugin-for-the-extjs-htmleditor/</link>
		<comments>http://blog.minimeta.de/2009/08/another-plugin-for-the-extjs-htmleditor/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 11:24:41 +0000</pubDate>
		<dc:creator>caribu</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[htmleditor]]></category>

		<guid isPermaLink="false">http://blog.minimeta.de/?p=204</guid>
		<description><![CDATA[This plugin provides a format-block for the extjs HtmlEditor. It is based on the work of Shea Frederick and some code from TinyMCE. This plugin has sofar only been tested in Firefox, so if anybody uses it and finds it to be buggy, please drop me a line and a patch if possible. Save the [...]]]></description>
			<content:encoded><![CDATA[<p>This plugin provides a format-block for the <a title="Extjs HtmlEditor" href="http://extjs.com/deploy/dev/docs/?class=Ext.form.HtmlEditor" target="_blank">extjs HtmlEditor</a>. It is based on the work of <a href="http://code.google.com/p/ext-ux-htmleditor-plugins/" target="_blank">Shea Frederick</a> and some code from <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE</a>. This plugin has sofar only been tested in Firefox, so if anybody uses it and finds it to be buggy, please drop me a line and a patch if possible. Save the following code to a file, add this to your html before extjs-all.js and install it the same way as the plugins by Shea Frederick, <a href="http://www.vinylfox.com/plugin-set-for-additional-extjs-htmleditor-buttons/" target="_blank">so go and take a look there</a>. Since I took some code from TinyMCE this code is licensed under the <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>.<br />
<span id="more-204"></span><br />
<code> </code></p>
<pre>Ext.ux.form.HtmlEditor.Formatblock = Ext.extend(Ext.util.Observable , {

	// private
	init: function(cmp){
		this.cmp = cmp;
		this.cmd = 'FormatBlock';
		this.store = new Ext.data.SimpleStore({
			fields: ['tag', 'name'],
			data : [
				['p', 'Paragraph'],
				['div', 'Div'],
				['h1', 'Header 1'],
				['h2', 'Header 2'],
				['h3', 'Header 3'],
				['h4', 'Header 4'],
				['address', 'Address'],
				['blockquote', 'Blockquote'],
				['pre', 'Preformated']
			]
		});
		this.cmp.on('render', this.onRender, this);
		this.cmp.on('initialize', this.onInit, this, {delay:100, single: true});
	},
	// private
	onInit: function(){
		Ext.EventManager.on(this.cmp.getDoc(), {
			'mousedown': this.onEditorEvent,
			'dblclick': this.onEditorEvent,
			'click': this.onEditorEvent,
			'keyup': this.onEditorEvent,
			buffer:100,
			scope: this
		});
	},

	// private
	onRender: function() {
		var tb = this.cmp.getToolbar();
		this.formatSelector = this.createFormatSelector();
		tb.add(this.formatSelector);
	},

	//private
	createFormatSelector: function(){
		var combo = new Ext.form.ComboBox({
			store: this.store,
			displayField:'name',
			valueField:'tag',
			typeAhead: true,
			mode: 'local',
			width: 80,
			triggerAction: 'all',
			emptyText:'Select a format ...',
			valueNotFoundText: 'Select a format ...',
			forceSelection: true,
			editable: false,
			listWidth: 120,
			selectOnFocus:true,
			listeners:{
				scope: this,
				'select': function(combo, record, index){
					tag = record.data.tag;
					this.insertFormatblock(tag);
					this.cmp.getToolbar().focus();
					this.cmp.deferFocus();
					this.formatSelector.reset();
				}
			}
		});
		return combo;
	},

	insertFormatblock : function(val) {
		if (val.indexOf('&lt;') == -1)
			val = '&lt;' + val + '&gt;';
		if (Ext.isGecko)
			val = val.replace(/&lt;(div|blockquote|code|dt|dd|dl|samp)&gt;/gi, '$1');
		this.cmp.relayCmd('FormatBlock', val);
	},

	getSelection : function() {
	  win = this.cmp.getWin();
		return win.getSelection ? win.getSelection() : win.document.selection;
	},

	getRange : function() {
		var win = this.cmp.getWin(), s, r;

		try {
			if (s = this.getSelection())
				r = s.rangeCount &gt; 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : win.document.createRange());
		} catch (ex) {	}

		// No range found then create an empty one
		// This can occur when the editor is placed in a hidden container element on Gecko
		// Or on IE when there was an exception
		if (!r)
			r = Exi.isIE ? win.document.body.createTextRange() : win.document.createRange();

		return r;
	},	

	getNode: function(){
		var elem, e, r = this.getRange(), s = this.getSelection();
		if (!Ext.isIE) {
			// Range maybe lost after the editor is made visible again
			if (!r)
				return this.cmp.getDoc().dom.getRoot();

			e = r.commonAncestorContainer;
			// Handle selection a image or other control like element such as anchors
			if (!r.collapsed) {
				// If the anchor node is a element instead of a text node then return this element
				if (Ext.isWebKit &amp;&amp; s.anchorNode &amp;&amp; s.anchorNode.nodeType == 1)
					return s.anchorNode.childNodes[s.anchorOffset]; 

				if (r.startContainer == r.endContainer) {
					if (r.startOffset - r.endOffset &lt; 2) {
						if (r.startContainer.hasChildNodes())
							e = r.startContainer.childNodes[r.startOffset];
					}
				}
			}
			elem = e.parentNode;
		} else {
			if (r.item)
				elem = r.item(0);
			else
				elem = r.parentElement();
		}
		return Ext.get(elem);
	},

	getBlocklevelElement: function(n){
		if(n){
			if (/^(P|DIV|H[1-6]|ADDRESS|BODY|BLOCKQUOTE|PRE)$/.test(n.dom.nodeName)){
				return n;
			} else {
				return this.getBlocklevelElement(n.findParentNode());
			}
		}
		return null;
	},	

	// private
	onEditorEvent: function(){
		var fs = this.formatSelector, r, p;
		p = this.getBlocklevelElement(this.getNode());
		if (p &amp;&amp; p.dom &amp;&amp; p.dom.nodeName != 'BODY'){
			fs.setValue(p.dom.nodeName.toLowerCase());
		} else {
			fs.reset();
		}
	}

});</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.minimeta.de/2009/08/another-plugin-for-the-extjs-htmleditor/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ohhhh myspace</title>
		<link>http://blog.minimeta.de/2008/09/ohhhh-myspace/</link>
		<comments>http://blog.minimeta.de/2008/09/ohhhh-myspace/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 10:05:39 +0000</pubDate>
		<dc:creator>caribu</dc:creator>
				<category><![CDATA[Ausland]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[cinemarketing]]></category>
		<category><![CDATA[ical]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[myspace]]></category>
		<category><![CDATA[not so open]]></category>

		<guid isPermaLink="false">http://blog.minimeta.de/?p=91</guid>
		<description><![CDATA[Ausland has a myspace page. It&#8217;s new it&#8217;s fresh and it&#8217;s something I/we avoided for as long as possible. Of course we get a lot of myspace links from bands that want to play at ausland, but I never bothered to register since I despised the optics of those pages so much that I didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Ausland on myspace" href="http://myspace.com/auslandberlin" target="_blank">Ausland has a myspace page</a>. It&#8217;s new it&#8217;s fresh and it&#8217;s something I/we avoided for as long as possible. Of course we get a lot of myspace links from bands that want to play at ausland, but I never bothered to register since I despised the optics of those pages so much that I didn&#8217;t want to see more of it. I was fine with listening to the sounds on the start page and then leave as quickly as possible.</p>
<p><span id="more-91"></span>Not that those myspace links to music from different bands aren&#8217;t helpful. They are. Instead of having to organize an ever growing pile of demo cds were the interesting ones always seem to be missing we now just have to check the original email and &#8211; booom there is the music. Great.</p>
<p>But myspace, oooh. I mean this could be done so much nicer. And basically myspace is this huge lock-in. The only obvious way to post information to myspace seems to be manual input. Open the editor and type away. This is about as silly as the interface <a title="Zitty berliner veranstaltungstips" href="http://www.zitty.de" target="_blank">Zitty </a>and <a title="Tip Berliner Veranstaltungsmagazin" href="http://tip-berlin.de" target="_self">Tip </a>are providing to input your dates free of charge. Actually, come to think of it the way Zitty and Tip are doing it is even worse. They are using some silly java applet to let you input your dates, one by one and you have to navigate through some kind of calendar that simply takes ages. I mean, there are standards for this kind of thing. Ical or rdf or if you must you could provide a custom api but a java applet is simply the worst possible user experience. Which is most likely intentional since they want you to pay money to a <a title="Cinemarketing Ein verdammter Monopolist" href="http://www.cine-marketing-gmbh.de/" target="_blank">company </a>so they can do it for you. I wonder whether this is legal. I should ask a lawyer because I strongly suspect this is monopolistic behaviour forbidden by law. Watch for another post on that topic.</p>
<p>Back to silly myspace. As I said, this is the age of webservices and of course I don&#8217;t want to retype stuff already on the net just to be up to date on some silly page that is 90% obnoxious and 10% fun. So there is no rdf or ical reader available from myspace and nobody seems to have gotten around to creating such a myspace app. And I didn&#8217;t want to dive into open social just for such a little task. Maybe I&#8217;ll do when I have time.</p>
<p>This is what I ended up doing: I created a javascript ical application using a <a title="pure Javascript Ical Parser" href="http://skogsmaskin.dyns.net/index.php?handling=vis_artikkel&amp;art_id=7" target="_blank">javascript ical parser</a> and a javascript <a title="Javascript extension to format dates" href="http://blog.stevenlevithan.com/archives/date-time-format" target="_blank">extension to the date object</a> to output formated date strings. Then I whipped up a little DOM script that will write the parsed and formated dates into a blank html page. Next, I thought I&#8217;d just use a little iframe on myspace and include this page and I&#8217;m done. No such luck. No iframes on myspace. They are filtered. Which in addition to the fact that you can&#8217;t use javascript is probably the reason why everybody is using these silly flash widgets on myspace pages. So I figure, ok let&#8217;s find some flash app that basically functions as iframe loading a html page from somewhere and display it. Since I run linux and I don&#8217;t really like flash to begin with, I have neither the tools nor the knowledge to create such a flash app. So I looked around the net and found a number of tutorials on how to do just that but no ready to use swf file. None.</p>
<p>Just when I was about to give up I came across <a title="Myspace App: myhtmlspace430" href="http://apps.myspace.com/myhtmlspace430" target="_blank">myhtmlspace430</a> which basically provides an extra editable area for your myspace page, but allows the iframe tag. So problem solved. I&#8217;m sure there are other methods but this works for me. In case anybody is interested, here is <a href="http://blog.minimeta.de/wp-content/uploads/2008/09/ical.zip">the javascript code ical used to parse ical and output to html</a>. Remember that you can&#8217;t pull ical calendars from anything but your own domain using the javascript xmlhttprequest object.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.minimeta.de/2008/09/ohhhh-myspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OneButtonRecording</title>
		<link>http://blog.minimeta.de/2008/08/onebuttonrecording/</link>
		<comments>http://blog.minimeta.de/2008/08/onebuttonrecording/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 13:50:58 +0000</pubDate>
		<dc:creator>caribu</dc:creator>
				<category><![CDATA[Ausland]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[ardour]]></category>
		<category><![CDATA[hammerfall]]></category>
		<category><![CDATA[jack]]></category>
		<category><![CDATA[streaming]]></category>

		<guid isPermaLink="false">http://blog.minimeta.de/?p=5</guid>
		<description><![CDATA[Its taken a long while. At ausland we wanted to be able to easily record our shows. In addition we wanted to be able to stream any show through our webserver. Early on we had dubbed this project &#8216;One Button Recording&#8217;. The idea was that it should very easy to use so that even people [...]]]></description>
			<content:encoded><![CDATA[<p>Its taken a long while.</p>
<p>At <a href="http://ausland-berlin.de" target="_blank">ausland</a> we wanted to be able to easily record our shows. In addition we wanted to be able to stream any show through our webserver. Early on we had dubbed this project &#8216;One Button Recording&#8217;. The idea was that it should very easy to use so that even people with little or no knowledge about the involved technologies could do it.</p>
<p>The hardware used is:</p>
<ul>
<li>a donated pentium 4 2.8Ghz computer</li>
<li>two condenser oktava microphones</li>
<li>a microphone preamp build from a kit</li>
<li>a donated hammerfall dsp soundcard</li>
</ul>
<p>Since I am the &#8216;IT departement&#8217; at ausland and since I had stopped using Windows some time ago I decided to use Linux for this project. I&#8217;ve used debian on servers, but on my desktop machines I use Ubuntu exclusively. So I decided to put this project together using <a title="Ubuntu Studio" href="http://ubuntustudio.org/" target="_blank">Ubuntu Studio</a> 8.04.</p>
<p><span id="more-5"></span>Basic setup was simple: Ubuntu recognised the Hammerfall DSP soundcard. The Hammerfall DSP card works best with <a title="Jack Audio" href="http://jackaudio.org/" target="_blank">Jack</a> and <a title="Ardour Digital Audio Workstation" href="http://www.ardour.org/">Ardour</a>. But since this soundcard is multichannel, being able to record anything meant that all users had to have at least some idea about how to route channels.</p>
<p>Our &#8216;Audio departement&#8217; Elle quickly created a template for Ardour, but being able to record anything still involved something like 12 steps. So the first item on my list was to open ardour with a new session that used the template. Sadly this wasn&#8217;t possible from the commandline. The solution was to to first build the new session files from an empty session created using the template. Then ardour could be started using these session files. This would leave the user with an ardour window where simply clicking on the record button would start recording what come in from the microphones.</p>
<p>Of course this didn&#8217;t cover streaming our recorded sounds. For streaming I decided to use icecast2 on the server and darkice an the audio workstation. Darkice works with Jack, but it didn&#8217;t connect the right sound card inputs with the darkice outputs. I looked around and found <a title="pyjack" href="http://sourceforge.net/projects/py-jack/" target="_blank">python bindings for Jack</a> that offered a way to manipulate the connections within jack.</p>
<p>Since those were python bindings I decided to write my little application in python. I knew that python bindings existed for gtk+, allowing me to easily create GUI for my software. I had not worked with python before but that actually added to the challenge.</p>
<div id="attachment_6" class="wp-caption alignleft" style="width: 310px"><a href="http://blog.minimeta.de/wp-content/uploads/2008/08/recording-und-streaming-gui.png"><img class="size-medium wp-image-6" title="recording-und-streaming-gui" src="http://blog.minimeta.de/wp-content/uploads/2008/08/recording-und-streaming-gui-300x217.png" alt="recording-und-streaming-gui" width="300" height="217" /></a><p class="wp-caption-text">recording-und-streaming-gui</p></div>
<p>The GUI was to be as simple as possible: Two buttons: one that started and stopped darkice and one that started ardour.</p>
<p>I used <a title="Pygtk Tutorial" href="http://www.micahcarrick.com/12-24-2007/gtk-glade-tutorial-part-1.html" target="_blank">Micah Carricks pygtk tutorial</a> to get me up and running for the GUI. This worked fairly well once I understood the basic layout principles of GTK, even though I did run into some problems using the gtk-builder. I think I had messed up my glade file doing some copy-paste in Glade and builder did not create a gui from my xml. I suspect that some of the widget ids were not unique. However I didn&#8217;t really check that and instead simply rebuild my GUI in glade this time being careful not to duplicate any ids.</p>
<p>After finishing the GUI I created two new python classes, one to create the session files and start ardour, the other one to start darkice and manipulate the jack connections. All of this was pretty straight forward, the only bigger problem I ran into was that I needed my software to wait for some time after starting darkice before I could create the necessary jack connections. I solved this using the <a title="Pexpect" href="http://www.noah.org/wiki/Pexpect" target="_blank">pexpect python module</a>, which also gave me functions to monitor health of the started subprocesses.</p>
<p>The one thing I did not manage was to pipe the output of the darkice subprocess into a gtk textview. I found some <a title="[Python-de] Pipes " href="http://python.net/pipermail/python-de/2005q2/006611.html" target="_blank">fairly simple example</a> on how to do this, however this did not work for me. Maybe I&#8217;ll investigate this further some other time.</p>
<p>I&#8217;ll be cleaning up the sources and move the hardcoded path and file informations into a config file and then I&#8217;ll be posting it on this blog, maybe it will be of use to somebody with a similar setup.</p>
<p><strong>Update:</strong><br />
Here is the <a href="http://blog.minimeta.de/wp-content/uploads/2008/08/recordinggui.zip">recordinggui</a>. I didn&#8217;t do much cleanup. But I&#8217;m sure you can figure it out if needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.minimeta.de/2008/08/onebuttonrecording/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
