Thursday, October 27, 2011

Safely connecting to a MySQL Database

You can connect to a MySQL database in a Real Studio web or desktop application using the MySQLCommunityServer class. If you have built a web application you need to consider SQL injection which is a way for someone to get data out of your database that you didn't want them to have or change data that you didn't want changed. The goal is to make sure that user input (such as SQL commands or delimiters) doesn't contain anything to manipulate a database in an unwanted way.

So, before you upload your web app, take a look at using prepared statements to protect your data. Although it uses the Real SQL Database there is example code for this in the Order example project. You can download that project from the about box in the Orders example.

Here's some example code from the Real Studio Language Reference:

// We'll assume "db" is the MySQL Database object added to your project
Dim stmt As MySQLPreparedStatement
stmt = MySQLPreparedStatement(db.Prepare("SELECT * FROM Persons WHERE Name = ? AND Age >= ?"))
stmt.Bind(0, "John")
stmt.BindType(0, MySQLPreparedStatement.MYSQL_TYPE_STRING)
stmt.Bind(1, 20)
stmt.BindType(1, MySQLPreparedStatement.MYSQL_TYPE_SHORT)

Dim rs As RecordSet = stmt.SQLSelect

Monday, October 17, 2011

Siri: The killer app for the iPhone 4S

I freely admit that I'm a gadget guy. I often buy new technology when it's first available and I'll admit that has not always worked out. I remember having several "Newton moments" waiting for the Apple Newton to attempt to turn my chicken-scratch handwriting into text. It routinely misunderstood- often to the delight of whomever was watching my demonstration.
Whenever I want to buy a new gadget, the first step is rationalization. How can I rationalize spending the money on this thing? Well, I don't have any other expensive habits. I don't play golf or gamble. But the real rationalization for buying the new iPhone 4S was my kids. The 8 megapixel camera can shoot 1080p HD video with image stabilization. After all, I can't go back in time and reshoot today’s pictures with a higher quality camera tomorrow. Basically 100% of the photos and video I take of my kids (heck, of anything) are taken with my iPhone; after all they say the best camera in the world is the one you have with you! So I convinced myself (and my wife since we make purchasing decision above $100 together) that the better camera alone was worth it. And it really is.
But there's another new feature of the iPhone 4S called Siri that I was interested in. For those of you that have somehow managed to still not have heard about Siri, it's a built-in personal assistant that recognizes your voice and can take actions for you. But as much as I attempted to rationalize Siri as a reason to buy the new iPhone 4S, somewhere in the deep recesses of my mind, I couldn't help but think it was going to be more cool than practical. That was, until I tried it.
Siri can be activated simply by holding your iPhone 4S up to your ear as if you are about to make a call. The very first thing I asked Siri to do was "Tell my wife I'm thinking about her." That is word for word what I said. Siri then sent my wife a text message that read “I’m thinking about her”. Apparently, I should have said, "Tell my wife I'm thinking about you" so that the text message would have been "I'm thinking about you", but that's close enough for me. Next, I asked Siri to call my mom. Siri asked, "What is your mother's name?" and I replied, "JoAnn". "Is your mother JoAnn Perlman?", asked Siri. "Yes", I replied. Siri then asked, "Do you want me to remember that JoAnn Perlman is your mother?" and again I replied, "Yes". Siri then told me it was calling my mom and the call went through. Pretty cool.
Testing Siri further I asked, "What is the capital of Texas?" Siri responded with a document that had several details about Texas including the fact that the capital is Austin, Texas. On my way home from lunch, I heard a text message come in. I put my iPhone to my ear and asked Siri to read my last message. It read it and asked me if I'd like to reply. I told it what I wanted my reply to say and Siri sent it. Next, I asked it what time my marketing meeting was today. It looked at my calendar and responded correctly. I asked it what I had on my calendar for tomorrow. It read my tasks. I even composed an email message and sent it while driving, though I'm not sure how you tell it which email account to use.
This is pretty amazing and useful technology and I'm sure Apple will take this much, much further. Siri seems to be the killer feature of the new iPhone 4S. Someone pointed out to me that technology like this has existed for Android for sometime. Well, in fact Siri has existed for iPhone for some time as well. What Apple did in iOS5 is buy it and deeply integrate it. But it’s interesting that I had never heard of it until now for either platform. Everyone is talking about Siri now but I don’t remember anyone ever mentioning it before for either platform.
For an app or feature to be considered “killer” to me, it must be very useful but I also have to know about it. It does no good for a great product or feature to exist if no one ever hears about it.

