Microsoft Flight Simulator – Arriving August 18

In June 2019 I blogged about the upcoming Microsoft Flight Simulator, often dubbed Flight Simulator 2020. I have been following the development, even if I have not been part of the alpha testing group.

Microsoft worked closely with the Flight Sim community, and posted a series of videos where they talk about different aspects of the game. I think most people (including me) expected the game to be released in late November or early December, to coincide with the holiday season.

But just a two weeks ago, it was announced that the game will be available on August 18.

There will be three different editions: Standard ($60), Deluxe ($90) and Premium Deluxe ($120). The more expensive editions contains more airplanes and additional handcrafted Airports. Pre-orders are already open.

Airplanes available in the different editions
Available hand crafted airports

The graphics is spectacular, Microsoft has recreated the whole Earth using satellite images and aerial photography, together with AI to create 3D buildings and trees from flat images. Weather is simulated in detail, and you can even get real-time weather. The airplanes are simulated in detail, in one of the videos from the developers they said that when you turn on landing lights, you see the Ampere meter move.

You can also fly together with other people, and in the most realistic settings real life air traffic will be available in the simulator.

I started playing Flight Simulator 3.0 back in 1988, and I don’t think I could even imagine backbthen what the game would look like 32 years later…

Flight Simulator 3.0 (1988)
Flight Simulator (2020)

0 Comments

Microsoft Flight Simulator – It will be back!

I am not a gamer, but there are a couple of games I do enjoy. One of them is Microsoft Flight Simulator, which I have been playing since 1988 or so. Yes, since version 3.0 for PC.

With each version it became more and more realistic looking, you could even buy third-party maps that used satellite images. I was able to fly over my house and identify it. The graphics was good, but not spectacular compared to the games of today. Then in 2009 Microsoft closed down the studio that had been developing the game, to the big upset of the flight sim community. The last version, Flight Simulator X (version 10) was to be the last.

There are a couple of alternatives today, the two major ones are X-Plane and DCS World. I recently started looking at DCS World, and it is pretty impressive. It also supports Virtual Reality headsets out-of-the-box. The game itself is free, you get a couple of airplanes and one region where you can fly. You then purchase the planes and regions you like, over time. The graphics in the game is stunning.

Recently, during the E3 trade show, Microsoft announced that there will be a new version of Flight Simulator in 2020. A 4K video was shown, and the graphics is amazing. The terrain is generated from satellite images, and the environment (ground vehicles, animals on the ground, etc) are controlled by AI. Looking at the video, the graphics is way ahead of anything I have seen.

I really hope Microsoft will be able to deliver, and that it really will be available in the end of 2020. I have been planning to build a new computer for a while, but now I will probably hold off until closer to the Flight Simulator release, in order to get the best and newest components. I have a feeling the game will use every ounce of power available for this level of realism.

6 Comments

CollabSphere 2019 – Registration and Call for Abstracts

The registration for CollabSphere in Boston this fall is now open. This conference, formerly known as MWLUG, is a great opportunity to learn more about the future of the IBM/HCL Collaboration products (Notes, Domino, Sametime, Connections, and more) directly from the product managers and executives at HCL. When CollabSphere takes place on October 28 to 30, the HCL acquisition of the products should have taken place, but you will still see many familiar faces on stage and at the round-table discussions, as a large number of IBM:ers followed the products over to HCL. This is obviously a sign that they belive in the future of the collaboration tools under HCL’s control.

In addition there will be many other sessions from business partners and customers, where you will learn the latest and greatest, as well as best practices, for everything related to the platforms. I have attending MWLUG and CollabSphere for several years, and the sessions are always top notch. Not only do I always learn new things, I also get inspired and energized to do new things with Notes and Domino.

This is also a great opportunity to network, both with HCL executives, product managers and developers, and with other customers and business partners.

The cost of the conference is only $100, which is a steal if you look at what you get. Most of the cost for the conference is covered by sponsors.

If you want to share your knowledge at CollabSphere, the call for abstracts is also open now. Submit your session, and perhaps you get to present to your peers in Boston in the end of October!

