Java Runtime Class Reload

Some call it hot deploy, some refer to runtime class reload/redefine, but whatsoever….
It is just mechanism to reload compiled class file during jvm runtime, to avoid ordinary java development life cycle of “code change -> build -> deploy”, which will significantly save lot’s of wait time (especially when you have multiple modules dependency project).

Both open source project: HotSwapAgent and Spring-Loaded works pretty well for me, but if you are looking for commercial product, JRebel will be the choice.

 

Windows Multiple Tab Terminal

I have been using Cygwin quite sometime for my development task before ubuntu bash on Windows. Even Windows can group similar program into single task bar icon but open different type of console still occupying task bar spaces and most importantly, it doesn’t look nice since all of them are console for me.

non-multitab

so I use Console to manage it.

console2

Everything working fine except it cannot maximize by clicking on the top right maximize icon, until I found ConEmu which solve my problem and I’m start using it from now on. Of course maximize the windows is just one of the highlight here and many more configuration is available.

multitab-terminal

If you notice from the image, I open Ubuntu Bash, PowerShell, Cygwin, Git Bash and Command Prompt in different tab 🙂

 

 

Refused to get unsafe header “Content-Disposition”

Hit into this error when tying to get the “Content-Disposition” header using XMLHttpRequest.

Refused to get unsafe header "Content-Disposition"

Finally found the solution is to include CORS access control headers in HTTP response….

httpResponse.addHeader("Access-Control-Expose-Headers", "Content-Disposition");

Take note that it’s not Access-Control-Allow-Headers but Access-Control-Expose-Headers

Credit to this stackoverflow post.

 

Business Hour Format

I’m creating a form which allow user to key in multiple days of week with multiple operation hours.

I want the format to save as below, but I found it tedious to reformat for displaying using normal javascript. Look into lodash and found it very handy 🙂

[
  {"day":"Mo","hour":{"from":"10am", "to":"2pm"}},
  {"day":"Mo","hour":{"from":"3pm", "to":"9pm"}},
  {"day":"Th","hour":{"from":"10am", "to":"2pm"}},
  {"day":"Th","hour":{"from":"3pm", "to":"9pm"}},
  {"day":"We","hour":{"from":"10am", "to":"2pm"}},
  {"day":"We","hour":{"from":"4pm", "to":"10pm"}},
];

Format to display:

Mo, Th, We : 10am-2pm
Mo, Th : 3pm-9pm
We : 4pm-10pm

Plunker here

Reference: schema.org

 

My New Gadget – Pine64

img_5615.jpg
Here is how I did to install the OS (using MacOS)

  1. Download image from Pine64.com or Pine64.org.
  2. Format your Micro SD card using Disk Utility.
    diskutil
  3. Launch terminal and list the available disk using diskutil command as below (we going to use disk2 base on the identifier):
    $ diskutil list
    /dev/disk0 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.3 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:          Apple_CoreStorage Macintosh HD            499.4 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1 (internal, virtual):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                  Apple_HFS Macintosh HD           +499.1 GB   disk1
                                     Logical Volume on disk0s2
                                     6D6E4910-AC62-4CC8-8F14-3A1227171470
                                     Unlocked Encrypted
    /dev/disk2 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *32.4 GB    disk2
       1:                 DOS_FAT_32 ROOT                    32.4 GB    disk2s1
  4. Unmount the disk.
    $ diskutil unmountDisk /dev/disk2
    Unmount of all volumes on disk2 was successful

     

  5. Unzip the downloaded image and burn the img file into disk.
    sudo dd if=/Users/dickson/Downloads/remix-v2.0-20160415-pine64-32GB.img of=/dev/disk2 bs=1m
    Password:

     

  6. Upon burning successfull, you will see the message as below:
    $ sudo dd if=/Users/dickson/Downloads/remix-v2.0-20160415-pine64-32GB.img of=/dev/disk2 bs=1m
    Password:
    30255+0 records in
    30255+0 records out
    31724666880 bytes transferred in 47100.051106 secs (673559 bytes/sec)
  7. Eject the disk if it still mounted.
    $ diskutil eject /dev/disk2
    Disk /dev/disk2 ejected

    p/s: For Windows user, you may format using Disk Management tool under [Control Panel\System and Security\Administrative Tools\Computer Management], and burn img file using Win32DiskImager. And if you feel the writing speed is too slow in MacOS, you may try using rdisk instead of disk, as they using different write mechanism.

    UPDATED : Just found this handy GUI tool etcher.io to burn image.

Credit to : rayhightower.com && www.hostvirtual.com && serenity.ee

 

Paper

Tap on the app icon, the news feed does not refresh as usual…

After Google Reader, this is second time “giant” kill my favorite apps for “reasons”. I feel upset as ordinary user, wonder how about mates who created Paper.

 

Reset Epson L210 Counter / Ink Out Error

Received the used printer from brother.

As usual, “free + old” stuff normally doesn’t works well without some tweak …. phew….. here we go.

First, fixed “Service required” which mentioned printer counter exceed (can’t recall the exact message)

Download the Epson adjustment program here and follow instruction here.

Second, fixed “Ink out error”

Follow instruction here to reset ink level.

Credit to : 
askindoprinter.blogspot.my
www.downloaddrivers.in

 

 

 

Disable WebView Application Being Pull Up and Down

I’ve created a hybrid app using Cordova, and notice I’m able to pull the header down and footer up, which lead to weird behaviour when using the app (at least I feel so).

Normal View

normal view

Pull Up

pull up

pull down

pull down

Adding single line of configuration in config.xml solve the issue. (pheeew… spend couple of hours to research this)

<preference name="DisallowOverscroll" value="true"/>
Reference: http://cordova.apache.org/docs/en/6.x/config_ref/index.html