Arduino Companion 1.1

23 May

Arduino Companion 1.1

I just published an update to my Arduino Companion app to Google Play, Apple Appstore as well as Blackberry's App World. 

How's the app doing?

It's doing rather well I would say! Across the Google and Apple stores, it now has more than 20.000 downloads. Not shabby, given that the only promotion I've really done for it is a single post at the Arduino.cc forums. I also don't really know what a good number is, but this isn't a game so it seems pretty good? It's also now listed as the number 1 app for the keyword Arduino in all the app stores, so I take that as some kind of compliment.

Based on feedback, the users really like the app. It has an average score of 4.6 of 5 on the Android Market and 4.5 of 5 stars on AppStore. On Market (or Play that it's called now) there's been three one-star reviews. These all complain about having to install the AIR runtime, so now I've skipped that by packing it all using the Captive Runtime capability. It's now a 10Mb download (rather than 1.6Mb) just because of those complaints. Oh well... User Power is for the good I guess?

I've also received a lot of positive feedback and it's been a great test at making view-based cross platform apps. I've done the project based on a simple framework that resides in it's own project for simple re-use, so making more apps should be fairly swift.

What's new?

I added the two most requested features from the more than 50 emails I have received from users: searching and internal linking. If a page is in the cached data, the app will now just open that page internally. Before I had this in place, all links in the reference went online to the original Reference-page. Now I check the URL requested against the cached URLs and only open the browser for those I don't have cached. The search will first search through all titles since that is usually what people want. Next it will search all the text of the cached content to look for hits there. The data is stored as XML, so it's super-fast to search that with e4x and AIR.

I've also added an omission from the last time. Many classes have an overview-page and now this one is also included. Due to the timing, I was also able to include the latest updates to the reference for the Arduino Leonardo that enables you to use the device for both receiving data from as well as controlling both keyboard and mouse. Can't wait till I get my first Leonardo board from ehobby.no so I can play with this! All versions now use Captive Runtime and if you make AIR apps, make sure you do too. Those 1-star reviews for a free product that you've worked hard to make are really hard to digest so just avoid them?

I've also fixed several minor bugs, but I can't seem to nail the one affecting certain Android tablets (including my own). I've tried asking my contacts at Adobe, but they've all failed to follow up and I don't want to push too hard...

Playbook difference

This is the first Blackberry app I'm publishing and It actually cost me a couple extra days just to get the app out for the Playbook. While compiling the AIR project for the QNX OS was more or less just the push of a button (as with Android and iOS), the app itself had a bug that only showed on the Playbook.

In the app, all listings are done in Flash but display of pages are rendered in the internal Webkit browser in the AIR runtime. The StageWebView worked flelessly on the desktop, Android and iOS, but on the Playbook it just showed a white page. I found lots of others that had the same bug, but no answers. In the end I figured out what was causing it and yeah - it was sort of my own fault. In the WebView, I capture clicks all on external linksso that I can show the internally cached version instead of the one that is online. In this handler, there was a "event.preventDefault()" that for some reason acted differently on the Blackberry device. All I had to do was to tweak the logic here and the app worked perfectly. Things like this is a little sad as it sort of breaks the advantage of having a platform that can target 3 different OS's across hundreds of devices with just one codebase.

Anyway the app is out on Google Play and the iOS and Playbook versions will come soon after (when approved) - enjoy the app!

ExpressionEngine: redirecting based on group_id

07 May

ExpressionEngine: redirecting based on group_id

Just a quick update - I've published a very simple plugin for EECMS that can redirect based on group_id. I made this so that admin users could go to one URL and members somewhere else after login, but you could use it in other ways as well. I also use it for basic redirection in a SAEF-based application based on EE, so it's good for that as well.

SAEF’s annoying default

02 May

SAEF’s annoying default

I love the Expressionengine CMS and these days I do a lot of projects with it. Today I lost an hour hunting for a stupid bug, due to a strange default. In my current project I needed a tooltip, so I did what I've done in dozens of projects before: I added jQuery + jQuery Tools at the top in addition to my own "ready-function" that would init the tooltip. It didn't work and it took me a long time to figure out what this error meant:

Uncaught TypeError: Object [object Object] has no method 'tooltip'

It looks like there's a problem finding the object, right? All the links I found led to things about the incorrect loading sequence of the Javascript files, but I knew that wasn't the fault here. I DID include the files in the right order. It worked standalone, but not in my EE templates. In other words - there had to be something inside EE that caused the problem? Strange!

A very nice module that I've only had a need for recently is SafeCracker (formerly called Stand Alone Entry Form or SAEF for short). It turns out - even if you don't use any features that require it, SAEF will include it's own version of jQuery and JQuery Tools? The code will be embedded at the bottom of your form, so even if you have everything in order at the top of the file, it'll be overwritten at the bottom. 

Fixing the problem is  as easy as adding a tiny snippet to your Safecracker tag

{exp:safecracker ...  include_jquery="no"}

This is 2012 and JS libs are updated on a weekly basis to fix browser bugs. Auto-incuding unrequested features based on outdated libraries is NOT the way to go (as default). Hope this post can help others to not spend time on this...

 

Away3D 4 Basics

12 Mar

Away3D 4 Basics

Finally taking the time to update the tutorials over at Flashmagazine to cover the Away3D 4 Beta that was released a few weeks ago. It's more than 40 code examples mixed into the 12 tutorials so it'll take some time to get through it all. It's mighty fun though and I'm really happy with the speed I'm seeing on both desktop and devices!

I've had a couple requests recently for how to do just a very basic 3D scene using Away3D v4, so here it is in case others need it too. It's just a cube that you can spin with either the mouse or keyboard, but it shows off quite a few of the differences in how to do things in v4. Materials, meshes, lights - there's differences for many core things. I'll summarize all these changes as I go through the code examples.

Arduino Companion - now out on Apple App store

17 Feb

Arduino Companion - now out on Apple App store

I knew about it, but it's facinating to experience firsthand the "Time To Market"-difference between Apple and Google. On Android, you can push things live on Market in a matter of minutes. Getting approval from Apple took 7 days. During that time I have received my first batch of feedback from Android users. I've gotten four 5-star reviews on Market, plus one 1-star review. The guy with the 1-star review didn't manage to install AIR on his handset for some reason. It hurts a bit to get a review like this when you're spending lots of time making something for the community to use for free, but it's better to know about the issue than not.

And - as my friend Paulo pointed out - export your app using Captive Runtime for Android. That'll include the correct version of AIR inside the app so the user never has to worry about it. It'll increase size, but reduce frustations so I'll certainly do that for the next version. Winter holidays and FITC Amsterdam is coming up now, but when I'm back I'll start working on the app again. I'll rebuild the views -system since I now know how I want it to work and I'll also add some more features. The plans are: a capacitor calc, a Volt/Ampere/Resistance/Watt calc and the first bits of a Hardware Reference!

Arduino Companion - my first app for devices is out

10 Feb

Arduino Companion - my first app for devices is out

Tonight I finally pushed the app out to Android Market and Apple's AppStore. It's already live on Market, but I guess it can take both days and weeks for it to hit the App-store? I hope others will find it as useful as I do. The idea of an offline Reference came about when arduino.cc experienced some server issues in January 2012. When I looked around for a way to browse the Arduino reference, I figured I could make something better than what was already available. I also had need for a Resitor calculator, so I've added that as well. That one I use many times a day thanks to my newfound hobby.

Making the app

I have lots of plans for new features I want in the app, but feel free to suggest improvements or new features in the comments. All sorts of feedback is very welcome! The app is pure Actionscript. I made parts of the app using Flex initially and the speed/responsiveness was nowhere near what I wanted. The data for the reference is structured using Expressionengine for easy editing/export. It took about 1,5 weeks to take the app to it's current state and more than half the time was spent on testing. Getting one app to work well across multiple screens is really quite a mess, so I hope I've tested enough?

The only known bug is that my Asus Transformer will report incorrect sizes when the app is rotated. It actually swaps the values for rotated and default orientation around? I only have this Android tablet to test on, so if you have an Android tablet and a few minutes to test - please do so and leave a message here. Apart from that bug, it works like a charm on iOS and Android. I haven't tested it on Playbook as I'm yet to receive from RIM the one I won just before GotoAndSki.

I'll probably spend some time getting it published to the other app stores as well such as Amazon, Nook and maybe also smaller ones like Samsung Apps. Any other suggestions?

Other apps?

While this is the first one that has been  published, I've also worked other AIR-based apps for devices. Next out will be my game project MineGunner and start to play with Genome2D. I had to take a break from that when I discovered that I needed hardware to get it where I wanted. The demos I saw of Stage3D / Genome2D at GotoAndSki totally blew me away! Who will need more than 6000 sprites running at 60fps on an iPad? Not me! :-D

gotoAndSki 2012

31 Jan

gotoAndSki 2012

Just back from another gotoAndSki conference in Switzerland and what a blast it was! Just as last year I went to Switzerland with @thomasnesse and @smest for almost a whole week, just to be sure not to miss out on good snow. The first day was simply EPIC!!!

50 cm powder snow, cloudy but with thin skies so there was plenty of contrast and no sunburns. We went offpiste until our legs got cramps and then some. When the conference started a few days later, my legs still hurt so on the sunniest day I spent some hours teaching @inspirit how to snowboard and refreshing the memory of @devboy_org. I was pretty proud to hear that Eugene did a black slope all by himself, only the day after! (while cursing @funkysoul and the others for picking that route).

Eugene Zatepyakin presenting @ gotoAndSki Switzerland

Eugene delivered a great talk about his AR library - in2ar - that now is completely rewritten and free of patents. It was especially impressive to see this running on mobile phones using AIR and Native Extensions! Other favorite talks were @quasimondo's return to public speaking. His session "The naked pixel" is guaranteed to fill any conference room! Dominic's session was also quite nice and worked as a primer on Ruby as well.

It was great fun to meet attendees from last year and to meet some new faces like Franto - one of many that I've followed in the Flash community for many years and only met now. I also talked to his buddy @sHTiF that has written a great 2D engine for Stage 3D (and a Starling alternative) that is called Genome2D. I have to finish up a couple other projects first, but then I'll definitely test how this engine plays with my MineGunner project! Seeing Adobe's @tomkrcha demo the Genome2D engine on an iPad 2 with 7000 sprites running at 60fps really convinced me that Flash on devices is here to stay! 

I had a great week in Stechelberg so a big thank you to @fcolaco & @almeidavid_ for organizing yet another great event! Given how bad the snow has been here in Norway this year, it was simply fantastic to get to Switzerland for this week. Just check out this picture - beneath that 2.5 meter high sign there is a road somewhere...

Why Javascript bores me

14 Jan

Update: I feel that I should add to this post that working with node.js and socket.io has sort of changed my mood when it comes to Javascript. I'm having lots of fun doing JS stuff these days and even combining it with Flash and AIR.

Now this is going to sound cocky (sorry) but I need to get it off my chest - the thing I hate about the Flash vs HTML(5)/JS/CSS(3) debacle is that clients now expect you to be able to do everything you could in Flash using HTML. They also expect that everything will magically work well on mobile devices such as iPads and cheap Android phones. This is after all the very promise that Steve Jobs and other cool guys have sold them. The problem is - it’s not like that at all.

It’s really hard work to solve browser incompatibilities and code around lack of capabilities in mobile browsers. I don’t mind hard work but this really bores me - a lot. I hate patching something that really should have worked, but since somebody didn’t agree on how to solve it I’ll get to poke around half a day to look for an answer…? It’s much more fun to create stuff, isn’t it?

I don’t mind that Flash’s role is changing. It was inevitable and I too love to see cutting edge work done in HTML/JS/CSS like this brilliant site by Bret Victor or enfantsterrible by WeFail. I just don’t want to go 5 years back in time to the time before Flash Player 9 and Actionscript 3. I don’t mind Javascript at all, but it feels so totally inappropriate to try and build serious apps with it (like I do with Flash and Flex). I don’t want to work on projects where I constantly have to cut back on creativity just because something just isn’t possible (yet). Flash is a platform that does not limit what I can do, so to me this boils down to either having (what I think is) a boring job or finding something more enjoyable. Work takes up too much of my life for it to be boring…

AS3 is such a mature language and if you read up on the future of Javascript, you’ll find that JS5 will be the “patched but still untyped” version of JS. Future versions after that will become what ECMA 4 tried to be before Microsoft more or less killed the project. Flash’s programming language AS3 is what Javascript will become in the future. It probably won’t be exactly like, but it’ll be close. I think that I will look for other challenges while waiting for javascript to mature where working with it no longer bores me.

Others have taken a different route and gone with the flow to do with JS what they have already done with Flash and Flex. I have no need to do that. There’s so many other things to do than have a boring job. Today, João Saleiro posted a brilliant and thorough article that more or less sums up all of my frustrations with “the future” of web development. It’s lengthy, but it’s really worth it - especially if you come from the HTML/JS side. Most HTML5 “comment trolls” don’t know anything about Flash, Flex or AS3, so they have no clue what they are missing…

Sorry. HTML5/Javascript/CSS3 The hype really bore me and I’m already used to Living in the future. I won’t spend time on learning the fancy “flavor of the month” JS-library that may be dead a couple months from now. Instead, I currently enjoy learning about electronics and microcomputers while coding in C - a language that is older than me and still just as valid. And if I ever “have to” to build something big with Javascript, I’ll certainly use something like Haxe that can remove the pain and add some fun.

Further reading?

HTML5 in way more than 5 paragraphs

The Increasing Cost of Interactive Production

The World of Pain that is HTML5 Video

The open web needs you now

PS: I do a lot of HTML, JS, CSS and have done so ever since I started in this business 15 years ago. I also do PHP and EE CMS on a almost daily basis. I just don’t see the excitement in fighting against technology to make it do what have been done already. If being on the bleeding edge requires daily pain and fighting inadequacies/inconsistencies/incompatibilities, I’ll rather look for things more fun to do?

Playing with Arduino

20 Dec

For quite some time I’ve wanted to play with Arduino and after the Rock City project, where I did a lot of soldering and hardware integration (based on Phidgets) I decided it was about time I got started. I picked up the kit today and I just couldn’t stop playing with it. The kit that I got was the Ultimate Microcontroller pack from MakerShed. Lot’s of components and I also added a bunch of extra sensors that I though I might find a use for. So much fun!

Arduino programming is C/C++ based and that’s something I haven’t done much. The syntax seems fairly easy and for now I haven’t run into what I’ve always dreaded the most with C - memory management issues. I’m sure I’ll run into some, but I’ve picked up a couple books to read over xmas so that I can try to avoid things like that. I’ve posted a short vid of my first project done without following a tutorial below.

I have one question for those of you reading this that have Arduino experience:
Why will only some of my LED’s fade in/out?
I’m using “analogWrite” to set a value between 0 and 255. Those that don’t fade will always toggle at a value of 128. I’ve swapped around the LED and resistor and that makes no difference. It seems this is related to the I/O ports used. You can see this in the video below.

Housekeeping time

16 Dec

Housekeeping time

Back when I started this blog in 2006, I installed Movable Type and just left it there. Kind of scary given the amount of hackers, but apparently MT is pretty safe now that WordPress has taken over? I’ve finally managed to move this blog to a more recent CMS, so that was certainly about time… I didn’t want to spend time on a new setup, so I tried installing Wordpress - just because it takes virtually no time. It turned out that my hosting company had not yet upgraded their PHP to the version required by Wordpress, so I had to look at other options.

I love ExpressionEngine, but setting it up for something as simple as a blog is totally overkill. Then it dawned on me that the brilliant Bjørn Børresen had created some simple and decent looking EE templates over at ThemeForest. Turns out he has found some really good solutions, so if you just want a simple EE site - go check these out. They come complete with a bunch of Bjørn’s nifty extensions as well so the blog has Gravatar support, thumbnail generation and video embedding support. By just copying the theme files to the server at setup time, everything is set up for you automatically. Very neat!

Next part was moving all the contents of the old blog into EE and the excellent DataGrab module by Andrew Weaver came to the rescue. All my content (including comments) converted perfectly on the first attempt and all I’ve had to do are some very minor tweaks to the content and templates. Have to say that I didn’t expect this to go as smooth, so kudos to Bjørn and Andrew! I also threw together a quick, static site for my ltd company while I was at it.

Now that all my projects are finished for this year and I’m almost done with all other private projects, I will kick back with some Android and iPhone development on my brand new 27” monitor (I needed more pixels!). If you have any challenging Flash projects in January/February - please get in touch! I have extensive device experience and I wouldn’t mind doing some Stage 3D either…
(Note: the usual banners and microsites are not challenging/interesting…)