Wednesday, January 4, 2023

LOL While Coding in 2023

Just a few days ago there was a thread on one of Rocket Software's community forums about users entering car license plates and searching the database for them. Their database has license plates like this list: QAA.6814, QAA-6814, QAA 6814, QAA/6814, or QAA6814. So, the proposed solutions were to create an index that cleans them up using "MCAN in the OCONV() function only leaves alpha and numeric character, eliminating all others." My best guess is this shop is a telnet shop using D3, a Rocket Software database.

You should be asking yourself why am I laughing when I should be crying? Using telnet you and D3 BASIC code which does not support regular expressions (i.e. regex) put you in a bind. You can use an OCONV to clean up the data as the user enters it or not and get this mess as described above.

The first thing any programmer worth their salary should be asking themselves, why have you not cleaned up the data? After you have done that fix the data entry program to stop letting the garbage in. Fixing this index for the user inquiry is like putting a tiny bandage on a head wound that keeps bleeding it takes a lot more to stop this kind of thing.

The laughing part is from realizing that I stopped building telnet applications some 20-plus years ago and stopped getting junk in the Universe/Unidata/D3 databases. With HTML5 you can add a regular expression to a pattern option. This means that garbage data would not get into your database because you stopped it at the time of input. When you index the field you would not need to clean it up just create an index on the data field.

Since I moved away from telnet and cleaned up our databases for our clients and ourselves, I cannot think of a time when we have had to clean up anything. Before there was replication, I wrote a routine to capture the changed data with a before image and an after image. That way if a user deleted a record or I needed to find the errand user that screwed up the data. Our XLr8Audit system had the goods to restore the deleted record of informing the boss and the user of the problem that was created by them which could be backed out as well.

Our job as programmers is not to let this stuff in the first place. If you do then your battle will be a lifetime of work to keep up with users that you let them enter anything. A former staffer that did our QA always said to us programmers that if you allow them to enter GIGO the problems are with you not them.

Someday, you have to stop programming in telnet and embrace new technology. Those companies who do not do this will have their software replaced and maybe their whole department. A former Universe client had roughly 5 programmers that wrote the entire system that ran a county in Colorado. The entire staff was replaced by 40 programmers writing in Java and other languages using Microsoft SQL Server, not Universe/Unidata/D3 databases.

Wednesday, March 30, 2022

Upgrading after 4 plus years

 When Eclipse 2022-03 came out this March, I was very happy that I could finally upgrade from the 2018 release. I could not believe it, I could be on a current release of Eclipse IDE. So, you might be asking yourself why were you stuck on that old release. Funny you should ask that and I will tell you the short version.

A couple of companies in the Eclipse world one called IBM and the other called Actuate Corporation were the large companies formally in charge of the development of the Business Intelligence Reporting Tool (BIRT). Somehow in the intervening years, Actuate got bought out by OpenText in 2015. OpenText pretty much stopped the development of the free version of BIRT and either transferred those Actuate employees or let them go. IBM, on the hand, just canceled its BIRT team around the same time even though many of their product relies on this technology for reporting.

This left BIRT with only a few volunteers to fix the bug and put out releases. Although they tried the last workable release was 4.8 in 2018. That is the release I have been using for about 4 plus years now. It worked but was based on Java 8. With each subsequent release of Eclipse which included new Java code, BIRT would not work with the other components that it relied on. Therefore you could not put the 4.8 packages into any new releases of Eclipse IDE.

As I have said many times before, Rocket Software Universe or Unidata has no built-in way of reporting except for the PRINT (page 295) statement using the PRINTER ON statement before that statement. So you have to write code to do logos, formating, paging, headings, and of course footing. With BIRT, however, you can print amazing reports. You can see one of my reports in the BIRT Gallery under the company name U2logic.

Sometime around the spring of 2021, a new group of volunteers started to work on bringing BIRT up to Java version 11 and hopefully releasing it to the public within a few months. It turned out that they were very optimistic about that goal. Nonetheless, just this month BIRT was released without a lot of fanfare. The wonderful engineers fixed numerous bugs and brought a release that works with the current version of Eclipse. Oh, by the way, I am using Java 17 with BIRT and it works wonderfully.

U2logic tool XLr8Reporter is now available for free with the purchase of any other product of XLr8. That means if you have a copy of our XLr8Editor or our other products you can use the BIRT designer interface to Universe and Unidata to create PDFs, XLSX, DOCX, and HTML reports for you or your shop.


Tuesday, January 11, 2022

Teaching an old dog new tricks

 It has been said that most programmers in their '20s are in their prime and they know everything. It has been said that most programmers in their '30s are good at hanging on to their job with the skills they learned in the last 10 years. It has been said that most programmers north of their '40s are just knowledgeable on what has been done and are always viewed with suspicion because their skill set is believed to be 20 years out of date. It has been said that most programmers just north of their '50s have limited knowledge of today's languages and technologies since their skill set is 30 years out of date. It has been said that most programmers in their '60s should have already retired or must be hiding in the mainframe closet because nobody remembers what languages or technology knowledge they could have known.


