Friday, April 29, 2011

CSS in a Web Application

With Real Studio Web Edition you can use the WebPageSource class to insert CSS, HTML or JavaScript into a Web Application in a couple of easy steps. For example, to use CSS to add a red square to the lower right corner of your web page add a WebPageSource class to the window. Next, set the Location property to 3- After Content. Then, enter this code for the Source property:


<style type="text/css">

#redrect {
position: absolute;
width: 100px;
height: 100px;
right: 20px;
bottom: 20px;
background-color: #FF0000;
}

</style>
<div id="redrect">&nbsp;</div>



Now Run the project and you should see a red square in the lower right corner or your page. Quick and easy customization of your web application is just one of the powerful features of Web Edition.

Monday, April 25, 2011

Optional Parameters

Did you know that the parameters you create for methods can be optional? There are two easy ways to do this and they can even be combined. The simplest way to make a parameter optional is to add the Optional keyword:

MyMethod(x as integer, Optional y as integer)

In the above example, the keyword Optional makes the "y" parameter optional. If only one parameter is passed, y will have the default value for an integer which is zero. You can also include the default value if you want it to be different that the default value for the data type you are using:

MyMethod(x as integer, Optional y as integer = 5)

When you provide a default value, the Optional keyword is, well, optional. But it's good to use it because it makes your code a bit more explicit.

You can even have the same parameter use two different data types by making two methods with the same name but with different parameters. For example:

Foo(x as integer)
Foo(x as boolean)

Both methods can have their own code or you could have one call the other. So as you can see, there's a lot you can do with parameters.

Wednesday, April 20, 2011

Real Studio Release 1.1 now available

Real Studio Release 1.1 is now available. This release includes 10 improvements, you can read the full release notes in the product download. Download Real Studio 2011r1.1 at our downloads page here.

Sunday, April 17, 2011

Why does it take a crisis?

The organization that hands out IP addresses to ISPs in Asia just ran out of IPv4 addresses. You can read more about it here. That means that soon, perhaps very soon, some Internet users in Asia are going to start having problems getting on the Internet. That's because the current scheme (IPv4) wasn't designed for as many IP addresses as it turns out we need. Why not? For the same reason that back in the 1940's the CEO of IBM said the total world market for computers was six. Sometimes even people with vision lack vision.

Thankfully, the answer to the IP address shortage doesn't involve waiting in long lines. In fact, the answer was developed years ago: IPv6. It uses much longer IP addresses along with some hexidecimal to provide more IP addresses than we will ever need. No, really. I think it's totally safe to say that this time. In fact, the number of IP addresses available under IPv6 is so big, I had actually never heard of the number before. It sounds like one of those numbers my kids make up when they want something to sound really big. "Dad, there are like a bazillion frogs in the backyard." I think that long before we run out of IPv6 addresses, we will have replaced the Internet with whatever it will be replaced with. Will you take the red pill or the blue pill?

Unfortunately, switching to IPv6 isn't as simple as typing in a new IP address. Behind your Internet connection is a lot of hardware that needs to be replaced in order to support IPv6. This is great news for companies like Cisco (who make such equipment) in the same way that the meltdown of nuclear reactors in Japan is great news for Toshiba who makes very safe 4S reactors that will no doubt now see speedy approval. As other continents start running out of IP addresses as Asia has, ISPs and the upstream backbone providers will finally switch to IPv6 and once again all will be right in the world.

If you are reading this, you are likely a Real Studio user. If that's the case, you will be happy to know that supporting IPv6 is relatively easy for us and you will, for the most part, be abstracted from it. Abstracting you from the gory details is, after all, our job.

But why does it always take a crisis for us ("us" being society in this case) to act? These problems are not like the asteroid in the movie, Armageddon, where we get just a few months notice that we are all going to die unless Bruce Willis can save us. These problems are ones we have years and years of warning about and have known solutions that don't involve sending oil workers into space.

I hope that the appropriate organizations that provide Internet access to the rest of the world will learn from Asia's cautionary tale.

As an unrelated note, for the very first time, I wrote this entire blog post on my iPad.

Friday, April 15, 2011

Building demo apps using in-memory databases

