Loading...

Tuesday, May 22, 2012

Creating an ANT file from an existing Java project

Sometimes we need to more tightly control the build process within our projects. When using Eclipse or Rational Application Developer, the IDE controls how the project is compiled through the properties screens (which ultimately are written back to property files).

However, what if you need to use the same build steps you use in Eclipse in an automated build system like Hudson, Jenkins, or (my favorite) Team Concert? Well, you can create an ANT file from an existing Eclipse based project easily, but not intuitively.

Right click on your project and select 'Export'. In the dialog that follows, select 'ANT Buildfile' file.
Generate ANT file from project



Then, select your target projects from the list. You can specify the name of the build file (defaults to build.xml), and the target directory of JUnit. 


Then, click finish. 
Now, you can open your file and edit it directly. The next step would be to replace the builders for the project.

To do that, right click on your project and select 'Builders'. Click the 'New' button, and select 'ANT Builder'. Then point to the ANT file you just created. Now your project will build based off that ANT file. Depending upon what other builders are in place here, you could remove the others, but I recommend you be judicious here. Some of those builders are validators that help you the developer be productive. Keep those, as well as those that are tied to custom plugins. Your ANT file should be able to stand on its own to do a reliable compilation however. Now, you can add WAR/EAR or packaging targets, and even deployment targets as needed. This will allow the script to be used by your continuous integration system to automatically build the project. If you use a 2 phase or 2 step approach, this means your file can do step1 (compile / unit test). If that passes, a post deploy task can deliver to another stream, where it will package and deploy the application to an integration server for QA testing. 


Helpful resources here:

Thursday, May 03, 2012

Diagnosing potential Linux drive failures

While working on server today I came across some odd issues in some applications. While checking the logs, I found some drive errors in the warn log file (Failed SMART usage Attribute: 7 Seek_Error_Rate). In searching for the cause of this error, I think discovered a nifty little tool that will tell you the health of physical disk drives as reported by the SMART controller. SMART stands for Self-Monitoring, Analysis and Reporting Technology Systems, and is a technology built into most disk systems. 


Two switches will get you going
smartctl -i <drive>
smartctl -Hc <drive>


The following output shows how my troublesome drive is on its way to a nearby recycling plant. Notice that the health check (Hc) shows that the drive is in pre-fail state. 



websrver1:/var/log # smartctl -Hc /dev/sdh
smartctl 5.39 2009-08-08 r2872~ [x86_64-unknown-linux-gnu] (openSUSE RPM)
Copyright (C) 2002-9 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   041   041   140    Pre-fail  Always   FAILING_NOW 1265

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                 (12000) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine
recommended polling time:        (   2) minutes.
Extended self-test routine
recommended polling time:        ( 140) minutes.
Conveyance self-test routine
recommended polling time:        (   5) minutes.
SCT capabilities:              (0x303f) SCT Status supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.
These tips were found on a link from Linux Journal. Hope they help you as well as they did me! Now, I just need to find a matching drive for this to replace in the RAID5 array. Hmmm...

Wednesday, April 18, 2012

Using IBM Passport Advantage, a helpful guide for newbies


If you are a new IBM Software customer, you will find that you obtain your software via download from the IBM Passport Advantage (PPA) web site. After your purchase has been processed, you'll receive verification from IBM in the form of a "Proof of Entitlement" document. Use this document to access PPA. This YouTube video is very helpful in explaining the download process.


Friday, March 16, 2012

Sharepoint vs. IBM Connections

I get this often, that Sharepoint does more than "Notes". Well, no kidding, its like comparing a car to a front end loader. The actual competing product is not Lotus Notes, but rather, IBM Connections. I came across this from a friend, and it is an excellent 30 minute introduction to Connection and comparing its features to those (or the lack thereof) of Sharepoint. Enjoy


Wednesday, February 29, 2012

Are your Java devs killing your business with data type issues?

So you thought you would outsource your Java development overseas and save a buck or two? Now you find out you cannot account for thousands of dollars in your general ledger and your customers are complaining that they are getting ripped off (or they are thanking you for unexpected discounts). If this sounds familiar, read this post carefully.

If you are doing Java development and interacting with currency values, then you must be sure you are representing those values with the correct data type. By that, I mean using the correct Java object.

As a background, Java supports the following primitive data types:

  • int
  • char
  • byte
  • short
  • long
  • float
  • double
  • boolean
  • void


Integer based data types (int, short, long) do not support the 2 digit decimals that represent the fractional dollars (or euros, pesos, etc). char, boolean, void, and byte also are not appropriate as you cannot do proper math functions on them. They also are not large enough to represent certain large values (i.e. the U.S. national debt .. oh now that THAT is saying something!). That leaves float, and long, which do support decimal points. If your developers have come to that conclusion and have thus coded your general ledger using these primitives, you may now start looking for new developers as this is WRONG!

