Posted in Tips

[Tips] Helpful commands for OS

  • MAC
  1. Find IP: ifconfig | grep ‘inet
  2. Go to /usr/local folder:

Method 1: From the Terminal, type “open -a Finder /usr/local/bin”.

Method 2: From Finder’s “Go” menu, select “Go to folder…”. That’ll bring up a window in which you can type “/usr/local/bin”.


  • Window
  1. Find IP: ipconfig
  2. OS info: dxdiag



Posted in Frameworks, Java

FFmpeg – A complete, cross-platform solution to record, convert and stream audio and video.


Nowaday, the Audio and Video are so popular. As a developer, you have many works to process them such as record, convert, stream, etc.

Actually, if you are an Java-er, C#-er, etc, it is really difficult to find the way to do that with pure language programming.

Today, I want to introduce one powerful ‘tool’ which can do these tasks quickly. It is FFMPEG.

FFMPEG is a complete, cross-platform solution to record, convert and stream audio and video. After using it, I found that converting video and audio has never been so easy ! You only use commands and option which are supported, only one line command ! Wow

Please find detail at below website:

Look at below commant to converting a .mp4 file to .avi file:

ffmpeg -i input.mp4 output.avi

Run it and Done ! You have a AVI file. How it is easy !

Because the FFMPEG is a cross-platform, so you can use it in any popular OS today such as Window, Linux, MAC OS, etc.

Beside running pure FFMPEG command directly, you can use it in your project using Java, C#, etc.

For Java, you only define a certain FFMPEG command and run it using Process object like below code:

String exeCommand = “ffmpeg -i your_input_file your_output_file”

// Run FFMPEG command
Process process = Runtime.getRuntime().exec(exeCommand);

Done. You can find the demo JAVA code using FFMPEG at Github here.

Share this topic if it is helpful 🙂

Thank you


Posted in Java

[Java] Java instruction for Beginner.


Hi Java beginner :), if you are a Java newcomer, I think you will have many questions such as: where should I begin ? How to learn Java ? Where are good Java lession ? etc.

So, I will list some items from low to high for you. They are tools, forums, framework, design, etc. I will update this topic with new other items day-by-day and I hope it can help you :). Ok, let start:

  1. IDE tool for Java programming: eclipse, Netbean, (I like using Eclipse than Netbean 🙂 )
  2. Java Forums: java_on_stackoverflow
  3. Helpful Java frameworks: JavaFX, Springs, Hibernate, etc
  4. OO Design:
  5. Basic Java tutorial:

Share this topic if it is helpful 🙂

Posted in Cloud, JavaScript

[Cloud] Kii Cloud – helpfull script Server Code


Kii Cloud is one of powerful cloud for developer. It provides a helpful data storage solution. So, the developer donot need to care the way store data.

The Kii Cloud also provide one strong feature that is Server Code. When you create a new project on Kii cloud, a Server Code for that project is created. You can make your own Server Code then deploy it to your project. I worked with Server Code for some projects, I used it to create triggers, scheduler, etc.

For example: you can create a trigger for a certain record which is inserted into one bucket (table), then Server Code will call your trigger function to do something automatically.

For Server Code implementation, please refer this guide

I created some useful script (for Window system) to help working on Server Code more convenient. I hope it is helpful for person who work on Server Code of Kii Cloud.

The script for Window system has 3 main part:

Part 1: define configuration for Kii project:

set kiiDeveloperLogFodder=%cd%\Kii_Logger
set KiiLogFile=”D:\KiiLogFile.txt”
set ServerCodeFilePath=”D:\your_server_code_path\servercode.js”
set HookConfigFilePath=”D:\your_hookConfig_path\hookConfig\hookConfig.json”

echo %kiiDeveloperLogFodder%

del %KiiLogFile%

set APP_ID=your_app_id
set APP_KEY=your_app_key
set CLIENT_ID=your_client_id
set CLIENT_SECRET=your_client_secret

set KiiSite=jp
set dateFrom=2015-11-18
set dateTo=2018-11-18
set codeVersion=your_code_version
set userId=your_user_id

set expectedLogLinesNumber=1500

set appKeys=–site %KiiSite% –app-id %APP_ID% –app-key %APP_KEY% –client-id %CLIENT_ID% –client-secret %CLIENT_SECRET%
set fromDateToDate=–date-from %dateFrom% –date-to %dateTo%
set userIdCommand=–user-id %userId%
set expectedLogLinesCommand=–num %expectedLogLinesNumber%
set infoLevelCommand=–level INFO
set debugLevelCommand=–level DEBUG
set errorLevelCommand=–level ERROR

Part 2: define Option for each script

set option_1=”Get Kii log”
set option_2=”Deploy Server Code”
set option_3=”List the Available Versions”
set option_4=”Get your Server Code”
set option_5=”Get Server Hook Config File”
set option_6=”List Server Code Execution Results”
set option_7=”Get the Detailed Execution Result”
set option_8=”NA”
set option_9=”NA”