A lot of web applications access a database as a primary function. If the user can make changes to that database, it can complicate your ability to provide a demonstration mode for your web app. You probably want the demo user to be able to make changes but since they are not official users yet, you don't want them altering real data. You could duplicate records and give them a demo status of some kind or have a separate demo database, but you still end up having to track the user to undo changes that they made. Fortunately, there's an easier way.

As you probably know, RealSQLDatabase is based on SQLite. SQLite has the ability to create a database, on disk of course, but it also has the ability to create a database that is in-memory only. An in-memory database can be modified but it can't be saved to disk. Using an in-memory database is a great way to allow a demo user to try all the features of your app without giving them the ability to make permanent changes.

To create an in-memory database you simply create a new database object without creating a database file or attaching an existing database file:

Dim Orders as RealSQLDatabase
Orders = New RealSQLDatabase
if Orders.Connect then
//continue
else
//Check Orders.Error
end if

Presto! You've got an in-memory database. You can create tables, add records, perform queries and basically do anything you can do with an on-disk database. If you want to pre-populate the database with tables and records, it's really quite easy to copy the tables and records from an existing RealSQLDatabase into the in-memory database. First, you attach the source database to your in-memory database using the Database.AttachDatabase method:

Dim source as Folderitem = GetFolderItem("Orders.sdb")
If Orders.AttachDatabase(source,"Source") Then

Then, you use SQLExecute to create a table and use a SELECT statement to specify the table and records from the source database. For example, the following code copies a table called “Invoices” and all of its records from the source database into the in-memory database (which in his case is the Orders property):

Orders.SQLExecute("CREATE TABLE Invoices As SELECT * FROM Source.Invoices")

Now you’ve got an in-memory database with a table and data copied from your source database! Pretty sweet huh? When using this with a web project, if you create the Orders property on the Session class, each user can have their own in-memory database that they can change as much as you allow without affecting other users. As soon as the user leaves the application and the session ends, the in-memory database will vanish. Of course, you can use this technique with desktop applications as well.

In-memory databases, along with the ease with which you can copy tables and records into them from another source database, make for a really powerful and easy way to provide demo apps for the web and the desktop.

Friday, April 8, 2011

Feedback Tips

Back in September of 2009 we introduced Feedback, our tool for reporting bugs and requesting features that is built in Real Studio. Since then we have updated and improved Feedback significantly, tailoring it to our users' and our engineers' needs. Though there are many features we look forward to adding in the future, there are probably a few really handy ones you may not know are already there.

Search by Creator: You can search for reports by the creator's email address using syntax like "email:test@123.com" where "test@123.com" is the creator's email address.

Search Using old Fogbugz ID's: Use "fb:xxxx" where xxxx is the original Fogbugz ID number.

Removing yourself from emails: To stop getting emails about a specific bug simply remove that report from your favorites list.

Read-Only Mode: Read-only mode allows users with expired license keys to search and check the status of exisiting reports. To exit Read-Only mode, simply go to Preferences, click on the Applications tab, then click the "Change" button in the Editions group.

Creating New Bug Reports: And last but certainly not least...can't create a new bug report? Just a reminder that before you can enter a new bug report you must first do a search to see if the report has been entered already. Feedback will not let you enter a new report until you have first searched. This feature was designed to save both you and our engineers time.

Hopefully this helps you to use Feedback to its fullest. If you have a tip on improving Feedback please enter a feature request. And don't forget about the Feedback Help on the start page or the Documentation Wiki.

Saturday, April 2, 2011

Web Site or Web Application?

When we announced Real Studio was going to support building web applications, many of you started asking if Real Studio could be also used to build web sites. Our initial response was no; Our web framework was designed for building web applications, not web sites. But as the discussions on our forums and email lists continued, it became obvious that the answer is not that clear...and you were going to use it to build whatever you wanted anyway!

Web sites are generally, mostly static content without a whole lot of user interaction whereas web applications are usually designed to create content dynamically and are highly interactive. But there is a ever changing gray area in between. So is our new web framework meant for building web sites?

If your web site (or a part of your web site) is very dynamic then it might actually behave more like an application than a web site. If that's the case, then Real Studio might be appropriate. If, on the other hand, your web site is very static, then Real Studio is almost certainly not appropriate.

Is Real Studio designed for building web sites? No, it's not. But your web site might function more like a web application than a website, in which case perhaps Real Studio's web application support is a good solution for you.