User loginNavigation |
JavascriptSaving Data into Excel the Easy Way using PHPIf you’re looking for an easy way to output your data from a PHP script into a Excel file, you’ve got to check out this script MS-Excel Stream Handler which I came across at the PHP Classes site. What this script essentially does is to implement a stream handler interface to write Microsoft Excel spreadsheet files. All you have to do to output data into an Excel file is to create an associative array with the data to be exported. For example if you wanted an excel sheet in this format: all you need to do is to create an array like this: $output = array( array("Serial" => "1", "Item" => "Cables", "Stock" => "100", "Cost per unit" => "$2" ), array("Serial" => "2", "Item" => "Phones", "Stock" => "40", "Cost per unit" => "$23" ), array("Serial" => "3", "Item" => "Keypads", "Stock" => "5", "Cost per unit" => "$4" ), array("Serial" => "4", "Item" => "Helmets", "Stock" => "54", "Cost per unit" => "$42" ), );Now to output this into an Excel file, all you need to do is to use the excel.php from Ignatius’s script and open a xlsfile stream to output the data. Here’s a script which creates the Excel file from the array above and allows the user to download the file to their system: require "excel.php"; //open Excel Stream to output $export_file = "xlsfile://tmp/example.xls"; $fp = fopen($export_file, "wb"); $output = array( array("Serial" => "1", "Item" => "Cables", "Stock" => "100", "Cost per unit" => "$2" ), array("Serial" => "2", "Item" => "Phones", "Stock" => "40", "Cost per unit" => "$23" ), array("Serial" => "3", "Item" => "Keypads", "Stock" => "5", "Cost per unit" => "$4" ), array("Serial" => "4", "Item" => "Helmets", "Stock" => "54", "Cost per unit" => "$42" ), ); //write the array to Excel fwrite($fp, serialize($output)); fclose($fp); //set headers to download Excel sheet header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); header ("Content-type: application/vnd.ms-excel"); header ("Content-Disposition: attachment; filename=\"" . basename($export_file) . "\"" ); readfile($export_file);This script allows you to quickly export any data which you can form into an array quickly into an Excel sheet. If you’re looking for an Excel export with advanced features like formatting the cells in the sheet, adding colors or the likes of those, you’re out of luck with this script. You can get this script and more information about it from the PHP Classes site: Fronteers 2009 - Douglas Crockford and Molly HolzschlagAs I announced earlier the Fronteers 2009 conference will be held in Amsterdam on the 5th and 6th of November. Today we announce two speakers, and we also have extended the early bird period by one week (ends 10th of July instead of 3rd). The conference will be held entirely in English. Categories: general tech, Javascript
SabreAMF 1.3 release9 months after the 1.2 release, I just published a long overdue release of the SabreAMF library. The package mainly contains bugfixes. Upgrading is highly recommended. Special thanks to Ionut Stoica for creating a Drupal Module, and Asbjørn Sloth Tønnesen for the bugfixes and patches. Enjoy! GIMP “Save for Web” plugin for UbuntuHere is a plugin for Gimp which gives you a “Save for Web” option in GIMP. This plugin gives you the option of preparing your images for the web by optimizing it, adding additional compression, stripping EXIF information from the images to reduce it’s size. You can preview the resultant image before you save your final image. You can get the deb files for this plugin over at GetDeb.net: Just download the deb file for your version of Ubuntu and double click the deb file once downloaded to start the Package Installer. Goto in PHP 5.3Via reddit: The goto documentation got an xkcd overhaul. :) Changing jobsI'm changing jobs! Well, at the very least I'm leaving Filemobile. It was for this job I moved from Hilversum, the Netherlands to Toronto, Canada. A very scary move for me at the time, but it turned out to be one of the best experiences of my life. I've ramped up my English, and went through the entire process of working out an idea to a successful company. As an owner I'll definitely still stay involved though, just no longer full-time. Although moving to a new country is always can be intense, it would have been a lot more difficult if it wasn't for my co-workers, who've acted as both my friends and family. I doubt I'll find a work environment as fun as Filemobile. (If you live around toronto, they are looking for smart people!). But after 3 years, it's time for something new. I'm excited to move somewhere else again, but haven't yet figured out the next step in my career path. If you have any advice or looking for someone with web development skills, definitely let me know! (resume). I'll be available for contract work, and I'll relocate wherever you are, if needed :). Why I choose the Palm Pre to be my next mobile phoneAfter having been in the USA for well over 7 months I finally got a cellphone. For a few months I've been thinking hard on whether I wanted the iPhone or the brand new Palm Pre. After I made my decision to go for the Pre I figured let's write a blog on why I made that decision. I spent ample time trying to decide between the iPhone and the Palm Pre, both very nice and capable phones. Let there be no doubt about that. It's something newWhile the iPhone is a very nice and capable device I must admit I've become a bit 'iPhone tired'. Sure, it has 35000 apps (of which 99,9% I'd probably never use) and it's a good phone overall. I've owned an iPod Touch however and I never managed to get REALLY excited about any of it. Strange if you think of it because I'm quite the Apple fan. The Palm Pre got me excited at the first video I saw of it. I loved the fact that there was finally something new and cool that's no an iPhone. After the reviews started coming in varying from mostly positive to very enthousiastic my interest increased even more. Easy app developmentWhile I can't do it YET (I don't have the MOJO SDK for the Pre) I'm dying to get into WebOS application development. In sharp contrast to the iPhone I can actually use my skills to build applications. HTML, CSS and Javascript are what powers WebOS applications. I'm not a C programmer and I probably never will be. I am however quite capable at the latter which is why building Palm apps is in my immediate reach. If you read this, Palm, please send me a copy of the SDK already! no AT&TI actually ALMOST got an iPhone. I was really truly undecided for a while between the Pre and a new iPhone 3GS. I got as far as actually going into an AT&T store and ask about a family plan and two iPhones. I hated the store, the wait in the store and the lying employees. When they were finally ready to hook me up I got told they wanted a $500 deposit from me. Apparently people who have only lived in the US for 7 months cannot be trusted. Nevermind the fact that I had absolutely no trouble getting a car loan for over $15k but a phone turned out to be a bridge too far. At least it did for AT&T. I told them to stick it where the sun don't shine. Then there's the costs. AT&T still seems to think it's totally fine to charge $20 per month extra on top of their already pricey plan for TEXT MESSAGING. I kid you not, TEXT MESSAGING. This means that over the course of your 2 year contract you'll pay a whopping $480 to AT&T to get what I have included in my plan on Sprint. That's almost a brand new contract-free iPhone people! A keyboardWhile Apple claims the keyboard is dead I beg to differ. When owning a Touch, data entry has always been the thing that often made me want to smash the device to pieces. I'm sure all of you Apple fanboys are great at it but I can't for the world input data into an iPhone / iPod Touch the way I can on a regular mobile phone keyboard. I suppose my fingers are too big or maybe I have an undiagnosed case of Parkinson. I don't know. The fact that I can't type on an iPhone at greater than snail-speed is an issue. The Palm Pre has a keyboard. It's small but... it does the job. I can type. W00t! iPhone FanboysThis may be a somewhat less 'absolute' reason but still: Apple Fanboys drive me insane. Yes, the iPhone is a great device but come on, really. Apple introduced an initially rather limited device and is now slowly adding features the rest of the world has been enjoying on their phones for for many years. OMG we can now copy & paste! OMG soon we'll have MMS (gotta wait for AT&T to get their act together on that though), YAY! video! Seriously guys, Steve has got you all by the balls. The iPhone is the one and only device I've ever seen that managed to get it's fans outrageously excited about common features that used to be missing. It's like getting all hyped up over Starbucks coffee introducing that their coffee will now be served HOT. NotificationsThe notification GUI on the Pre ROCKS. Period. No intrusive popups. Nothing is gonna interfere with what you're doing on the phone right now. Instead an elegant bottom section of the screen is used to notify you of new emails, texts, MMS messages and other things. It's freakin' brilliant. Some interesting featuresWhile many iPhone owners don't seem to care about the complete lack of multitasking, I kinda do. It's kinda convenient to stay on IM when you want to look up where you're gonna eat tonight isn't it? It's quite nice when you see a link in your Twitter app and you can actually visit it without shutting down the Twitter app. And there's many more examples where multitasking comes in handier than one may think. I'm not talking about running tons of background processes draining your battery. I'm talking workflow here. Apple can throw in all the marketing talk they want but the lack of multitasking kinda sucks, no matter how you look at it. Funny thing is, I'm sure it will get introduced at some point and the fanboys will probably once again treat it as if a revolution has just occurred. Not so much really. Then there's the GPS feature. An iPhone is totally USELESS for driving, unless you want to slam your car into a tree while looking at the map on your iPhone. The Pre comes with Sprint Navigator which is pretty much a full blown car GPS system including spoken directions. Like it should! Rounding upOnce again, don't get me wrong here. I'm not anti-Apple and I'm not a fanboy. In fact I love Apple products and I think the iPhone is a fine phone. I'm not a Palm fanboy either because by no means I think this phone is perfect. I plan to write my own review about it in a week or two after some heavy use. I suppose it really depends on what one wants from a phone (and a provider) which phone is the best pick. For me it turned out to be the Pre. I think the device has tremendous potential and I hope I can get my hands dirty on some Pre app development soon! Feel free to comment on which phone you have chosen and why! No fanboyism please though! Tags: palm,palm_pre,pre,phoneCategories: Javascript, php
PHP feature request: 'Throwable' interfaceI would love to have a 'Throwable' inteface in PHP, so I opened my very first feature request. I realize this is mostly an OOP purist request, as it won't provide any real functionality. If you agree, vote! State of the Browsers — IE editionRecently I held a presentation at a local Microsoft conference in the Netherlands. Slides are here. Fanatical followers will recognise most of the topics I discussed from earlier slide shows, but the last one, about the changes to the market share of IE6, 7, and 8, is new. Basically, IE6 will continue to exist when IE7 has all but disappeared, and, contrary to what you might expect, this situation will create exciting opportunities for Microsoft’s competitors. Besides, last week the news came that Microsoft is going to voluntarily de-bundle IE from all Windows 7 machines that will be sold in Europe, and I continue to have my doubts about that affair. So it’s time for a special State of the Browsers IE edition. Categories: general tech, Javascript
HTML5 Storage testsI have started an HTML5 compatibility table today. For now it only contains a test of HTML5 Storage in all desktop browsers, and a short report is in order. I also retested the DOM HTML; no changes. Categories: general tech, Javascript
Nokia N97 Blogger’s Meet in BangaloreYesterday Nokia India had arranged for a blogger’s meet in Bangalore to familizarize us with the upcoming N97 mobile phone. The meet featured Axel Meyer, Nokia’s Global Design Head for Nokia Nseries, who took us through a presentation which showed what the Design team took into account while designing this phone. What I liked about the design was the 30 degree tilt of the screen when the QWERTY keypad slides open. This allows the user to interact with the keyboard and the touch-screen at the same time. The tilt also allows the user to hold the phone with just the index finger - pretty comfortable - unlike the slide out of the E75. One snippet which kind of surprised me in the presentation is that Axel mentioned that there more than 1 billion users of Nokia phones. This particular model is targeted to users who are looking at having a personal experience with their mobiles - targeted towards people who share photos, videos, microblog, are active on social network and need a phone which doubles up as a personal computer on the go. During the Q&A session, one of the bloggers did ask about the high price of this model (expected to be around Rs. 35,000 during the launch). Axel answered that this mobile is meant for people who are looking a niche phone which provides the full online and social experience the N97 provides. After the presentations, I got to play around with the N97 for sometime - pics of the phone are at the end of this post. Some of the points which caught my attention about the N97 are:
Thanks to Nokia India and Songita B. Verma & team for getting this event organized! It was great having to hear direct from the Design Team on the rationale behind the various features which are packed in the N-Series phones. Learn more about the Nokia N97: Some of the Pictures from the Event: The N97 Presentation Home Screen Widgets Axel Meyer during his presentation Q&A Session First look at the N97 Trying out the Handwriting Recognition 30 Degrees Tilt of the Screen when the keypad's open More pictures from the event are available on Flickr. Macbook LCD screen repair projectThe LCD screen from my macbook broke a while back, much to my regret Apple's warranty didn't cover it at the time and was going to charge $900 for it. I was pretty set on making it useful again, so a few days ago I ordered a new LCD screen myself. It was quite an undertaking to replace it, because it was needed to take the entire thing apart, top to bottom. It took me 4 hours, and 12 minutes including dinner and going to the neighbours to replace a screwdriver. Here's a 12 second version of it: Sorry, your browser does not yet support the HTML <video> Try it with the latest version Firefox, Opera or Safari. If you plan to try this yourself, know what you're getting into.. Make sure you have a steady hand and it helps if there's someone around to hold stuff together. Make sure you get good screwdrivers and be very careful with the cabling. I also found it handy to use tweezers. I got the instructions from IFixit, which has some great guides. After all that, I ended up with 1 screw I was unable to fit back in, a few damaged wifi antenna cables (still worked!) and I discovered a few places of broken plastic, which were likely from the first time it got damaged. Fronteers 2009 conferenceJust as we did last year, Fronteers, the organisation of front-end engineers in the Netherlands, organises a front-end conference. Ticket sale has started, and two more speakers have been announced. The Fronteers 2009 conference will be held on 5th and 6th of November in Amsterdam. In addition to Nate Koechley and Steve Souders , John Resig of jQuery and Nicole Sullivan will join us to discuss JavaScript libraries and object-oriented CSS, respectively. The line-up will consist of twelve world-class speakers; the other eight will be announced later. Ticket sale has started; currently we’re in the early bird period that will expire on the 3rd of July. A two-day ticket costs € 250; a one-day ticket € 175. Additional discounts are available for Fronteers members (who have meanwhile received a mail), and Dutch educational institutions. The conference is sponsored by Vodafone, and we’re currently negotiating with other potential sponsors. I hope to see some of you at Fronteers 2009! Categories: general tech, Javascript
Google Mobile App for Nokia S60 Phones
Google has brought out their Google Mobile App for Nokia S60 Phones. You can get the application by visiting m.google.com on your mobile browser. This application provides a shell for Google applications and services. When you start the app, you get a search screen, and the app detects your location to give you area specific suggestions. As you start typing in a search term, you get search suggestions. Performing a search opens up the mobile browser to continue browsing. The app provides a shortcut key to quickly jump to Google search from the Home screen on your mobile. This cuts down the number of keystrokes required to startup a Google search. Apart from the quick access to Google Search and mobile apps, this app provides little else for Indian users, as the suggestions I saw while using the search were hardly relevant to my location. Link : http://www.google.com/mobile/nokia_smart/app.html Google Page SpeedWeb developers have to check out Google’s new Firefox + Firebug addon called Page Speed. This addon inspects your webpage to see how you can optimize the load time. Yahoo’s YSlow was good, but Google takes it a few steps further to even inspect your html and styles to see what can hider the render time of the page once it’s loaded. Apart from the standard tests on if your content is gzipped, server headers are correct and enable client side caching and parallelizing downloads from differnent host names, this addon also does the following:
Page Speed helps you improve your site’s performance based on the following categories of best practises:
Get Google Page Speed at: http://code.google.com/speed/page-speed/ Screenshots: Google Page Speed Recommendations CSS Optimization Recommendations Javascript Minify Savings Suggestion to Defer Javascript Loading Tweets60 - Twitter client for S60 mobilesIf you’re looking for a free native Twitter client for your S60 device, you’ve got to check out Tweets60. It’s works on S60 3rd and 5th Edition phones. As with most Twitter clients you can view your Timeline, Replies, DMs and Favorites and follow/unfollow Tweeple. The interface is good and simple with the actions to post, reply or retweet in the Option menu. One cool functionality in Tweets60 is that you can configure multiple access points and prioritize them. Useful when you’ve got Wifi access and then default to GPRS/3G connection when you’re not in Wifi range. If you’re on a tight data plan, this application also comes with an option to save your bandwidth by allowing you to set the refresh frequency to manual or set it to 5, 10 or 30 minutes. For a basic twitter client - Tweets60 does it’s job pretty well. According to Ravensoft’s tweets, it looks like a pro version is in the making. I just hope the free version doesn’t get too crippled to promote the sales of the pro version. A few missing functionalities in the current version of Tweets60 are (in my order of my preference):
Get Tweet60 from : http://www.tweets60.com/ jQuery TOOLSjQuery Tools provides some UI addons to the basic jQuery Library. You can create Tabs, Accordions, Tooltips, Overlays and more using this library. The whole library fits in less than 6Kb, so you can replace all the separate libraries you are using for these functionalities by using this library. The library has an easy to use API, which both beginners and advanced developers can use to integrate. To show you how easy it is to setup tabs in this library, here’s an example from their site. The HTML code looks like this: <!-- the tabs --> <ul> <li><a href="#">Tab 1</a></li> <li><a href="#">Tab 2</a></li> <li><a href="#">Tab 3</a></li> </ul> <!-- tab "panes" --> <div class="panes"> <div>pane 1 content</div> <div>pane 2 content</div> <div>pane 3 content</div> </div>The Javascript which powers the tabs is simply : // setup ul.tabs to work as tabs for each div directly under div.panes $("ul.tabs").tabs("div.panes > div");To see this in action and more information on the code, check this link out: You can also check out the other functionalities which this library provides :
Learn more about jQuery Tools over at: http://flowplayer.org/tools/index.html Related articles by Zemanta
SabreDAV 0.8I just released v0.8 of the SabreDAV library. This is mostly a bugfix release, and fixes some compatibility problems with both Windows Vista and adds support for Netdrive. Netdrive is free for home-use and is an alternative for the built-in clients from Windows XP or Vista. Do not use it if it's more than 1 person accessing data from a webdav share, I can not stress this enough.. If it's just you, you'll find it works much smoother than the built-in client. Compatibility breakAll exception classnames are renamed. They follow Sabre_DAV_Exception_FileNotFound, instead of the Sabre_DAV_FileNotFoundException convention. This change was made for consistency reasons. If you implemented anything custom, you will probably run into this while upgrading. Download and the full changeLog. FutureIt's pretty close to being feature-complete, so unless I really missed something or more bugs will be found this will probably move quickly towards 1.0. Thanks for the support and using it! PHP Compiler Internal Slides by Sebastian BergmannHere’s an interesting slide from Sebastian Bergmann which explains the magic that happens when you execute your PHP code, and how it gets converted into bytecode. He also goes ahead to show you how to extend the PHP compiler in the presentation. PHP Compiler Internals View more Microsoft Word documents from Sebastian Bergmann. Blogging for 3 yearsI just realized I've been blogging for 3 years now, so it's time for my annual meta-blogging post :). I've managed to come up with 50 mildly interesting topics since the 2 year mark, so that's pretty close to a 1 post per week average. Not bad, but a drop of 4 posts since the last. Thanks very much for reading, I'm always really happy to see people linking or dropping comments, if there's any improvements I can make in my writing definitely let me know. |