Friday, August 28, 2009

Announcing 2 Regional REAL World Events!

We are very excited to announce today that we are taking REAL World on the road this Fall! We'll be heading to Atlanta on November 3 and Chicago on November 5th for full day conferences in each city. The Atlanta event will take place at the Marriott Marquis Hotel and the Chicago event will be at the Hilton downtown.

The REAL World Regional Events are the definitive events for anyone who wants to get the most out of REALbasic, REAL Studio and REAL Server. This conference will give users the opportunity to hear from other REALbasic, REAL Studio and REAL Server users and experts on how to improve their knowledge and skills as a developer. These events will feature a keynote presentation from Geoff Perlman, REAL Software's Founder and CEO that will cover upcoming features, like Reporting and Cocoa, along with REAL Software's strategic direction.

We are currently looking for speakers to present at each event. We do offer speakers a free pass to the event. Those interested in presenting REALbasic, REAL Server and software development-related sessions are welcome to submit their proposal with their preferred session topic(s) and a brief description, along with their name and contact information to me at realworld@realsoftware.com. The deadline for applying to speak is September 15, 2009. There are a limited number of speaking opportunities available.

Registration for these regional events will open soon. Conference pricing has been set at $250, with an early registration price of $200 through October 20th. Attendance is limited to 50 attendees, so please register early to guarantee your spot.

More details about the sessions, along with a more complete agenda, will be available in the coming weeks.


Thursday, August 20, 2009

Drawing multiple color gradients

I've seen many examples over the years regarding gradients. Start with one color, then progressively blend it into another. What I haven't seen yet is how to create complex gradients with 3 or more colors. If you can create a two color gradient, a multi-color gradient is conceptually similar.

Pairs are handy for this, because we can prepare a list of percentages and colors and pass that to our method. The left value will contain the percentage, the right value will contain the color. Our gradient will be a simple red-yellow-green gradient:

dim colors(2) as pair
colors(0) = 0.0 : &cFF0000
colors(1) = 0.5 : &cFFFF00
colors(2) = 1.0 : &c00FF00

This basically says that at 0%, it should be red. At 50%, it should be yellow. At 100%, it should be green. We'll pass this array a method which defines the width, height, and direction of the gradient:

Function CreateGradient(Width As Integer, Height As Integer, Points() As Pair, Vertical As Boolean = false) As Picture
  dim p as new picture(width,height,32)
  
  dim i,x,w,nextstart as integer
  dim pointOne,pointTwo as pair
  dim colorOne,colorTwo,blendedColor as color
  dim pct as double
  
  for i = 0 to ubound(points) - 1
   pointone = points(i)
   pointtwo = points(i + 1)
   colorone = pointone.right
   colortwo = pointtwo.right
   if vertical then
     w = (pointtwo.left.doublevalue * height) - nextstart
   else
     w = (pointtwo.left.doublevalue * width) - nextstart
   end
  
   for x = 0 to w
     pct = x / w
     blendedcolor = rgb((colorone.red * (1 - pct)) + (colortwo.red * pct),(colorone.green * (1 - pct)) + (colortwo.green * pct),(colorone.blue * (1 - pct)) + (colortwo.blue * pct))
     p.graphics.forecolor = blendedcolor
     if vertical then
       p.graphics.drawline(-1,x + nextstart,p.width + 1,x + nextstart)
     else
       p.graphics.drawline(x + nextstart,-1,x + nextstart,p.height + 1)
     end
   next
  
   nextstart = nextstart + w
  next
  
  return p
End Function

And that's all you need to create better gradients on-the-fly. Just for fun, here's the colors you need to draw a gradient similar to Apple Mail's toolbar buttons:

dim colors(3) as pair
colors(0) = 0.00 : &cDADBDD
colors(1) = 0.50 : &cD6D7DA
colors(2) = 0.51 : &cC8CBCE
colors(3) = 1.00 : &cDDE0E3

Monday, August 17, 2009

Turning a weakness into a strength

REAL Server is not yet well-known outside of the REALbasic community. We are working on that, but in the mean time, there is an area where this weakness is a strength.