ECHO 1) %option_1%
ECHO 2) %option_2%
ECHO 3) %option_3%
ECHO 4) %option_4%
ECHO 5) %option_5%
ECHO 6) %option_6%
ECHO 7) %option_7%
ECHO 8) %option_8%
ECHO 9) %option_9%


CHOICE /C 123456789 /M “Enter your choice:”

:: Note – list ERRORLEVELS in decreasing order

Part 3: define script contents to run for options which are defined at Part 2

ECHO %option_1%
rem Get Kii log
node bin/kii-logs.js -t %appKeys% > %KiiLogFile%

ECHO %option_2%
rem Deploy Server Code ==> Make sure that you update 2 files: KiiServerCode/servercode.js & KiiHookConfig/hookConfig.json
node bin/kii-servercode.js deploy-file –file ../KiiServerCode/servercode.js %appKeys% –hook-config ../KiiHookConfig/hookConfig.json



PS: You also find full of scripts from my Github at KiiCloudServerCodeScript (Remember read README file before running scripts)

Share this topic if it is helpful 🙂


Posted in Uncategorized

[Java] Regular Express for URLs detection in a sentence.


Regular Express is very great. It helps us a lot in cases of filtering string which we expect. In this section, I want to introduce once case using Regex, that is detecting URL links in a sentence.

To detect valid URLs which start with “www.”, “http” and “https” in a sentence, you can use below Regular Express:

public List<String> extractUrls(String text)
List<String> containedUrls = new ArrayList<String>();

// String urlRegex = “((https?|ftp|gopher|telnet|file):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)”;
String urlRegex =
+ “(”
+ “((https?|ftp|gopher|telnet|file):((//)|(\\\\)))” // URLs starting with http://, https://, or ftp://
+ “|”
+ “(^|[^\\/])(www\\.)” // URLs starting with “www.” (without // before it, or it’d re-link the ones done above).
+ “)”
+ “+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*”
+ “)”;
Pattern pattern = Pattern.compile(urlRegex, Pattern.CASE_INSENSITIVE);

Matcher urlMatcher = pattern.matcher(text);
while (urlMatcher.find())

return containedUrls;

Above Regular Express only detect which word contain URL(s) such as: “<<>>>aaa”, etc. So, to remove unexpected other words, you can modify code to do that.

Please refer my_demo to remove unexpected words after filtering using Regular Express


Hope it help 🙂

Posted in JavaScript

[Javascript] Regular Express for URL and Email detection in a sentence.


There are many ways to detect URL(s) in a sentence:

  • Use validUrl lib: Refer detail at here

This lib has a disadvantage that is it can analyze a URL is valid or not. It means if you put that URL in a sentence such as “Hello site !”, it cannot detect the URL

  • Use below Regular Express:
function linkify(inputText) {
    var replacedText, replacePattern1, replacePattern2, replacePattern3;

    //URLs starting with http://, https://, or ftp://
    replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
    replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');

    //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
    replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
    replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');

    //Change email addresses to mailto:: links.
    replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;
    replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');

    return replacedText;

Using above Regular Express, you can detect URL(s) as well as Email(s) in a sentence. You can modify this Regular Express for your jobs :).

You can refer detail of Regular Express guide at here

Like and Share if it is helpful 🙂

Posted in Cordova/PhoneGap

[Cordova] Display Onsen UI popover as dropdown

It is very easy to display an Onsen UI popover as dropdown.

For full example, please refer here

Below is detail of code to display popover using Onsen UI

  • HTML
<body ng-controller="DropdownController">
Dropdown example
</ons-toolbar> </ons-page> <ons-template id="popover.html"> <ons-popover cancelable direction="down"> <ons-list> <ons-list-item ng-repeat="option in options" modifier="tappable"> {{ option }} </ons-list-item> </ons-list> </ons-popover> </ons-template> </body>
  • JS
.controller('DropdownController', function($scope) {
  ons.ready(function() {
    ons.createPopover('popover.html').then(function(popover) {
      $scope.popover = popover;

  $scope.options = ['Load', 'Sync', 'Settings'];
Posted in Mobile_Tips, Useful Apps

[App] JLT Free – Mobile app provide a huge of Japanese tests for learners



JLT – Japanese Language Test is a Mobile application which provide a lot of Test data for learner on N1, N2, N3, N4, N5 levels.

–          It is FREE

–          Easy to use, UI is very friendly.

–          It provice a lot of Japanese tests.

–          Test Result Analysis is clear.

–          Daily update.

How to download for Android ?

–          Way 1: Open “Google Play” on your mobile and search “JLT Free”, then install it.

–          Way 2: Get it from link: