— React-Native Programmierer . Patrick Tresp

in 1998, The Raspberry ketone diet drops Raspberry Ketones erection necessary for lovemaking. Research workers screened the African mango fat african mango

Also this time, i want to write a very little summary of btplay in cologne, since i just got back from vacation, a lot is already out of mind.

Luca Sale
– keywords: phonegap, ripple, cloud9

Nico Zimmermann
– keywords: schau, passion project time ( save a month a year to just to passion projects )

Tim Ahrens
– keywords: fontfonter ( try fonts on any website )

Grant Skinner
– keywords: technitone, createjs

Thanks also to the great talks:

– Marcin Wichary
– Seb Lee
– Frank Reitberger
– Joshua Davis ( still cracking somethimes  and thank you for this: „the work you make is the type of work you’ll get hired to do“ )
– Sebastian Golash

Read More

Whithout writing too much about it for today, the best way ( i can always only speak for myself ) to call a function with setTimeout in JavaScript is:

var myTimeout = 400;
setTimeout(function(){ callFunction(parameter[s]) }, myTimeout);

function callFunction( parameter[s] )
// Do some Stuff here with the parameter[s]

Especially when a Parameter is a „multiple Word – String“ (e.g. „Hello Everyone, i am a multiple word String!“ ), using a „closure“ will be the way that works also in Internet Explorer 🙂

Read More

When working with JQuery, it seems all work is taken over by the library.
Actually it does, unless a client tells you afterwards, Internet Explorer 8 is still his/her weapon of choice, next to the ipad of course.
A really funny combination of technical aspects, but client is king, lets make him feel that way.

A real pain is that IE8 is not able to use event.preventDefault() nor event.stopPropagation().

For this, its helpful to use a function that will end the event, no matter what browser:

Step 01. make sure to stop Events

