Posts by Year

2020

Tracing PWA new content refresh event

less than 1 minute read

I was using this wrapper around PWA(Progress Web Apps) APIs register-service-worker and was wondering how does it detect when there is a new build and the pa...

Back to Top ↑

2019

Back to Top ↑

2018

Back to Top ↑

2017

Back to Top ↑

2016

Re read inputstream in java

less than 1 minute read

Sometimes in java you get an inputstream, you need to process it the first time to process the data then you need it again to output the contents. To do thi...

Set the base url for jsp

less than 1 minute read

Sometimes when you’re working on jsp pages and you need to set a base url for all pages, and this value needs to be available for use, then use the followin...

How to generate certificate for apache2

less than 1 minute read

If you need to setup ssl (‘https’) connections to your apache2 webserver then use the following steps. sudo mkdir /etc/apache2/ssl sudo openssl req -x509...

How to add gcm messaging to your app

1 minute read

If you tried the gcm playground and it does not work then try gcm quickstart tutorial. git clone https://github.com/googlesamples/google-services.git You ...

Basic Maven Commands Part 3

less than 1 minute read

use jetty to run program To use the Jetty Plugin just add the following in your pom.xml: <project> ... <build> <plugins> &l...

Adding search to your blog

less than 1 minute read

How to add search to blog goto www.google.com/cse google custom search engine add your website do verification, put google html onto your website, c...

Basic Maven Commands Part 2

less than 1 minute read

Here are some basic maven commands for setting up your project: JavaWebapp mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=co...

Installing libav on Ubuntu 14.04 Trusty

4 minute read

Requirement: Got a video that was encoded using HEVC, couldn’t play it on my device so have to convert it to mpeg4. The tool ffmpeg was replaced in previous...

Java 6 7 8 features

less than 1 minute read

Java SE 6 Support for web services JSR 224 - Java API for XML-Based Web Services (JAX-WS) 2.0 Support for scripting languages JSR 223 - Scripting for the J...

Java Template pattern

less than 1 minute read

The Template pattern formalizes the idea of defining an algorithm in a class, but leaving some of the details to be implemented in subclasses. Reasons for ...

Java Observer pattern

less than 1 minute read

Observer pattern - one subject many observers, state changes in the subject must be notified to all observers. Observers first register with the subject, on...

Java Overriding vs Overloading

less than 1 minute read

Method overloading, is when method with same name co-exists in same class but they must have different method signature. Method overloading is done via ...

Java String StringBuffer StringBuilder

less than 1 minute read

String is immutable StringBuffer and StringBuilder is mutable StringBuffer is synchronized thread safe. StringBuilder is not thread safe but operation is fa...

Basic Maven Commands

less than 1 minute read

maven commands to run program mvn exec:java -Dexec.mainClass="com.example.Main" maven commands to run program with args mvn exec:java -Dexec.mainClass="c...

Key changes in Java 8

1 minute read