Why? Simple. Just answer the following question. What does the following produce?

public class HopeAndChange
{

    public static void main()
    { long five = (long) 5.00;
       long cost = (long) 1.90;
    System.out.println(five-cost);

    }
}

If you say 0.10, you would be tragically wrong. It would print "4". Why? Both float and double use binary floating point arithmetic. Many decimals cannot be represented in binary.  So. What's the solution? That is to use a compound object representing real currency. BigDecimal is a good candidate for that is it can represent very large numbers, and supports decimal values very well. Many software tools will miss this point - its not an easy one to catch. It does not generate an error. One way is to ensure that any code that does calculations has associated unit tests (i.e. JUnit). Rational Application Developer in particular has built in features that support code coverage. You can also update its Software Analyzer built in tooling to help identify standard nomenclature variables being represented by a floating point.

This test above is also a good question for an interview for possible employment candidates. If they cannot accurate tell you what this produces, or especially, why it does not produce the expected results... tell them you'll 'let them know'.



Wednesday, February 15, 2012

Getting better tracing and debugging for Rational HATS macros.

Question: How can I tell what is happening in my macro when it runs on the server?

Sometimes, when working with Rational HATS macros, you need more information when debugging. When it runs on the server, you really don't see much in the SystemOut.log (the WAS console file). I've got some suggestions for you that will help you better understand what's happening in your macro.

Run WAS in debug

First, to help you see where the macro is, or what is happening on the screen you can enable the HOD applet to display in your local WAS environment. To do that either restart the WAS server in debug mode, or change the runtime properties file. When starting in debug mode, the HATS runtime will use the runtime-debug.properties file (located in your EAR project). This however, can mean some slow performance. It also does not give you much benefit if you don't have any custom Java code such as Integration Objects, Business Logic, or Custom Widgets.

Enable the HOD applet

Instead, you can simply enable the HOD applet in runtime.properties (also in the EAR project). Just look for the following line:

trace.HOD.DISPLAYTERMINAL=0

Change this value to 1 to enable the host terminal when the runtime starts. This will help your debugging sessions. As soon as the application starts, you'll see the applet start up in a separate window. You can resize it to full screen if you like. Its fully interactive - if the macro gets stuck on a screen, you can 'push' it along.


Add tracing to your macro

Another nifty thing you can do is add trace statements to your macro. Add the following inside the <action> xml element in the source. Note, that you can do this using the Advanced Editor or the source view, but NOT in the host terminal, nor the visual macro editor. This is a bit of a hidden gem, and you'll need to get your hands dirty in source code to use it.

<trace type="SYSOUT" value="'Executing xxx action now'"/>


Note that the type attribute can accept a few different values. SYSOUT sends the trace to the SystemOut.log file of WAS. You can also use HODTRACE which will write the comment to the HATS tracing file, usually found in the installedApps/HATS_EAR/logs folder of your WAS environment. The last option is USER, which allows you to send it to a user tracing facility. The last one I have not used, but plan to experiment on. If your sysadmin has disabled sysout statements on your production WAS environment, you will not see it (and that is a best practice). In a production environemtn, after you test your macros, you should instead change these to HODTRACE, or USER if you find you are able to write to another tracing facility. Currently it will not write to the java.util.logging interface but we have requested that as a feature in a future release.

For the value attribute, notice that the string is in single quotes. You can also append macro variables such as $strCustId$, where strCustId is a macro variable. This allows you to see what the state of the value is at runtime in the system console.

Monday, February 06, 2012

AIX COBOL Overview with Rational Developer for Power

For an environment long thought a dead end, IBM has revitalized the platform with its new COBOL tools for AIX in RDp. The UI is a wonderful replacement for vi or other text based editors, yet allows developers to build upon their vi expertise by allowing common vi commands in the LPEX editor. The COBOL Development Tools for AIX feature of RDP includes many source editing-related capabilities that target IBM TXSeries. These capabilities help you:


  • Access remote files, processes and shells on AIX
  • Identify code problems early through live syntax checking
  • Color tokenize and syntax check embedded CICS® and SQL statements, making it easier to read and write source code
  • Use content assist for embedded SQL statements
  • Access code templates to help write code
  • View code snippets, including predefined COBOL source snippets
  • Select and extract source into a new paragraph using a new refactoring tool

Rick Sawyer did a great job showing off these features. Note that this video does not include the latest features of the 8.0.3 release.


Wednesday, January 11, 2012

Increasing the JVM heap for RSA, RAD, and other Rational or Eclipse products

I ran into an issue this past week where several times my Eclipse workspace ran into out of memory errors. I'm running Rational Software Architect (RSA), with several additional plugins, plus run one instance of WAS, and another instance of WebSphere Portal. Yes, I know. Yikes! That said, I have the horsepower for all these systems with a new laptop (a quad-core lenovo Thinkpad w520 with 16GB of RAM, can I get a hell yeah).

So I've never touched the top end of the memory on this laptop even running all this at the same time (along with multple browsers, Lotus Notes, putty, Word, and at least 2-3 other apps). So my problem was not my hardware. Rather its my JVM for RSA. I installed the 32 bit version of RSA as one of the plugins I'm using (HATS toolkit) requires the 32 bit version. You can increase the maximum heap size in the eclipse.ini settings found under x:\IBM\SDP\eclipse.ini , assuming you installed your environment off the root drive. In this file the values that come after the vmargs statement are passed directly to the JVM. Xmx is setting for the maximum heap size. I recommend that you change both this size and the Xms setting (the starting heap size). The Xmx/Xms setting should default to to 1024/100 respectively. I've increased it to 1536/256. Be very careful how you set these. Make a quick back up copy before you make your changes.


-vmargs
-Xquickstart
-Xms256m
-Xmx1536m
-Xmn64m
-Xgcpolicy:gencon
-Xscmx48m
-Xshareclasses:name=IBMSDP_%u
-Xnolinenumbers
-XX:MaxPermSize=128M
-Xverify:none
-Dosgi.requiredJavaVersion=1.5
-Dosgi.bundlefile.limit=100


You also MUST update the line



-vm 'install directory'\jdk\jre\bin\j9vm\jvm.dll
to
-vm 'install directory'\jdk\jre\bin\javaw.exe




Otherwise, it will not respect the variables and WILL crash your Eclipse instance. 


There is a great blog post on these various settings that I found at http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html
You may need to tweak some other settings as you go to manage performance. Don't forget that in version 8 of the products you can dynamically reduce your memory foot print: http://blog.strongbackconsulting.com/2010/11/reducing-rad-8-memory-footprint.html

Thursday, November 03, 2011

Deploying connection information to RDz users in an enterprise

When rolling out Rational Developer for System Z to a mass number of users, I've found there is an easy way to do this that avoids mass confusion, and frantic help desk calls.

Export RDz Connection Information
Usually the connection to mainframe will have many settings and parameters, that are unique to that environment, and even giving a user step by step instructions is usually not enough to quell the number of help desk calls when mainframers are making their first connection.

The easy way is to have one z/OS admin create the connection settings, specifying the host name (always should be fully qualified, and NOT just an IP address), the SSL certificate info, daemon connection type, and port information. Then right click on the connection, and select 'export'. Save this to a network share, or email it to the target team members. This ensures they enter the user does not fat-finger the SSL connection information when they enter it, and helps to cut down on the number of help desk calls.

Friday, October 21, 2011

Now available: Rational Developer for System z Training

We've been pretty silent on the blog over the past three months, but for good reason. We've been heads down working hard over the summer to build a curriculum based on our partnership with Island Training Solutions. We've now perfected and delivered our course to over 1000 developers worldwide.

The training is delivered remotely. Your developers can sit at their computers, and log into our remote virtual machine desktops. An instructor will be able to walk you through all the lab exercises on the remote VM. You do not need to have RDz installed on your desktop - the remote VM has all that your developers need. Our instructor will alternate between lab and lecture. Each module is between 10-45 minutes in length, and is about 70% lab. Your developers will get real, hands-on experience using the tool so they can get busy using the product immediately.

Our new course offers a one-day hands on, lab intensive on RDz. The course is highly modular, which allows us to tailor the curriculum to suit the needs of your mainframe developers. The one day course includes the following modules:

  • RDz Workbench Basics
  • z/OS Connections
  • Dataset management
  • Dataset members
  • Basic COBOL & PL/1 Editing
  • Compare, Replace, & Merge editor
  • ISPF Profile Editing
  • z/OS Projects
  • Working Offline
  • z/OS Job Entry System
  • Generating JCL (Compiling)
  • Syntax Check
  • TSO Shell & Emulation
  • Debugging Batch Applications
  • Debugging CICS Online Applications
  • Managing DB2 z/OS Data
We also have other modules that we offer either in replacement of those above, or in an additional half day class. Those modules include:
  • z/Unix Subsystem
  • Advanced Editing
  • BMS Editor
  • HLASM editor
  • CICS Explorer
  • CICS Web Services
  • DB2 Stored Procedures
The one day course is an excellent boot camp to get your COBOL developers started using the new RDz toolset. We also offer RDz installation and consulting services as well. If you are interested, please contact our sales group at sales@strongback.us.