Alfred Alternative For Windows

Have been using Alfred primarily for “any” search in macOS, and found Listary for Windows.

 

Yet, Another RSS Feed Reader RIP

I use it almost everyday and it shuts down after Google reader and Paper…. Phew…
Whats next ? let’s rock Feedly (finger crossed).

 

The iPhone ‘iPhone’ could not be restored. An unknown error occurred

To restore iPhone with IOS firmware (IPSW) in recovery mode, but facing error as per title, may try to comment “gs.apple.com” in hosts file as image below:

 

 

 

Resource from: https://support.apple.com/en-my/HT201442

 

Java 8 File to String in One Line

 

 

Pragmatic Java Application Test

Has been a while, I was thinking to blog this out but “lazy” bugs keep biting me 🙁 so I didn’t manage to do it. Until yesterday, I was looking for some related info but I hardly recall what I did previously. Phew… so decided to jot down here.

Typically software application should at least perform 2 types of automate tests which are unit test and integration test. For me… the distinction between these two are pretty straight forward:

Unit Test Integration Test
Test on smallest unit of application such as method / function Test on combination of few units in application to prove they run nicely with external resource (if there is any)
Cheap to run, fast to run (normally less than a minute) Slower compared with unit test (normally few minutes or more)
NOT depends on external resources such as database, third party services, disk access Normally involve database, disk access, other services
Mock the input of unit test if necessary Use the real service / resource
Maven Plugin Usage
Class name normally suffix with “Test”, for eg: TaxCalculatorTest (Maven Surefire plugin automatically include these wildcard patterns) Class name normally suffix with “IT”, for eg: TaxCalculationServiceIT (Maven Failsafe plugin automatically include these wildcard patterns)
Using Maven Surefire Plugin Using Maven Failsafe Plugin
Run during “test” phase in default Maven lifecycle Run during “integration-test” phase in default Maven lifecycle
Minimal sample Maven configuration:
Minimal sample Maven configuration:
Command to execute:
Command to execute:
Report generated in <PROJECT>/target/surefire-reports Report generated in <PROJECT>/target/failsafe-reports

By viewing the status report generated by surefire & failsafe plugin doesn’t create much insight, but we can make use of Jacoco plugin to create code coverage report as below.
Here are minimal sample Maven configuration for Jacoco:

Jacoco coverage reports generated at <PROJECT>/target/site/* when we run mvn verify (bind to maven verify phase). To view the coverage reports, simply open <PROJECT>/target/site/jacoco/index.html with browser.

Yay ! we have now cover first part of test (automate unit + integration test), and if you notice, we done all steps manually (run maven command, open report from target folder) just to get the report display.

Moreover, we just able to view the coverage report locally, how if we want to share with other team members or to make it public accessible.
And…….. How can we automate the whole process ?

Da.. Dang !! We have Jenkins (Continuous Integration) + SonarQube (Continuous Code Quality Inspection) to help us 🙂

Setting up Jenkins is pretty straight forward, just follow steps from Jenkins Guided Tour or Installing Jenkins. We should able to see something as below if Jenkins setup successfully and  launch in browser.
Let’s continue with SonarQube setup by following “Get Started in Two Minutes” guide from it’s official site. And if nothing goes wrong, we should able to bring up SonarQube console via browser as below:
Until this stage, you might feel a little tired or sleepy, it’s okie to refresh yourself with a cup of coffee 🙂

To allow Jenkins to work with SonarQube, we might need a little setup as below.

  1. Install SonarQube Scanner for Jenkins.
  2. Generate authentication token from SonarQube and store it somewhere as steps below for subsequent Jenkins configuration use.
  3. Goto Manage Jenkins –> Configure System, There should have SonarQube configuration module available.
    Just configure it by click on Add SonarQube, and fill in necessary information (sample below), then Save it.
  4. After setting up Jenkins – SonarQube, the next step is to add a Post Build Steps (SonarQube Scanner) for your Jenkins job as below:
    Note: Sample analysis parameter added above are very minimal, refer Analysis Parameter or Code Coverage by Unit Tests for Java Project for more parameter available.
  5. Rerun your Jenkins job after configuration, and you will see the analysis report generated in SonarQube as below.
  6. Yay !!!! We can now have beautiful test coverage report generate upon each code commit (of course, we need to configure Jenkins job to trigger build on each code commit to make these “magic” happen).
 

Software Architecture Patterns

Thanks Oreilly for the free eBook.

Read the description or download the eBook here.

 

Flash ZTE Blade Q Lux

Trying to flash my niece’s phone with other rom which hope to have light weight OS, but no luck and end up with infinite boot screen load 🙁

Google around but also no luck to get any useful info (at least for this model of phone), some people sharing to use SP Flash,  any other alternative which doesn’t work for my case too. End up I found the solution from ZTE site, which is to download the original rom and flash it…. phew….

  1. Download original rom from ZTE support or here.
  2. Copy into sd card (FAT32) formatted.
  3. Boot your phone into recovery mode by pressing Volume Up + Power key.
  4. Press Power key again once you are in recovery mode to enter menu selection mode.
  5.  Press Volume Down key to select the menu and Volume Up key to enter.
    (Recommend to wipe data/factory reset before apply update from sd card)
  6. Done!

file_007 file_001 file_003 file_004 file_005 file_006file_000

 

 

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 🙂

 

 

Convert SVG Into Data URI

svg-datauri

Playground available @ Plunker.
Resource: canvg, HTMLCanvasElement

Note: If your browser does not able to launch the Plunker sample, it might due to back-ticks (`)  which I’m using for svg string concatenation, it’s ES6 feature and some browser does not support yet. Replace your properly formatted svg will do 🙂