Showing posts with label Software Engineering. Show all posts
Showing posts with label Software Engineering. Show all posts

Tuesday, April 3, 2012

NClass - Free UML Class Designer



If you are ever looking for a nice UML class designer look no further than NClass. I used this for a project to port a large code base from .NET to Java. The program was able to reverse engineer UML from compiled .NET code. Love it.

Friday, March 23, 2012

Performance settings for production weblogic deployments

Put this in the weblogic.xml under WEB-INF folder: 
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.oracle.com/technology/weblogic/servers/wls810/dtd/weblogic810-web-jar.dtd">

<weblogic-web-app>

<container-descriptor>
<servlet-reload-check-secs>-1</servlet-reload-check-secs>
</container-descriptor>

</weblogic-web-app>

For JSPs you can also set this in weblogic.xml:

<jsp-descriptor>
<jsp-param>
<param-name>pageCheckSeconds</param-name>
<param-value>-1</param-value>
</jsp-param>
</jsp-descriptor>


Unless you are altering servlet code and JSPs on the fly in production (bad idea), there is no need to ever check for changes. These two settings can help with performance because without them, Weblogic will have periodic threads blocking
requests to poll the filesystem for Servlet or JSP changes.

So by default in thread dumps you will see one or more of this sort of thing:

waiting for monitor entry [c4f7f000..c4f7fc28]
     at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:771)

unless you disable that like shown above.

Monday, September 26, 2011

Database test SQL for each vendor

When I setup a connection pool or database tool with a new database profile I like to test that it works, here are some vendor specific SQL you can use to test your db connection.

Cloudscape

#SQL SELECT 1

#DB2

#SQL SELECT COUNT(*) FROM SYSIBM.SYSTABLES

#Informix

#SQL SELECT COUNT(*) FROM SYSTABLES

#Microsoft SQL Server

#SQL SELECT COUNT(*) FROM SYSOBJECTS

#MySQL

#SQL SELECT 1

#Oracle

#SQL SELECT 1 FROM DUAL

#PointBase

#SQL SELECT COUNT(*) FROM SYSTABLES

#PostgreSQL

#SQL SELECT 1

#Progress

#SQL SELECT COUNT(*) FROM SYSTABLES

#Sybase

#SQL SELECT COUNT(*) FROM SYSOBJECTS

This is useful because you don't often know what tables exist in a database to test a query with, you can't assume select * from person would work if no person table was created. These queries are for the builtin system database resource in the specific vendor database types, they should exist even on a freshly installed or blank database server.

Friday, August 26, 2011

dynaTrace evaluation

dynaTrace can monitor/profile .NET and Java code but I only worked with evaluation of the Java side.

Download the dynatrace full install for linux x86 and windows x86 here product download page

Obtain a license key for evaluation (file will have a name like dynaTrace_license_201107201015.key)

You must have a dynatrace account to download them (dynatrace-3.5.2.2393.msi, dynatrace-3.5.2.2393-linux-x86.jar, dynaTrace_license_201107201015.key)

page dedicated to installation

Define a dedicated VM for dynatrace server/collector, I put the full install jar on a RedHat VM which acted as my server (make sure it has 4GB of RAM)
Run this to install the jar:
java -jar dynatrace-3.5.2.2393-linux-x86.jar

With this extracted to a folder (I put it in ~\dynatrace..) you can start the dyna collector and server with these commands:

cd dynatrace
nohup ./dtserver &
nohup ./dtanalysisserver &
nohup ./dtcollector &
I then ran the install for dynatrace-3.5.2.2393.msi on my desktop, I only installed the dynatrace client on my desktop.

Now you need to copy the dynatrace/agent/lib folder to the servers you want to profile/monitor (do not copy the folder to a path with a space in it like "program files", I put them in c:\tools\dynatrace\agent\lib)

Now you can change the websphere application server JVM arguments to add the dynatrace agent :
-agentpath:"C:\Tools\dynaTrace\dynaTrace 3.5.2\agent\lib\dtagent.dll"=name=OCMWS,server=192.168.1.122
-agentpath:/root/dynatrace-3.5.2/agent/lib/libdtagent.so=name=OCM,server=192.168.1.122

Note: Edit the line above to match the path to where you copied the dynatrace agent dll/so, also give each JVM you are monitoring a different name, and finaly the IP address is the dynatrace server IP address which may be different for you.

