Tuesday, August 07, 2012

Now Playing Desktop Display for VLC using Geeklet

I was looking for now playing display on the desktop for Mac. I used combination of Samurize, Foobar and Now Playing Simple Plugin in Windows and would like to have the similar experience.

The closest combination I can find is by using Geektool. There's a posted geeklet for Now Playing on VLC to be used with Geektool but it no longer work when I tried it. It seems the xml posted by vlc web interface has changed since the posting of that Geeklet.

I end up playing around with the new vlc's xml myself using XMLStarlet to get the value I want. It's a great command line tool for handling xml. Here's the command that I then feed to Geektool (using shell Geeklet) :

cd /Users/Hafiz;curl -o vlcstatus.xml -s http://localhost:8080/requests/status.xml;./bin/xml sel -t -v "/root/information/category[@name='meta']/info[@name='title' or @name='artist' or @name='album']" vlcstatus.xml

What it does is dump the xml to the file using curl, and then XMLStarlet parse and display the relevant part (artist, album, title). When the above command put in shell Geeklet, Geektool will then display it on the desktop.

Here's how it displayed on the lower-right corner of my screen.


Monday, July 30, 2012

Use Restkit Object Mapping directly

Restkit has a good object mapping library inside it. However, it's used is integrated with it's loadObject function and not really clear how we can use it directly without going through loadObject. This is useful when we have data we want to map that does not come from loadObject flow.

There's a brief hint on this on Restkit's Object Mapping manual on section Task > Performing a Mapping. It shows how the mapping is called internally.

Here's the clases related to Object Mapping in Restkit :

and here's summary of the steps :
  • create an instance of RKObjectMappingProvider
  • make mappings for each model using RKObjectMapping and add it to the instance of  RKObjectMappingProvider above (using setMapping function)
  • when it's time to do the mapping create RKObjectMapper instance following the "Performing a Mapping" documentation mentioned above




Accessing app content on iOS device or emulator on

When developing iOS app that store data to device, having a direct access to the filesystem will help a lot on debugging. Here's the references of it on Stackoverflow to access them : for device and emulator. Below are the summary :

  • For device, use project organizer on XCode to access device. From the device entry, you can download the filesystem content of the app
  • For emulator, the filesystem reside on : ~/Library/Application Support/iPhone Simulator/[OS version]/Applications/[appGUID]/

Tuesday, July 10, 2012

iThoughts and Freeplane compatibility

I used Freeplane a lot, not just for mindmapping but also for other uses like lists, outlines and notes. So, it's quite useful for me to having it accessible as much as possible. Currently, the best available option to have Freeplane's file  mobile on iPhone and iPad is using iThoughts. It is not perfect and many aspect not translated well between them, but it's usable and good enough for my need for now.

Here is some tips and notes of using iThoughts as "mobile" Freeplane :

  • Turn off "Resolve Auto Attributes" under "Export Options" group in iThoughts. This will map auto/blank attributes on iThoughts to defaults to Freeplane which is better than having to deal with confusing translation of Auto/inherited attributes
  • iThoughts only know edge color, so every node color (text, background, edge) will all translated (flattened to be more exact) to edge color on iThougts. The bad thing about this is that it's a lossy translation, so when you re-open on Freeplane, all node-related color are back to default except for the edge color
  • Icons compatibility is quite limited. Some typical groups and sequences like flags and numbers are in-sync as some punctuation-based icon like question and exclamation icon is in-sync too. So, use icon sparingly and test for compatibility
  • Even after yo have established your personal convention you might still see some surprises on maps/nodes. This usually some Auto format issue. Try to reset the format to Auto on iThoughts and/or Default in Freeplane and reapply the needed formatting. This usually get the format in-sync again
iThoughts is a good app in itself, but it's Freeplane compatibility it's just medium level. Although it would be ideal to have full Freeplane  app but with some tweaks above  iThoughts could do the job for now.

Monday, April 23, 2012

muCommander to "complement" Finder in OSX Lion

I recently found muCommander File Manager. It's simple, dual-pane file manager (as a bonus, it's also multiplatform due to it's java usage). It supports natively several file protocol e.g: smb, ftp. However, the biggest use of it for me currently is that it can open windows share when Finder can not.