When it comes to database servers, the well-known products have names like MySQL, Oracle, Microsoft SQL Server, Sybase, DB2, etc. If you are building a commercial product that uses a back-end database server, there is a good chance that it uses one of these. If your customer is big enough to have a dedicated IT department, it might make sense to support the database server the company is already using. If the product is going to be used across the company, this is a good thing as it makes it easier for the prospect to purchase your product since they won't get any grief from IT about it. Could using the corporate database server or some other well-known database server ever be a bad thing?

Yes, it can. In many companies, if the IT department even recognizes the name of the database server you are using, they will feel it should be their responsibility to support it. That may bring IT into the decision making process. If your product is sold at a departmental level, they may want to purchase it but have to fight the IT department because IT doesn't want to have yet another database to support. So what's the solution?

There are many IT departments that don't get involved if the product is departmental and they think the database server is proprietary. Our own REAL Server for example, comes across that way. Even though it's based on SQLite, arguably the most installed database engine in the world, REAL Server is not nearly as well-known and, as a result, comes across as a proprietary database server. This can make it easier to sell departmental products because you can keep the IT department out of the sales cycle.

We have a customer right now that is switching from MySQL to REAL Server for this very reason. That's turning a weakness into a strength!

Thursday, August 13, 2009

Reduce Flickering on Windows

On Mac OS X and Linux, windows are double-buffered, meaning everything is drawn to an external source and sent to the screen all at once. On Windows however, changes are drawn to the screen the moment something changes. If you're drawing to a canvas, this can result in a flickering effect that is very annoying.

I've got a few tips to reduce or eliminate flickering:

  1. Turn on the Canvas.DoubleBuffer property.
  2. Turn off EraseBackground. EraseBackground causes the drawing area to be erased first, which will be flushed to the screen immediately causing flicker. This is important for both Canvas and ContainerControl classes. In ContainerControls, make sure the instance has it disabled, and if your code creates one of your ContainerControl subclass "out of thin air" then make sure your subclass has this disabled as well. Keep in mind that sometimes control artifacts can be left behind depending on the type of drawing you're doing, since they weren't erased first. My only suggestion is to try it and see how it works for your case.
  3. Only draw using the Canvas.Paint event. As much as we programmers like to say "Canvas, display this now" using the backdrop property, it is the wrong way to do it. Instead, when you want the canvas to forcefully update, use the refresh method. The backdrop property is only useful from the window editor, when you want to display a static / non-changing graphic.
  4. Whenever you call RectControl.Refresh, pass the optional EraseBackground parameter to it with a false value. This will prevent the control from erasing itself pre-refresh. See tip 2 above.

If you are already double buffering manually, there is no need for tip 1 in your case. In fact, you're better off leaving it disabled if you're going to do the buffering yourself. If your code looks similar to

Dim Buffer As New Picture(G.width,G.height,32)
// do your drawing to Buffer.Graphics
G.DrawPicture(Buffer,0,0)

then you're buffering manually. If your paint event has more than a single call to the "G As Graphics" object, then you need to enable the DoubleBuffer property.

Buffering will prevent transparency however, so you might want to fill your area with a color first. This will also help prevent artifacts left over from disabling EraseBackground. Something like:

If Self.TrueWindow.HasBackColor Then
  Buffer.Graphics.ForeColor = Self.TrueWindow.BackColor
Else
  Buffer.Graphics.ForeColor = FillColor
End
Buffer.Graphics.FillRect(0,0,Buffer.Width,Buffer.Height)

will work well to fill the buffer with the same color as the window it's placed on.

And there you go. Follow these tips, and the flickering effect on Windows will be greatly reduced.

Monday, August 3, 2009

Colorado REALbasic Summit from the Association of REALbasic Professionals

The Association of REALbasic Professionals and Inspiring Apps are pleased to announce the Colorado REALbasic Summit.

Join us in scenic Boulder, Colorado for a REALbasic conference that aims to help REALbasic professionals (and aspiring professionals) get ahead. A healthy mix of in-depth, advanced technical sessions and business topics will sharpen your skills and help you better run your business.

The Summit begins the evening of Thursday, Sept. 24th, and ends Saturday afternoon on Sept. 26th. The registration fee is $199 for ARBP members, or $249 for non-members.

Registration will open soon, and is capped at 40 attendees. For more information, please visit:

http://www.inspiringapps.com/REALbasicSummit/