<?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>A world in dk(decay/denmark) &#187; server</title>
	<atom:link href="http://rotand.dk/blog/tag/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://rotand.dk/blog</link>
	<description>Just another pointless weblog</description>
	<lastBuildDate>Sat, 27 Jun 2009 19:17:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CLI voip calls</title>
		<link>http://rotand.dk/blog/2009/05/03/cli-voip-calls/</link>
		<comments>http://rotand.dk/blog/2009/05/03/cli-voip-calls/#comments</comments>
		<pubDate>Sun, 03 May 2009 08:13:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[telephone]]></category>
		<category><![CDATA[voip connection]]></category>
		<category><![CDATA[voip phone]]></category>
		<category><![CDATA[voip service provider]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[wake up call]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=178</guid>
		<description><![CDATA[
Sometimes it would be nice to use a script call somebody and play a message.
I &#8220;needed&#8221; a wake-up-call system and since I use a voip-phone and have access to a server. I thought i would be quite nifty if I could have the server call me. Furthermore i would like to be able to script [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rotand.dk/zen/phone/front1.jpg"><img class="ZenphotoPress_thumb alignleft" title="front1" src="http://rotand.dk/zen/phone/image/thumb/front1.jpg" alt="front1" width="180" height="180" /></a><br />
Sometimes it would be nice to use a script call somebody and play a message.<br />
I &#8220;needed&#8221; a wake-up-call system and since I use a voip-phone and have access to a server. I thought i would be quite nifty if I could have the server call me. Furthermore i would like to be able to script calls, so for instance the calendar could call me with reminders rather than sending an email.</p>
<p>I googled around but weren&#8217;t able to find such a utility. But i did find cli-sip client <a href="http://www.pjsip.org/pjsua.htm">pjsua</a>, based on <a href="http://www.pjsip.org/">pjsip</a>. Its posible to use it in conjunction with a shell script.</p>
<h4>Scripting</h4>
<p><code>jacob@vps:~./control.sh sip:108329@foobar.com "wake up you lazy bastard!"</code><br />
Is the basic usage i wanted to have. In order to get this functionality there are two steps.</p>
<p><span id="more-178"></span></p>
<h5>Generating wav file</h5>
<p>I ust use text2wave, from <a href="http://www.speech.cs.cmu.edu/festival/">festival</a>, which is available as a package on ubuntu.<br />
<code>echo $2 | text2wave - -o message.wav </code></p>
<p>$2 to use the second argument, and pipe it to text2wave. Let text2wave read sdtin and output a file message.wav</p>
<h5>Call and play the wav file</h5>
<p><code>pjsua_app --config-file=test.conf --play-file message.wav $1</code><br />
Here the magic is in the conf file. Its a rather straightforward to use, and the documentation is good.<br />
<code><br />
# we don't want the host's audio device<br />
--null-audio<br />
# SIP parameters<br />
--realm domain.com<br />
--registrar sip:number@domain.dk # DNS SRV, or FQDN</code><br />
<code> --username USERNAME<br />
--password PASS<br />
# default of 55 will be rejected as being too short by sipX<br />
--reg-timeout 3600<br />
# auto-answer all calls with "200 OK"<br />
--auto-answer 200<br />
# automatically loop incoming RTP to outgoing RTP<br />
--auto-loop<br />
# mix WAV file into the audio stream</code><br />
<code> --auto-play<br />
--auto-loop<br />
--duration=60<br />
</code><br />
This is based on a config file i found somewhere, can&#8217;t remember where. There a a lot of other options, pjsua handles nat quite nicely as well. It was easy to test it at my homebox, behind a router, just be sure to set an external ip address.</p>
<p>Now this will call and play the message, but it wont stop pjsua. It will just sit around waiting for someone to call. I couldn&#8217;t find any nice way to handle this, but since pjsua reads stdin for commands, it possible to pipe commands to it.<br />
<code>echo "sleep 60000 q" | pjsua_app --config-file=test.conf --play-file message.wav $1 </code><br />
So sleep for 60 seconds, then accept the next input from stdin, the &#8220;q&#8221;uit command.</p>
<p>Generally this configuration is set for 1 minute, it might be necessary to tweak this.</p>
<h4>Frustrations</h4>
<p>There is/were a bug in the tarball, that meant that it wouldn&#8217;t run if it couldn&#8217;t find a soundcard, since it should run on a vps this is quite annoying. But in the svn version its solved, so if you want to do something like this, use the svn version. Other than this installation is straightforward.</p>
<p>When working with cron, remember to use full paths. In the <tt>control.sh</tt> script the better solution were to add a cd working directory, in order to have all the paths correct. This were quite annoying to debug, as the script would run from the shell. And just fail when added to the crontab. Furthermore mails from crontab were delayed, so i couldn&#8217;t see the output. I did get someone to look over my shoulder and spot the bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2009/05/03/cli-voip-calls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New server</title>
		<link>http://rotand.dk/blog/2008/04/03/new-server/</link>
		<comments>http://rotand.dk/blog/2008/04/03/new-server/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 19:49:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/04/03/new-server/</guid>
		<description><![CDATA[The time has come and I&#8217;m moving to a new server.
Its a virtual private server, which mean root access via ssh, and a lot more managing. At the moment I&#8217;m fiddling with testing and moving data. Though very soon I will be moving, which probably will give some weirdness here, until everything is settled.
I am [...]]]></description>
			<content:encoded><![CDATA[<p>The time has come and I&#8217;m moving to a new server.</p>
<p>Its a virtual private server, which mean root access via ssh, and a lot more managing. At the moment I&#8217;m fiddling with testing and moving data. Though very soon I will be moving, which probably will give some weirdness here, until everything is settled.</p>
<p>I am looking forward to be able to do all the fun stuff on the new server, ie jsp. In the meantime its just annoying to configure DNS, take backup&#8217;s, fixing stuff.</p>
<p>Lessons learned so far :</p>
<p>Its kool to be able to ssh in to the new server and just move everything with ftp and not download and upload.</p>
<p>iconv is a nifty unix command for converting: <em> iconv -f ISO-8859-1 -t UTF-8 file &gt; newFile</em></p>
<p>DNS is a nightmare at least for me so far.</p>
<p>Its easy to move wordpress: Export everything, install a new wordpress and import the file. (which incidental also means upgrading).</p>
<p>pmwiki is also easy to move.</p>
<p>I have a mediawiki, that I don&#8217;t use any more and i couldn&#8217;t find an easy way to convert it to static html, so i think ill just have to live without it. Which is a bit annoying since  I wikisquatted at it to show of some povray stuff and that will be lost.</p>
<p>I have a lot of old junk files from various experiments.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/04/03/new-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash development</title>
		<link>http://rotand.dk/blog/2008/02/09/flash-development/</link>
		<comments>http://rotand.dk/blog/2008/02/09/flash-development/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 21:21:13 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/02/09/flash-development/</guid>
		<description><![CDATA[A course Im taking requires that we use flash and we are left to using specific workstations at school or download a 30 day trial for the 6-7 week project. And well either way we are supposed to be using a proprietary piece of software from Adobe.
The first flash assignment were to create a picture [...]]]></description>
			<content:encoded><![CDATA[<p>A course Im taking requires that we use flash and we are left to using specific workstations at school or download a 30 day trial for the 6-7 week project. And well either way we are supposed to be using a proprietary piece of software from Adobe.</p>
<p>The first flash assignment were to create a picture slide show, with captions and a soundtrack. Using the Adobe flash gui its very easy, drag and drop &#8220;programming&#8221;.</p>
<p>But as Richard Stallman says &#8220;its not a matter of convenience, but of ethics&#8221;. So I went looking for replacements. In another course I had no problems using octave instead of matlab, so should this be any different? Yes, unfortunately it seems that its very difficult to get the needed features in free software, well at least in the given timeframe.</p>
<p><a href="http://haxe,org" title="HaXe">HaXe</a> is able to compile to swf, as well as doing a lot of other nifty stuff. I just learnt about it recently from this <a href="http://blog.haxe.org/entry/29" title="HaXe video ">video</a>.</p>
<p>I didn&#8217;t manage to make the entire assignment, (yet?)  in  haxe, but i did make this :<br />
<a href="http://rotand.dk/blog/wp-content/view.html"> flash presentation(5MB+)</a></p>
<p><strong>UPDATE</strong></p>
<p>I did manage to add sound and captions.</p>
<p>So how did I do it?</p>
<p>Well first of all i installed haxe and <a href="http://swfmill.org/" title="swfmill">swfmill</a>. Haxe is able to use the actionsscript api and swfmill can create resources so your are able to refference them in you haxe code.Here is the recipe i used to create this slideshow.</p>
<p>1. create a xml file for swfmill, in order to create a resources for the haxe code.This i something like</p>
<pre> &lt;movie width="480" height="480" framerate="25"&gt;</pre>
<pre>   &lt;frame&gt;</pre>
<pre>      &lt;library&gt;&lt;clip id="img1" import="library/newton001Slide_.png"/&gt;</pre>
<p>unfortunately swfmill isn&#8217;t able to add sound to a library, so that had to be loaded directly from a file. I had some trouble getting it to function on the server but i think that adding &#8220;-D network-sandbox&#8221; to the haxe compilation might have done something. ???</p>
<p>2. run swfmill, thats swfmill simple slides.xml slides.swf</p>
<p>now i had linkage names for the image files, and could add them to the movieClip.</p>
<p>3. Create file SlideShow.hx</p>
<p>The main part. The basic haxe syntax is pretty straightforward, but since it uses the actionscript api it were mostly a question of getting a hang of actionscript. I did however strugle a bit with making a anonymous function, for the sounds onLoad. I used  &#8220;<em>static inline function sndStart(succes){&#8230;}</em>&#8221; , its a wee bit diffrent than what i would do in java. but it works.</p>
<p>3. compile.</p>
<p>make a &#8220;make file&#8221; for haxe, compile.hxml</p>
<pre>-swf test.swf</pre>
<pre>-main SlideShow</pre>
<pre>-swf-lib slides.swf</pre>
<pre>-swf-header 480:480:25:FFFFFF</pre>
<pre>-D network-sandbox</pre>
<p>The last part -D is a conditional flag and as far as i can tell it shouldn&#8217;t do anything, but a saw it in <a href="http://filt3r.free.fr/index.php/2007/12/22/38-sexy-light-mp3-player" title="fmp3"><strong>Fmp3PlayerHx</strong></a> and when i added it the sound seemed to work from the server, using a URL :s :s</p>
<p>4. run haxe compile.hxml</p>
<p>5. display the pretty result. (try not to go crazy when wordpress decides to help you format the html code&#8230;.), at first i tried embedding the flash in this post, but wordpress kept on changing the code, apparently if you add code and have newlines between the tags it throws in a couple og &lt;p&gt; tags &#8230;..</p>
<p>Now its on a separate page, then you don&#8217;t have to download the 5 mb flash file just to view the page, and I can use wordpress with out getting too frustrated.</p>
<p><a href="http://rotand.dk/blog/wp-content/SlideShow.hx">sourcecode slideShow.hx</a></p>
<p>The music is <a href="http://en.wikipedia.org/wiki/Free_Software_Song">&#8220;the free software song&#8221;</a> this version is by <a href="http://www.jonobacon.org/">Jono Bacon</a> , and I personally prefer it to the version by Richard Stallman</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/02/09/flash-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Annoying db-server</title>
		<link>http://rotand.dk/blog/2007/05/30/annoying-db-server/</link>
		<comments>http://rotand.dk/blog/2007/05/30/annoying-db-server/#comments</comments>
		<pubDate>Wed, 30 May 2007 07:02:47 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2007/05/30/19/</guid>
		<description><![CDATA[I knew my host didn&#8217;t have the best databases, but once I had installed Wordpress. Which uses a mysql for every page, i found out just how bad it was. Often I was not even able to get a page to load. So I contacted support.
The answer : since you don&#8217;t have a business solution, [...]]]></description>
			<content:encoded><![CDATA[<p>I knew my host didn&#8217;t have the best databases, but once I had installed Wordpress. Which uses a mysql for every page, i found out just how bad it was. Often I was not even able to get a page to load. So I contacted support.</p>
<p>The answer : since you don&#8217;t have a business solution, you will experience lag at peak-hours. Apparently there are more peak than non-peak hours in a day&#8230;</p>
<p>The solution : upgrade to business ( which is triple the price ) or</p>
<ul>
<li>backup and delete all databases</li>
<li>wait until their controlpanel restart</li>
<li>create a new database, which now will be on the database-server with least load</li>
<li>restore backup</li>
</ul>
<p>I did it, and it seems to work better. But I think its bad service and i immediately went looking for other hosting. I have prepaid so I&#8217;ll probably stay the year out &#8211; but if you know of a good an reliable host (and  reasonably priced host ) please let me know.</p>
<p>the <a href="http://www.surftown.dk/">annoying host is surftown</a></p>
<p>The transistion went faily well, meaning i got to restore my blog &#8211; before their main controlpanel went down for maintenance?!</p>
<p>After restoring Tinymce wouldn&#8217;t show popups ( tinymce &#8211; is the visual editor for Wordpress). It shouldn&#8217;t be related. But anyways i had to add a line to a tiny_mce_popup.js stating the domain. Something about FireFox blocking javascript, i found <a href="http://breadcrumbs.davejlowe.com/archive/83/tinymce-error-permission-denied">this fix</a><br />
edit: which wasn&#8217;t a solution after all, something is &#8220;bugging&#8221; me&#8230;</p>
<p><a href="http://www.surftown.dk/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2007/05/30/annoying-db-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
