Saturday, December 27, 2014

Apache2 tips and file locations

The last post mentioned that the HP2000 notebook has Apache2 web server running and that more information and added details were to be added at a future time.

This weekend thought to put pen to paper and put some of the necessary log file and directory locations.

Apache2 log file location:
/var/log/apache2/access.log
/var/log/apache2/error.log

Apache2 config file location (this is unique to Ubuntu):
 /etc/apache2/

Apache2 file location:
/usr/lib/cgi-bin

This directory will contain you .html, .cgi. pl, .sh files (perl, bash, cgi). Note that a perl script in this directory can have a .cgi extension. 

Starting, stopping restarting Apache2:
>apache2 start
>apache2 stop
>apache2 restart

Friday, December 26, 2014

Installing Bugzilla, JAMWiki, and phpmyadmin installation

This post was going to go into detail about the installation process for JAMWiki, then bugzilla, then phpmyadmin. Details were going to explain the difficulties, prerequisites, outline any configuration file changes that were needed and other steps along the way.

Well, the post is not turning out this way. This is a very high level summary.

Tomcat Web Server:
The tomcat web server is needed for JAMWiki. A coworker installed JAMWiki and has it running pretty well, so I thought this would be a decent project to undertake. Surprisingly it was fairly straight forward and not too hard.

JAMWiki:
Next came a JAMWiki down load. I guess this is in the form of a .war file the lives in a particular directory on the file system. I chose to put in in my home directory structure. Once tomcat and JAMWiki are installed, I point my web browser to:

http://localhost:8080/jamwiki-1.3.2/en/StartingPoints

Based on the success on JAMWiki, I had always been interested in Bugzilla. It needs the apache2 web server. So apache2 was downloaded and installed. Next came the bugzilla down and install. Both of these download and installs were per the instructions. Difficulty came when configuring bugzilla into the apache2 web server. The configuration file was tricky. This is where documenting the process would have been good, but it did not happen, no documentation. After trial and error, bugzilla is working. I point my web browser to:

http://localhost/bugzilla/

Finally, the last is the phpmyadmin. A coworker is running this, and with the MySql database that is installed, figure phpmyadmin is a good thing to have on board and running. The install was simple and assistance on the ubuntu forum's made the necessary soft link (ln -s) from one file (with full path) to another file and directory (full path). I point my browser to:

http://localhost/phpmyadmin/

Both bugzilla and phpmyadmin use MySql as the database.

This pretty much concludes the post. I'd suppose some action on my part would be to study up on apache2 and tomcat web servers. When you hear web server, first thing that comes to my mind is a full on high powered server and not a simple HP-2000 Notebook Computer running Ubuntu 14.04.

Saturday, November 8, 2014

Last weekend I was working on updating my linkedin profile. It did take both days, granted I did not work on this constantly. Worked it a few hours, put it aside, repeat. This came about after a week of looking over 9500 lines of C source code, integrating in into an existing system. The person who wrote it put a ton of work into that project. Suppose I have taken it over to straighten it out and make it work a little better. So, over the course of those two days, this is how it turned out.

Reverse engineering and legacy application code survey, identify areas to gain efficiency. Function inventory, clean up and reuse. Implement quality practices.

Study existing source files and command procedures, assess what is needed for improvements. Clean, and improve function headers for future reference and maintenance.

Use existing coding standards or conventions; propose the use of standardized source templates for establishing coding and standards or conventions.
 
Observe, inquire and study user experiences. Look for common patterns and themes. Look for ways to automate and improve. Consult with users and managers for proposed changes.

Use scripting languages for generating code templates. Assess and prepare scripts or command procedures for automated loop unit and system integration testing.

Use operating system tools (netstat, iostat, ps, pr commands) to monitor system environment during runtime and test events.

Observe, log and trend application run time performance, looking for memory leaks, memory usage, cpu usage, system environment, networking, peripherals.

Runtime troubleshooting skills, cause and effect analysis. Define system problem boundaries and scenarios. Answer questions: If operated this way, what happens; what indications are different than if system operated another way; how does the code react under various scenarios.

