Posted in Uncategorized

[Mobile App] ETL Free -App for English testing

android_logo

A BIG update is available now. Have fun with new UI 🙂

Android: https://play.google.com/store/apps/details?id=com.ionicframework.kogaapp922977&hl=en

Advertisements
Posted in Uncategorized

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

java_logo_100

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())
{
containedUrls.add(text.substring(urlMatcher.start(0),
urlMatcher.end(0)));
}

return containedUrls;
}

Above Regular Express only detect which word contain URL(s) such as: “<www.google.com<>>>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

Example:

Hope it help 🙂

Posted in Uncategorized

[Cordova] How to preview PDF file inside Cordova project

cordova_logo

Hi all, I faced this challenge for my tasks list. After searching a lot on Internet with various solutions:

  • Using InAppBrower: this plugin can open PDF for preview but it will open a certain PDF reader application on device not inside our Cordova project
  • PDFObject: hmmm, I tried use it but I faced compile error about import it into my project, I did not fix that issue because of time limitation.

Finally, I found the solution which solved my challenge 🙂 (it saved my life 🙂 ).

Below is result:

screenshot_2016-10-18-14-25-43

About the detail, please follow steps of the “example” at my github

I preferred that solution at sayanee’s github. Thank him very much 🙂

You also install that plugin by npm (Ref detail at here):

npm install angular-pdf

Hope it is helpful 🙂