Check this out
My first track released: Slow Swing
by Klas Lundberg on Mar.22, 2011, under Check this out, Portfolio
Comments Off :House, Klassy, Music, Soundcloud more...Things that inspire me: Kinetic Typography
by Klas Lundberg on Feb.28, 2011, under Check this out, Trends
Animated typography will probably be one of the coolest trends during 2011 thanks to CSS3. Personally I love it! The Swedish TV channel 9 have a trailer for Mad Men which is probably the most beautiful trailer I have ever seen.
I discovered it a while ago, but I saw it once again just a couple of minutes ago. It filled my heart with passion once again, so I just had to post it here. Enjoy!
My new job as UI Designer at RIM
by Klas Lundberg on Jan.18, 2011, under Check this out
Last week I started my new job at Research In Motion (RIM). I actually got a job at The Astonishing Tribe (TAT) first, but just as I had signed the papers, TAT got acquired by RIM. So the whole situation changed for me and my new colleagues, but I am very excited about this new opportunity!
So now I will be working as a User Interface Designer in the mobile industry. You’ll probably see things I make in the BlackBerry product line from now on.
TAT has really made some cool stuff so far. Make sure to check out their demos & concepts.
This means I’m no longer working for Basilicon. It has been more than 3½ great years there and it has really given me a lot of great skills and experiences. Not to forget; the Swedish Design Award!
I will still carry on some web design, but in my own company Instinct Media from now on. So if you’re interested in getting a nice design – don’t hesitate to contact me.
Camera lenses for mobile phones
by Klas Lundberg on Nov.18, 2010, under Check this out
Did you know that you could get lenses for your mobile phone? A couple of months ago, I found an article at Gizmodo about these lenses. I did some googling and found a retailer in Hong Kong, selling all kinds of strange phone gadgets and more importantly, the kind of lenses I was looking for.
At the moment they are selling three kind of lenses; a 2x tele lens, a 180° fisheye lens and a combined wide/0.67x macro lens.
It was a bit unclear which lens to buy and what size, since the video guides I found were a bit confusing. It didn’t get easier with the fact that the website of the dealer was a bit messy when it came to finding products. But after some comparing I decided that it didn’t matter which one I chose, since they all were unbelievably cheap. About $10-$16 including shipping.
I was worried about the delivery and how trustworthy the company was so I just ordered one lens the first round. I decided to go for a combined wide/macro lens. After about a week I got a mail saying that the package had been sent and about two weeks after that, the package arrived to me in Sweden. The customs declaration on the package actually declared the value of the lens to no more than about $3.
After the first successful delivery, I also ordered a 2x tele lens and a 0.67x fish eye lens. The tele lens was also delivered recently after about 3 weeks but I’m still waiting for the fisheye lens. I will put up some sample images when it arrives. To my joy, the note saying the other order was delayed, was really a piece of beautiful design!
The lenses are mounted onto your phone with a pretty strong magnet. Most phones isn’t ferromagnetic metal, so the package comes with three attachable metal rings to put around the camera on your phone. They are 13 mm outer width and 9.5 mm inner width. You have to make sure that the surface around your camera is flat and that the ring doesn’t cover the flash.
The metal ring fitted perfectly on my Sony Ericsson Xperia X10 Mini Pro and it doesn’t seem to fit on iPhone 4, since it covers the flash. However, when attaching the lenses, they’re in the way of the flash on my x10. Hopefully, they will develop phones with prepared lens mounts in the future.
The lenses comes with lens covers and a strap for keeping hold of your lens. At first, I put the strap on the phone, but I discovered that it wasn’t a great idea since the magnet of the lens affected the compass on the phone, which made the navigation act weird. But then moving the lens away from the phone, everything went back to normal.
The back cover is actually also magnetic and attaches strongly to the lens.
13mm wide/0.67x macro lens
The first lens I tried was the wide/0.67x macro lens. This is an amazing lens which is a wide lens in normal mode and acts as macro lens when mounted apart. The wide mode makes great pictures, but the macro is really stunning.
13mm 2x telephoto lens
The 2x tele lens I got a week ago is not as great as the wide lens. It gets a heavy vignette when used with my phone. I guess its because it has a rather wide angle camera. This makes the lens a bit useless but adds a somewhat cool effect. It would probably be a bit better if the lens was a bit bigger.
13/15mm 180° fisheye lens
The fisheye lens seems the coolest, but I haven’t tried it out yet, since I’m waiting for the package to arrive. This lens comes in to sizes; a 13mm and a 15mm. From what I read, they both comes with the same size metal rings. The 15mm is said to give sharper images with less distortion, so that convinced me to order the bigger one. Let’s just hope it fits!
Note: Order at your own risk! I’m not responsible for any bad choices you may make, I’m just telling about my experience.
› 13mm wide/0.67x macro lens
› 13mm 2x telephoto lens
› 15mm 180° fisheye lens
› 13mm 180° fisheye lens
Wide/0.67x Macro Lens on Sony Ericsson Xperia X10 Mini Pro
by Klas Lundberg on Nov.18, 2010, under Check this out
I got an attachable wide/macro lens for mobile phone a while ago. I mounted it onto my X10 mini pro and the images with the lens on is really impressive. Also check out the pictures from the tele lens.
The images are untouched.
- Swedish 20-note in macro
- The side line text on a swedish 20-note in macro
- My eye in macro
- Comviq Kontant card in macro
- Pilsner Urquell in macro
- My living room in wide
2x Telephoto Lens on Sony Ericsson Xperia X10 Mini Pro
by Klas Lundberg on Nov.18, 2010, under Check this out
As well as the wide/macro lens, I go an attachable tele lens for mobile phone a while ago. This lens was not as impressive as the other lens. This one has some heavy vignetting, which made me a bit disappointed.
The images are untouched.
- My hallway with tele and flash
- My livingroom with 2x tele
- My livingroom with normal camera
Mailing function for PHP with UTF-8, HTML and attachments
by Klas Lundberg on Jun.13, 2010, under Check this out
I found a function a couple a years ago which I’ve been using for mailing in my projects. The function was rather basic from the start and then I’ve added functionality as needed. Nowadays it is changed into only having UTF8 support (since I almost always use UTF8 encoding) and also support for HTML. the HTML encoding is detected automatically if the <html> tag is present in the text. You can attach images and files by adding them into an array. Feel free to use it however you like.
To get UTF-8 to work correctly in your PHP pages, see my post about Setting up PHP for UTF8 and XHTML compatibility.
The nice mailman image is from The Invisible Agent.
//////////////////////////////////////////// // Function: send_mail() // UTF-8 Mail sending with html and attachments //////////////////////////////////////////// /** Sends a mail. * * @code { # To Email Address $to_address = "to@address.com"; # From Email Address $from_address = "from@address.com"; # From Name $from_name = "Send Mail"; # Message Subject $email_subject = "This is a test mail with some attachments"; # Use relative paths to the attachments $attachments = Array( Array("file"=>"../../test.doc", "content_type"=>"application/msword"), Array("file"=>"../../123.pdf", "content_type"=>"application/pdf") ); # Message Body $email_body = "<html><head></head><body>This is a message with <b>".count($attachments)."</b> attachments and maybe some <i>HTML</i>!</body></html>"; send_mail($to_address, $from_address, $from_name, $email_subject, $email_body, $attachments); } */ function send_mail($to_address, $from_address, $from_name, $email_subject, $email_body, $attachments=false) { $eol="\r\n"; $mime_boundary = md5(time()); $headers = ''; $msg = ''; $html = (mb_strpos($email_body, "<html>") !== false); $mail_site = "send_mail@" .$_SERVER['SERVER_NAME']; # Common Headers $headers .= 'Sender: ' . $mail_site . $eol; $headers .= 'From: ' . mb_encode_mimeheader($from_name) . " <" . $mail_site . ">" . $eol; $headers .= 'Reply-To: ' . mb_encode_mimeheader($from_name) . " <$from_address>" . $eol; $headers .= 'Return-Path: ' . mb_encode_mimeheader($from_name) . " <$from_address>" . $eol; // these two to set reply address $headers .= "Message-ID: <".time().$mime_boundary."@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v" . phpversion() . $eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $headers .= 'MIME-Version: 1.0' . $eol; if ($attachments !== false) { $headers .= "Content-Type: multipart/mixed; boundary=\"1$mime_boundary\"" . $eol; $msg .= "--1".$mime_boundary.$eol; if($html) { $msg .= "Content-Type: multipart/alternative; boundary=\"2$mime_boundary\"" . $eol.$eol; } } else { if($html) { $headers .= "Content-Type: multipart/alternative; boundary=\"2$mime_boundary\"" . $eol; } } # Setup for text OR html # Text Version if($html) { $msg .= "--2".$mime_boundary.$eol; $msg .= "Content-Type: text/plain; charset=UTF-8".$eol; $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol; } else { $headers .= "Content-Type: text/plain; charset=UTF-8".$eol; $headers .= "Content-Transfer-Encoding: 8bit"; } $msg .= strip_tags(str_replace("<br>", $eol, str_replace("<br />", $eol, $email_body))).$eol.$eol; if($html) { # HTML Version $msg .= "--2".$mime_boundary.$eol; $msg .= "Content-Type: text/html; charset=UTF-8".$eol; $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg .= $email_body.$eol.$eol; # Finished $msg .= "--2".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection. } if ($attachments !== false) { for($i=0; $i < count($attachments); $i++) { if (is_file($attachments[$i]["file"])) { # File for Attachment $file_name = substr($attachments[$i]["file"], (strrpos($attachments[$i]["file"], "/")+1)); $handle=fopen($attachments[$i]["file"], 'rb'); $f_contents=fread($handle, filesize($attachments[$i]["file"])); $f_contents=chunk_split(base64_encode($f_contents)); //Encode The Data For Transition using base64_encode(); fclose($handle); # Attachment $msg .= "--1".$mime_boundary.$eol; $msg .= "Content-Type: ".$attachments[$i]["content_type"]."; name=\"".$file_name."\"".$eol; $msg .= "Content-Transfer-Encoding: base64".$eol; $msg .= "Content-Disposition: attachment; filename=\"".$file_name."\"".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !! $msg .= $f_contents.$eol.$eol; } } $msg .= "--1".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection. } # SEND THE EMAIL ini_set('sendmail_from',$from_address); // the INI lines are to force the From Address to be used ! mail($to_address, mb_encode_mimeheader($email_subject), $msg, $headers); ini_restore('sendmail_from'); }
Setting up PHP for UTF8 and XHTML compatibility
by Klas Lundberg on Jun.13, 2010, under Check this out
PHP is usually not configured for working well with UTF8 multilingual support and XHTML from start. To get it working correctly, you need to adjust a few settings.
UTF-8
There are two things to think about. First, make sure your php files are saved using UTF8 encoding. Even notepad can achieve this in the file save dialog. Then you have to set the php.ini settings to UTF8. This can be done with the ini_set() function. The ini_set() have to be called before outputting any text or HTML/XHTML in the document.
// UTF8 settings ini_set('mbstring.language', 'Neutral'); ini_set('mbstring.internal_encoding', 'UTF-8'); ini_set('mbstring.http_input', 'UTF-8'); ini_set('mbstring.http_output', 'UTF-8'); ini_set('mbstring.encoding_translation', 'On'); ini_set('mbstring.detect_order', 'auto'); ini_set('mbstring.substitute_character', 'long');
Normally, the server sets the content type correctly if the file is coded in UTF8, but sometimes you need to force the content-type to have UTF8 charset. The header() function also have to be called before outputting any text or HTML/XHTML in the document.
// Set XHTML content type and character encoding of the document // You may also use text/html as mime type instead of application/xhtml+xml header('Content-Type: application/xhtml+xml; charset=utf-8');
Sometimes you may have problems with getting data from MySQL encoded correctly as UTF8. Most of the time this isn’t a problem, but you can also force some UTF8 settings on the MySQL server. Use the mysql_set_charset if you have PHP version 5.2 or higher and SET NAMES/SET CHARACTER SET if you have an older version of PHP.
$conn = mysql_connect('localhost', 'user', 'password'); // PHP 5.2 and above mysql_set_charset('utf8',$conn); // PHP below v 5.2 mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8");
At last, do not forget to add the Content-Type <meta> tag in the <head> section of your HTML/XHTML. Otherwise the web browsers will display your page incorrectly anyway.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />XHTML
To get correct XHTML compatibility you need to adjust the session settings of PHP so that sessions is integrated the right way into your code. The server is often configured to insert session id:s into url:s on your PHP page.
// XHTML compatibility ini_set('arg_separator.output', '&'); ini_set('url_rewriter.tags', 'a=href,area=href,frame=src,input=src,form=action,fieldset=');
For security reasons, I recommend you to disable the url rewriting, since it makes it possible to hijack another user’s session under certain circumstances. This makes the previous XHTML settings unnecessary, but keep them if you intend to use sessions by URL.
// Disable session by URL ini_set('session.use_only_cookies', '1');
Still having problems?
To see your PHP version and how the settings are affected, simply call php_info() after changing the settings. Master value is the original server setting and Local value is the value after changing it using ini_set().
php_info();
These UTF8 settings works most of the time, but many servers may have other configuration issues. If you still have issues with UTF8 check the php_info() output for any settings set to ISO-8859-1 and change them to UTF-8 using the ini_set() function. If you still have problems, check that your document files really are saved using correct UTF-8 character encoding.
My music project: Klassy
by Klas Lundberg on May.17, 2010, under Check this out, Portfolio
I’ve been busy producing music lately. I got my music computer up and running again after about a month of deadness. Just then I saw a remix competition for the Lundakarnevalen, which is a carnival for students in Lund every fourth year. I’m not really a student anymore (well technically I am), but my heart still beats a little for Lund, especially beacause I participated in the last two carnivals in 2002 and 2006.
So I decided to join the competition for remixing the official song of Lundakarnevalen – Karnevalsmelodin 2010. About two weeks later I actually managed to finish my remixing and I actually produced two remixes.
The theme of the carnival this time is Right & Wrong and I got inspired by the Karnevalsmelodin LIP UN-DUB video. So I made a right and a wrong mix. The other mix is actually the same as the first but with the beat in mixed order; instead of 1-2-3-4 it’s 1-3-2-4. This gives the other mix a whole different sound, which I almost like even more than my first mix. Naturally, the song gets totally screwed up, but that was my intention anyway. The cool thing is that if you mix the beat the same way once more, you get the original mix back! =)
You can check out my very basic music project page which will be extended further during my progress. You can also listen to my two first remixes below. Judge yourself which one is right and which is wrong. =)
TMFAO
by Klas Lundberg on Apr.07, 2010, under Check this out
I joined Twitter yesterday. Follow me on http://twitter.com/KlasLundberg. For this post I also found some nice Follow me on Twitter badges by Ema Hoffmann.















