How to blogs and code snippets - Summary

Building Jersey 2.x RESTful Web services in Servlet 3 container with Maven

Posted Monday June 20, 2016 16:02:28
Building Jersey 2.x RESTful Web services in Servlet 3 container with Maven

This is our implementation of Jersey 2.23.1 RESTful web services running on Tomcat 8's Servlet 3.1. It is our practice to write a blog as way to document a new feature available in our servers. We use NetBeans 8.1 for our IDE.


Continue reading

How to install letsencrypt SSL certificates for Nginx server block on Debian Jessie

Posted Tuesday April 26, 2016 14:25:54
Let's Encrypt

Let's Encrypt (letsencrypt) is a new Certificate Authority (CA) that provides an easy way to obtain and install free trusted TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, letsencrypt, that automate most, if not all of the required setup steps.


Continue reading

How to create a hidden service in the Tor network in Debian Jessie with Nginx

Posted Saturday April 23, 2016 23:13:57
Dark web - onion service

(This is for educational purposes only!)

With hidden service also known as "dark web", "dark net" or "deep web", it is possible for servers to hide their locations while offering various kinds of services. Users connect to these hidden services without knowing the network identity.


Continue reading

How to use and append data to Masonry in responsive jQueryMobile with JSF 2 and ajax

Posted Monday March 02, 2015 18:48:00

   Using Masonry in jQueryMobile with JSF 2 and Ajax
This is a demonstration on using Masonry, a grid layout JavaScript library, in a responsive JSF 2 page with jQueryMobile framework. This also shows how to do partial update, appending new grid items to Masonry by fetching additional data from the server via JSF <.f:ajax /> requests. The following assumes that you have included in a page the necessary jQuery, jQueryMobile, Masonry, and ImagesLoaded JavaScript and CSS files. This is based on MyFaces 2.2.3 JSF implementation, version 1.43 of jQueryMobile (JQM), and Masonry version 3.2.

As a demo please check out our Gallery page, it employs the same code as described here.


Continue reading

Install Tomcat 8 behind Nginx with Google PageSpeed in Debian Wheezy

Posted Saturday March 22, 2014 13:24:56

   How to install Tomcat 8 in Debian Wheezy
Here is a guide on how to configure Debian Wheezy with Tomcat 8 behind Nginx with Google PageSpeed. This is based on our recently configured Wheezy of similar setup. Below are the main components of this webserver installation.

  • Nginx with Google PageSpeed and some other Nginx modules
  • Tomcat 8 on Java 7
  • MySQL and phpMyAdmin on php5-fpm.
  • Debian Wheezy Linux server.


Continue reading

How to play a sound when an element is clicked in HTML page

Posted Saturday February 22, 2014 13:57:43

   How to play a sound when an element is clicked in HTML page
In this example we will demonstrate how to play a "click" sound when a link or other element is clicked in HTML pages. A sample code for jQueryMobile is also provided. An MP3 audio file is used play the actual sound. You have to have jQuery in your page for this to work.

Sound is played through HTML5 <audio /> tag but instead of embedding the tag manually, the tag is created via Javascript/JQuery. Below is how this is done.


Continue reading

Using Google Custom Search engine in PrimeFaces Overlay Panels

Posted Thursday February 20, 2014 23:59:02

The following is an example on how to implement a custom Google Search engine in PrimeFaces version 4 <p:overlayPanel />. First create an account with Google Custom search (CSE) here https://www.google.com/cse. You will get your own Custom Search engine ID. From within your CSE account you will find a place to generate the following basic CSE Javascript code. Place this code in the head section or in the body just before the closing </body> tag, whichever is prefered.


Continue reading

How to create a JQuery Mobile page with responsive grids

Posted Wednesday August 21, 2013 23:01:26

This blog aims to demo examples on how to implement a responsive page targeting various handheld screen sizes. What we decribe here is similar to what we use in our XHTML JSF home page that uses JQuery mobile but is no different when applied to a JQuery mobile page in HTML.


Continue reading

Serving responsive Adsense ad units

Posted Monday August 05, 2013 19:09:50

Responsive adsense ad units are helpful for websites targeting various screen sizes where ad units adapting to screen resolutions are desired. This is the case for mobile websites. This blog is based on a blog from "inside adsense blogs". Please note that link units are not yet supported as of blog time.

To create responsive ads, generate the ad unit code as you usually would from your adsense account. When creating a new unit, a code generaor window is presented and from this window choose to generate the new Asynchronous (BETA) JavaScript code from a dropdown.


Continue reading

How to display a custom styled Google map

Posted Wednesday July 31, 2013 19:38:18

Styling a Google map is available since the introduction of API version 3. Custom styles are custom colors applied to map features, like "road", "water", etc. This is done either by setting the styles property of a standard map's MapOptions with custom values or by creating a separate custom map.


Continue reading

Improving page load with mod_expires and ExpiresFilter in JSF applications

Posted Monday June 24, 2013 16:00:04

Apache 2 mod_expires and Tomcat 7 ExpiresFilter add Cache-Control HTTP header in server responses. Caching allows resources to be saved, or cached by the browser. Once a resource is cached, the browser refer to the locally cached copy instead of having to download it again on subsequent visits to the web page. This reduces round trip time by not having to request for these resources, thus improve page load.


Continue reading

Using Rhinoslider with image and youtube content in JSF pages

Posted Saturday May 04, 2013 18:44:17

Rhinoslider demo   
Rhinoslider sample.   
Rhinoslider is a beautiful JQuery slider plugin that can handle images, video and other HTML content with many custom options. Using the plugin in HTML pages is quite simple and straightforward. Their website even has a generator that will give you a code and start customizing the plugin from there. Here in this blog, we will demostrate how to integrate this plugin on images and youtube videos into a JSF page based on version 1.05 of the plugin. We will provide 2 options of embedding the plugin. Live demo is available in the home page with this site.

Listing 1 below, is a sample generated page. Please make sure that items from 6 to 11 of the snippet are accessible from the page itself. These items are part of the plugin download. If using PrimeFaces, you may want to remove lines 6 to 8. Also lines 10 and 11 are optional and are controlled by the values of "easing" and "controlsMousewheel" parameters of the plugin (see Listing 7).


Continue reading

2 ways to setup SSL on Tomcat 7

Posted Thursday March 14, 2013 17:08:20

Today we will demonstrate how to setup SSL on Tomcat 7 with and without Apache2 in Debian servers using self-signed certificates. This should work with Debian Squeeze and Wheezy servers.  We assume you already have existing Apache 2 and Tomcat 7 installations.


Continue reading

A dynamic standard sitemap.xml with Google image extension implemented as a Java Servlet

Posted Thursday March 07, 2013 00:57:25

A sitemap.xml generated on demand is very helpful for websites that has lots of pages and with pages that are added frequently. According to Google, sitemaps help their crawlers find pages from websites. This is true for new websites or for pages that has fewer links to them.

The servlet herein described is based on sitemaps.org protocol with Google image extension. We used JDOM2 library to create the XML sitemap structure. Below is how a standard sitemap looks like with the Google image extension. Please note that image extension is supported only by Google. Bing/Yahoo ignores them.


Continue reading