Wednesday, October 5, 2011

So long, Steve.

When I heard this evening about the death of Steve Jobs, I immediately thought about the huge influence he has had on my life over the last 30 years.


I started learning programming on an Apple II. Actually it was a clone because my dad wouldn't "pay extra for a brand." He paid dearly when we replaced the motherboard three times.


I earned my first computer, a Macintosh 512K, doing custom programming for my brother's company.


I made my living working at an Apple dealer and later writing custom Mac software until I went to work for a Mac development tools company in Silicon Valley. In 1994 I left for Austin, Texas where I founded Real Software because there were no good rapid application development tools for the Mac. 


My kids have been growing up watching Pixar movies. And when I saw the trailer for Finding Nemo, I knew Pixar was something special so I bought Pixar stock and held it until they were bought by Disney.


I watched Steve Jobs bring Apple back from the brink to amazing success. Apple is certainly the greatest corporate turn around in history. From the iMac to the iPod, to the iPhone and the iPad, he has left his mark on the world of technology.


Steve Jobs truly was a visionary. He was often way ahead of his time and never allowed the limits of what others thought possible to stop him. He was a relentless taskmaster (based on what the people I know that worked for him) but that was just what came with the package.


What I learned from Steve Jobs was to not be afraid to dream big, to be passionate about what you do for a living and to never accept "just good enough."


I had never really realized until tonight that my entire adult life has been so impacted by the vision of Steve Jobs. This might make me sound like an Apple fanboy, but really, I'm just a fan of great products that enable people to do things they couldn't have done without them. Steve Jobs was always great at making great things.


Whether you liked him or hated him, he was a genius. Only a fool would deny that.


But now he's gone, far too early and the world is diminished.


So long, Steve. We'll miss you.











Real Studio, Cocoa and LLVM

Our new Cocoa-based framework for Mac OS X made some big leaps forward in Real Studio 2011 Release 3. And we continue to hear good results from our beta testers that their projects are running fine under Cocoa. We have set up a way for beta testers to alert us to any showstoppers that may prevent them from shipping their apps. Needless to say, we are prioritizing these to maximize the number of Real Studio developers that will be able to ship Cocoa-based Mac apps using our next release. This is important because starting in November Apple is placing additional restrictions that will require apps submitted to the Mac App Store to be built with Cocoa. To be clear, it's not that they are requiring Cocoa; it's that Carbon apps don't seem to be stable when built with the new restrictions Apple is requiring. To further our efforts to get Cocoa into the best shape we can for our next release, we are adding additional engineering resources.


Real Studio 2011 Release 4 will ship in November. Our Cocoa support will still be considered beta for that release. Our criteria for it to no longer be beta is that we are comfortable making Cocoa the default option for building for Mac OS X. However, although it's beta, there's a very good chance that your projects will work perfectly using the Cocoa build option so give it a try and give us feedback.


There will be more Cocoa bugs to fix for 2012 Release 1 and there are two additional features that need to be implemented for that release as well: the movie player and drawers. However, we are quite confident that 2012 Release 1, scheduled to ship in February, will bring our Cocoa support to the point where we can remove the beta label. That will be a real milestone for us (no pun intended) as the transition to Cocoa has been a long one.


Once Cocoa is no longer beta, we will return to working on our transition to LLVM for our compiler backend. While we have been focused on Cocoa, the LLVM team has been improving LLVM - and this is great news for us and you! Hooking up the Real Studio debugger was estimated to take us at least a month, due to a significant amount of work required to parse the LLVM metadata. Fortunately, the LLVM team has done this work for us which means LLVM for Real Studio that much closer.


Finally, I'd like to thank all the beta testers who take their time to help us improve Real Studio. Thank you! We really appreciate your efforts and we look forward to putting out the new releases you need.