Why would you decide either overtly or covertly to not continue learning? If you are a lawyer most states require Continuing Legal Education or CLE to maintain your standing in the bar association. Lawyer in many states, you must have additional hours in professional responsibility and ethics and other courses. Engineers, depending on their specialty, may be required to complete Professional Development Hours or PDH to maintain their state license. Some states require as well some hours for professional ethics as well as other courses. Software engineers are not considered real engineers and almost all states do not require a license. However, if you call yourself an engineer in some states you can get into a bit of legal trouble if they find out you are just experienced in software.


Could this be why most programmers do not consider themselves to be software engineers? Could this be why most programmers loath learning a new skill or even being certified on some vendor products? Could this be why year after year the skill set of programmers on balance never grows? Could this be why when a new release of the database, or a new release of your particular programming language specialty that the documentation sits unread?


Well some of us think this should not be the case. On average the databases, I work on are updated every 18 months. The manual that comes with it has to be read from cover to cover to see what changed or to see what I have forgotten. The latter is most often the case but I digress.


The database Universe started supporting JSON through a library call. There was little fanfare on the normal sites I look at. The documentation supplied by Rocket Software was very poor with no decent examples. About 5 years later there was a good example from one of their engineers a little late for me. Nonetheless, I was able to wade through the syntax and get an idea of what it could do to replace our hand-coded string builder. I converted our handed coded JSON string UniBasic code to create JSON objects using the new functionality. For the most part, it took about 2 days to get the production code changed to use this new library call. Ironically, to create JSON the new way was not much faster until the strings reach about a megabyte then the code was much faster. Below is a sample of the changes.


SET.PROPERTY.OLD:

     JSON = "" ; ADD.IT = @FALSE

     MAX.FM = DCOUNT(PARAM1,@FM) ; * Example: CustomerName:@FM:Address

     FOR X = 1 TO MAX.FMT

        IF ADD.IT THEN JSON := \,\

        JSON := \"\:PARAM1<X>:\":"\:PARAM2<X>:\"\  ; * PARAM2 is the data        

        ADD.IT = @TRUE

     NEXT X

     RETURN.ID = "{":JSON:"}"     

     RETURN



SET.PROPERTY:*

     JSON = ""

     RTN.STATUS = UDOSetOption(UDOOPTION_OUTPUTMODE, UDO_OUTPUT_COMPACT)

     RTN.STATUS = UDOCreate(UDO_OBJECT,udoObj) 

     MAX.ROWS = DCOUNT(PARAM1,@FM)            

     FOR X = 1 TO MAX.ROWS           

        RTN.STATUS = UDOSetProperty(udoObj,PARAM1<X>,PARAM2<X>)

     NEXT X

     RTN.STATUS = UDOWrite(udoObj, UDOFORMAT_JSON, JSON)

     RTN.STATUS = UDOFree(udoObj)     

     RETURN.ID = JSON

     RETURN

Our main entry tool web browsers get updated every 6 to 8 weeks. When they do update there are two things that always change for us such as JavaScript and CSS language support. It took 7 plus years for Firefox to fix a problem with the cursor moving to the URL after an AJAX call instead of the next column in the data table grid. Of course, this worked in Chrome but we had to put in a dead function call to not lose tab support to create a workaround for our Firefox users. Nevertheless, you have to read the developer notes to see what is new, what is changed, what is fixed, and what is no longer supported.


Somewhere around 2016 ES6 JavaScript language brought arrow functions also called fat arrows. They are used to help in writing concise functions. It took a bit of practice to understand what they can do for you. Nonetheless, there was some push back from clients and staff asking why would a programmer go into working code and change just because JavaScript had new features. Again, they are not wrong but the why is important here.


The word that describes "fat arrows" is that they are concise. Why is that not a good thing? Learning new things can introduce bugs that have been routed out. Maybe since some of this code was written in the early 2000's it could use an update and the next set of programmers that would not roll their eyes when they talk about this old code if it is constantly updated as standards change. Below is a sample of old and new code.


oDrivers = [{"id":"1","value":"Unitas"},{"id":"2","value":"Brisco"}]

// Old Code

for (var i=0;i<oDrivers.length;i++){

if (oDrivers[i].id==DriverNo){

driver_name = oDrivers[i].value;

}

}

// New Code

var driverItem = oDrivers.find(obj=>obj.id==DriverNo, true);

driver_name = driverItem.value;

If you are not willing to learn then maybe it is time to retire from programming. Or you could look into another profession that requires less continuous education suggestions. Or if you are so inclined you could get promoted to management. See the Dilbert Principle for more informed comments on management style and substance.