PieChart with AChartEngine in Android

In my last project I was spending a lot of time looking at charting/graphing libraries for Android. I finally found the awesome AChartEngine but found it very hard to get a simple example working. So here is now a small PieChart example which hopefully can get you started! This example shows a pie chart with income, costs and the difference in a “sub total” sum.

Here’s a quick how to:

  • Extend GraphicalView (class in AChartEngine)
  • Create a getNewInstance method that returns the current class using a custom Renderer and DataSet
  • Create a custom Renderer (defines colors and labels for the chart)
  • Create a custom DataSet (the data maps to the colors you give in the renderer)
  • Profit!

To use this awesome PieChart you’ve now created you need to create a Layout in your xml which you can add the instance to.

Read More

Animated TabHost with slide gesture in Android

So when I was writing my Recept Keeper application i used a TabHost thinking it would have easy access animations and gestures for sliding. Turned out I was wrong and if targeting Android 4 or higher I could have used a PageView/Flipper.

I did however write a custom OnTabChangeListener that which has animations and gestures baked into it. Hope you can find some use of it in your TabHost!

Read More

Adding HP Photosmart C5280 to DS209 NAS

After lots of trouble and searching for Linux drivers to get the printserver in the Synology DS209 to work properly I had given up on wireless printing at home. Being bored tonight though, I got into my hea to give it another try since I had a Diskstation Manager update for my NAS.

After the update I figured what the heck, lets see if they’ve added some more options that I can tweak and what do you know, there was!

So, to get this working I:

  1. Plugged printer USB into the DS209
  2. Open the external devices in the Diskstation Manager
  3. Mark the printer in the list and click Usb printer manager -> setup printer
  4. Use Network MFP (this wasn’t here when I last tried!)
  5. I enabled AirPrint (Haven’t seen this before either!)
  6. Setup Brand to HP and Driver to HP Photosmart 7150
  7. Add printer and install any needed drivers on computer
  8. Done!

The 5280 still isn’t officially supported it seems but now I’m printing from both my Mac, Hack and Windows machines without problems. Next fight is scanning :)

Add css style to your JavaDoc to make it readable

Been getting into Java more and more lately and JavaDoc must be the most horrific leftover from the 90’s web with purple/black/times new roman styling. Not only is it unreadable due lack of margins, line-heights and smooth contrasts. It is also butt-ugly. My favourite plugin for Chrome came to the rescue though. “Personalized Web” makes it so easy to add custom CSS to any site you want. So grab the plugin from Chrome app store and get a customised version below since the Sensemaya version is no longer available.

DN.se redesigns and brings back print typography to the web

One of Swedens major newspaper websites got a redesign today and man, they have been working hard! They have managed to put aside all the web typography rules we all are started to take for granted. Things like vertical rhythm, 1.5em’s line-height for readability and lots of white space that allows the user to scan for content no longer exists. Instead it’s packed with what I’m sure is great print-design which makes the site unreadable and unusable, at least for me.

Lucky though that I found this Chrome plugin called “Personalized Web” that allows you to add custom CSS. I’ve used this before to get around Facebook’s silliness with the right sidebar.

Here’s the CSS for my dn.se and facebook.com that I’ve adjusted to my liking:

DN

Facebook

Internet Explorer limits stylesheets links to 30 could be the reason your styles are not applied

After spending several hours the other day working on the endless adaption of Internet Explorer 6 for a Drupal project, and wondering why the styles in the conditional stylesheet I had added weren’t being applied, I stumbled on a small note that IE for some reason limits the number of linked stylesheets to 30 before it stops rendering. This causes the styles in any additional stylesheets to not be applied although the stylesheet is in the code. This seems like another stupid limitation in the painfully crappy (yes, it’s a pro term) IE series of browsers.

Read More