To add this to the JVM startup on WebSphere open the IBM console and go to
Servers | application server | server1 | Java Process and Management | Process Definition | Java Virtual Machine | Generic JVM Arguments
prepent the full -agentpath value to the Generic JVM arguments
Click ok and Save your changes, double check that the save took place by entering the console again and checking the generic jvm argument for the new value.

You will have to restart WebSphere to have the JVM startup with the new startup JVM arguments.

Launch the dynaTrace client after doing the above, tools | settings | dynatrace server | connectivity | put in the host IP address.
default values for login are admin:admin, port 2021, test the connection, it should be a green arrow and say success.

Click License, attach the license .key file for dynatrace evaluation: dynaTrace_license_201107201015.key.

Use online videos to see how to use the client to slice and dice the data from the agents and profile your application.




There is no license for the client so you can export captured data and give it to anyone with the client installed and they can view the details of the session and use the client to troubleshoot and make changes.


Thursday, July 28, 2011

Use OutputStreamWriter not FileWriter

Search your Java code for FileWriter and replace it with OutputStreamWriter... especially if you write UTF-8 encoded documents. You can run into a nasty problem where you develop your Java code on Linux and then when it runs on Windows, character encoding problems crop up. FileWriter uses a OS System setting to determine what encoding to use, so it will change depending on what OS runs the Java code!

Here is an example of how to use OutputStreamWriter for UTF-8 encoded output.
         OutputStreamWriter out = null;
