New mixes on soundcloud
- January 19th, 2012
- Write comment
Last year was really busy and it doesn’t stop. Anyway I had some time over Christmas holidays to upload a couple of mixes on soundcloud.
Enjoy!
DnB
Techno & House
Archive for the ‘Code’ Category
Last year was really busy and it doesn’t stop. Anyway I had some time over Christmas holidays to upload a couple of mixes on soundcloud.
Enjoy!
DnB
Techno & House
I’m currently in a dilemma. A major App must be built in PHP so I’ve now the framework discussion.
As I’m a new team member and I’ve worked in the past with both frameworks I got the obvious question “which one I’d prefere?”.
I’ve to say that this discussion is my fault because I introduced Cake a few weeks ago. So my colleagues made some research and told me, that the main opinion about these frameworks is that Cake is for N00bs and Zend for skilled developer. This is shitt!
There are two types of frameworks:
White Box
In this case the developer must be familiar with the internals of the framework. Basically the developer will extend behaviors by using subclases. This is called inheritance.
Black Box
For this type of framework the developer must not be familiar with the internals. Basically objects were created and behaviors were delegated between them.
In other words for non technical: With a white box you need to code e.g. the “user”. Using a black box you tell the framework “make user” and the code for the “user” appears.
From the performance point of view a white box framework would perform better. This is because a black box fw needs a lot of “features” that were not used in most cases.
Basically every project hast its requirements and dependencies. In my case requirements can be shortened to: “Build a C10K app as cost efficient as possible”. Thus hosting and locale are also really important factors.
On the one hand by using a white box framework the app will have a better performance so that machine power (Server) is less needed but the developing time will be higher than using a black box. On the other hand an app built with a black box framework will need more machine power. So now the break even point between machine power and developer time must be calculated. Anyway machine architecture is important in both cases!
But let’s go back to Zend & Cake.
Zend can be used as blackbox and whitebox. Thus an app will have different performance depending in which “mode” the frame work is used. A developer can use Zend like libraries “the white box style” or heavy weight “the black box style”.
Cake is black box BUT coded in the right way Cake can also achieve a good performance and reduce developing time. This is why I like cake. You also don’t need to bake the whole app thus you can also achieve performance increase. Also by tuning caching, Cake can achieve the needed performance. But now the developer must be familiar with Cake internals too.
Please also keep in mind that Cake2.0 will be released soon. And there will be optimizations regarding performance.
At the end what does this say about skills? In my eyes nothing. For me a good developer will never produce “Spaghetti code, will follow design patterns and produce as rapid as possible so that it’s cost efficient.
I ordered my Kinect a couple of weeks ago but because of this hard winter it was delivered last week. So I couldn’t post earlier. Anyway let’s get started.
First we need to access the Microsoft Kinect USB camera. There is a library called libfreenect which is developed and maintained by the OpenKinect Community.
Now that we have access to some of the Kinect features we need to get the data to Flash. For that a wrapper is needed. Basically it sends the data via a socket to your flash app. The best source for AS3 is as3kinect. There you will find installers and HOWTOs to get the shitt working! For OSX there is an alternative written by Koji Kimura which is based on cocoa…. it’s called flKinect. In my opinion the API is not as “good” as as3kinect but flKinect has a program installer and doesn’t need any action over Cosole. This is good for me because I like others to test my experimental apps – for me, screen recording sucks! When I choose to use flash for an app/website the most important thing is interaction thus I need the feedback of others, mainly simple users.
At this point I have a clear idea of what type of app I want to built but for this I need more information of how Kinect works and how the data can be used/implemented. So I’m currently reading this:
But what does this mean for my flash development? Well this means that it was good in the past to get in touch with BitmapData manipulation, collision detection, motion tracking, color and edge tracking etc.. and it’s also good that I have all this clases that I can reuse for this project. But first I need to finish reading – so I hope this post was helpful!

Some friends were facing character encoding problems on an oracle db.
Well the origin of this problem is that when you install an oracle,
in this case it was a 9i, the NLS_LANG param (if not defined) is set to
AMERICAN_AMERICA.US7ASCII. The language is AMERICAN,
the country is AMERICA, and the character set is US7ASCII.
This is really a problem if you live in Germany and you want to
work with german charachters & CLOB
The best way to avoid problems with the old JDBC they are using, is
to install the DB once again with an UTF8/16. But this is not possible.
There are also some other dependencies for these guys so the best way
for their workflow ist to do an exp, drop the user and imp again. Than
connect with the SQLDeveloper and recheck the CLOB.
| sql | | copy | | ? |
| 01 | |
| 02 | exp scott/tiger filename=mydump.dmp |
| 03 | |
| 04 | sqlplus scott/tiger |
| 05 | DROP USER scott CASCADE; |
| 06 | CREATE USER scott IDENTIFIED BY tiger; |
| 07 | GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO scott IDENTIFIED BY tiger; |
| 08 | |
| 09 | imp scott/tiger filename=mydump.dmp |
| 10 |
than sqldeveloper But please use SQL Developer with causion ! It sucks.