Research, develop, standardize enforce coding standards, operator messaging. This becomes helpful and is key for later maintenance and troubleshooting.

Improve, instrument and add efficient logging to source code for runtime tracing and problem detection.

In the end, fairly pleased with how it turned out.

Sunday, August 3, 2014

Programming with Java and more

Recently at work there was a need to improve a scheduling application. There were two scrolling JTextArea's that would reset to the top of each of their lists when (yet another) JTextArea was manipulated. At first the thought this would take a really long time to correct. It was good to know that the needed change was fairly quick and straight forward.

That small change provided an opportunity to better the application a little more. This was to add a few things to it's only tool bar. These small things were a JTextArea (non-scrolling), plus a few more JTextArea's to visually balance the tool bar's appearance. While doing some internet research on these changes, stumbled upon the addSeperator(). What a neat method, addSeperator(). While all this was going on, consideration was to find yet another Java book as a reference for toolbars and such. Even went so far as to go to Barnes and Noble to see if they had one of those good Nutshell books.

I came back empty handed and decided to look through books on my book shelf to see if the needed reference material was available. Sure enough, this book had everything I needed for the scheduling application improvement work I was doing.


A few days after getting this book off the book shelf, I realized this book is an excellent reference book for this scheduling application. There are no scheduling type examples in the book, rather, it is helpful from the basic conceptual point of view, class and object fundamentals.

I've been through this book and other Java books several times. Each time, once the topics gets to talking about Inheritance, well, I'm just about asleep by then.

This time though, I did not fall asleep and got through the topic of Inheritance and actually can remember what I read. Starting with a class A for example. Well, you need to make a new class B. You find that class B needs many of same datatypes and methods in class A. So you code this as,

class B extends A{
 
}

So what you now have is class A is now a super class. Class B is a subclass. Class B has all the stuff that class A has. Superclass, subclass, I'm confused. Though to me that sounds backwards. The book definition on page 205 makes this clear:

The prefixes super and sub come from the language of sets used in theoretical computer science and mathematics. The set of all employees contains the set of all managers, and this is said to be a superset of the set of managers. Or, to put it another way, the set of managers is a subset of the set of all employees.

So in my case of using class A, this was the employee class and class B is the manager class. So I hope to have the permanently clear.

Suppose one last helpful topic shown in this book was on page 145. This shows how a class should be defined. It goes like this (and it is typed in straight from the book).

class ClassName
{
   field 1;
   field 2;
   field 3;

   constructor 1;
   constructor 2;

   method 1;
   method 2;

}

Finally, one more area that put me to sleep is the relationship between classes. Good for an afternoon nappy time. Here is goes. Relationship between classes are: Dependence (Uses a), Aggregation (Has a) and Inheritance (Is a). More on that later as well as "just what is the use of this super word used for. Good stuff, very helpful. I hope to expand on this soon.



Friday, July 4, 2014

Hiking


This is a follow up hike on the Kuilau Trail that was back on Saturday, 27-October-12, under the label 4 days 16 miles.  I was visiting and wanted to do Kuilau trail. On this particular hike, I chose to travel very light. The load was 2 bottles of water, id, car keys and my LG phone. Figured to keep things simple with a light load. So the emphasis is on the hike and not worrying about taking that perfect photo shot. The LG has a pretty good camera. Three photo's are with this post.

On previous hikes, I normally turned around at the picnic tables. I started around 1:15 in the afternoon. Thirty minutes later, I rested a bit at the picnic tables, finished a bottle of water, then continued on the trail. Other folks and guide books mentioned a wooden bridge, so I thought to try and make it to there. Seemed to recall from the guide book that the bridge was just about 1/2 mile more. Without the load of a backpack and water I did not need, that 1/2 mile went pretty quick. 

The below is a picture stating the end of Kuilau Trail and beginning of the Moilepe Trail along with the mileage to the eventual end points. 


From the other side of the bridge, this is what the sign says. Just as the guide books said, 1/2 mile. I suppose those extra conditioning hikes around the neighborhood helped a bit.


