Thursday, March 26, 2009

Workaround for ALTER TABLE limitations

As you know the ALTER TABLE sql command built-into sqlite has some limitations (sqlite is the database engine behind REALSQLDatabase and REAL SQL Server).
Basically what you can do with ALTER TABLE is just rename a table or add a column.

As a quick workaround you can use the SQL language.
For example if you have a table like:
CREATE TABLE table1 (field1 INTEGER, field2 INTEGER, field3 INTEGER)

and if you want to change field2 to TEXT and remove field3, you can write the following SQL commands:

CREATE TABLE table1_temp (field1 INTEGER, field2 TEXT);
INSERT INTO table1_temp (field1, field2) SELECT field1, field2 FROM table1;
DROP TABLE table1;
ALTER TABLE table1_temp RENAME TO table1;

With these 4 commands you can CHANGE (manually) every table definitions.
Please note that in this way you need to re-create indexes, views and triggers associated to table1.

Wednesday, March 25, 2009

Escaping Quotes

I've got a very simple tip today, one that I thought most REALbasic developers knew, but I'm finding many actually don't know this.

Let's say you need to put quotes inside a string. The most common way I've seen developers do this is with Chr(34):

  dim myString as string = "Hello " + chr(34) + "World" + chr(34)

Some developers choose to define a constant and use that instead:

  dim myString as string = "Hello " + kQuote + "World" + kQuote

But did you know you can insert a quote into your string by using two quotes instead?

  dim myString as string = "Hello ""World"""

Makes the string a little more legible, doesn't it?


Friday, March 20, 2009

Post build scripts

With the changes in how Windows applications are built it can sometimes be hard to get your debug session set up the way you need.
There are a couple of choices:
  1. use run paused and manually COPY items from one location next to your debug application

  2. use a post build script so you can set it up once and then just hit run like always


PostBuild scripts run after the compiler has compiled your application but before the debugger has started your application.

