Normally Apache Tomcat comes with the default index.html file. So if you go to http://localhost:8080/index.html with your web browser it will serve you the index.html file with HTTP status 200.

At the terminal, the HTTP status can be obtained with the following command.

curl -sI http://localhost:8080/index.html|head -1|awk '{print $2}'

This works if the Apache Tomcat is serving a file. What if it is a load balancer that listens to port 8080 but does not serve any files. To test if it is working and listening to port 8080. Use the following command.

nc -z localhost 8080 2>&1|grep succeeded|wc -l

--

--

My cheat sheet of array related functions. I’ll add more along the way when I use more of it.

Declaring Array

int[] ia = new int[3];
ia[0] = 9;
ia[1] = 8;
ia[2] = 7;

Char Array To String

char[] ca = {'a', 'p', 'p', 'l', 'e'};
String s = String.valueOf(ca);
System.out.println(s);

Array Sort

String[] fruits = {"pear", "apple", "banana", "orange"};
Arrays.sort(fruits);
for(String fruit:fruits){
System.out.println(fruit);
}

Array List Sort

ArrayList<String> fruits = new ArrayList<String>();
fruits.add("orange");
fruits.add("pear");
fruits.add("apple");
fruits.add("banana");
Collections.sort(fruits);
System.out.println(fruits);
# size
System.out.println(fruits.size()); # 4
# get item 0
System.out.println(fruits.get(0)); # apple

< Back to all the stories I had written

--

--

Items/ingredients

  • Eggs
  • Pots
  • Stove
  • Ice
  • Water

Instructions

  1. Leave eggs in fridge overnight.
  2. Boil a pot of water. Once boiled, lower the flame to the smallest possible where you could still see small bubbles bubbling.
  3. Put eggs into pot slowly with spoon so that you don’t crack the egg shell.
  4. Let it cook for 7 minutes.
  5. While waiting, prepare a pot or big bowl of ice water with ice in it.
  6. Once 7 minute reached. Quickly move the eggs into the ice water and leave it in there for 1 minute.
  7. Remove the eggs and de-shell.

< Back to all the stories I had written

--

--

Kevin FOO

Kevin FOO

15 Followers

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.