Yesterday a guy was claiming that he had to copy all counterstrike source files from one server to another. He was telling that this takes a lot of time because he had to sftp to desktop and than upload to server.
Well rsync can do this much quicker and better. I wrote a few years ago this little script called my_syncmokey.
| shell script | | copy | | ? |
| 01 | |
| 02 | #!/bin/bash |
| 03 | echo "***************************************************************" |
| 04 | echo "* *" |
| 05 | echo "* - Your Sync Monkey started - *" |
| 06 | echo "***************************************************************" |
| 07 | echo |
| 08 | echo |
| 09 | |
| 10 | #Logfile |
| 11 | LOGFILE="PATH/TO/YOUR/LOG.log".`date '+%Y%m%d_%H%M%S'` |
| 12 | |
| 13 | #config |
| 14 | SERVER="IP FROM THE SERVER YOU WANT TO PULL" |
| 15 | REMOTEDIR="/PATH/TO/THE/REMOTE/FOLDER" |
| 16 | LOCALDIR="/PATH/TO/THE/LOCAL/FOLDER " |
| 17 | SSH="/usr/bin/ssh" |
| 18 | |
| 19 | #output |
| 20 | echo >> $LOGFILE; |
| 21 | echo "- Sync Monkey started -" >> $LOGFILE; |
| 22 | echo >> $LOGFILE; |
| 23 | echo "Timestamp: " `date '+%Y%m%d %H%M%S'` >> $LOGFILE; |
| 24 | echo >> $LOGFILE; |
| 25 | echo >> $LOGFILE; |
| 26 | echo "command: rsync -av --links --rsh=$SSH $SERVER:$REMOTEDIR $LOCALDIR " >> $LOGFILE; |
| 27 | echo >> $LOGFILE; |
| 28 | |
| 29 | #sync and write to logfile |
| 30 | rsync -av --links --rsh=$SSH $SERVER:$REMOTEDIR $LOCALDIR >> $LOGFILE; |
| 31 | |
| 32 | #print output |
| 33 | cat $LOGFILE | while read line |
| 34 | do |
| 35 | echo $line |
| 36 | done |
| 37 | |
| 38 |

I had a few days ago a couple of minutes and I wanted to take a look into three.js.
I had the idea to use Audio Data API to get the sound spectrum of a song and combine this with three.js particles.
Just for an experiment…
As I needed a song that I could use without get fucked by those labels/artists I started a CC search and found Galdson’s Denilio – awesome.
A few minutes later the Experiment was ready and started. And it was so beautiful in my Eyes! But my computer is really crappy so I couldn’t enjoy and my time was over too…
Yesterday I started the experiment and I was unhappy again because of performance issues. But this was the original purpose of the Experiment, get a feeling for performance…..
Anyway I hacked a quick FPS keeper and voilá.
I promised to share but first you will need a Mozilla with the Audio Data API you can get it here:
Linux:
firefox-3.7a1pre.en-US.linux-i686
Mac builds:
10.5
10.6
Windows:
firefox-3.7a1pre.en-US.win32
The Experiment is here
cheers
update:
” ich habe eben noch mal mit Vodafone telef. aufgrund, das die änderung in wap.vodafone.de
nur GPRS empfang ergab. Und das ist auch richtigt ! Siehe http://www.vodafone.de/konfig
aber GPRS suckt ja ordentlich. Für Umts braucht man einen Vodafone Daten Tarif was ich auch hab’
also sind keine Änderungen nötig !!! Die Änderung, die unten beschrieben wird gilt nur für den Vodafone Life! Tarif !!
”
Ich habe mir gestern das Pre besorgt, schick schick aber ich habe Vodafone mit Datenflat bedeutet,
das man eine kleine Einstellung beim Pre vornehmen muss um nicht in die Kostenfalle zu tappen.
Aber Achtung – bitte vorher bei Vodafone anrufen und sich nach dem eigenen Tarif erkundigen.
Aber Achtung – alle änderungen die nun folgen sind auf eigene Gefahr !!
Das mini Tutorial erfordert schon fortgeschrittene Kenntnisse ansonsten könnt’s eng werden.
1. Root
Einen guten howto für den Root Zugang habe ich hier gefunden Palm Pre Root Zugang also dann erstma “bis später …”
2. APN
man muss den richtigen APN Zugangspunkt eingeben dafür habe ihr jetzt ja auch den root zugang. Also
putty öffnen und in die console
| actionscript | | copy | | ? |
| 1 | cp /usr/lib/luna/CarrierNetworkSettings.db3 /media/internal |
damit habt ihr die Datei CarrierNetworkSettings.db3 in einem für euch zugängliches Verzeichnis kopiert.
Jetzt einfach über den usb Modus die Datei auf euren Rechner übertragen.
Die Datei ist eigentlich eine kleine Datenbank des Typs Sqlite. Dort befinden sich die APN Zugänge.
Achtung ! – Eine Sicherungskopie der CarrierNetworkSettings.db3 anlegen. Falls was schief geht …..
Jetzt müssen wir diese Datei editieren. Ich persönlich finde den sqlite-manager am Besten !! Plattform unabhängig und klein wie Sqlite. Also installieren.
Jetzt habt ihr im FF unter Extras den sqlite-manager damit mach ihr die CarrierNetworkSettings.db3 auf dort müsst ihr unter
com_palm_data_carriernetworksettings_DataConnectionSettings mal die suche öffnen und auf das Feld APN contains web
eingeben.

