header image with round borders
 

family affairs declassified

January 11th, 2009 @biophonc

A few days ago I got a private message via meinvz.net and a girl, possibly with japanese ancestory asked me a few thing that only a very few people could possibly know about and if we could meet soon. That sounded strange and even herself pointed out, that it might sounds “strange”. A vague idea came up to my mind of what it might could be, but it made it less strange.

Flashback: In 2001 I met my real dad for the first and last time, by ambushing him in Poland, Brzeziny, without a warning. He was thunderstruck by seeing me but after an expensive redwine I brought along and a couple of beer he became talkactive and so we talked. One of my questions was, if I have some siblings but he negated it. I was not sure if he was talking the truth, but I was fine with that answer, whereas I wished he would have said the opposite. [...] after a couple of beer and a slight drunkenness we decided to stay over night and go to sleep. On the next mornign we got up early and decided to leave early aswell. He asked if we could stay a little longer, but we had rented a room in an international student hotel and had to leave.

Today I’ve met my youngest sister and her Mom! I do not only have one silbing, nope – two younger sisters. Okay – half-sisters but to me it means I have two sisters now and one brother. Yay and that’s so cool! :) The uberstrange thing about it is – they always lived here – where I live for about 7 years now. Just around the corner. The one lives just 300 m around the block and the other will move there too in a short time.

The tragic part about this story is, our chichi(jap. f. Dad) has no friggin kudos.


new usb stick

December 8th, 2008 @biophonc

I needed a little backup devide and bought this one:
datatraveller
I’ve got the 32gig model for 60 Euro – which is quite ok. The speed is ok – not that super fast but storrage space is more important for me than speed (atm).

*update*

Some friggin idiot stole it. If I find out who you are – I’ll make it an unforgetable moment for you.


flickr.groups.pools.getPhotos and php_serial

December 4th, 2008 @biophonc

If you try to get a serialized array (php_serial) from the flicker api from a group (flickr.groups.pools.getPhotos), you may find your self a little bit lost, because you do not get the photos you want, only the amount of how many. You double check if everything is set to public, your account is ok and even try to upgrade it – but that’s not it. You used the usefull API querybuilder from flicker and then it works in that case and you wonder why it doesn’t in your application. The simple solution is, it doesn’t work with the php_serial format. Skip this parameter and you get your set as XML response. The only thing you need to do is, use the XMLReader and iterate through the result set.

It took me quite a while to figure this out – like 1,5 hours – so eventually this post is usefull for someone ;)


simple method to add a safari css

November 5th, 2008 @biophonc

There are some selector hacks out there, but I don’t like them – ie: (@media screen and (-webkit-min-device-pixel-ratio:0) {}). My personal favourite is done with Prototype because I use it a lot and it is pretty simple:

<link rel="stylesheet" type="text/css" media="none" href="/css/safari.css" id="safari" />
<script type="text/javascript">
	// matches all safari/chrome versions
	if(Prototype.Browser.WebKit) {
		$('safari').media="all";
	}
</script>

If you set the media attribute to none – no media device will display it. By adding the little if statement, you can check if the Browser is WebKit, which is the engine name of safari or chrome and alter the media value to all.

If you do not use prototype, you can do it like this:

<script type="text/javascript">
	// targets safari 3 - not 2!
	if(window.devicePixelRatio) {
		document.getElementById('safari')media="all";
	}

	// targets all safari or better said webKit engines
	if(navigator.userAgent.indexOf('AppleWebKit/') > -1) {
		document.getElementById('safari')media="all";
	}

	// prototype way + targeting old and new webKit with two stylesheets
	if(Prototype.Browser.WebKit) {
		var mySafari = (window.devicePixelRatio) ? 'safari3' : 'safari2';
		document.getElementById(mySafari)media="all";
	}
</script>