I have many issues with Windows Share in Finder and it can break the workflow sometime. muCommander help with that in many cases. On some other needs, it does not entirely solve the problem since it can not mount it and only allow transfer. This means I can not open the file directly through the share but need to copy it locally first. Still, it's a good help for now until Apple fix the interoperability with Windows Share.

Apart from that, I probably won't use it much beyond helping the windows share issue above. and some occasional need for dual pane.  It's a nice looking File Manager but a little too simplistic for my needs.

Wednesday, April 18, 2012

Powerful but light PHP Framework/Library combination : Slim, Twig, Idiorm/Paris

I need to work on PHP website recently and were looking for libraries and framework to approach it better with the latest components available. My previous perception on PHP is that it has has a lot to catch up with existing solutions on Ruby and Python. However, this time it seems it already has done it's homework and now has many options regarding some development in web programming e.g: Template Engine, Microframework, ORM.

Here several libraries/framework that I find can form a good combination for small to medium project :

  • Slim is a micro framework for PHP. It is a good enough to help separate the web application into a more modular, decoupled architecture (call it something like MVC if you like). It's a very low-cost approach compare to using full-blown framework like Zend. In Python, I used Flask and it's quite similar.
  • Twig is a templating Engine. It's like Jinja in Python. In fact, the initial coder is Jinja developer, so it's not too strange that it feels quite similar. I don't think people should write/generate HTML code inside PHP directly  anymore. It's inhumane :). Templating engine helps the code deal with the logic exclusively while it deals with how to present it. It has a good two-ray integration with Slim above : there's Slim extension for Twig and Twig can be plug to Slim as Template engine.
  • Idiorm/Paris is a a very light ORM layer for PHP. It just one class and one file with a straightforward and simple uses yet it does the job really well.
So far, I find the combination above serve me quite well. They are quite flexible, does not force too much assumptions/model and has small learning-curve and overhead.

Monday, April 16, 2012

Manage Linux system services using sys-rc-conv

There's a good tool to help manage system service in linux : sysv-rc-conv that I start to used just recenrly. It's much better than having to deal with /etc/rc*.d stuff.


I don't know why I haven't used it before, probably because of the name :). It does describe the context and function well but not exactly easy to remember and pass around.


Thursday, April 12, 2012

Integrating Apple Ecosystem


Early this year I got some iPhone app project to start. So, it began my serious usage of Apple Ecosystem. I start to use together iMac, iPhone4 and iPad2. It's been a very involving process to get them integrated into my current workflow (which up till then was mostly Windows-based). Most of my previous system is still used except for HTC Touch Pro2 which is replaced by iPhone4. Below are some notes on the integration process :

  • Moving to The Cloud. My previous main GTD system is synced directly using cable with my HTC-TP2 act as the central on the synching with Laptop and Desktop with WMDC and BirdieSync as a glue. With the inclusion of the new devices it would no longer possible (or at least very impractical) to keep doing it. I guess this is what the clouds are made for. I now rely on Google Map, ToodleDo and Dropbox for most of the syncing.
  • Java-Based software are ported well. Java works. I got jEdit, Freeplane, Astah working and ready to use on
  • Mutliplatform software do it's job well. Firefox and Thunderbird has no issues here.
  • Most of the software has comparable counterparts. Most of the software has more or less a comparable alternative on each platform. Some are better but some are less fancy, so overall it's a draw, I guess. I miss TortoiseSVN quite a lot in iMac.
Apart from the software it's mostly the adaptation that take some time. I don't like to just imitate what I did on other platform to another one. It's more satisfying, and useful on the long run, to try to understand first the new platform different approach and to migrate the needs as natively as possible before improvising more later on. For example, I tried built in Mail and Calendar on iMac for sometime before switching back to Thunderbird+Lightning.

So far, I enjoy the new systems and it brings many fresh views, new approach and utilities.

Tuesday, April 10, 2012

jEdit on Mac : How to get better font rendering