With that, it was turn-around time, headed back to the picnic area, down the trail to the trail head. This hike has some wonderful birding opportunities. This egret has a few buddies that seem to be comfortable watching the people. At one point, an egret was in the middle of the trail. I stopped to look at it. Eventually it took off and flew over head. It was quite something to be able to hear the wind being displaced by the wing movement.


Finally, there is one area on the trail that is especially enjoyable, this is where the trees are towering and present quite a canopy. I don't know what kind of birds those are, but they are calling to each other sometimes frequently, other times in-frequently. It's worth stopping for a few minutes and taking it all in. 

Sunday, February 16, 2014

Returning a Java Array List

A coding problem was presented which the best solution was to have a Java method return a list of string type of data. I've returned int's, floats, single character strings but not necessarily a list. 

A quick refresher on the ArrayList() to become familiar with how it works to include defining it and adding string data. Once the familiarization was completed, it was quickly coded. Of course this started out in a:

public static void main(String args[]) {
   ...rest of code;
}

Once it was working it was cut/pasted out of the main and into its own method shown below.

   public static ArrayList <String> ArrayFunction1 () {   
      ArrayList<String> myArrayList = new ArrayList<String>();
      Logger("ArrayFunction1: Entry");
    
      myArrayList.add("JAN");
      myArrayList.add("FEB");
      myArrayList.add("MAR");
      myArrayList.add("APR");
      Logger("ArrayFunction1: Second element is: " +  myArrayList.get(1));    
      Logger("ArrayFunction1: Exit");
      return myArrayList;
   }


The method was not called as yet as I wanted to make sure there were no javac compile problems. Eventually, the main() was coded to actually call the ArrayFunction1() method.

ArrayList<String> mainArrayList = ArrayFunction1();
Logger("ArrayListTest:main: Size of mainArrayList: " + mainArrayList.size());
Logger("ArrayListTest:main: Third element is: " +  mainArrayList.get(2));

Wondering about what this Logger() method is? 

   public static void Logger(String inStr){
      System.out.println(inStr);
   }


Suppose everyone has one of these somewhere. Overall it was a good refresher on the ongoing learning of Java. Quite simple and basic material. Very handy and will be used again soon.

The Northern Trust at the Riviera County Club, Pacific Palisades


Here is a post that has nothing to do with hiking, geocaching, remodeling or programming. So, the best label will be need to be hiking as it was an outside spectator sport.

Getting There:
Took PCH to Sunset. Took Sunset up to the 405. Did not have printed instructions or had punched the location in the Garmin. Had never been up Sunset from PCH, did not know it would have been that much of a difference in the drive. People that know the area drive very fast, me on the other hand did not go as fast and managed not the directly find the VA parking lot. Ended up going over the 405, checking directions on the Android, then making the way back, getting on San Vincente via some other major throughfare. Sorry fellow drivers if I did not sail through your city.

Finally, got the the parking area. At one point in considered abandoning the effort and leaving.

The trip then continued from the VA parking lot to the bus. Bus to an elementary school drop off point in the middle of an older community in near the course. Walked through the neighborhood along these older homes eventually getting to the course entry point. They were wanding people with metal detectors. No idea why. We are not hunters, we are golf fans. So after the hassle of LA driving, finding the parking area, getting on the bus (not that bad), treking through the neighborhood (not that bad either) finally got into the grounds, got my printed out ticket scanned. That was about the only thing that worked without some form of misery.

Not knowing anything about the course and not doing any event homework plus being frazzled by the trip thus far, I consulted a course volunteer for ideas on where to go and watch. He suggested the area by the 11th hole. This would catch the first group of players and they rolled through the course. It was adjacent to two other tee boxes in case there would be some good action. So off to the 11th.

On the walk up there, I noticed that Angel Cabrera had just hit his tee shot and was making his way to the 11th as well. So he and I locked strides and I pretty much shadowed him until reaching the 11th. There was some eye contact, but I opted to remain silent fearing a course marshal would expel me. Angel did his thing, sank his put, got the polite round of applause and off to the 12th. I stayed at the 11th.

