Tomcat: redirecting traffic from port 8080 to 80 using iptables

Glass Onion Blog

First verify that Tomcat is running on port 8080. Run the following command

# netstat -ntl

The output will look something like

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0      *                   LISTEN
tcp        0      0        *                   LISTEN
tcp        0      0 ::ffff:       :::*                        LISTEN
tcp        0      0 :::8009                     :::*                        LISTEN
tcp        0      0 :::8080                     :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

Run the following command to redirect port 80 traffic to port 8080

# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Run the folloing command to verify that redirect is working fine

# iptables -t nat -L

The output will look something like

target     prot opt source               destination
REDIRECT   tcp  --  anywhere             anywhere            tcp dpt:http redir ports 8080 Chain OUTPUT (policy ACCEPT) target     prot opt source               destination Chain POSTROUTING (policy…

View original post 28 more words

Posted in Uncategorized | Leave a comment

Correctly switch between 2 Column and 1 Column grid on iPhone Landscape/Portrait mode

I had been designing a website with 4 banner that each takes col-md-3 for desktop-sized screen and takes col-xs-12 on portrait mode on the iPhone.

//screenshot will be added in a short moment.

It turned out that it looks horrible on landscape mode as the banner are over-stretched. In this post, with the help of xander, we had managed to successfully put up 2 column of grid on the landscape mode. The main issue here is that on the landscape mode, the iphone will only use c0l-xs as such we have to force it to use col-sm.

@media only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 568px) {
.col-sm-6 {
float: left;
width: 50%;
Posted in Web Development | Tagged , , , | Leave a comment

Configuring App Transport Security Exceptions in iOS 9 and OSX 10.11

Steven Peterson

What is App Transport Security (ATS)?

At WWDC 2015, Apple announced “App Transport Security” for iOS 9 and OSX 10.11 El Capitan. The “What’s New in iOS” guide for iOS 9 explains:

App Transport Security (ATS) lets an app add a declaration to its Info.plist file that specifies the domains with which it needs secure communication. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.

In simple terms, this means that if your application attempts to connect to any HTTP server…

View original post 549 more words

Posted in Uncategorized | Leave a comment

Mass download of files via wget

A couple of days ago Eric Ligman, Microsoft Director of Sales Excellence had posted on the give away of free Microsoft eBooks. The list of eBook for give away is indeed long and in this post, I will be teaching you how to download them all with just two commands in linux.

The first command download the list of free ebook, the second command visit each of the link in the txt file and download them and save it as the name given from the server. Without the “–content-disposition –trust-server-names” option, the file will simply be save as the last portion of the url.

wget <a href="">…/Key_Shorts/MSFTFreeEbooks.txt</a>
wget --content-disposition --trust-server-names -i MSFTFreeEbooks.txt

You may visit the original link from Eric Ligman here

Lastly this guide won’t be possible without help of unix stackexchange

Posted in Uncategorized | Tagged , , , , | Leave a comment

Creating Jar for JavaFX Application

This is a step by step guide to creating a Jar for a JavaFX Application using IntelliJ IDEA. It is only tested on IntelliJ IDEA 2016 with Java8. Steps might be slightly different for Java7.

First, open up File > Project Structure.

Next click on Artifacts as shown below.


Next click on the plus icon to add a Jar From modules with dependencies… as shown.


Once the above step is completed, the below pop-up will be shown. Select your main class. This will be the class that is accessed when your app launches. It is typically or something similar. Click OK twice to exit the pop-up and Project Structure.


Now to generate the jar file, go to Build > Build Artifacts…


Once you clicked on the Build Artifacts, the below will be shown, select Build for the Action. Once clicked, the jar will be generated in the folder /out/artifacts/ and you can run the jar file directly from it.


Posted in Java, JavaFX | Tagged , , | Leave a comment

JavaFX load data on launch

To load data on launch for a JavaFX app, you would simply need the following in your Controller.

The initialize method is the first piece of code that is run when you launch the JavaFX app.

protected void initialize() {
    //load data here...
Posted in Java, JavaFX | Tagged , | Leave a comment

Installing mysql on Raspberry Pi

In this post, I will go through how to install mysql on Raspberry Pi 2. Installing mysql is much simpler than installing Apache Tomcat as it can be done via apt-get

sudo apt-get install mysql-server

During the setup, you would be prompted to set a password for your sql server. Do remember the password that you had set as you would need that later.

After the setup is complete, you may access the mysql server with the password above by typing the following.

mysql -u root -p

[Updated 25 July 2016]

I had forgotten an important step during my initial post.

It is important to do the below as well to ensure that you have the mysql-connector, without this you will run into jdbc driver error.

sudo apt-get install libmysql-java

Posted in mysql, Raspberry Pi | Tagged , , , , | Leave a comment