try {
try {
out = new OutputStreamWriter(new FileOutputStream(outputFile),"UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage,e);
}
try {
out.append(yourStringDataToWriteToOutputFile);
out.flush();
} catch (IOException e) {
throw new RuntimeException(e.getMessage,e);
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e.getMessage,e);
} finally {
try {
out.close();
} catch (IOException e) {
throw new RuntimeException(e.getMessage,e);
}
}

Hope this helps you get past file character encoding bugs with Java. Here is a great link on various Java Anti-Patterns which should be avoided when writing enterprise class robust code:

Tuesday, March 2, 2010

Coping with requirement descoping

Image: FreeDigitalPhotos.net

I am in the middle of a frantic ATG code push. The QA cycle (as usual) was a painfully short 2 days. Since the project is pretty large and was months in development, many areas of the UI were changed. Some of the changes were accepted by the QA and business team, but other changes were found to be too wonky to rollout live to thousands of agents. It was inevitable that the business side would request à la carte features from the overal design implemented to roll live (due to the short qa and hard deadline). Problems arise when removing (descoping) a rejected UI change which breaks other features because of dependencies.

I was able to deliever a rapid turnaround on descoping large functional sections of a code push. I did this by keeping a record of each file that was add/changed/removed for the project as well as correlated which business requirement(s) were the motivation behind the file's change.

Traceability saved the day.

I have not been as diciplined in the past with keeping track of changes for a project, let along keeping record of how the changes correlate to the busines requirements. Now, having done this, it is something that has helped me in the following specific ways:

  1. fulfill all the documented requirements of the project,
  2. quickly descope rejected code,
  3. rapidly find and fix bugs found against requirements,
  4. perform code reviews and explain the moving parts quickly,
  5. provide detailed rollout plans for the changes,
  6. merge in other changes into the project with ease

Not every project may be large enough to require record keeping like this. Keeping track of this stuff is boring but the benefits of doing it really make it worth the effort for me. (Just like documenting my knowledge has.)

Tuesday, February 9, 2010

FourGablesGuy's Best Practice tip #1478: Don't use email clients to store your knowledge

Image: FreeDigitalPhotos.net

If you were to lose all your email messages today, how high of a disaster would that be for you:

  • as an employee or
  • personally?

Scale where 1 is "no big deal" and 10 being "I am ruined, RUINED!!!"


If I am tempted to save an email after I have read it, I stop and think:
"Why do I want to save this? "
"Oh, it is because I will/might need this info again later."
"Well, if that is the case, it should then be put in a secure place or made into a blog post, forum post, document, etc.. on a knowledge site."

I don't always put important learned information in a blog post or in a secure archive, and sometimes I am searching my email for something that I didn't put in a place I could easily find later... However, I think the more consistently I avoid storing knowledge in my email box (either in folders, sent items, trash, etc..) the better off I will be. It takes some time up front to move knowledge to the place it belongs but it takes even more time to scour your email folders for the one bit of info out of your email-haystack when you need later. If I do have to search and find information in my email, then I always move that data into a better place, because the fact I needed the information twice indicates I will need it yet again.

In my opinion we should treat email as an ephemeral messaging tool, not as a personal knowledge compendium. So until Google Wave gets broad adoption, email is like a sticky note on your desk, neither should be used to preserve important knowledge.

Addendum: Email is a bad choice, but some do survive using it as a knowledge base tool. However, the absolute worst place to maintain important knowledge would be your IM chat history. IM chat toools are great and I use them to ask and answer questions, but I kick myself when I am looking through old chat history for a nugget of information to reuse that I neglected to preserve better. I also am frustrated when managers/coworkers repeatedly ask me questions in chat that I have answered weeks or months previously. I am trying to establish the habit to put the answers I give/receive in IM chat on a wiki or (maybe an email..) or somewhere more permanent so that I can refer back to the more stable place later. IM chat is a double-edged sword, it is fast and convenient in the short term, but you can be hurt long term by failing to capture knowledge from your chat sessions.

Friday, November 21, 2008

Coolest thing for bloggers today

Go here

and put in your blog url.

It will analyze your blog and determine your blog's Meyers Briggs personality type.

Pretty neat I think.

When I take the test I am INTL, but the site gave this blog ESTP! I guess blogging lets me get out of my shell. Or my blog is nothing like my personality...

Saturday, November 15, 2008

Getting to the bottom of a BSOD

Rebecca's computer has started throwing BSOD recently. Blue screen of death (BSOD) errors have caused many people to throw up their hands in disgust at Windows countless thousands of times. Industries are built around fixing computers with BSOD. Fortunately, I worked front line technical support for several years and know a thing or two about these. Although, format and reinstalling windows is going to most likely fix the issue, it is akin to cutting off a persons leg for an ingrown toenail. Struggling to fix problems without reformatting and reinstalling has resulted in gaining more insight into the internals of the Windows OS and software in general.

So I could boot into safe mode with F8 while the computer started but, each time I tried to boot into normal mode, I would get BSOD and reboot. In safe mode you can go to control panel | system | Advanced | startup & recovery | settings and uncheck the box for Automatically Restart. This will allow you to read the BSOD message which was necessary for me to troubleshoot the problem. You see, unlike some people, computers will usually tell you what is wrong them and furthermore it is usually possible for you to fix computer problems.

The error message was 0x0000007e 0xc0000005 ... so really useful to a geek who can read hex and memorize windows kernel error codes. Each time a Windows XP computer BSOD crashes, a message gets put in the System Log, also you will get (unless you configured differently) a timestamped MiniDump binary file .dmp in Windows/Minidump folder.

The minidump file created from the BSOD is key to really getting at the root cause of the problem. But it is not really human readable (it can partially be read in a text editor but lots of binary data makes it laborious.) So you have to have windows debugging tools to extract the information from the file out to get to the bottom of the problem. http://www.microsoft.com/whdc/devtools/debugging/default.mspx Well, both Windows symbols and Debugging Tools to be precise. Without symbols the .dmp file will not reveal all its secrets.

To start I moved all unsigned drivers out of system32/drivers folder into a tmp folder called system32/drivers.unsigned

You can identify the unsigned drivers with a tool in safe mode called sigverif, just pick advanced and point the search to system32/drivers folder to get a list of unsigned drivers.

Then open an explorer window and move these files out of drivers and into drivers.unsigned.

Restart and you should be back in business and able to boot in windows normally, but some hardware or software will not work right until you figure out which one of your unsigned drivers is sick. This is where the .dmp files will zero in on what driver is to blame, the rest of the unsigned drivers are innocent bystanders to this one bad apple.

The culprit, vsdatant.sys, which using process explorer, is a file installed on Rebecca's system by Zone Alarm.


Microsoft (R) Windows Debugger Version 6.9.0003.113 X86
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\WINDOWS\Minidump\Mini111508-03.dmp]
Mini Kernel Dump File: Only registers and stack trace are available

Symbol search path is: C:\WINDOWS\Symbols
Executable search path is:
Unable to load image ntoskrnl.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntoskrnl.exe
Windows XP Kernel Version 2600 (Service Pack 3) UP Free x86 compatible
Product: WinNt, suite: TerminalServer SingleUserTS Personal
Kernel base = 0x804d7000 PsLoadedModuleList = 0x80554040
Debug session time: Sat Nov 15 05:55:48.000 2008 (GMT-7)
System Uptime: 0 days 0:00:33.562
Unable to load image ntoskrnl.exe, Win32 error 0n2
*** WARNING: Unable to verify timestamp for ntoskrnl.exe
Loading Kernel Symbols
...............................................................................................................................
Loading User Symbols
Loading unloaded module list
..
Unable to load image tcpip.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for tcpip.sys
ERROR: FindPlugIns 8007007b
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************