dort das feld web.vodafone.de mit wap.vodafone.de ersetzen und fertig.
Zur Sicherheit könnt Ihr noch die Tabelle durchsuchen ob da noch irgendwo web steht. Dies sollte nicht der Fall sein.
Mir ist von Vodafone gesagt worden, das die Flatrate nur für den APN wep gilt. Sollte man über web gehen wird’s teuer !!
Hier könnt ihr aber auch noch mit der Hotline reden über mehr Info’s bin ich auch dankbar.
!! Bitte über den Quick check im vodafone Portal mal ständig den Rechnungsstatus checken !!
So jetzt müssen wir die CarrierNetworkSettings.db3 irgendwie wieder zurück schaufeln dafür nutze ich
Wenn WebOS Quick Install bei euch läuft müsst ihr nur auf Tools -> Sendfile gehen und die überarbeitete db3 in die Verzeichnisse
| actionscript | | copy | | ? |
| 1 | /usr/lib/luna/ |
| actionscript | | copy | | ? |
| 1 | /var/luna/data/ |
das wars’.
Schon 24h um und keine Kosten zu sehen.

This CAPTCHA Class uses Securimage. You can get it here
Securimage is an open-source free PHP CAPTCHA script for generating complex images and CAPTCHA codes to protect forms from spam and abuse…
show.php
| php | | copy | | ? |
| 1 | |
| 2 | include 'securimage.php'; |
| 3 | $img = new securimage(); |
| 4 | $img->show(); |
| 5 |
To load the created image, just write an URLLoader than a Loader, that loads the URLLoader data ….
Captcha.as
| as3 | | copy | | ? |
| 01 | |
| 02 | public class Captcha extends Sprite |
| 03 | {
|
| 04 | private var _loader:URLLoader; |
| 05 | private var _captchadata:BitmapData; |
| 06 | private var _captcha:Bitmap; |
| 07 | private var _cont:Sprite; |
| 08 | |
| 09 | public function Captcha() |
| 10 | {
|
| 11 | this._cont = new Sprite(); |
| 12 | this._cont.useHandCursor = true; |
| 13 | this._cont.buttonMode = true; |
| 14 | |
| 15 | this._loader = new URLLoader(); |
| 16 | this._loader.dataFormat = URLLoaderDataFormat.BINARY; |
| 17 | var url:String = "show.php"; |
| 18 | var urlReq:URLRequest = new URLRequest(url); |
| 19 | |
| 20 | this._loader.addEventListener(Event.COMPLETE, completeHandler); |
| 21 | this._loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); |
| 22 | this._loader.load(new URLRequest(url)); |
| 23 | } |
| 24 | private function ioErrorHandler(e:IOErrorEvent):void |
| 25 | {
|
| 26 | //SOS.alert(_e.toString()); |
| 27 | } |
| 28 | private function completeHandler(e:Event):void |
| 29 | {
|
| 30 | this._loader.removeEventListener(Event.COMPLETE, completeHandler); |
| 31 | this._loader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); |
| 32 | |
| 33 | var myLoader:Loader = new Loader(); |
| 34 | myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, createCaptcha); |
| 35 | |
| 36 | var byteArr:ByteArray = new ByteArray(); |
| 37 | byteArr = this._loader.data; |
| 38 | |
| 39 | if(byteArr.length != 0) { myLoader.loadBytes(this._loader.data); }
|
| 40 | else { /* SOS.alert("error"); */ }
|
| 41 | } |
| 42 | private function createCaptcha(e:Event):void |
| 43 | {
|
| 44 | this._captchadata = new BitmapData(175, 45, false, 0xFFFFFF); //sizes of secureimage.php ~ Line 89 |
| 45 | this._captchadata = (e.target.content).bitmapData; |
| 46 | |
| 47 | this._captcha = new Bitmap(this._captchadata, "auto", true); |
| 48 | this._captcha.x = 920; |
| 49 | this._captcha.y = 92; |
| 50 | this._cont.addChild(this._captcha); |
| 51 | this._cont.addEventListener(MouseEvent.MOUSE_DOWN , renew); |
| 52 | this.addChildAt(this._cont,0); |
| 53 | } |
| 54 | private function renew(_me:MouseEvent):void |
| 55 | {
|
| 56 | this._cont.removeChildAt(0); |
| 57 | var url:String = "show.php?"+Math.random()*100; |
| 58 | var urlReq:URLRequest = new URLRequest(url); |
| 59 | |
| 60 | this._loader.addEventListener(Event.COMPLETE, completeHandler); |
| 61 | this._loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); |
| 62 | this._loader.load(new URLRequest(url)); |
| 63 | |
| 64 | } |
| 65 | } |
| 66 |
I hard-coded some dimensions inside the class, and some other ugly things, so feel free to change for your needs.
But don’t forget to put the Math.random() after the URI to refresh the captcha, this can avoid caching issues.
You can see this class Working here. Click on the share Btn.
Sure, this class can be used to load nearly all types of binary image data ….
In my oppinion “copy to clipboard” buttons don’t have a real
usability benefit. The only thing they do is open new security holes.
Also the need to be updated when Browsers or Plugins change.
In the Past there was an approach using Flash, but since Player 10
this does not work any more. Sure there are new clipboard function
in Player 10 but what about the users < FP 10 ?
At the Moment there is a Js Library called Zero Clipboard which uses
Clickjacking to achieve the copy…..