Text Editor is one of the first software I look around when I start using Mac. I am a jEdit user on windows but I figure I tried what's available natively on Mac first, in case there's something better and works natively. Long story short, jEdit is still the best option for me.

It runs quite well on Mac but somehow it seems something is a bit miss in the way it renders font. The characters are a bit blurry, although not too bad and I still managed to ignore it for sometime. However, after a while, the difference with the native editor like TextEdit start to raise some curiosity about the difference on how they render the font.

The discussion here, finally shed some lights on the issue. Below is what need to be set on jEdit (quoted from the original post) :

Edit the file: /Applications/jEdit.app/Contents/Info.plist

.. somewhere around line 66 you'll see these options

      Properties
     
        apple.awt.textantialiasing
        true
        apple.laf.useScreenMenuBar
        true
        apple.awt.antialiasing
        true

.. just after those lines, add the following extra properties:

        apple.awt.graphics.UseQuartz
        true
        apple.awt.rendering
        quality

.. restart jEdit, and you should have much nicer font rendering!
:-)

It looks much nicer after it and give me even less reason to try to move from jEdit.

Wednesday, September 07, 2011

A stuck and hang VM on Xenserver

Yesterday I found our development server can not be accessed. It's a VM under Xenserver and trying to fix things through XenCenter is quite a deadend. The console can not be accessed from XenCenter, there's only blank whitescreen and when the VM was being forced to shutdown it complained "Another operation involving the object is currently in progress class: VM".