I stayed at the 11th for the next five groups. Most notably in these groups would be Lee Westwood, Bill Hass, Harris English, J.J. Henry, Kevin Stadler, Keegan Bradly. These guys I suppose are some of the more popular of the others in their round 3 parings. Eventually, I departed this 11th and headed to watch some guys tee off. A side trip would be to get a snack and something to drink.

That's right, now I remember. I picked some random group to follow from 10th tee off to the green. Thing is I can't remember who was in this random group. They had their expected and practiced perfect drive and second shot that landed on the green (of course). At this point, I got a snack and a drink, and made my way down along the 9th fairway to the area known as “The Grove”. Watched the group of Bubba Watson, Kevin Streelman and Billy Hurley hit their second shots.

Funny, this group had about 10 followers. You know how the marshal's will have everyone be silent while the player is setting up and making the shot. The crunching of those salted potato chips I'm sure would have been an issue so I stopped crunching until after these shots. Then offered the obligatorily polite clapping.

By then, that Coke was history so I ducked in the Military Appreciation tent and got a bottle of water and lifted a program. The program was a $5 value, the water was a $3 value. They were handing out free Carls Jr burgers and fries to military folks. I opted not to consume a burger and fries since being the middle of the afternoon that would put me into weekend nap mode.

Leaving the Military Appreciation tent, I paced myself behind a group of younger former military guys and parked at the 9th just in time to see Webb Simpson, Jason Dufner, and John Huh get down to business and drill their drives way down there. They got their round of polite applause and off they went. Eventually I'd be making my way down the 9th.

Off I went to the tee box of the 14th. Got a good standing place for the next bunch through. This was the threesome of Dustin Johnson, Jim Furyk and Blake Adams. I suppose the good standing place was not that good 'cause I could not see the flight of the ball. Seems this group had many fans. Unknown if it was a Dustin Johnson following or Jim Furyk. I'd opt for the former. This was the last bunch that I settled down to watch, then headed up towards the 18th and the club house area.

I chose the route along the 9th fairway (opposite side). Had an interesting conversation with two volunteer guys who man'ed that ball location survey tripod mounted telescope device. Seems that is quite a fun thing to volunteer for. It has some technology, they keep you fed and watered, and you get to see all the groups play through. I suppose it would become more work than fun though. These are the guys that input the ball location data that is transmitted to some computer server somewhere and is sent on the Internet for all to enjoy.

Eventually, made the climb to the 18th where an unknown threesome was wrapping up business for the day. This was at the top of the course and the pro shop was being opened to the public. Not being as situationally aware as I normally am, I happened to walk within inches of Fred Couples. That was kind of interesting. There were other golfers that had wrapped up their round and were hanging out in the immediate area. Suppose I could have stayed awhile and take in a view of the course from this elevation.

With that, I called it a day, and made my way to the entrance area, walk back through the neighborhood, get on the bus for the ride back to the VA Center parking lot. It was then the drive up the 405 during “Jamzilla”. You see, “Jamzilla” was CalTrans shutting down three north bound lanes going over Mulholland. I wanted to get on the 101, but missed the turn at the 405/101 near Sepulveda, so I stayed on the 405 to the 118. So I survived “Jamzilla” but it was not that bad, it's been worse.

The Course:
On the PGA tour TV coverage, they mentioned the rich and famous play here. I'd figure the rich and famous play here because the course is close to home. My personal opinion and with limited knowledge of golf courses (what makes them good, what makes them bad) I did not really have an overall positive opinion. If I was blindfolded and dropped off there, well, once the blindfold was removed I would not figure I was at such an exclusive venue.

The Players:
While at the 11th, here are some random observations. Golfer had missed a belt loop while getting dressed this morning, a caddy selecting an dpointing out an individual person in the crowd and asking them directly to stand still, a caddy asking people to put their cell phones away, a golfer missing a birdie putt and throwing his putter on his bag, golfers mumbling loudly after missing their birdie putts, a golfer was very happy making an eagle, a well known golfer demonstrating his obsessive compulsive disorder with his sand wedge, people in the crowd commenting (not in a derogatory manner mind you) on the size of a few caddies, a caddy with his polite English/Australian/South African accent asking folks to “be quite please”. I could hear him wanting to say, “Excuse me please, would you mind being quite for a bit, me mate is putting”. Once golfer was using a really nice putter with a small head. Pretty interesting. Not everyone makes a 3 foot put, even the pros.