function stopEvent(e) {
	if(!e) var e = window.event;
	//e.cancelBubble is supported by IE -
        // this will kill the bubbling process.
	e.cancelBubble = true;
	e.returnValue = false;
	//e.stopPropagation works only in Firefox.
	if ( e.stopPropagation ) e.stopPropagation();
	if ( e.preventDefault ) e.preventDefault();		
       return false;

Step 02: adding and removing the listeners.

Since IE (8) does not support addEventListener or removeEventListener etc. the element needs to be checked, whether it supports addEventListener or attachEvent ( IE )

function addListeners( el )
{// Allow function call without passing parameters
	var e = el;
	if( !e )  e = document.getElementById('myDiv');
	var el = e;
	if( el )
		if( el.addEventListener )
			el.addEventListener('mouseup', onMouseUp, true);
			el.addEventListener('mousemove', onMouseMove, true);
			el.addEventListener('touchstart', onTouchStart, true);
			el.addEventListener('touchmove', onTouchMove, true);
			el.addEventListener('touchend', onTouchEnd, true);			
		}else if( el.attachEvent ) {
                        // make sure mouse events have the prefix <strong>on</strong>
			el.attachEvent('onmouseup',    onMouseUp);		
			el.attachEvent('onmousemove',    onMouseMove);
			el.attachEvent('touchstart',   onTouchStart);
			el.attachEvent('touchmove',    onTouchMove);
			el.attachEvent('touchend', onTouchEnd);				
// also remove the Listeners correctly:
function removeListeners( el )
{	var e = el;
	if( !e )  e = document.getElementById('myDiv');
	var el = e;
	if( el )
		if( el.removeEventListener )
			el.removeEventListener('mouseup', onMouseUp);
			el.removeEventListener('mousemove', onMouseMove);
			el.removeEventListener('touchstart', onTouchStart);
			el.removeEventListener('touchmove', onTouchMove);
			el.removeEventListener('touchend', onTouchEnd);
		}else if( el.detachEvent ) {
			el.detachEvent('onmouseup',    onMouseUp);
			el.detachEvent('onmousemove',    onMouseMove);
			el.detachEvent('touchstart',   onTouchStart);
			el.detachEvent('touchmove',    onTouchMove);
			el.detachEvent('touchend', onTouchEnd);				

Now its just a Matter of Needs, what to do within the handlers:
an Example could be

 function onMouseUp(e) {
	log('-&gt; mouse up');
	e.touches = [{clientX: e.clientX, clientY: e.clientY}];
function onMouseDown(e) {
	log('-&gt; mouse down');
	e.touches = [{clientX: e.clientX, clientY: e.clientY}];
function onMouseMove(e) {
	log('-&gt; mouse move');
	e.touches = [{clientX: e.clientX, clientY: e.clientY}];
function onTouchStart(e) {
	log('-&gt; touch start');
	//do something with e.touches[0].clientX or e.touches[0].clientY
function onTouchMove(e) {
	log('-&gt; touch move');
	//do something with e.touches[0].clientX or e.touches[0].clientY
function onTouchEnd(e) {
	log('-&gt; touch end');
	if( !is_touch_device() ) removeListeners();

And to not get any errors, add function log and function is_touch_device…

function log(str) {
	var c;
	c = document.getElementById('console');
	c.innerHTML = str + '
' + c.innerHTML;
function is_touch_device() {
  return !!('ontouchstart' in window) ? 1 : 0;

Finally, if it is an Touch device, you want to add the listeners onLoad of the document, on regular devices on MouseDown. Call this function on documen_ready or onLoad.

function init() {
	var el;
    el = document.getElementById('myDiv');
	if( el.addEventListener )
		el.addEventListener('mousedown', onMouseDown, false);
	}else if( el.attachEvent ) {
		el.attachEvent('onmousedown',    onMouseDown);
	if( is_touch_device() ) addListeners();

it works so far in IE8/9, FireFox 3.6.1+, Safari and mobile Safari ( ios )

Read More

During a Projekt, i was wondering, why local use of HTML5 Videos was running, but online it failed.

It turned out, that the MIME-Types for .ogg or .webm were not correctly set. The Server served them as plain text-files.

To get the Server to add correct headers to the files, it is helpful to add those lines in your .htacess .

Not all of them are always neccessary.

AddType video/ogg .ogm 
AddType video/ogg .ogv 
AddType video/ogg .ogg 
AddType video/webm .webm 
AddType audio/webm .weba
AddType video/mp4 .mp4 
AddType video/x-m4v .m4v

Sometimes it’s that easy

Read More

or…. how to get back to efficiency.

One of the major issues for me as a developer is how to use my time. Decisions need to be made, what has to be done ( by me ) till when and what needs to be worked on next.

Since i am a very lucky in the fact, that i have lots of jobs, i tended to fuddle up everything and not get anything done stress free.

So what now? I won’t be the one, that will invent a time stretching mechanism in physics, astrology or whatever.

I read an article that came per tweet ( can’t find it of course by now ) that inspired me, coming back to more efficiency.

First, a couple weeks ago a friend reminded me, that i could set my phone to not push e-mails anytime to my phone. Which means, whenever i want or need to receive E-Mails, i simply open the mail-app manually. Whoa what a relief – the phone does not „pling“ all the time which distracts me or wants my attention.

Which leads me to the second point. Event though my phone doesn’t pling that much anymore, i wondered, what distracts my attention to code while programming. The pling… it is still there, cause my mail program of course is checking my mails all the time. Every 10-20 minutes or in even smaller periods the pling comes up. I sat back and read the mails, that needed so much urgent attention:

  • Cheap Flights to London for 29 € ( Oh yeah lets go )
  • Get a Picture framed for 40% off ( right, haven’t done that for a while )
  • Tibet needs help – Donate here ( just phish my account! )
  • etc.
  • etc.

I figured, its not SPAM! I really signed up for those newsletters and surely marked them as read, whenever they came in. So for a couple of weeks i unsubscribed all newsletters which i really do not need to receive, since i look up stuff manually that interests me. Many services are unsubscribed by now and daily E-Mail rate dropped 80%. Still working on more!

Third– Email is no real-time communication, even though we tend to force ourselves to believe that. I do, for example, have a time, where i am very productive in coding, another time for writing Mails, another for doing office stuff. There not the same each day, but when i feel, i am getting ready to code, i close my mail program for at least an hour. no more pling…

Oh, don’t want to forget the other attractors, even though nobody does it while working! Twitter, Skype, Facebook, g+, Online-News, community etc, etc.
Since Skype is the only thing, that connects me to other developers and friends i tend not to switch it off, Facebook kind of killed that totally crazy chatting anyhow. Whenever i really want silence – i am „busy“.
Twitter, Facebook, News and all the other information spreaders i watch first in the morning, before i even start thinking of work, after lunch and sometimes before i leave.
Compact distraction!
This week i did work on 7 different jobs and different clients, usually it would mean, i don’t get home till midnight and i feel worn out, but i didn’t.
It wasn’t a 9-5 week of course but i sure did have the time to come down, think about, what i do and i even found time to write down those lines….

Read More

With the latest Update of OSX Lion and therefore getting the new Webkit, the external Viewer seems to shrink the output swf.

Even though i do like small applications, i love to be able to read an click what i produce.

So whats up?

FDT creates a wrapper to launch the swf when using the external swf viewer. In this wrapper, the embed tag does not include any informations about width and height of the swf, and that causes the swf to shrink. Thanks to FDT support, it is possible to have a workaround on that, besides using the standalone player or the browser ( i kinda got stuck to the external viewer ).

Basically, what you do is:

  • get the generated code from the wrapper FDT created
  • create a HTML-File
  • copy the generated code and insert the width and height attributes in that code
  • change the Debug-Configurations, on what to open after the compile process ( yes, the new HTML-file )

The bug is filed under : http://bugs.powerflasher.com/jira/browse/FDT-2255
Don’t like reading? http://screencast.com/t/lylw8JVrve

Read More

If this service is really working, it will save a lot of pushing informations through different channels and will make some peoples days.

It only works by invitation currently, but i will give it a try now.



Read More

While setting up an AIR Application which asks for User-Interaction by Keyboard, i was surprised, that Keyboard-Interactions are not allowed in regular Fullscreen Mode.

After looking up in the documentation i found :

stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

This „Specifies that the Stage is in full-screen mode with keyboard interactivity enabled.“

Something i want to keep in mind, since FullScreen did not mean „no interactions by keyboard“ to me!


Read More

While trying to set up a simple Example with the StageVideo in FlashPlayer 10.2 i had lots of trouble setting up the Environment. Neither could i use Flash IDE to export correctly for FP10.2 nor could i use FDT to compile a running version.

I relied on the fact, that Flex Hero automatically includes FP10.2 which turned out to be false. Therefore i downloaded the last update and finally had the playerglobal.swc for FlashPlayer 10.2 available.

After having this working, the Example to check the performance was a piece of cake.

package vid
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.StageVideoAvailabilityEvent;
	import flash.events.StageVideoEvent;
	import flash.geom.Rectangle;
	import flash.media.StageVideo;
	import flash.media.StageVideoAvailability;
	import flash.media.Video;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	 * @author patricktresp
	public class StageVideoTest extends Sprite
		private var _nc : NetConnection;
		private var _ns : NetStream;
		private var _stageVideo : StageVideo;
		private var _video : Video;
		public function StageVideoTest()
			var stage : Stage = Main.getInstance().stage;
			stage.addEventListener( StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoState );
		private function onStageVideoState( event : StageVideoAvailabilityEvent ) : void
			var available : Boolean = (event.availability == StageVideoAvailability.AVAILABLE);
			_nc = new NetConnection();
			_nc.connect( null );
			_ns = new NetStream( _nc );
			_ns.bufferTime = 0;
			var customClient : Object;
			customClient = new Object;
			customClient.onMetaData = onMetaDataHandler;
			_ns.client = customClient;
			if ( available )
			_ns.play( "video/hd.f4v" );
		private function addRegularVideo() : void
			var stage : Stage = Main.getInstance().stage;
			var video : Video = _video = new Video();
			video.smoothing = true;
			video.attachNetStream( _ns );
			stage.addChildAt( video, 0 );
		private function addStageVideo() : void
			var stage : Stage = Main.getInstance().stage;
			var v : Vector. = stage.stageVideos;
			var sv : StageVideo;
			if ( v.length &gt;= 1 )
				sv = _stageVideo = v[0];
				sv.addEventListener( StageVideoEvent.RENDER_STATE, stageVideoStateChange );
				sv.attachNetStream( _ns );
		private function stageVideoStateChange( event : StageVideoEvent ) : void
		private function resize() : void
			_stageVideo.viewPort = new Rectangle( 0, 0, _stageVideo.videoWidth, _stageVideo.videoHeight );
		private function onMetaDataHandler( meta : Object ) : void
			if ( _video )
				_video.width = meta.width;
				_video.height = meta.height;

Next Step will be the test within an existing application running in Projector.

For Performance Testing i used a very fast Picture-Changing Movie:

No StageVideo:

Yes StageVideo:

Of Course the video.smoothing has a direct effect on the high CPU-usage, without smoothing:

Still more than 30% saved and another step closer to „green programming“.

Read More

During a Project i needed a method which shuffles a Vector. Since i could not find an implemented shuffle() function i remembered how PHP works with sort-functions and came up with this really simple comparison function:

package de.patricktresp.util
	 * @author patricktresp
	public class VectorUtil
		public static function shuffleVector( a : Object, b : Object ) : int
			return Math.floor( Math.random() * 3 - 1 );

So whenever needed i just go:

vector.sort( VectorUtil.shuffleVector );

This works fine for now, but i am very sure there is some more efficient and faster methods.

Suggestions are appreciated.

Read More