The set up for a PostBuild script is fairly straight forward (I'll use our case as an example)
  1. next to your project file create a directory called "Scripts"

  2. create a new IDE Script, add the required code to do your copies and save it into this directory as "PostBuild.rbs"


Our script contains the following :

#if TargetWin32
dim s as string
s = DoShellCommand( "xcopy /E/C/Y %PROJECT_PATH%\Framework " + CurrentBuildLocation + "\Framework\", 99999)
s = DoShellCommand( "xcopy /E/C/Y %PROJECT_PATH%\Resources " + CurrentBuildLocation + "\Resources\", 99999)
#endif


These two commands copy the entire contents of the Frameworks and Resources directories from directories next to the project file into the newly build debug app.

You might want to put all your debug resources (pictures , dll's, etc) in a directory next to the project file and then just use xcopy to copy the contents of that into the directory where the debug app got built to.

How I came to REALbasic

I'm Norm Palardy. As many of you know I've been a long time user of REALbasic. In fact, I've been using it since before it was called REALbasic.

I've used it in all kinds of projects for a wide range of things.

I initially started out using REALbasic because it could generate Java Applets which, at the time, was something the project I was working on might need. It turned out we didn't need that, but Cross Basic, as it was called at the time, proved useful in other ways, so I kept using it.

Eventually I was tasked with another larger project within the same company that REALbasic proved useful for. We had a need for a system to capture SCADA data and to play it back so we could test the expert system we were creating.

My job was to create the data capture and playback system.

Since we were gathering data from another area of the company and then piping it into our application, I had to figure out the API the other team had available, and test it while I built it.

I used REALbasic to do all this work - scope out the API and sample data that was being passed. I could then put it all in a list and watch as it came in and verify that my analysis of the protocol was correct.

REALbasic proved invaluable in this evdeavor.

I eventually left this company and worked for a small start up that was creating a video jukebox. All of the code was being done in C/C++; but mock ups for screens and functionality was often done in REALbasic. And some of the system software we used was done in REAlbasic because it was dead simple to create the first prototypes. The machines were all Macintosh’s and the system updates were all written in REALbasic. We could update the OS, extensions and anything else, including the software that ran the video jukebox.

We also had a number of other tools in REALbasic for managing the configuration data, smart cards, client lists, and even some of the video encoding utilities.

Eventually I left this company as well and worked for myself.

I wrote the entire OpenBase connection kit for REALbasic in REALbasic.
This was a complete rewrite of a C/C++ based database plugin that, at the time, had gone through a few developer’s hands. The rewrite started as a proof-of-concept and now is embedded in at least one well-known product made with REALbasic.

And from there I landed a job at REAL working on the product that I've been using for so long.

The MySQL Plugin for REALbasic

Some of you may have seen that Alacatia Labs has announced they are no longer going to support the MySQL Plugin for REALbasic. We have been receiving questions about what that means for the future of the MySQL Plugin. We are working on one and will again officially support the MySQL Plugin in REALbasic. More information about this will be available soon.

Thursday, March 19, 2009

Swimming Naked

After yesterday's announcement, a few people speculated that we made the changes out of some financial desperation. We are a privately-held company so we don't make our financials available to the public. However, I will give you a few important facts so that such speculation does not create a lot of unnecessary worry.

Last year, more specifically the second half of last year, was challenging for most businesses. For many, revenues dropped dramatically requiring immediate and drastic cost reductions which resulted in significant job losses that continue this year. One of my favorite quotes is from Warren Buffet who said, "Only when the tide goes out do you discover who's been swimming naked." As it turns out, there was an awful lot of naked swimming going on last year. And when the economy falters, it impacts most businesses because there's less money being spent and as a result, the current of the economy flows more slowly. I started to notice something in April, but wrote it off as a bad quarter until September when it became obvious to everyone that the global economy was in trouble.

Last year was challenging for us and we did have to make some cuts as a result. But they were necessary and this year, despite the current global economic crisis, things are looking much better for us. Sales have exceeded our projections and are in fact higher than they were for the same year-to-date period last year. That's important because the economy had not yet gone into crisis at this point last year. Even more important are new license sales, which are already stronger than expected this year. We are profitable for 2009 and are cash flow positive.

So why are we making the changes we announced yesterday? Like any smart company, we are always looking at how we can make changes to our offerings to make them more attractive and generate more revenue. We are, after all, a for-profit company. The new product line-up and pricing are more appropriate, and by having more clearly segmented editions, we can target features to specific types of users to make REALbasic even more attractive.

I founded this company at near the peak of the internet boom at a time when Java was shiny and new. People thought I was crazy. Fortunately, some friends and family believed in me, and I was able to get REALbasic off the ground. We have had no significant additional investment since then and are entirely self-funded. We have been doing this now for more than ten years and plan to continue for many years to come. I hope this will alleviate any concerns you might have about our longevity.

Wednesday, March 18, 2009

We are listening

As I'm sure you have heard by now, we are reducing the price of REALbasic Professional Edition and introducing a new edition as well, REAL Studio. We have heard from so many of you that you depend on the Remote Debugger. As a result, the Remote Debugger will continue to be available in the Professional Edition. We want you all to feel like the value of REALbasic is great for the edition you own.

Why are we making this change after the fact? I think most of the decisions we have made over the years have been good ones. But we occasionally make mistakes like all people do. And when we do, we try to recognize that and correct it.

We have no plans to make any other price changes. In fact, we have made only a few price changes to REALbasic since it first shipped in July 1998.

Some of you may be wondering if our support for Cocoa will be limited to a particular edition. The answer is no. Cocoa will be available in all editions of REALbasic.

However, there will be some new features coming in the future that will be geared towards full-time developers and will be in the REAL Studio edition only.

I apologize if this announcement caused you grief today. Hopefully, the fact that we are listening and have decided to keep the Remote Debugger in the Professional Edition will show you that we do care about your needs.

Wednesday, March 11, 2009

What's good for Apple is good for REALbasic

Cross-platform development tools may be increasing in popularity with enterprise IT. Today on ITWire.com, Stephen Withers wrote that:

"Almost three-quarters of enterprise IT administrators recently surveyed said they expect to increase the number of Macs in their organisations. Since 1984 the role of Macs in the enterprise has variously waxed and waned. But the growth in Apple's share of the market seems to be translating to increased corporate interest."

It does say that about half the surveyed organizations were already deploying Macs to some degree so the survey is a bit skewed. However, there is no shortage of evidence that Apple's market share has increased substantially in the last few years. The Market Share by Net Applications web site which measures market share based on data collected from thousands of web sites, shows that the market share for Mac OS X has increased from 6.09% to 9.61% over the last two years. That's a 50% increase in just two years. It's also noteworthy that the market share for Linux while small has increased from .4 to .88 over that same period of time. That's more than 100% increase.

The desktop operating system playing field is still far from level. And while most Mac developers have known for a long time now that they can't ignore the Windows market, Windows developers have mostly ignored the Mac. But as Apple's market share continues to grow, it may reach a tipping point. That's the point at which Windows developers can no longer ignore the Mac market. Personally, I think that tipping point is 20%. A developer might be willing to lose one sale out of ten because he or she doesn't support a particular OS, but two out of ten starts to hurt. If Apple stays on their current trajectory, they would reach 20% in 6 years (at 1.5% growth per year). But it might not take anything like that long. I suspect that Apple's market share will increase faster than that. But there are factors that are difficult to adjust for. For example, the economy is certainly impacting PC sales. And what impact will Windows 7 have? Will it reduce the number of switchers or increase it?

The more level the playing field gets, the more important cross-platform development tools become. That's good for REALbasic. But that same trend means that cross-platform software products in general become more important which gives you, as a REALbasic developer, a big advantage over those using single platform tools.

So generally speaking, what's good for Apple, is good for us and for you.

Tuesday, March 10, 2009

Cocoa Update

As most of you know, we are working hard to create a new platform layer for REALbasic based on Cocoa, the API for Mac OS X. For most of you, this won't require any changes to your code. You will just choose a new option when you build your application. You won't have to learn anything about Cocoa either.

Last August, we announced that we would be in beta by the end of the first quarter of 2009 and shipping by the end of the second quarter. We are making excellent progress but the schedule for shipping a beta is going to conflict with the schedule for REALbasic 2009 R2 which is going to ship in mid-April. Since REALbasic 2009 R3 is likely to be the release in which we ship Cocoa support, we will make Cocoa available for testing with the first R3 alpha release. If you are on our beta list email list, we will announce the alpha there most likely in the first two weeks of April. So we aren't going to make the end of first quarter date but we will be close. The transition from Carbon to Cocoa is a big one and I'm sure you will all agree that the important thing is that it's done right. While there will be some new features, our goal for the first release is compatibility with existing projects. When we have more news, we will post it here.

Tuesday, March 3, 2009

REALbasic's New TrueWindow Feature

REALbasic 2009r1 adds a new TrueWindow property to any subclass of Window and RectControl. If you use any control subclasses, design your own Canvas-based custom controls, or use ContainerControls, TrueWindow just might make your life easier.

Before we get into actual usage, it's best to understand the problem TrueWindow is designed to solve, and that problem is interacting with the parent window of a control. Every RectControl and ContainerControl has a Window property which provides you with the parent Window of that item. But when you're nesting ContainerControls, the issue becomes more complex since ContainerControl is a subclass of Window. Because the problem only appears when nesting ContainerControls, and ContainerControl is a Professional Edition feature, you will need a copy of REALbasic Professional Edition or a trial version to follow along.

We're going to do something very simple to demonstrate how this works. We'll create a PushButton subclass that displays a message containing the window's title. But first, we'll do it "wrong" to demonstrate the benefit of TrueWindow.

Start a new project. Create a subclass of PushButton called MyPushButton. Double-click it and in the action event, enter

MsgBox(Me.Window.Title)

Your subclass is done for now. Now, create a ContainerControl called ButtonView. Double-click it, and place a MyPushButton on it. You may give it a caption and place it however you like, that's not important to this tutorial.

Now, open Window1, and place a ButtonView on the window. You should see your button you just setup in the last step. Again, position it however you like. Title Window1 "Hello World". Now run the project and click your button. If all went according to plan, you should see an empty dialog appear.

Since ContainerControl is a Window, when MyPushButton calls Me.Window it gets the instance of the ContainerControl, then grabs that container's title - which we never set and the user never sees.

This is where TrueWindow comes in handy. It will return the topmost window regardless of the level of nested ContainerControls. So change MyPushButton's Action event to:

MsgBox(Me.TrueWindow.Title)

Now run the project again. This time when you click the button, you'll see the window's title. Excellent! The MyPushButton subclass will function equally well placed directly on Window1, since TrueWindow always returns the topmost Window, even if no nesting has occurred.

There are other uses for TrueWindow as well. If you're designing a custom control based on Canvas and need to fill the background to match the window it's on, TrueWindow is perfect for this:

If Me.TrueWindow.HasBackColor Then
G.ForeColor = Me.TrueWindow.BackColor
Else
G.ForeColor = FillColor
End
G.FillRect(0,0,G.Width,G.Height)

You could also use it to display a sheet on the parent window of a ContainerControl without knowing which window it'll be embedded on:

Dim MySheet As New MySampleSheetWindow
MySheet.ShowModalWithin(Self.TrueWindow)

So there you have it. TrueWindow makes it easier for control subclasses to interact with their “real” (from a user’s perspective) parent window without worrying about how the class will be used.

My thoughts on REALbasic 2009r1

Hello all, I'm William Yu - a long time REAL Software engineer. Having been in this company for so long I've seen its ups and downs and I've touched more parts of this product than I care to mention, but it's also the beauty of working for the same company for so long, everything that you do has profound effects.

2009r1 has been really fun to work on for many different reasons, but the focus on quality for me was top priority (among other things, like having our first baby). It was nice to finally fix the KeyDown event bug with ComboBoxes on Windows, and adding support for saving/loading PNGs with alpha channels turned out to be a popular feature. We also added an Indeterminate state to the CheckBox control as well as for the Listbox checkboxes. We worked with many of our customers to resolve specific issues, including fixing a bug in REALbasic with the new MBS plug-ins, and a special thanks to David Grogono for helping us find some of the picture loading/saving bugs. I even got to fix a few compiler bugs as well in 2009r1. One bug that really irritated plug-in developers was the fact that our incremental compiler didn't properly recompile subclasses of plugin classes when the plugin changed, this is now fixed in 2009r1. I can go on and on, but take a look at the release notes to see the many improvements we've made!

REALbasic 2009 Release 1 Now Shipping

REALbasic 2009 Release 1 is now available. This release continues with our focus on product quality and adds 26 new features and 100 improvements. To download, or to view the complete list of new features and improvements, visit http://www.realsoftware.com/download.