Note, this method shouldn’t be used for “accessible” Websites, because it relies on javascript. You can do it then serverside as well by “sniffing” the UserAgent from the HTTP Request and add your little switch there – whereas this isn’t a 100% safe method though, because some people alter their UserAgent strings and there are tons of vendors/versions thus your detection may fail from time to time.

An alternative to this way is to load the needed script on the fly, so you can reduce a HTTP Request, by writing the link tag dynamically to your document. However – the describe method above is shorter ;)


twitted

October 29th, 2008 @biophonc

ok, i’ll give it a try! ;)
http://twitter.com/biophonc


new theme

October 26th, 2008 @biophonc

it was time for a change – so I’ve made a new theme for my blog. Nothing special but it looks quite ok (haven’t tested it in IE, I don’t care bout it – but in safari, firefox, chrome and opera it looks good). At least YSlow say it has Grade B and if only the google syntax highlighter plugin would produce valid xhtml, then it would be valid … ;)


new protosafe released

October 24th, 2008 @biophonc

just in time. One of our clients requested it (minified + packed) last week and today I found an updated version and it seems t work fine: http://code.google.com/p/protosafe/


how to cut a string with regex (the neat way)

October 9th, 2008 @biophonc

It is fairy a common task to cut a string – ie when a teaser text should not be longer than n characters. A lot of people use substring() or substr(), depending on their favourite language. However with regex it is really easy and you do not need to cut a word:

// in php it would be:
preg_match("/(.{1,15}(\s))/", $yourString, $matches);

// or in java something like this - maybe ; )
Pattern myPattern = Pattern.compile((.{1,15}(\\s)));
Matcher myMatch = myPattern.matcher(yourString);

To put it in plain english:
* get the first 15 characters (same as substring)
* BUT – and here goes the magic: match less until you find a whitespace character and cut the rest.

So it could look like this in php:

<?php
// you could check the length of the string but actually you don't need to ...
$myString = "People seem to enjoy things more when they know a lot of other people have been left out of the pleasure.";

preg_match("/(.{1,15}(\s))/", $yourString, $matches);
echo $matches[0]." ...";

// would print:
// People seem to ...
// and with {1,27}
// People seem to enjoy things ...
?>

beer o’clock! cheers :)


daily madness

September 24th, 2008 @biophonc

I got up to late today and my ticket list is ways to long plus I need to finish some work for a client. However – the weather is fine today and I don’t feel stressed or something like that. I bought the new Roots Manuva and really like it. I had a “club-mate” and a delicious Panini toast (yummy) and I am very looking forward to have an after work beer – in about 2 hours ;)

At my work we usually do Java/JSP stuff but a few weeks I did a small PHP Job here and today I made the statistic in mysql. Actually nothing special but a welcome change if you imagine stupid JSP Struts tasks day in and day out and boring style-stasi requests from project managers and so on. But I am hip to the spirit and love computer work – or at least the creative-innovative part of it – the rest I try to reject and forget. Actually it is always the same – some project manager come up with a kick ass idea and then during the production it gets reduced to something really boring and forgettable unimportant whatsoever.

My coffee is empty [...] ^^


MySQL EXPLAIN aka DESCRIBE for UPDATE/DELETE

September 21st, 2008 @biophonc

Ever tryed to “explain” a delete or an update statement? It will fail. It took me nearly an hour to figure this out. Actually I’ve never needed to explain a simple DELETE statement, but in todays case I did and was wondering why my query always failed. It is too bad that there is no such “feature”. With InnoDB you can use of course the ON DELETE/UPDATE stuff but in my case I didn’t want to alter the existing DB.

However, if you need to delete multiple rows over multiple tables, you may do something like this: ;)

DELETE stats, links, logins
FROM promo_stats AS stats
LEFT JOIN promo_links AS links USING(promo_link_id)
LEFT JOIN promo_logins AS logins USING(promo_login_id)
WHERE stats.promo_item_id=6;

 

footer image with round borders