Here are some new features inside Java 8 Lambda expressions - provides the ability to pass code as data to methods ... public static void main(String[] a...

How to build owncloud android version

less than 1 minute read

To build owncloud android you need a JDK and the Android SDK Start the SDK Manager and make sure to install the API 19 and API 23 platform and the SDK Buil...

Create project site for github repo

less than 1 minute read

If you want to create github project sites follow the instructions as Github Pages. Create your project repository. Add files to repository Push cha...

Add comments and analytics to github blog

less than 1 minute read

After investigating different comment system Comment System Comparison decided to use Disqus. To use apply for account then setup website, use the website ...

AngularJS project to call RESTful service

less than 1 minute read

Trying to modify an angularjs dashboard app angular-material-dashboard to use the RESTful ContactService. This is a node.js program so requirements are: N...

Change github blog to jekyll bootstrap

less than 1 minute read

Trying out Jekyll Bootstrap because it contains comments, categories and other utilities such as analytics. Came across some problems with this plugin, it ...

Spring Framework ViewResolver

less than 1 minute read

My spring project needed to have two access points http://localhost:8080/springwebapp/ and http://localhost:8080/springwebapp/contact/jsonlist.json one for w...

Openshift project

1 minute read

In order to support my android project I needed a backend. Chose openshift because it is free, have login capabilities and can run jboss. First go through th...

Android studio - Android project

less than 1 minute read

Starting an android project to call some webservices. Using android studio 2.0. Android studio will install the android sdk for you but if you have already a...

Github does not support pygments

less than 1 minute read

If you are blogging using github and are using syntax highlighting then watch out for this. Github does not support pygments anymore. You will get this emai...

Blogger to Jekyll

less than 1 minute read

I wanted to see if it was possible to import blogger posts into github blog. Found this tool that makes it simple to do so: jekyll-import Instructions: i...

Back to Top ↑

2015

Jekyll Syntax Highlighting Example Part 2

less than 1 minute read

The page.title is included in the layout template. To check out how to do syntax highlighting see the source for this file RAW. This is an example of synta...

Jekyll Syntax Highlighting Example Part 1

less than 1 minute read

The page.title is included in the layout template. This is an example of syntax highlighting. Github does not support rouge so have to change to Pygments. ...

Back to Top ↑

2014

Code formatter for blogspot

less than 1 minute read

Three solutions1. Use online code formatter http://codeformatter.blogspot.tw/ copy code to there translate then copy the results into code formatter.2. Use j...

Back to Top ↑

2013

Maven dependency management

less than 1 minute read

Maven dependency management Scenario: jar file from repository not in the format you want. <pre style="background-color: #eeeeee; border: 1px dashed rgb(1...

Back to Top ↑

2012

Back to Top ↑

2011

Spring webservices part 2 jax-ws example

2 minute read

This is a simple example of webservices using jax-ws spring component.It is a contact application that allows you to store your addresses.The webservice retr...

Spring webservices example part 1

3 minute read

This is a blog on how I implemented webservices using the spring framework.In part 1 we setup a simple spring web application. A simple contactapplication wh...

Constant Improvement

less than 1 minute read

Must have constant improvement.Go over each topic.Create examples for each topic.Doesn’t matter if it takes time, that is what improvement means.

Back to Top ↑

2010

Batch programming getting the date

less than 1 minute read

How to get the date in bat? Windows XP.for /f “tokens=1-4 delims=/ “ %%a in (‘date /t’) do (set year=%%a& set month=%%b& set day=%%c& set weekd...

Back to Top ↑

2009

How to link wireless to nas

less than 1 minute read

How to link wireless to nas?What are the different ways to connect wireless router to nas securely?use vpn? or just configure passwords?Things done:setup web...

The things a company must have’s

less than 1 minute read

Must have:basic encryption and decryption algorithms utils available for company to use.study md5, des and encryption providers.

Bad way of doing things

less than 1 minute read

Things NOT to do:how not to do thingsdon’t just do, confirm the requirements in writing before implementing.reduce the risk of customers saying i didn’t ask ...

Java toolkit

less than 1 minute read

If you want to use the image manipulation toolkit included with the JDK.when using this in eclipse:Image image = Toolkit.getDefaultToolkit().getImage(“tray.g...

Setting up netbeans 6.7.1

less than 1 minute read

<ul><li>install jdk 1.6.0_13</li><li>install netbeans 6.7.1 with java web capabilities and install glassfish to /sun/AppServer</li...

What is web 2.0

less than 1 minute read

web 1.0 people just put their static information on the webweb 1.5 some interactivity mainly online shoppingweb 2.0 is all about interactivity and communicat...

OOP composition vs inheritance

less than 1 minute read

favour composition over inheritance. even though you have common code in the base class and child classes uses those methods it is better to move those com...

Apache httpd configuration

less than 1 minute read

Alias /pds /packaging/sun/pds <directory packaging="" pds="" sun=""> Options Indexes Order allow,deny Allow from all </directory> Make changes ...

Java pattern matching

less than 1 minute read

case insensitive search for a string      Properties properties = System.getProperties();      properties.list(System.out);      String osname = (String)pr...

Unix solaris commands

less than 1 minute read

Use prstat to see the Processes and CPU loadUse vmstat 2 2 to indicate the free memoryUse iostat to see internal disksUse netstat to see network infoUse mpst...

The Template Method

less than 1 minute read

use template method when you need a base class to contain a certain behaviour with some base algorithms while having the subclasses implement those other b...

Patterns delegation

less than 1 minute read

use delegation when you need an object to contain behaviour of two other objects containing the same methods.some object pretending to be another object but...

Patterns abstract factory

1 minute read

use abstract factory if you need platform independence, for example if you have an api that creates buttons and you need to modify the library so that you ...

Apache virtualhost mod_proxy example

less than 1 minute read

How to setup a virtualhost in Apache for example same ip apache 80 port -> tomcat 8080 port (use reverse proxy) apache 19080 port -> tomcat 9080 port(...

Jboss mdb example

1 minute read

This is an example on writing a Message Driven Bean in JBossif you decide to use jboss as your application servercomponents usedjboss-4.0.5.GAeclipse 3.2xdo...

Programming struts redirect howto

less than 1 minute read

struts redirect howto different web contextswebappA sendredirect to webappBString url = response.encodeRedirectURL(“urlwithparameters”);System.out.println(“...

Apache httpd reverse proxy howto

less than 1 minute read

apache httpd reverse proxy settings howtoLoadModule proxy_module modules/mod_proxy.soLoadModule proxy_ajp_module modules/mod_proxy_ajp.soLoadModule proxy_ba...

Programming struts tags usage

less than 1 minute read

struts tags usageusing arraylist and mapsdefine in your action<pre>List urlName = new ArrayList();for (Iterator i = st.iterator(); i.hasNext();) {Str...

Programming java form base authentication

less than 1 minute read

add security-constraint, login-config, security-role into web.xml<security-constraint>        <display-name>securityconstraint</display-name...

Programming hibernate annotations example

1 minute read

Hibernate annotations - hibernate without the mapping filesnote: you must use jdk1.5, hibernate 3.2 core and annotationscreate hibernate.cfg.xml<pre st...

Struts invalidate session

less than 1 minute read

Create a struts action - LogoutAction.java<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;back...

Environment setup

less than 1 minute read

Must have a environment setup so that the company can run right.Must have a file server where commonly used files can be stored eg. slide templates.This ca...

Rules for Cleaning logs

less than 1 minute read

Clearing logs or file purging should be done at the systems level and not at the programming or applications level because cleaning logs or deleting files ...

LDAP getting the previous dn

less than 1 minute read

public static String getPreviousDN(String dn) { String retString = null; try { DirContext DirCtx = DriverLocator.getInstance().get...

Back to Top ↑