Just for a short overview,
I sometimes play drum and bass on parties. To improve the audience experience, I use flash to visualize the digital culture I’m living. For this, I wrote some applications in flash and air. These apps are more experiments to find out how my sound can influence visual media to generate a special atmosphere.
Sometimes some people notice what I am doing or know what is happening. Therefore, questions came up and it is difficult to have a productive conversation at a party….
So why flash?
I think the main reason was that I wanted to experiment with Flash and later on with the new features of the player 10.
So let us get started.
The first step to reach the stuff I had in mind was to grab the audio signal. I have a line-in, so let us take a look what possibilities I have in flash to use this. I found the flash.media package providing some classes to access the microphone and the sound spectrum. I found out that it was not really easy to get apply the computeSpectrum method on the microphone. So I thought. O.K. I’ll code a Java app that catches the audio signal, computes spectrum and send this data as bytearray to flash. However, this was not very cool, even having some java code, I could re use and I wanted to stay with flash.
I explored the possibilities and none of them were easy and latency efficient for my purposes. I really needed some time to find the solution and it was sooo simple !
Setup a streaming Server on your computer. My choice after some tests was Icecast2 here is a sample of my config:
| xml | | copy | | ? |
| 01 | |
| 02 | <icecast> |
| 03 | <limits> |
| 04 | <sources>2</sources> |
| 05 | <queue-size>0</queue-size> |
| 06 | <burst-on-connect>1</burst-on-connect> |
| 07 | <burst-size>0</burst-size> |
| 08 | </limits> |
| 09 | <authentication> |
| 10 | <source-password>hackme</source-password> |
| 11 | <relay-password>hackme</relay-password> |
| 12 | <admin-user>admin</admin-user> |
| 13 | <admin-password>hackme</admin-password> |
| 14 | </authentication> |
| 15 | |
| 16 | <hostname>localhost</hostname> |
| 17 | <listen-socket> |
| 18 | <port>6666</port> |
| 19 | </listen-socket> |
| 20 | <fileserve>1</fileserve> |
| 21 | <paths> |
| 22 | <logdir>./logs</logdir> |
| 23 | <webroot>./web</webroot> |
| 24 | <adminroot>./admin</adminroot> |
| 25 | <alias source="/" dest="/status.xsl"> |
| 26 | </alias> |
| 27 | <logging> |
| 28 | <accesslog>access.log</accesslog> |
| 29 | <errorlog>error.log</errorlog> |
| 30 | <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error --> |
| 31 | </logging></paths></icecast> |
Setup a streaming client on your computer like Edcast and choose the right audio in.
When you get this programs running you will have a streaming server running under the following URL:
or if you are using shoutcast :
….. /;stream.nsv
So now, you can catch this audio stream from your flash app like this:
| actionscript | | copy | | ? |
| 1 | |
| 2 | this._sfx = new Sound(); |
| 3 | var req:URLRequest = new URLRequest("http://localhost:6666/stream");// /;stream.nsv
|
| 4 | var context:SoundLoaderContext = new SoundLoaderContext(0, false); |
| 5 | this._sfx.load(req, context); |
| 6 | this._channel = this._sfx.play(); |
| 7 | SoundMixer.bufferTime=0; // works for me locally |
| 8 |
Now you can get the spectrum over an onEnterFrame Event with SoundMixer.computeSpectrum. I am going to explain this in part II
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.