Use !analyze -v to get detailed debugging information.

BugCheck 1000007E, {c000001d, 89d6a024, ba597978, ba597674}

Unable to load image vsdatant.sys, Win32 error 0n2
*** WARNING: Unable to verify timestamp for vsdatant.sys
*** ERROR: Module load completed but symbols could not be loaded for vsdatant.sys
Probably caused by : vsdatant.sys ( vsdatant+450c1 )

Followup: MachineOwner
---------

What is still strange to me is I did not remove this driver from the system32/drivers folder. Here is a list of the drivers I removed from the folder:
11/15/2008 10:07 AM dir .
11/15/2008 10:07 AM dir ..
10/04/2006 07:42 PM 2,432 cdr4_xp.sys
10/04/2006 07:42 PM 2,560 cdralw2k.sys
11/18/2002 02:51 PM 377,358 cmaudio.sys
03/03/2008 05:25 PM 1,405,632 cmudax3.sys
11/11/2003 10:44 AM 333,600 ctdvda2k.sys
09/02/2003 11:25 AM 11,266 diag69xp.sys
01/31/2008 04:18 PM 9,216 FlashSys.sys
11/23/2002 07:36 PM 16,016 hpoipr07.sys
09/10/2003 11:36 PM 21,060 iviaspi.sys
09/17/2003 03:57 PM 8,440 LANPkt.sys
01/14/2008 01:15 PM 15,340 ndisrd.sys
09/19/2003 01:47 AM 10,368 pfc.sys
10/10/2006 02:06 PM 17,136 SSLDrv.sys
12/18/2004 07:32 PM 38,229 StMp3Rec.sys
08/07/2006 03:42 PM 20 SymRedir.cat
08/07/2006 03:42 PM 1,133 SymRedir.inf
07/10/2008 08:35 AM 32,000 usbaapl.sys
17 File(s) 2,301,806 bytes

So I still may have to add them back to system32/drivers, a few at a time, to see if I can zero in on the driver in the above list that caused the issue.

Update: Well, from the above list I narrowed it down to:
01/31/2008 04:18 PM 9,216 FlashSys.sys
All other files did not cause a BSOD when put back in system32/drivers folder.
I am not sure how to identify the source software that put FlashSys.sys into my drivers folder, but I suspect my SanDisk Cruzer Titanium USB 2 GB thumbdrive as the culprit.

Update 11/17/2008:
Well I again got a BSOD, so I removed all but
11/18/2002 02:51 PM 377,358 cmaudio.sys
03/03/2008 05:25 PM 1,405,632 cmudax3.sys
Which I need for sound and I am back in business again, but I am not sure which of the other files besides:
01/31/2008 04:18 PM 9,216 FlashSys.sys
is also causing BSOD on the system. I will probably need to find a way to track down the source software programs for each of these drivers.

Monday, July 28, 2008

ZoneAlarm: a love / hate relationship

I love the free version of ZoneAlarm. Having a firewall software loaded on a Windows XP computer with access to the internet is a must for the health, security and privacy of a system. However, ZoneAlarm is such a nightmare when I try to do anything "networky". I have added the IP address of the other computer, but the menus in Zone alarm are so poorly named I cannot figure out how to enable network file sharing. So I am stuck, I am trying to get Ubuntu to mount a Windows XP share drive, if I disable ZoneAlarm, BINGO I am in, if I enable ZoneAlarm, when I try to connect I get an infuriating ZoneAlarm message that remote access was blocked. If you know of a better personal firewall software to use (or how to get ZoneAlarm to allow Windows XP filesharing traffic) please let me know.

My dream Windows XP Internet and network firewall software is:
  • Free (can be open or closed source, but nag screens to buy should not be worse than ZA)
  • Configurable (So that I can allow traffic like windows file shares)
  • Good help documentation so I can figure out how to allow different types of traffic in and out
  • Actively maintained
  • Always on and low resource footprint (does not grind my system to a halt)