I hope to see you in Boston!

0 Comments

Thirty Years – What A Ride!

Thirty years. It can feel like an eternity, or like just yesterday. That is how long I have been working in the IT industry, as of 2 weeks ago.

When I graduated the Swedish equivalent of High School in the spring of 1988, I did not know what lay ahead. If anyone would have told me where I would be 30 years later, I am not sure I would have believed them.

Computers, and especially programming, was my big interest. I had spent every available hour in the computer room in school. I went there during breaks between classes (if only 15-20 minutes) as well as during lunch break (usually 1 hour long. I learned to eat really fast, to maximize my time in front of the computer… Then after school I often spent 4-5 hours learning to program, either from books, magazines, or from other students.

After I graduated, I was not really motivated to go to college. But I found an intensive one-year college level education in systems programming and computer science. It would be classes 8am to 5pm, 5 days a week. Today you would probably call it boot-camp…

Unfortunately the class did not make, it needed a couple more students. So in the beginning OS September 1988,after about 2 weeks of classes, we were told to come back in January. We were encouraged to find a job or internship in the mean time. So I started to call around to different companies I found in the yellow pages.

After a few days I got a hit, a company was looking for a first line support technician. I sent in my application (I did not even have a formal resume) and a copy of my high school grades. A week later (on a Friday) I had an interview, and the following Monday I started working there. This company was Microsoft.

Needless to say, I learned a lot at Microsoft. I return to the class during the spring semester, worked at Microsoft during the summer break and then again after I graduated at Christmas.

After a year in the Air Force for the (then) mandatory military service, I intended to go back to Microsoft, but I was offered a job as a programmer at another company, and I jumped at that option. From there it just continued, via 5 years as an IT journalist and then over 20 years working mainly with Lotus (later IBM) Notes and Domino.

There are times when it feels it was just like yesterday I was writing Pascal code for a computer running CP/M-86 as operating system. Or when my coworker and I, who lived in the same apartment building (but on different floors and in different ends of the building) decided to run RG58 coax cable between out apartments, so we could network our computers. Or when I went scuba diving in Egypt and brought an IBM ThinkPad 701C (the model with the expanding keyboard) and a digital camera with me, so I could write a diary to publish on my personal website. Yes, it was pretty much a blog, way back in 1995…

But when I look at how technology has changed, it feel like the middle ages.

Our network at school (yes, we actually has one!) had a hard disk the size of a small shoebox, and with a capacity of 30 MB, to be shared between students and teachers. Yes, it’s not a typo. 30 Megabyte! Today most hard drives have at least twice that amount of memory just for cache…

Compare that with my mobile phone, on which I am writing this post while riding a bus from Dallas to Houston. It has 2185 times that memory (64 GB) built in. I have an additional 200 GB in the form of a micro SD card. This amount of storage would have been unfathomable 30 years ago.

Today we have internet access everywhere. I can sit in my car, in a restaurant or on a bus in the middle of nowhere and still have access to all the knowledge (not to mention cat videos) in the world. In fractions of a second I can perform a search that would have been virtually impossible 30 years ago.

I can turn on and off the lights at home, no matter where in the world I am. I can check the temperature in the different rooms and change the AC settings, if needed. I get an automatic alert if there is smoke I the house, or water where it is not supposed to be. And I can check the status of my laundry remotely.

I can talk to the computer, phone and other devices and have them turn lights on or off, tell me what the weather will be later that day or the next few days, or play any music I ask it to play. This is just like in Star Trek or 2001, except it is for real.

I can buy anything I need from the comfort of my home, or from anywhere in the world, and get it delivered within a day or two, sometimes even the same day.

At the same time I do miss the days back when I started with computers. It was like a new frontier, an unknown area where you had no idea what could happen next.

I still remember the excitement when I managed to create something new and cool, and I got it to work after spending countless hours working on it and troubleshooting the code. It is rare that I feel that excitement today, in the same way. But it still happens. .

I am very fortunate to be able to work with what I love, and have been able to do it for this long. I am looking forward to the next 30 years with great excitement.

1 Comment

Six Days Left…

I have finished the slides for my presentation at CollabSphere in Ann Arbor next week. I just have a little more code to add to demo database, and perhaps throw in a bonus or two…

My session will be next Wednesday (July 24) at 9am in Grande III.  There are still a few seats available for CollabSphere 2018. The cost is only $100 for 3 days of presentations, workshops, and networking, This is great value for the money!
Don’t miss the latest from IBM and HCL on Notes and Domino 10, Nomad and probably a surprise or two.

 

 

1 Comment

Domino 10 is coming… in 2018!

IBM and HCL have promised to release Domino version 10 by the end of 2018. The other  week there was a joint webinar where some of the new features were discussed. If you missed this, there is a replay of it available. I will discuss some of the features in just a moment. But just look at the infographics below. There are so many new features already lined up.

The promise of Open IDEs means that we should be able to use more modern development tools. Hopefully the latest version of Eclipse, and maybe even Visual Code and/or Visual Studio. Those were frequently requested during the Domino 2025 jam. Support for OAuth authorization was also promised, as well as more REST APIs. Support for Loopback was mentioned.

There were even demos, despite HCL only being 8 weeks into the development. Quite a few features had already been developed earlier, at IBM, but were not released for one or another reason.

For being less than a month before the big IBM Think conference, where you would expect some big news to be presented, HCL and IBM did not hold back. This makes me very excited about what all we will get to see in Las Vegas later this month.

So what all did we get to hear about and see last week?

Let’s go directly to Domino. A new file format, called NSF-2 is being discussed, and we were promised an increase of the maximum file size from 64 GB to 256 GB per database. This is very welcome. DAOS has been a stopgap, helping when the database contains a large number of attachments. But when you have a very large number of documents, you previously had to split them into multiple databases. 

While on the subject of a lot of documents, IBM is planning to overhaul the search as well, using elastic search (ES or E-Search as IBM calls it) to search even faster in large data sets. Even more support for running Domino in Docker containers is planned, including Docker Enterprise images. Domino running on Raspberry Pi?

For me as developer, the most exciting news is that Domino will support Node.js. HCL promised a full node.js implementation, so you can use the package manager npm within Domino. It also sounds like HCL is at least thinking about ways to implement support for Git. This is huge, and it will give Notes/Domino developers access to modern tools and functionality. But not only that, it will be easier for Domino customers to find expertise in the form of developers, as node.js is a very popular framework. In addition, Domino developers will learn new technologies, making them more attractive on the market.

 

During the Q&A session afterwards, the representatives for both IBM and HCL promised even more cool features to be presented at IBM Think in Las Vegas, coming up next week. Among what is to be presented is a brand new roadmap and a list of the features requested during the Domino 2025 jams earlier this year. I can’t wait to see what is in store for Domino.

There are several sessions covering Domino 10, and you can bet I will be in the audience! I hope to see you in Las Vegas next week.

 

 

0 Comments

My presentation at MWLUG

Tomorrow, August 8, you are welcome to attend my presentation “Elementary!” at MWLUG 2017. In about 45 minutes I will show how to easily incorporate Watson functionality in your own applications, both on the web and in your Notes client applications.

I will be using Node-RED and IBM BlueMix to do this, and I think many will be surprised how easy it is, and how little code is needed. For example I will implement translation from English to Spanish with two (2) lines of server side code. To call this from the web you just need another handful of lines.

I hope to see you tomorrow at 5pm!

0 Comments

IBM Connect 2016 announced – in Orlando!

IBM just published information about the future of the conference known as Lotusphere/IBM Connect/IBM ConnectED. To the contrary of what probably everyone thought, the conference will be back in Orlando in January 2016, reverting back to the name IBM Connect.

It’s long run at Walt Disney Dolphin and Swan (affectionate known as Swolphin) will however be over. In 2016 the conference will take place at The Hilton Orlando, between January 31 and February 3. So the length of the conference will be the same as IBM ConnectED earlier this year.

The rate (on the hotel website) is currently $219/night plus a $22/night resort fee (which includes free in-room wifi). A bit less expensive than Dolphin and Swan.

Connect2016-SaveTheDate
I hope to see a lot of my old friends (and make some new ones) in a little over 7 months.

2 Comments

IBM ConnectED 2015 – The Good and The Bad

When I arrived to Orlando for the 18th time to attend Lotusphere (now renamed IBM ConnectED), it was with mixed feelings. The conference was much smaller than before, and everyone expected this to be the last conference in the Lotusphere format in Orlando. IBM had a contract with Disney that expired after the 2015 conference and we all knew it. So most attendees did see this as a last hurrah or a kind of farewell to Lotusphere.

But during the conference the feeling was something different. There was an energy there, and people were excited, not saying farewell.  Many new announcements were made that energized the attendees.  In particular the new web based mail client IBM Verse generated a lot of buzz.  The news that IBM Verse will integrate with Watson logic and capabilities and the promise of an on-premises version later this year were especially positive and energizing.

The sessions I attended were great. The opening session had a new format, with the guest speaker at the end instead of at the beginning, and this actually worked really well. There were a lot of demos, most of them said to be live, and no panels on stage. There were three customer stories/presentations (from Blue Cross of California, Bureau Veritas and LVMH Moët Hennessy – Louis Vuitton) and they were refreshingly more relevant than the “commercial breaks” of the last several years. The guest speeker was French high-wire artist Philippe Petit, famous for walking on a line between the two World Trade Center towers in 1974. This event is the subject of an upcoming movie called The Walk, with former Lotusphere guest speaker Joseph Gordon-Levitt playing Petit. I enjoyed his talk, it was one of the better ones. I still think he is crazy for what he does, though. 🙂

SessionIsFullThere were several session who were filled to capacity and had to turn away people, just like in the good old days of 10,000+ attendees back in 1998-2000. Yes, the sessions who were full were scheduled for fairly small rooms, but they were also extremely technical in nature. To me this indicates that this is just what the audience wants. More hard core technical sessions and less marketing and customer stories. IBM marketed ConnectED as more technical than in the past, and to a large extent they delivered. But there were still a number of sessions with less technical/product subjects.

Liz Urheim at IBM is talking about IBM Verse at the closing session
Liz Urheim at IBM is talking about IBM Verse at the closing session

The main focus of ConnectED was in two areas: IBM Connections and IBM Verse. The unexpected announcement that IBM Verse will be offered as a freemium product and positioned to compete with giants like Google Mail in itself generated a lot of interest. Attendees were also guaranteed early access to the new IBM Verse mail client.

Personally I really like the integration of IBM Watson in Verse, and the way email is sorted/categorized based on importance. I am looking forward to testing this for myself.  I hope there will be a way to import existing email from Gmail or even on-premises Notes mail into IBM Verse.

There were, as always, some complaints among the attendees and many had to do with changes to procedures from previous years. During registration, each person was give four (4) drink tickets for the Monday and Tuesday parties. Previously the drinks were free at these events.  Since the generic paper tickets given out at registration came from the office supplies chain Staples, some attendees considered just driving to a local store to buy some more. In the end IBM did not enforce the drink ticket policy.  They rescinded this in steps, first not requiring them at the Monday evening event where the 25th birthday of Lotus Notes was celebrated, and then again at the Tuesday party.

The traditional Wednesday party in a local theme park was moved to Tuesday last year, as the Kennexa part of the conference ended one day before IBM Connect (as the conference was called in 2013 and 2014). This year the party was held in the Dolphin hemisphere ballroom, with a band playing and serving some food and drinks. The party was two hours long, shorter than the theme park parties in the past. The loud music made it hard to talk, so I actually did not mind the shorter party. But I have to say that it did not feel anything like the events in the past.

It is obvious that IBM is in cost savings mode. The badge holders were regular clear plastic holders, not the much more elaborate and useful holders of the past with the conference name printed on it, integrated pen holders, pockets useful to hold and collect business cards as well as space for the convenient pocket guide with all sessions. But what irked the attendees the most was that the traditional pretzel cookie in the boxed lunch distributed on the last day of the conference had disappeared.  In its place was a generic cookie that was not well received by attendees. The Twitterverse lit up as disgruntled attendees expressed their strong displeasure using the hashtag #pretzelcookiegate.  IBMs Jeff Schick even mentioned this during the closing session.

The exhibitors at the showcase were located in a new area called TechnOasis, two meeting rooms in the Swan conference section across the hallway from where most of the sessions took place. Personally I liked the location, it made it much easier to drop by the different pedestals between session than in the past. The area was much smaller than in the past and a little bit harder to navigate. I am not sure if the size was due to fewer companies exhibiting this year or because the available space was limited. As opposed to previous years I was able to meet up with pretty much every exhibitor, and I found some very useful products.

One of those product was Domino4Wine, which lets you run Domino Designer and Administrator natively in OSX and Linux. Prominic.Net worked with (and paid) CodeWeavers, the company behind CrossOver, to get the IBM products working in Linux and on OSX. Teamstudio also announced that their products work in this environment, and other toolmakers like Ytria (creator of scanEZ and several other Domino toiols) and MartinScott Consulting (developer of NoteMan) also plan to make sure their products work in this environment.

This is a very interesting development, and it shows that the business partners community see such a strong value in Notes and Domino that they are willing to pay for development that IBM really should have done, and which the community have been requesting for years.

DSC_3671The closing session featured Dr Arthur Benjamin, a professor in mathematics. He is what he calls a mathemagician, and on stage he squared two-digit, three-digit and four-digit numbers faster than the assistants from the audience could do it with their calculators. He even squared a five-digit number, but that took a little bit longer, about 45 seconds. He also explained the method he uses to perform these calculations. The closing sessions are always great, and this was one of the best ones I attended, in my personal opinion.

After the closing session there were a number of traditional events loosely organized by members of the community. Linuxfest was held poolside.  This year it was more a review of Linux related news and a Q&A session for running Notes and Domino on Linux. Later that evening another tradition continued with the closing of Kimonos at 2am, followed by a gathering of about two dozen community members and IBMers in the Dolphin rotunda. Beverages were consumed and Mat Newman had his badge removed around 3.45am, marking the unofficial official ending of Lotusphere (or ConnectED if you are IBM).

People said farewell, with the usual “see you next year” and “see you next time” even though we were all acutely aware of the lack of future plans for the conference. Some people hope that the success of ConnectED 2015 (rumors talk about over 3000 paying customers, as opposed to the planned 1500) will pave the way for a Lotusphere 2016.

In my opinion the most likely resolution is that IBM will fold the conference into one of their mega-conferences in Las Vegas. The important thing then is that the ICS (Collaboration) products like Notes, Domino, Verse and Connections must have their own section and not be so mixed in and diluted with all other products. That would make it very hard to find our specific sessions and also be a huge disadvantage for the active and engaged Notes community itself. There is a need to have a place to congregate as specialists in this field so that we can meet, congregate, learn from each other, re-invigorate and motivate ourselves and enjoy each others company.

At the closing session, Liz Urheim from IBM said that the plans were still being discussed, but that there would be a ConnectED/Lotusphere in one form or another. She promised some news in the next few months.  Soon we shall see.

On a personal note, I am happy I got to see so many of my friends, and as always I made some new ones. Some of my long-time friends were missing and their absence was noted.  What is clear is that they are still part of the community even if they do not attend anymore or have moved on to work with other products or platforms. Once in, never out.

With this I am saying goodbye Orlando and goodbye Lotusphere. See you all next year, wherever and under what name it may be. To me it will always be Lotusphere.

5 Comments

Nokia is dead

Microsoft is taking a page out of IBM’s playbook and is killing off the Nokia brand. Future models of the smart phones in the Lumia series will be named Microsoft Lumia. Last month the Nokia Lumia 735 and 830 were launched, and they will probably be the last phones branded as Nokia.

The mobile division of Nokia will also be renamed to Microsoft Mobile.

More at The Verge.

5 Comments

Two more days to thank someone

IBM Champion

It is now just two days left to nominate IBM Champions. So if you know someone who have been helping the community, perhaps through video tutorials, blogs, presenting at (or organizing) conferences or answering questions on different forums, submit a nomination.

This is how IBM explains what a Champion is:

An IBM Champion is someone who makes exceptional contributions to the technical community. Contributions can come in a variety of forms, and popular contributions include blogging, speaking at conferences or events, moderating forums, leading user groups, and authoring books or magazines.

So hurry up. There are many worthy champions out there!

0 Comments

Swedish fighter jets to compete for US contract

Swedish Air Force JAS39 Gripen (single seat model). Photo by Ernst Vikne (Creative Commons BY-SA).
Swedish Air Force JAS39 Gripen (single seat variant).
Photo by Ernst Vikne (Creative Commons BY-SA).

According to an article in Aviation Week, Boeing is planning to team up with Swedish airplane manufacturer Saab to offer a new two-seater training version of the JAS 39 Gripen fighter to the US Air Force. The old Northrop T-38 is being retired, and a new trainer is needed in the future.
Approximate 350 trainers are needed, but in addition the fighter could be useful for aggressor training (e.g Red Flag and Top Gun), currently flying mostly F-15 and F-16 fighters.

Another use for the two-seater JAS 39F model would be as a companion trainer for the F-22 Raptor and F-35 Joint Strike Fighter, neither of which are being produced in a two-seat version. Currently T-38 is used in this position as well.

A source in the USAF quoted in the Aviation Week article hints that the step is not very far to use an affordable air defense fighter to replace the aging Air National Guard F-15/F-16 fighters.

Hungarian Air Force Saab JAS39D Gripen
Hungarian Air Force Saab JAS39D Gripen

JAS 39 have been produced in four different variants. JAS 39A and B were the initial version that entered service in 1996. Some of them have been updated to the new C/D models, and additional JAS 39C/D have been delivered to countries like Hungary, South Africa, Thailand and Czech Republic.

Switzerland is intending to buy the new JAS 39E single-seat model, after a referendum in 2014. Sweden is also planing to upgrade to that model when it becomes available.

The F model Boeing is intending to offer the US Air Force is a brand new development, possibly with some functionality not needed in a trainer removed to save cost.

0 Comments

How to write better code in Domino Designer – Part 4

I am back after a short break. Let’s continue where we left off. Today I will talk about object oriented Lotusscript. We looked at functions in part 3 of this series, and while functions are very useful, you should consider building objects instead.

So why would you use classes? The short answer is that they are much more powerful and also much easier to maintain. The code is usually shorter and I get a better overview. It is modular and can easily be moved to other applications. It is easy to maintain and add functionality. And the calling code can be very compact and easy to understand as well.

You are already using objects/classes today, when you are writing Lotusscript code. The DOM (Domino Object Model) are made up of classes that let you access different Domino objects, like sessions, databases, views, documents, etc. You already know how to call and use classes, now we will look at creating your own. It is much easier than you probably think.

About 2 years ago, I wrote two articles about object oriented Lotusscript, but the code samples were scrambled when I moved my blog to WordPress. You can find the old articles here and here. But the article you are currently reading will be look at a more basic class, and explain more of the code.

 

How do I write OOLS?
You write class definitions and code in the Declarations section in Domino Designer. I usually put my classes code in script libraries. Most of the time I put just one class in each script library, but if they are related and one class is used only within another class, I put all related classes in one script library. I then name the script library after the main class, so in my claim system I have script library called Class.ClaimData, Class.FinancialTransactions and Class.ClaimLink.
You define a class, with one or more functions/subs. You can also define variables in the class to store data inside the object. Functions, subs and variables can be private (only accessable inside the class) or public (accessable from the calling code). You should always have a Public Sub New() defined in the class.

I have posted several classes here on my blog in the past, doing different things:
Get latitude and longitude for an address – Win32 only
Mail Merge/Form Letters in Lotusscript
Mail Notification Class
Class for File Functions
HTML Retrieval Class – Win32 only
Accessing Windows Clipboard – Win32 only

Take a look at those article and you should get an understanding of how to write a class..

 

Your First Class

Let’s start with a very simple class. It will contain some math functions. We will start with just one, used to add two values together.

Option Public
Option Declare

Class MathClass
    Public value1 As Integer
    Public value2 As Integer

    %REM
        Sub New()
        Description: Constructor for the class
    %END REM
    Public Sub New()
        '*** We will add code here later
    End Sub

    %REM
        Function Add()
        Description: Adding value1 and value2 and retur result
    %END REM
    Public Function Add() As Integer
        Add = value1 + value2
        End Function
End Class

And this is how you use the class:

Sub Initialize
    Dim math As MathClass
    '*** Create new instance of MathClass
    Set math = New MathClass()
    '*** Set the two values in the class
    math.value1 = 4
    math.value2 = 6
    '*** Display the result of the Add() function
    MsgBox math.Add()
End Sub

Easy, wasn’t it? However, we can expand a little on this. Instead of assigning the variables value1 and value2 after the math object is created, we can pass the values to the object at create time:

Option Public
Option Declare

Class MathClass
    Public value1 As Integer
    Public value2 As Integer

    %REM
        Sub New()
        Description: Constructor for the class, taking two integers as arguments
    %END REM
    Public Sub New(arg1 As Integer, arg2 As Integer)
        value1 = arg1
        value2 = arg2
    End Sub

    %REM
        Function Add()
        Description: Adding value1 and value2 and return result
    %END REM
    Public Function Add() As Integer
        Add = value1 + value2
    End Function
End Class

And here is the updated code to use the class:

Sub Initialize
    Dim math As MathClass
    '*** Create new instance of MathClass
    Set math = New MathClass(4,6)
    '*** Display the result of the Add() function
    MsgBox math.Add()
End Sub

We can now easily add more functions to the class, for subtraction, multiplication, etc.

 

Get/Set properties of your class

Often it is a good idea to check the values you pass to the class. The easiest way is to use the Set properties. You use the corresponding Get property to read values from the class. In this example, we will check if the value is greater than 100, and if so we will reduce the value by 100 before storing it in the rivate variable used inside the class.

Option Public
Option Declare

Class MathClass
    Private p_value1 As Integer
    Private p_value2 As Integer

    %REM
        Sub New()
        Description: Constructor for the class
    %END REM
    Public Sub New()

    End Sub

    %REM
        Property Set value1
        Description: Set value1 and subtract 100 if needed
    %END REM
    Property Set value1 
        If value1>100 Then
            p_value1 = value1 - 100
        Else    
            p_value1 = value1
        End If
    End Property

    %REM
        Property Set value2
        Description: Set value2 and subtract 100 if needed
    %END REM
    Property Set value2 
        If value2>100 Then
            p_value2 = value2 - 100
        Else    
            p_value2 = value2
        End If
    End Property

    %REM
        Function Add()
        Description: Adding value1 and value2 and return result
    %END REM
    Public Function Add() As Integer
        Add = p_value1 + p_value2
    End Function
End Class

We call the class exactly like in our first example. But remember that we reduce the number by 100 if it is larger than 100. The output of this code is identical to the previous examples:

Sub Initialize
    Dim math As MathClass

    '*** Create new instance of MathClass
    Set math = New MathClass()
    '*** Set properties of the object
    math.value1 = 4
    math.value2 = 106
    '*** Display the result of the Add() function
    MsgBox math.Add()
End Sub

Let’s say we want to add a function that subtract the first value from the second value. We then just add a Subtract() function to the class:

    %REM
        Function Subtract()
        Description: Subtracting value1 from value2 and return result
    %END REM
    Public Function Subtract() As Integer
        Subtract = p_value2 - p_value1
    End Function

Now you have the foundation of object oriented Lotusscript. Go forth and conquer!

6 Comments

Code: Simple class for parsing file names

In the developerWorks forum for Notes 8, a user asked about how to check if a file (in this particular instance attached to a Rich Text Lite field) is an Adobe PDF file. The easiest (but of course not fool proof) way is to simply check the extension of the file name.

That reminded me that I have a simple Lotusscript class with some file functions that would simplify the parsing of a filename, if you want to get the path, the file name or just the extension. I thought that perhaps more people could use this, so I am posting it below. Thanks to Andre Guirard for the code to create directories. That is a function I sometimes need when working with files, so I added that to the class for my convenience.

Option Public
Option Declare

Class FileObject
  Private p_FileName As String
  Private p_FilePath As String
  Private p_Extension As String

  Public Sub New()

  End Sub

  Public Property Set FileName As String
    p_FileName = FileName
    p_Extension = StrRightBack(FileName,".")
  End Property

  Public Property Get FileName As String
    FileName = p_FileName	
  End Property

  Public Function Extension() As String
    Extension = p_Extension	
  End Function

  Public Property Set FilePath As String
    p_FilePath = FilePath	
    If Right(p_FilePath,1)<>"\" Then
      p_FilePath = p_FilePath & "\"
    End If
  End Property

  Public Property Get FilePath As String
    FilePath = p_FilePath	
  End Property

  Public Property Set FullPathName As String
    Me.FilePath = StrLeftBack(FullPathName,"\")
    Me.FileName = StrRightBack(FullPathName,"\")
  End Property

  Public Property Get FullPathName As String
    FullPathName = p_FilePath & p_FileName	
  End Property

  Public Sub MakeDir(Byval strWhere As String)     
    ' *** This code by Andre Guirard @ IBM
    ' *** http://planetlotus.org/profiles/andre-guirard_22584
    ' *** Using an iterative method instead of recursive due to stack issues (see link above)
    On Error 76 Goto parentDoesNotExist 
    Dim stack$ 
    Const NL = { 
} 
    Do 
      Mkdir strWhere 
      On Error Goto 0 ' first success, stop trapping errors; avoid infinite loop. 
      strWhere = Strleft(stack, NL) ' "pop" a path for next iteration 
      stack = Mid$(stack, Len(strWhere)+2) 
failed: 
    Loop Until strWhere = "" 
    Exit Sub 
parentDoesNotExist: 
    ' This error code can indicate other problems, but assume missing parent. 
    ' If not, we get a different error (75) later when trying to create the parent. 
    Dim fpath$, fname$ 
    SplitFilepath strWhere, fpath, fname 
    If fpath = "" Then Error 76, "Invalid path: '" & strWhere & "'" 
    stack = strWhere & NL & stack ' "push" onto stack to retry later. 
    strWhere = fpath ' try a path one step shorter. 
    Resume failed 
  End Sub 

  ' ===== Private Supporting Functions =====

  Private Sub SplitFilePath(Byval fullpath$, dirpath$, filename$) 
    ' *** This subroutine by Andre Guirard @ IBM
    ' *** http://planetlotus.org/profiles/andre-guirard_22584
    ' *** Called from MakeDir()		
    Const DELIMS = {/\:} 
    While Instr(DELIMS, Right$(fullPath, 1)) ' discard final delimiter character... 
      fullpath = Left$(fullpath, Len(fullpath)-1) 
    Wend 
    Dim candidate$, i% 
    filename = Strtoken(fullpath, Left$(DELIMS, 1), -1) 
    For i = 2 To Len(DELIMS) 
      candidate = Strtoken(fullpath, Mid$(DELIMS, i, 1), -1) 
      If Len(candidate) < Len(filename) Then  				
        filename = candidate
      End If
    Next
    Dim fplen%
    fplen = Len(fullpath)-Len(filename)
    If fplen > 0 Then fplen = fplen - 1 
    dirpath = Left$(fullpath, fplen) 
  End Sub
End Class
 
1 Comment

End of content

No more pages to load