Sunday, January 19, 2014

Using a HashMap in Java

After using the ArrayList mentioned in my last post, I thought to see what the HashMap is all about. Once defined, the HashMap takes a "key" and a "value". In the code snippet below, the "1" is the key and the "JAN" is the value.

These are used within database code where within a table, there will be a key in one column and a value in the other column. Not being into extreme database programming that would require the use of a key/value, thought it would be useful to at least understand how to code these. 

ArrayFunction1() was coded to put the key/value into myHashMap.
ArrayFunction2() was coded to extract various items from myHashMap.

If this looks familiar, it is a direct copy of the ArrayList() in the previous post as well. Found it very convenient were all that was needed was a search/replace operation.

public static HashMap <Integer, String> ArrayFunction1 () {   
   HashMap<Integer, String> myHashMap = new HashMap<Integer, String>();
   Logger("ArrayFunction1: Entry");
...

   myHashMap.put(1,"JAN");
   myHashMap.put(2,"FEB");
   myHashMap.put(3,"MAR");
   myHashMap.put(4,"APR");

...
   Logger("ArrayFunction1: Exit");
}

public static void ArrayFunction2 (HashMap<Integer,  String> myinputarray) {
   Logger("ArrayFunction2: Entry");
...
   Logger("ArrayFunction2: keySet:        " + myinputarray.keySet());          
   Logger("ArrayFunction2: entrySet:     " + myinputarray.entrySet());   
   Logger("ArrayFunction2: values:        " + myinputarray.values());
...
   Logger("ArrayFunction2: Exit");
}

And this is the output. It shows the keySet(), and entrySet() and the values() that are in the HashMap. I left out some of the boolean methods (containsValue()), containsKey()). They work pretty cool, showing true or false if the item is present in either the key or value.

ArrayFunction2: keySet:        [1, 2, 3, 4]
ArrayFunction2: entrySet:     [1=JAN, 2=FEB, 3=MAR, 4=APR]
ArrayFunction2: values:        [JAN, FEB, MAR, APR]


Wondering what that Logger() function is? It is that method shown in the previous post that accepts a String as the only argument and simply outputs the input string to stdout. In otherwords, Logger() is a just wrapper to System.out.println().

Saturday, January 4, 2014

What to look for when code reviewing java source

Troubleshooting Java compile warnings:

As I continue to work with Java, from time to time my source code, when compiled returns the following messages to stdout. This is a fairly common message as I maintain certain source files at work. Here is an example of the particular message.

Note: ArrayListTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Sometimes a programmer will inherit a Java project from another person who in
turn may have got that project from someone else. So we have a hand-me-down
Java source file that when compiled, returns those two notes mentioned above.

The Java compiler is nice enough to tell you that there is a situation there
and to recompile with the -Xlint. The -Xlint will output all the warnings to
stdout. There could be times where it would not be practical to actually run
the -Xlint option. Checking the ant build script may offer a means to use that
-Xlint as a compile option.

Using the -Xlint will be helpful in finding the offending line of Java source
code. For an example, here is a defined array list both the correct way
(commented) and the way that causes those two above compilation notes.

      // create an array list
      //ArrayList <String> al = new ArrayList<String>();
      ArrayList al = new ArrayList();

So when it comes down to it, the coder should keep in mind when inheriting a
project that is a hand-me-down, they may need to keep things in mind like
ensuring data types are declared in such a way so it keeps the compiler happy. Either way the program will run, it is just a really good practice to ensure source compiles clean.

As for me, as I go through this one source file at work, perhaps a few hundred lines or so, I'll know what I'm suppose to be looking for in order to clean up these messages. Maybe I'll be lucky enough and find where in the ant script to insert this compiler option.