Sunday, April 24, 2016

What Other Languages to Learn?

I consider myself to be very blessed to have been able to start in a full-time programming job in my forties. This is especially true as I did not start with any formal computer science education. Because of what I was able to do for about 15 years, mainly with Microsoft Access and Excel, I was given a chance in my company to write OmniScript. This has shown me just how much I enjoy programming. Therefore I came to want to learn a lot more about it, especially learning some other programming languages.


Where to Start?

What other,  more common,  programming language would I start with?  A simple Google search yields a lot of blog posts and articles on this subject. There are many different opinions but one of the languages that was on the short list of most, if not all, was Java.  C and C++ were also near the top of most lists but I found that Java appealed to me the most.


Why Java? 


I decided to start with Java for a few reasons.

  • Though Java has been around for over 20 years now, it is still one of the most popular programming languages. 
  • Java is cross platform.  "Write once, run anywhere." 
  • Java is used in making Android apps, something I had an interest in doing.
  • Though I'm still interested in learning C and/or C++, Java seemed like an easier starting point. 
  • I liked what I was seeing for online resources to learn Java.

Regarding the last point, I found a Udemy course in Java that I was planning to start but then I came across the Stanford Programming Methodology course (CS106A) and decided that would be a great place to start. Not only would I be learning Java, I'd also be learning good programming principles. I'll write more about my experience with the Stanford course in my next post.

While to some extent this could be said of my introduction to OmniScript, in the words of Obi-Wan Kenobi, I felt like I was about to take my first step into a larger world, and I was quite excited.

i++

Sunday, April 17, 2016

Notepad++ and OmniScript

Writing OmniScript in the default application, OmniStation, soon had me longing for something more. In that application there are no helps for the programmer. There is no language color coding and no hotkeys. Then I got on a big project developing a new website and we were introduced to a browser based scripting tool that does have some color coding. This was a welcome addition but this scripting tool also had some limitations and still no hotkeys. So I still wanted something more. Enter Notepad++.



Language Support


I had come across Notepad++ earlier but at that time I wasn't doing any programming so I didn't fully appreciate what it could do. Naturally there was no pre-programmed Notepad++ language support for OmniScript. So I set about setting up a user defined language for OmniScript. With colors for if/ ends, loop/endloops, routines, functions, comments and more, this made looking at and following scripts so much easier. I have continued to tweak this user defined language over the last couple of years and a growing number of scripters on our team are using it and Notepad++. It's worth having to paste script back into OmniStation over and over to be able to use the benefits of this great text editor.  



Other Great Features


Other great features of Notepad++ have made it one of my favorite programs of all time. The hotkeys are a great time saver. I constantly use them to delete or duplicate and move whole lines. Indenting or un-indenting whole sections at once has been another great benefit. And then there are the search features. Simply double clicking on a word and having all other such occurrences of the same word in that file automatically highlighted has been a huge help in avoiding and finding errors. Searching for all occurrences in one file or all open files has been wonderful for making changes or just tracing the flow of a program. I regularly have 30+ component scripts open at the same time and I can't say enough about being able to so easily search for all occurrences of a variable or term across all scripts at the same time, with all of the results so nicely cataloged for me. On top of all of that there are the great plugins.


I am constantly singing the praises of Notepad++ to my co-workers. I have often said that I want a Notepad++ shirt to wear. It has become goal of mine to at one point contribute to this great program.


i++

Sunday, April 10, 2016

OmniScript Containers

One of the best features in OmniScript is what is known as Containers. The closet thing I can compare them to is a table in a database, such as Microsoft Access. The same thing could be accomplished with a multi-dimensional array but the container structure ties everything together very nicely and makes it very simple to set up and work with.

Creating Containers

When you create a container in OmniScript you declare the length of the key for each record as well as how many of each type of field you will be using in the container. As with OmniScript variables, there is only one type of numeric field but there are three different types of text fields based on the length of the string.  There are 10 byte, 40 byte and 200 byte text fields. So you determine how many of each field you will need and declare them in the container create statement.

Adding and Updating Container Records

Once the container is created you can add records or update existing records based on the unique record key. Numeric fields can be set or added to or subtracted from. Text fields can only be set but through a two step process you can read what is in them, append to that string, and then reset them. Any record fields that are not set when the record is added to the container default to 0 for numeric fields or null for text fields.

Because each key is unique and the records in a container are sorted by the key, containers are useful for both sorting and consolidating duplicates.

Accessing Container Records

Individual records in a container can be accessed with a get statement by specifying the record key.

Just like with the built in sets of records in the recordkeeping database you can loop through the records in a container. You can either loop through all records or you can use a key prefix to only loop through the records that have a key starting with the string provided. This allows you to create one container with a primary set of records and then create a second container that has a varying number of records that relate to the records in the first container, in a one to many relationship. The key of each item in the second container begins with the key of the corresponding item in the first container.

And so then you can loop through the first container and for each item in that container you loop through the second container with the key of the first container being used as a keyprefix for the loop on the second container.

Cleaning up Containers

Naturally, container items can be deleted and containers can be emptied and reused as needed. When you are done with them it is also important to destroy containers to clear them out of memory and free that memory up.


Containers are definitely one of the strengths of OmniScript and a very useful tool in managing data.

i++