There's some discussion and proposed solution from this and this thread forum. Here's quote from one of the post that  finally fix it for me (you need to login to server's shell to execute the below command) :

1 - "xe vm-list" to get the uuid of the VM that is hung
2 - "list_domains" to list the domain uuid's so you can determine the domain # of the VM above by matching the uuids from this output with the uuid for your VM from the previous command.
3 - "/opt/xensource/debug/destroy_domain -domid XX" where XX is the domain number from the previous command
4 - "xe vm-reboot uuid=XXXX --force" where XXXX is the uuid from the first vm-list command for your VM. (name-label may work but didn't work this time for me so I used the uuid)

Sunday, August 21, 2011

Install Kubuntu 11.04 on Samsung N150

I had a Samsung N150 from the office and installed it with Kubuntu 11.04 not long ago. Below are some notes to get it working acceptably. It's more of a high level notes/todos on setting things up for guides and reminder and not meant for the detailed to-the-letter instructions (read : familiarity with ubuntu/linux is assumed).

  • The basic installation. There is nothing special here as it went quite straightforward.
  • Changing the network-manager with wicd. My wifi can not be connected with the defallt-installed network-manager. Removing network-manager and replacing it with wicd (together with it's kde integration) solve the problem.
  • Add xorg-edgers to apt-source and do updates to get video driver hardware acceleration (http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu natty main). This way, the 3d efffects on kde will run smoothly.
  • Fix the brightness setting : https://bugs.launchpad.net/ubuntu/+source/udev/+bug/574250. Installing samsung-backlight and samsung-tools mentioned on the article does not help in my case (only working once after install and the brightness setting fail to work again after resboot).  The solution I end up settling in is making script to encapsulate the solution using setpci as referred on the article. It is not user friendly but good enough for me and since I don't change brightness too often it i not really a big deal.
Despite it needs some research and tweak to get it working to a usable state, it is interesting to use when it is finally working. The kubuntu netbook-style desktop need sometime to get used to but after it I can appreciate how it makes the work on the netbook and and it's utilization become more efficient, most notably the screen real estate.  It does that without compromising the usability too much. Also, having the application menu integrated to desktop in a popup/vertical way is very cool too.

Wednesday, June 29, 2011

The Return of Help Viewer, Visual Studio 2010 Service Pack 1

I recently install Visual Studio 2010 Service Pack 1. It surprised me when opening the Help a familiar-looking Help Viewer popup (although from the looks of it, it seems now rewritten in WPF following the visual studio itself).


I was a bit uncomfortable using the previous browser-based help initially, although overtime I am starting to get used to it and appreciate some of the benefits e.g: easier saving, simpler navigation. However, now that the desktop-based one came back, I am happy again :).

The main problem with me with browser-based one is that it got closed often and getting mixed up with other stuff opened in browser. It makes switching to it slower than desktop one since my mind seems to need additional work to get to it  i.e: find the browser and select the one that open the help, compare to just open the application directly. The reason is quite similar to why I still prefer using thunderbird for opening mail no matter how improved gmail web-based email client currently i.e: desktop-based still feels more native and direct.

Monday, June 27, 2011

Trace Registry Activity using Process Monitor

I have some problem with interoperability with certain executables that seems to behave somewhat randomly. Along the way, I stumble upon Process Monitor. From it's descriptions on the site : 

"Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity".
It proves very useful in my case. It shows that somehow there is registry activity that explain the cause of the previously random behavior.

It's another useful addition to the toolbox along with other utilities from Sysinternals that I have been using so far, most notably DebugView and ProcessExplorer.

Thursday, June 23, 2011

Adding Note Support, Freeplane for Windows Mobile

I have added note support to Freeplane for Windows Mobile. I ported the note support form PocketFreemind with some changes mostly in simplifying node edit/save cycle and dialog. It is still on the repository right now and will be on the next release.

Here's some screenshot :

Note view panel
Note editing with tag helper

Tuesday, June 21, 2011

Make Single Executable Installer using IExpress

Visual studio deployment project produce two file when built i.e: setup.exe and the .msi file. I need to make them into single-file executable installer. This reference is really useful. It turns out there's already a tool that exist in windows itself to combine several file installer into one : It is called IExpress.exe and reside on C:\Windows\System32.

I had some notes in following the above references (and it's various links) :

As the entry said, using setup.exe as an entry point does not work due to the "bug" introduced since visual studio 2008 (it was working in visual studio 2005).  I currently use visual studio 2010 and it still not working too. However, the given solution using batch file did not directly working either when I tried. When executed by resulting exe the .bat file seems to have trouble with long file name while it is working when I tested the .bat file directly.

Some trial and error later, it turns out that somehow the resulting .exe executed the .bat file using command.com and causing problems with file path. When I tested directly .bat, and working, it is executed by cmd.exe, that's why it behave differently. So in "Install Program to Launch" dialog, to ensure cmd.exe is used instead of command.com,  instead of entering setup.bat, I called the command  "cmd.exe /c setup.bat" as illustrated on the screenshot below.
 





Also, for the cleanups, instead of using the refered codeproject reference that relatively complex,  I used script that act as a pair of the setup.bat refered on the post and has content as below  :

RMDIR /S /Q "%Tmp%\[UNIQUE PRODUCT NAME]"

and put it in Post Install Command field (using the same "cmd.exe /c" call as stated above). It is much simpler that way and utilize what's already provided by IExpress.

Friday, June 17, 2011

Light Use of XPlanner

I use XPlanner to track development process. However, in many cases e.g: very small team, small scale software, I don't use many of it's feature and use it as a very light project management tools that feels more like an extended todo list (which is good since it is simpler and does not get in the way of the development more).

Here's how I used XPlanner lightly :

  • I filled mainly only text and description for stories and tasks, other fields are left in default
  • No timesheet entry, just click "complete" when task is complete and change the stories to status to "implemented" when all it's task is done
  • I monitor only what task is done and what stories is implemented
So, when it is used like this it's basically just an"over-featured" todo list, but it still has some advantage over generic todo list and that is the built in iteration concept. I can still feel that I am within development iteration. Also, when in other iteration I decided to use more of it e.g: timesheet, it is still there, ready to be used.

Thursday, June 16, 2011

UML for Reverse Engineering

There's an entry on Martin Fowler's blog that I find interesting. I talks about using UML as a tool to understand the existing code. It resonates with me since that is how I find myself using UML lately i.e: more as a reverse engineering helper than as a top down development design tool.

I still use UML in a top down fashion sometime, usually when trying to solve certain mechanism directly in the code seems to spawn too much options/thoughts. This is the time that I usually fire up UML tool (I use Astah, BTW) and do some mockup of classes, association and interations until it's clearer what I need to do next in the code. However, this is not frequently happening since many coding tasks have a clear next-actions (to borrow GTD term).

On the other hand, reading existing code usually require the understanding of the base code structure first before I could do the tracing and debugging. It's like try to get a map first of the are so I know where the location of certain things and how I can get from there to somewhere. This is where the UML come in, to help get the understanding of the big picture of the code. And like the above article said, I find using our own modelling is much more useful in getting the understanding of the code than using automated reverse-engineering typically exist in CASE Tool.

I usually keep the file/diagram for future references/re-use but not neccessarily keeping it updated as it's already done it's purpose i.e: helping to drive the development process and keep moving it forward. I could always refresh the model when needed, for example when trying to understand part of the code that I haven't been working on for a long while.

Wednesday, June 15, 2011

Freeplane for Windows Mobile

I am a long time user of PocketFreemind on which I am one of the programmer too. It is working fine while I still in qvga device. However, when I switched to wvga device it started to show many issues that I feel the rewrite was needed. So, there comes FreeplaneWM which later become Freeplane for Windows Mobile.

Here are some note on the changes/differences of the rewrites from PocketFreemind :

  • The domain model is now just a thin wrapper over .Net's XML-related classes. Any changes done directly to those XML classes through the wrapper without additional data structure in the between. This simplify the code and improve performance.
  • The layers/module are simplified. There are basically just application layer (gui related matters) and domain model (xml plus wrapper classes)
  • Attention to vga/wvga visual consistency and behavior
In a nutshell, the changes is driven by the goal that so it can be used in wvga/vga devices well and keeping the codebase fun to code.

Tuesday, June 14, 2011

Base Setup : HTC Touch Pro 2

I own HTC Touch Pro 2 for more than half a year now (replacing my previous HP iPaq 912c). It takes some time for the various apps and setting to settle in. For me personally, it's not just about using of the gadget itself but more about how it integrates with my personal workflow. That is also why I still stick to Windows Mobile currently as many things that I use still not yet available in other platform.

Here's a brief overview of the setup of the essentials :

  • Shell and Core App : SPB Mobile Shell+PocketBreeze+PocketInformant. These are the basics and I probably won't use a gadget if I can not setup a comparable feature on it
  • Desktop Sync : BirdieSync + Windows Mobile Device Center (WMDC). Having complete and reliable synching to desktop is essential otherwise it will be a pain to have to sync manually or having a gap in data between mobile and desktop. Birdiesync (event, tasks, contacts, etc..) and wmdc (files, notes, etc..) does all that I need
  • Outliner : Freeplane for Windows Mobile. I wrote this app myself (branching from PocketFreemind project on which I am one of the developer too). I used Freeplane a lot, especially for things that can not be captured by the structured information manager. This allow me to have access to it on the go
  • Spredsheets : Excel Mobile. Spreadsheet are great for certain type of data and I have some main personal files on this form that makes the existence of it on the gadget is very important. Windows Mobile comes with it out-of-the-box so it's already well-covered right from the start
Those are the essentials that makes up the base of my mobile setup. There are other apps that I use frequently but they are functionality specific while the above are has more of a dashboard/control-center/base-system feel to them.

Monday, December 07, 2009

Variable (a.k.a Properties) in Visual Studio's Deployment Project

I use Windows Installer Deployment in Visual Studio. It's simple to use and make quite a decent installer and it's good enough. It is basically wrappers and helper-tools around the native Windows Installer service in Windows. However, having start directly using the helper instead of the native one makes me occasionally wondering how to do certain things in the IDE tools which is quite obvious in the native ones. I guess, it's the usual case of convenience versus completeness of using helpers/wrappers/tools versus the native support.

One of the important case of this is when I wanted to write to the registry using some dynamic value (e.g: Destination Path which will be decided by user later) instead of the hardcoded one. I can't find an info on this on the visual studio help on the IDE part and only after some searching around that I got into reading the native Windows Installer service documentation on the "Wind32 and COM Development" part of MSDN. There's a thing called Properties that I could use for this kind of problem. In this case I would need to use "[TARGETDIR]" which later would be substituted on runtime with the installation path.

So, I guess the lesson is when something not clear on the tools/wrapper level try looking on the native/lower level.