Having tasted the DateTime classes in .Net made you wish that there is something like it on the Java World. Compared to .Net's DateTime, what's available on Java world regarding the date and time handling feelds a little dated. It turns out that there is even a better stuff on Java, JodaTime. It has more detailed and useful abstraction regarding date time matters. It even has a sister library NodaTime for .Net which seems shows that the abstraction choices adopted to significant number of developers.
You can head out to it's front page and read "Why Joda Time?" section on overview of the relevance of the library. For me personally, it makes the bridging from .Net world of DateTime to Java world easier
Wednesday, March 13, 2013
JodaTime, for easier DateTime handling in Java
Diposting oleh
Hafiz
di
Wednesday, March 13, 2013
0
komentar
Label: library, programming
Friday, February 15, 2013
Tunnel Internet traffic through OpenVPN per client only
We have been using OpenVPN at the office to access development resources only. So, as long as we have LAN connection to the VPN host server all is good. However, there is the need to direct all traffic including internet through it. It can be useful on public network to have it as a secure tunnel for all traffic to have more peace of mind. I don't want it to apply to every connection, I still prefer using internet non-tunneled on secure local network for speed reason.
Some references assume the setting is to be applied to all connected clients so the setup is set on server config. The notes below move the server-side setting to client so it can be set per client/case only.
Setting things up on the server side
The server is Ubuntu using Shorewall as a Firewall. What is needed on the server side is setting NAT from OpenVPN interface to the internet so the internet traffic from vpn can be forwarded to the outside world. Here's what to doAllow IP Forwarding in /etc/shorewall/shorewall.conf :
IP_FORWARDING=Yes
add entry to /etc/shorewall/masq :
eth0 [vpn network IP]
allow traffic from vpn to internet on /etc/shorewall/policy :
vpn net ACCEPT
Client Side
Here's the lines to be added on the client configuration :
redirect-gateway def1
dhcp-option DNS 8.8.8.8
dhcp-option DNS 8.8.4.4
Google DNS used to override whatever exist on client system in case it cannot be accessed through the tunnel.
I make two different .ovpn file with the same keys setting but one has the above setting. This makes it easy to switch between the one for tunneling internet traffic and vpn-lan-only.
That's about it. Below is some source references :
- http://openvpn.net/index.php/open-source/documentation/howto.html#redirect
- http://wiki.debian.org/HowTo/shorewall (part about PAT and NAT)
Diposting oleh
Hafiz
di
Friday, February 15, 2013
1 komentar
Label: system
Tuesday, January 08, 2013
Utilizing Springpad with a little help from Evernote
I stumble upon Springpad sometime ago. It was on some discussion on some forum (probably stackoverflow, it's a bit hazy now) about programmer's notebook. It was hard to really pinpoint the usage of it for me initially since it's feature is all over the place. I can't really describe what it is personally, you just have to try it yourself to really get the feel of it. It's a mix of Evernote, Pinterest and probably several other cloud-services.
I tried to use it for several purpose some which does not seems to fit well. In the end I settle with using it for more collecting-related purposes. It is a great tool to collect things on the fly. On GTD space it is great for Inbox and Someday/Maybe stuff. I migrated my Waiting-For list to it also since it has a good list item support. Here's the highlight of it's features that relevant for my usage :
- Flexible views. You can see the items using several different layout : cards, list, custom. If you are an Evernote's user, you might find some visuals quite interesting compare to it, at least visually
- Notebook and Tagging organization
- Great iOS mobile client feature-wise although still quite buggy in term of stability
- Interesting collecting workflow. Saving books, movies and other stuff is actually fun
Comes Evernote to the rescue. I am not a newcomer with Evernote, it's just that somehow I prefer OneNote style of note-taking (on iMac I settle with Growly that has the closest workflow with OneNote) so I am not actively using it. I have been thinking about porting the note-taking business to the cloud though and it seems a good time to do so. Not much needed to say when related to cloud-based note app since currently Evernote is the de-facto standard. I need to adjust my system though since it only has limited notebook number allowed and the organization seems to center around tagging (I think I am gonna miss OneNote a lot due to this).
So, the serious note matters are on Evernote while Springpad note system currently only useful for basic notes for me. I might switch fully to Springpad if it has a comparable note feature (accross multiple device that is). Until then, having to switch between the two is bearable considering the usefulness.
Diposting oleh
Hafiz
di
Tuesday, January 08, 2013
0
komentar
Label: system
Thursday, December 06, 2012
Setup Cyrus IMAP account on Thunderbird
I connected to Cyrus-IMAP server using Thunderbird. There's some problems on the first try :
- All the folder reside under INBOX folder. Trying to move them up fails
- The sending does not work, always hang with the message box informing that it can not save to Sent folder
Below is how the dialog looks like :
Diposting oleh
Hafiz
di
Thursday, December 06, 2012
0
komentar
Label: system
Wednesday, December 05, 2012
Setup postfixadmin on top of existing postfix installation
My office mailserver was a result of migration sometime ago. It was done in a limited time at that time so I only migrated the needed data and setup to keep it running as soon as possible. So, stuff like postfixadmin was left out (the system is postfix+courier+sasl setup).
Until this recent time that I need to add the account that it started to bite me. Most of the setup guide for postfixadmin assume a pristine install where it generate the database from scratch which could possibly wipe out my existing installation. So, I need to follow them less linearly.
After some searching around, I settled using this article as a starting point. However, it's quite outdated (to the point the writer marked it oudated on a big font at the top of the page) but it prove useful in my case nonetheless. It also assume fresh install but it define the steps more clearly including some behind the scene matters that happen which help me make some workaround for my specific case.
So, here's the summary (some silly-but-useful trial and errors and mistakes omitted) on what I did :
- Backup like crazy. It's a live system after all and one can not be too careful
- Download and install the .deb package from postfixadmin site : dpkg -i postfixadmin*.deb. Saying no when asked for auto setup apache and database.
- Add apache setting : make symbolic link on /etc/apache2/conf.d/postfixadmin to /etc/postfixadmin/apache.conf
- Add setting for the existing postfix database to /etc/postfixadmin/config.inc.php along with other settings there
- I couldn't find the admin account for it and find the solution to reset it here. Here's what I did on my case :
- Installed dovecot-common package since I used courier instead of dovecot. It is needed to get access to dovecotpw utility
- run : dovecotpw -s MD5-CRYPT -p password | sed 's/{MD5-CRYPT}//'
- update the admin account (it's on admin table of postfix db) with the above result
Diposting oleh
Hafiz
di
Wednesday, December 05, 2012
0
komentar
Wednesday, November 14, 2012
Multiple Monitor Setup : 2 +1
It is quite the norm now to use multiple monitor setup for software development. It used to be that dual monitor setup is quite hot but now three monitor is already quite common. However, I find it better to have 2 + 1 setup instead of going to 3 monitor setup (with "+ 1" being a screen of another device ).
I have only certain space at one time (not to mention attention) and with several devices and gadgets I use, they all have to battle for the space in my workspace. So, I set aside one side for secondary device instead of third monitor. I find it more useful this way since I have more flexibility with the third space which I can use for Laptop, Tablet or even Books when needed. Also, if I want to breath a little I can just clear it up (or have there a snack, tea or whatever).
Below is my current workspace following the above setup.
With the above setup, I have quite generous leftover space as below.
As you might see, there is still some space free for support stuff. That is PS3 on the far corner for those stressful times :), connected to the secondary monitor (Dell monitor) that has comfortable source auto-switch.
And here's my Windows workspace which has the blank right space to be used for the +1 as the above setup i.e: for non-desktop devices.
As you might notice, I am generally a desktop guy. I don't like working on laptop so much (at least for major development work) unless I really need to.
I find the +1 screen can function as third monitor quite easily e.g: opening references, utilities and even with more flexibility. The downside is that it has no direct computing connection to the main machine which break a flow a little compare to having the keyboard and mouse interacting with the integrated three screen. This can be helped a little using stuff like cloud, file sharing, bonjour protocol, etc.
Diposting oleh
Hafiz
di
Wednesday, November 14, 2012
0
komentar
Label: system
Tuesday, October 23, 2012
Integrating Personal Information Manager accross Devices
I like to have integrated Personal Information Manager (Calendar, Task, Contacts, Notes, Files) across my devices. It just does not make sense for me to have different set of tasks, calendar, contacts, etc.. on different devices that I used.
On the pre-Cloud days I used BirdieSync at the core of my synching (I am a happy Thunderbird user). It worked well until I updated my mobile ecosystem to Apple (iPhone and iPad). It was the time when I switched my system to Cloud-based since trying to keep device-to-device synching was no longer practical. So, below are my current setup in general.
Backend : Google, Toodledo and Dropbox
After some searching I settle with Google, Toodledo and Dropbox as backend :- Google : Calendar, Contacts, Email
- Toodledo : Task, Support Notes
- Dropbox : Files
Desktop : Thunderbird+Lightning and Addons
On the desktop I manged to have one conveniently integrated setup below- Thunderbird + Lightning Calendar Addon. I only used the calendar on Lightning since the task on Toodledo does not support bidirectional synching to it
- There are Google Providers Addon that helps sync contact and calendar with Thunderbird
- For Toodledo, I mount it to Thunderbird using WepApp Tabs Addon
Mobile : Pocket Informant, Toodledo App
It's quite flexible on the mobile side these days since lot of various options available to connect to the above backends. Here are just the highlights of what I used currently
- Pocket Informant. It synched all calendar, task, contacts and notes to Google and Toodledo, so it's almost a one-stop solution for it
- Dropbox client. The mobile version support file viewing to some extent.
Having a reliably integrated Information Manager is essential to have us really using it. Otherwise, on this time of multiple devices, we'll just play around with the system on the beginning and potentially discard it later on when the data become scattered and unusable.
I find the above setup working for me personally. You might find other setup more align with your usage and the level of integration that you think is acceptable.
Diposting oleh
Hafiz
di
Tuesday, October 23, 2012
0
komentar
Label: system
Tuesday, October 16, 2012
How to speed up Code-Build-Test cycle on Android Development
I find that without serious tweaking, Android Emulator can be quite a pain to work with. It's slowness can disturb Code-Build-Test cycle significantly and it accumulates on each cycle wasting some precious development time and not to mention breaking the thinking and work flow.
Here's some tweaks that I find helpful to minimize the problem and make the development flow comfortable again :
- Configure Hadware Acceleration for emulator to the best that your machine can support. Follow the guide to Setup hardware acceleration Android's developer site. Using it accelerate the Graphic and Virtual Machine
- Increase the RAM of emulator
- Minimize the builtin data size of the app. If there's a lot of multimedia files, find a way to just use only small subset of it while developing. The bigger the data the app has, the longer it took to port the app from the development system to emulator which would be bad when happen hundreds time a day
Diposting oleh
Hafiz
di
Tuesday, October 16, 2012
0
komentar
Tuesday, October 02, 2012
Storage and Reader/Player App on iOS for File-Centric Usage
I was a happy Windows Mobile user back in the day and I like how I can access it somehow just like another storage system. The system can be used more as File-Centric system rather than App-Centric like the recent mobile system.
This feature can be quite useful sometime e.g: bring file when in a hurry to read/play on the go or copy somewhere else later. I missed this kind of use case when started to use iPhone where it has sand boxed model for the App and the only way to interact with the app and storage is through limited iTunes storage model (which is not quite intuitive nor practical at times).
Thus, my search for a good storage-related app started. Along the way I find that the apps I found also feature built-in reader and player. This is quite interesting since this makes it a self-sufficient subsystem in itself beyond just a mere storage app and it fits with my needs mentioned above.
So, here's some of the apps that I used right now :
- File Explorer (Universal). This is the most complete in term of feature that I know of. What I really like is how it can access Samba share and Play directly (without copying) many formats that iOS does not support natively. It has great reader/player functionality but from the feel of it took more of Storage first, Reader/Player second approach.
- Good Reader (iPad). I needed more advanced PDF reader for my iPad than the built-in one, so I bought this. It turns out it could function as a storage app too and in fact many people use it as such. It's reader first app though with a good general-purpose storage facility.
- ReaddleDocs (iPhone). I got this when it goes on sale (free) but despite it's price at that time it is a very good app. It's rival Good Reader for reading feature although for PDF reading, good reader has much more sophisticated feature. However, the interesting aspect of this app is how beautiful the built-in reader/player is. It complement my usage of File Explorer above.
Diposting oleh
Hafiz
di
Tuesday, October 02, 2012
0
komentar
Friday, September 28, 2012
Getting Started with Android Development
Recently I had project to build Android App. So, here's some notes on starting out with Android Development.
Development Environment
First things first, the development environment setup. I look up for a good IDE to work with Android and it seems Eclipse is de-facto standard so it's not a hard choice. However, choosing which package of Eclipse to download is overwhelming and there does not seem to be a good convention for it around the net. I decided to got with "Eclipse for Mobile Developers" since it has "Mobile" word in it and from the package description it seems light enough. So far, I think it's a good choice and I don't have any serious problem with it.The next step is installing Android Development Tool from Eclipse's built-in marketplace. It's a breeze though since the installation process from the marketplace took care of almost anything needed. It setting up the brand new Eclipse install into an environment ready for Android App development including including Emulator, Debugger, etc. The only thing I need to do is checking up some license agreement and clicking next.
Not all is rosy though. As I start testing making the first app...
First App and Emulator Issue
My first test code does not run and it turns out I had to install system image first. I installed through Android SDK Manager and after it the "Hello World" app finally ran.The default emulator setup is quite slow though so you need to tweak it in AVD Manager, adding GPU, storage and stuff to to the virtual device accomodate the testing better. It ran very well afterwards.
The Development Resources
For development resources, Android Developers page is quite indispensable. That and some googling (which many times point me to Stack Overflow discussion) is pretty much what I need to get things done so far.Also, along the way I find a nice little xml-serialization/object-mapping library called Simple (a pretty simple name :) ). It's java-based but the binary already compatible for the use in Android development. I haves used it since and it rocks!, no need to deal with xml parser if I don't really really have to.
It's been a pretty nice experience of developing on Android. I probably starting out when many parts of the development has quite mature so it flows quite nicely. Also, Eclipse is a great IDE and very helpful. It's a little on the "heavy" side but still very usable and has tons of useful features which make it's heaviness issue negligible.
Diposting oleh
Hafiz
di
Friday, September 28, 2012
0
komentar
Tuesday, September 18, 2012
iOS Getting Started notes
Below are some Apple references materials that I follow when starting out iphone dev sometime ago. It's more or less in order of reading from the introductory/basic to specific :
- IOS First App. Useful to get the feel of the overall development.
- Objective-C Programming Language
- Cocoa Fundamental Guide. Explore the main/core Framework being used in iOS development.
- iOS App Programing Guide. Discuss things like how the program actually execute on the device and how it relate to the code.
- Tools Workflow Guide for iOS. Discuss things like the deployment to device, testing, etc..
- XCode4 User Guide, Getting familiar more with the IDE would help a lot in day to day programming
- iOS Human Interface Guidelines. Some guidelines on GUI component usage and conventions.
Diposting oleh
Hafiz
di
Tuesday, September 18, 2012
0
komentar
Sunday, September 09, 2012
Exploring guitar sounds : AmpKit and Korg AX1500G
My current effect is Korg AX1500G. It's an old but dependable multi effects and you can do tons of combination of sounds within ranging from the practical one to weird, alien sounding noise. So, naturally, I did some comparison with it, while testing Ampkit Link (with AmpKit App). There is already a lot of review about these products though, so you'll be well-served by googling about them and I don't think I can add any new things.
I didn't have a concrete picture initiallny on what to use the AmpKit for. It's more of a curiosity and sounds like an interesting to play with. After all, the AX1500G, with my already scarce spare time, still waited to be explored and used more (it's been gathering quite a lot of dust recently).
It turns out that the sound that comes from AmpKit is quite nice. There is also a lot of tools and settings to play with. I played around with recording, background track, SoundCloud integration. Below is the result of doodling around with it. Be warned though, it's pretty monotone, amateurish stuff :) :
All around I am happy with it and hope to explore more of it. There's also additional purchasable effects which seems interesting to play around with. I figure it would be useful as a mobile, instant effects to replace bringing a big and heavy one. What I need is just the Ampkit Link and the iPhone, which I usually bring anyway.
Diposting oleh
Hafiz
di
Sunday, September 09, 2012
0
komentar
Label: music
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.
Diposting oleh
Hafiz
di
Tuesday, August 07, 2012
2
komentar
Label: system
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 :
- 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
Diposting oleh
Hafiz
di
Monday, July 30, 2012
0
komentar
Label: coding
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]/
Diposting oleh
Hafiz
di
Monday, July 30, 2012
0
komentar
Label: coding
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
Diposting oleh
Hafiz
di
Tuesday, July 10, 2012
0
komentar
Label: system
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.
Diposting oleh
Hafiz
di
Monday, April 23, 2012
0
komentar
Label: system
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.
Diposting oleh
Hafiz
di
Wednesday, April 18, 2012
3
komentar
Label: coding
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.
Diposting oleh
Hafiz
di
Monday, April 16, 2012
0
komentar
Label: system
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.
So far, I enjoy the new systems and it brings many fresh views, new approach and utilities.
Diposting oleh
Hafiz
di
Thursday, April 12, 2012
0
komentar
Label: system