Yes I should just switch the other computer to Ubuntu as well and be done with it but,
we have and love the Adobe software that is windows/mac specific. This is the major reason left to have MS Windows at home, this and PC games which I never play anymore. I wonder how much Adobe is being paid to NOT develop a Linux version of their software, because as soon as they develop Linux versions... RIP MS Windows forever.

Thursday, June 5, 2008

Annoying Eclipse "Problem Occurred" Again

I post this so that it might help someone else in a similar frustrating state. My Eclipse 3.3 has been giving me this annoying message ever few minutes.

Problem Occurred
periodic workspace save.
Cannot find file C:\Projects\.metadata\.plugins\org.eclipse.core.resources\.projects\KB-485\1.tree

This project is a large CVS repository with over 1GB of static file content (don't ask I didn't have any involvement in the creation of the CVS module.) Recreating the project would be several hours of time pulling down the files from the network.

This error was causing me to have to click ok while trying to write code. Also, I got the same error trying to even close the project.

I fixed it by navigating to the directory in the error:
C:\Projects\.metadata\.plugins\org.eclipse.core.resources\.projects\
creating the missing KB-485 folder and creating the missing 1.tree file (just an empty file)

Then I was able to close the project and open it and the 1.tree file was overwritten and the error has been fixed.

Monday, April 7, 2008

Why You Should Almost Never Customize Enterprise Software

Why is it that so many large companies will buy an expensive enterprise software package that is missing critical functionality and features for their business? Why do these large companies that buy this expensive software then pay for expensive developers to write customizations to that software that should have been included in the software to begin with. In every case that I have seen, the customization was not necessary and should not have been done. It wasted thousands of dollars and results in unnecessary delays or in one extreme case even compromised the benefits the out of the box software would have provided.
Each customization an enterprise company decides to make should have a strong business case behind it because of the incredible cost it will bring to future upgrades and general maintainence. In other words, each software customization(ui change, feature enhancement, integration piece, etc...) should have a positive return on investment that factors in the cost to maintain that functionality. Most good features should just be added to the next release of the enterprise software and supported by the software vendor. If their are features missing from enterprise software ABC, the first step is to engage the vendor Product Development team and ask for it to be added in and tell them why. Open a feature request ticket, call them everyday, twice a day, until they relent and say yes because phone calls are cheaper than developers.
Good reasons to customize:
  1. It gives my company a strong competitive advantage.
  2. It is legally required, my company will be take to court if it is not included.
  3. It saves my company vast amounts of time or will reduce expenses dramatically.

and, after many attempts, the vendor has told me they will not add it to the product.

Very bad reasons to customize:

  1. My subject matter experts don't want to have to click that. (resistance to change)
  2. My customers will be confused. (assumption / training issue)
  3. I have this exsting system I want to leverage (another form of resitance to change)
  4. I can't wait for the next release to have this feature and the vendor won't backport it. (shortsighted decision)

From day one, installing and rolling out an enterprise software system to replace an existing process (or set of processes) will be subjected to tremendous resitance to change by every department affected by the project. Picture a single person (you) on one side of a rope and the entire company pulling the rope the other direction to get an idea of a typical resistance scenario. Recognising this early and planning for it is critical for a project to be successful.

Furthermore, until the software is rolled out and actually used by the actual agents or customers in an actual work setting or production environment, any beliefs about how the interface will be (mis)understood are just plain guesses. Often they are not intelligent guesses. Often what I have seen is contrived, based on assumptions or imperfect mental models, or, worst of all, problems derrived from sandbox environments where the edge cases get lots of attention and the meatier workflow is left unnoticed or ignored. Until users are forced into the new software, kicking and screaming, the real usability issues will remain hidden. So why fix the UI when you don't know for certain what precisely is broken?

Finally, your existing systems do what they do, any attempt to integrate them with the new system is a change resistance on your part to allow the new system to stand alone as it was intended to operate. You can't always know the impact on the existing system an integration will have, nor should you expect to fully understand the negative impact the existing system will have when it is connected.

Bottom line is the vendor sales agent will probably tell you anything can be done and is possible, and technically they are correct. Just because a sales person says your ideas are great and wonderful does not mean they actually are. Would a car dealer tell you that putting snow tires on your band new convertable mustang was a stupid idea? not if they thought it would cost them the sale! Custom auto shops are glad to take your money to drop a truck's suspension rendering the vehicle a crippled novelty rather than the expertly designed and highly functional vehicle you test drove. Enterprise software is not that different.

About Me

My photo
Lead Java Developer Husband and Father

Tags