Monday, June 29, 2009

The Best Cell Phone Ever?

iphone_3gsPermit me to go a bit off topic with today's post. As you may have heard Apple released a new version of the iPhone on June 16th. I was due for an upgrade and I have heard nothing but good things about the iPhone for the past year. So I decided to fork over the $199 upgrade fee and get the 16GB iPhone 3GS.

I got the phone last Monday and I must admit it is the best phone I have ever used. The sound quality is quite good and I really like the speaker phone. The headset that comes bundled with the iPhone has the same standard Apple earbuds but it also includes an inline microphone and volume controls. The microphone does a good job at picking up voice and I have had no complaints when using the headset to talk on the phone.

The integrated iPod functionality makes the phone work just like an iPod. This makes it an excellent music player as well as a phone. The new improved processor makes the video much smoother and crystal clear. The screen is bright and big enough to use for watching movies or TV shows. I also like the wide variety of podcasts that are available.

The new horizontal keyboard makes texting much easier to do. I have had a bit of a transition from my Treo 750 with the thumb keypad. I was also used to the Windows Mobile touch screen, the multi-touch screen on the iPhone must be touched with a fingertip. I was in the habit of using a stylist or sometimes a fingernail to select items on my Treo. I am getting used to the multi-touch screen and I think in the end it will be nicer than a screen that responds to any pressure.

I have found that the 3G radio works very well in my area. I get very quick download and browsing on the network. The integrated WIFI is very useful when I am at home or in the office. The Safari web browser is easy to use and includes some of my favorite features. There is a pages interface which is much like the tabs you find on Firefox and IE 7+. This allows me to keep pages I refer to often "open" so I can go back to them quickly.

Probably the best feature of the iPhone is the AppStore. It is super easy to get applications for the iPhone and there are thousands of them. The ability to instantly purchase and deliver an application to the phone is a very powerful feature. So far I have only installed the free versions but there are many reasonably priced apps that I have my eye on as well.

iPhone_MO My first application was iAnywhere Mobile Office for iPhone. This allows me to get my corporate e-mail, calendar, contacts and tasks on my iPhone. All of the information is stored in a secure "sandbox" on the phone which is encrypted for additional security. The corporate contacts are available to the phone so I can lookup numbers to dial and add corporate contacts to my speed-dial favorites list.

Overall my experience with the iPhone has been very positive, I really like the phone. I have found a few negatives. The landscape keyboard does not seem to work in every application. Sometimes it is very slow to rotate the display or I may have to rotate the phone several times to get the screen to the proper orientation. The device can only run one application at a time and it is sometimes frustrating going back to the home screen every time to switch to a different application.

The battery life is not bad I have gotten several hours of use from the phone on a charge. I am still kicking the tires so I am using the phone a lot more than I would normally so I think the battery life will even out soon. It is too bad that you cannot get to the battery since it would be nice to have a spare around to swap when you need to use the device. It would also be nice to have some kind of memory expansion, microSD or similar, for the phone. This is the only "smart phone" I have used that does not offer any memory expansion.

The bottom line: Apple has produced an excellent device which provides a ton of functionality into a nice clean package. The third generation includes an updated processor and many software enhancements. I think the upgrade price was very reasonable for all the features. I wouldn't want to pay the $599 full price for the device though.

Friday, June 26, 2009

Entity Framework Screencast

EF Title Now that Advantage supports the Microsoft Entity Framework, I put together a screencast which demonstrates the functionality. We converted the example database used in the entity framework quickstart which is available from Microsoft.

This screencast creates a new project and creating an entity model from an existing Advantage Data Dictionary. Once the entity is created we bind the objects to some controls. Finally we use the SaveChanges() method to commit any changes back to the data dictionary.

I am working on a  utility that will create the sample database. When the tool is complete I will get it posted to Code Central along with some additional entity framework samples.

Wednesday, June 24, 2009

Introduction to the Microsoft Entity Framework

As you may have seen on the Advantage Announcements Feed the latest version ( of the Advantage .NET Data Provider now supports the Microsoft Entity Framework. But, just what is the entity framework?

The Entity Framework (EF) was released as part of Visual Studio 2008 service pack 1. So you have to have the latest VS2008 service pack installed to use the EF. EF provides an Object Relational Mapping (ORM) which allows developers to create objects within their application which represent the relational database. This technique has been available for some time through other products such as nHybernate and eXpress Persistent Objects from Devexpress.

The EF comes with an object modeler which can create a new object model based on an existing database. You can also create objects which do not map directly to a database object. For example if you need to view data from several tables you would normally write a query within your application or create a view in the database. When using the EF you can create a model that represents the data the way you need it for your application which can simplify development.

Below is an example model built from an Advantage Data Dictionary. The database is the one used by the Microsoft Entity Framework quick start guide that we migrated to Advantage.

School Model

As you can see the model includes all of the fields in the tables, called scalar properties, as well as relationships between tables, shown as navigational properties. This interrelation between these objects makes them very useful within your program. For example if you wanted to see the course grades for a student you can do this by creating an ObjectQuery that includes the CourseGrade link within the Person table. With the link established in the ObjectQuery the grades for each student are now part of the Person object and available to your program.

Entities can be accessed using LINQ to Entities or with Entity SQL. These are both very easy ways to access your data through the entities that you have created. These methods are also used to modify the data contained in the underlying tables as well.

I am currently working on some example code and a series of screencasts on using the Entity Framework with Advantage. These should be available over the next few weeks so stay tuned.

Monday, June 22, 2009

Book Review – Head First Design Patterns

I really enjoy the Head First style of writing because it uses many subtle and some not so subtle distractions to keep the reader interested. So after reading Head First Object Oriented Analysis and Design I moved on to Head First Design Patterns. If you have never read a Head First book before you can get a feel for the style by reading this sample chapter.

The thing I liked most about this book was how I could apply the design patterns to code and tools that I had written in the past. I was one of those unfortunate souls who got my education through one of those schools Joel Splosky refers to a JavaSchools. We did not do a lot of work studying programming patterns. I recognized many of the techniques but I did not know the terms. This is expressed quite well in chapter one:

Design Patterns give you a shared vocabulary with other developers. Once you've got the vocabulary you can more easily communicate with other developers and inspire those who don't know patterns to start learning them.

HF_Guru One of my favorite attention grabbing techniques they used throughout the book was the Design Patterns Guru ( as seen on the right ). These sections were used as a way to summarize the points made throughout the chapter. As you progress through the book you move from a grasshopper to a worthy design patterns student. This is one of many techniques that keep the book moving forward while reinforcing the content.

Head First Design Patterns covers fifteen patterns in depth and highlights several more. In fact, entire chapters are devoted to a single pattern or two at the most. This combined with very good examples, written in java, make learning these patterns very easy to learn.

Some of the patterns I found the most interesting were; Factory, Observer, Decorator and Adaptor pattern. Factory patterns are used throughout .NET programming. In fact the Advantage .NET Data Provider contains a Factory class which is used to instantiate the various data objects. The Observer Pattern can be found in database Notifications. Decorators and Adapters are similar in the sense that they both modify how an existing class works. However, they are much different in purpose.

A decorator is used to add new behavior to an object. The book uses a coffee shop application as an example. Consider a cup of coffee to be the class that you want to decorate. Once the roast has been selected customers may want cream, sugar, mocha or any other add in. Each of these add ins modify the original coffee and can be used on any type of coffee. This makes it easy to add new decorators that can be applied to any coffee class. Without decorators each coffee class would have to be modified for each new add in.

The Adapter class wraps around an object allowing it to be used by another object. The book uses an international plug-in adapter as an example. When you travel to Europe from the US you need to use an adapter to plug in your devices, assuming they can handle the 220 v. All of our Advantage clients can be thought of as adapters which allow the application to talk to Advantage. The Advantage Delphi Components translate Advantage API calls into easy to use TDataSet components making programming easier. Similarly the Advantage .NET Data Provider uses Advantage API calls to generate the standard .NET data classes.

Chapter twelve covers compound patters, because a real world application will use more than one pattern to get the job done. This is where the (in)famous Model-View-Controller (MVC) pattern is introduced. This is an often misunderstood pattern probably because we are so used to keeping everything together and not really separating out the different functional pieces. With the MVC model each layer is abstracted leaving providing a true "do one thing" principal.

This pattern is very prevalent in database programming and can be applied at several levels. The database (or tables) can be thought of as the model we are working with. The database server is the controller which interacts with the model. The view is the application which displays the data to the users so they can interact with it. Of course, this is a very high level which could be broken down into smaller pieces. For example, the Object Relational Model (ORM) produces it's own model which uses a data provider as the controller and the application as a view. This allows the ORM model to be different than the physical database model providing more flexibility to the developers.

Be sure to read chapter thirteen for some practical real world advice as well as some additional reading. There is also an appendix which covers eight more patterns if you didn't get enough from the first thirteen chapters.

The bottom line: I thought this book was very informative, the information was presented in a fun way and reinforced constantly throughout the text. I learned a lot about patterns and I agree that having this common vocabulary will be very useful when working on collaborative projects with other developers. I would recommend adding this book to your bookshelf as a reference to use when designing your new applications or features.

Friday, June 19, 2009

Delphi Prism Screencast – Part 4

Prism_Part4 In the final part of the Using Advantage with Delphi Prism screencast series we demonstrate some administrative functions. First we create a new table in the data dictionary and grant rights to all the groups, with the exception of the built-in groups, for the table. We also demonstrate how to change the current users password by using the sp_ModifyUserProperty system procedure.

The entire series will be posted in the Screencasts section of the DevZone. A list of all the individual screencasts is below:

  • Part 1 – Connecting to Advantage and opening a table
  • Part 2 – Using DataReaders and calling stored procedures
  • Part 3 – Updating data
  • Part 4 – Administrative operations

You can view the entire series on a single page by using this link.

Monday, June 15, 2009

Michigan FoxPro User Groups

I was on the road last week visiting FoxPro user groups. This is a great community filled with talented developers. Most of whom have many years experience working with databases in general.

We visited the Detroit Area FoxPro User Group (DAFUG) and the Grand Rapids FoxPro User Group (GRAFUG) and presented the same material we did at the Atlanta FoxPro User Group (AFUG) earlier in the week. For more details about the information we presented take a look at this post.

One of the really cool things about the FoxPro community is how tight knit they are. Many of the members travel to other user group meetings to present material. For example many of the speakers selected for Southwest Fox will be presenting at user group meetings prior to the conference. For a complete listing of these SWFox previews take a look at this post from the SWFox blog.

As always the presentation was well received. However, the best conversations generally happen after the meeting. We visited a great pizza place after the Detroit user group where we chatted for several hours. The Grand Rapids group meets on Saturday mornings so we were able to go to lunch before our flight home.

Thanks to everyone who came to the user group meetings. Especially to Dale Zimmer, president DAFUG, and Jody Meyer, president GRAFUG, for coordinating the meetings. 

Wednesday, June 10, 2009

Atlanta FoxPro User Group Meeting

We presented at the Atlanta FoxPro User Group meeting last night. This is the fourth FoxPro User Group I have spoken with this year. We had a great turnout for the meeting along with many positive comments. I would like to thank everyone for attending.

We covered the various Advantage topics highlighting our FoxPro support. Some of these topics included:

  • Overview of Advantage Database Server
  • Converting an existing DBC to an Advantage Data Dictionary
  • Concurrent access from an Application and a Native FoxPro application

All the attendees received a flash drive which included a developer version of Advantage and a collection of screencasts about using Advantage with Visual FoxPro. All of these screencasts are also available on the DevZone. The  list of current screencasts on FoxPro is below.

We will be visiting the Detroit FoxPro and Grand Rapids user groups later this week.

Friday, June 5, 2009

Delphi Prism Screencast – Part 3

Part3 In part three of our four part series we will be demonstrating editing data. There are two ways to update data using the Advantage .NET Data Provider with SQL or using the Advantage Extended Data Reader. Both of these techniques are demonstrated in this part of the screencast.

The entire series will be posted in the Screencasts section of the DevZone. A list of all the individual screencasts is below:

  • Part 1 – Connecting to Advantage and opening a table
  • Part 2 – Using DataReaders and calling stored procedures
  • Part 3 – Updating data
  • Part 4 – Administrative operations

Monday, June 1, 2009

FAQs – May 2009

Index Property not showing accurately

When viewing the table properties page the Index property of a particular field may indicate that the field is not indexed even though the field is part of an index. In order to determine if an index exists for a particular field ARC compares the field name to the index expressions. If an index expression consists of the fieldname then the Indexed property is set to yes. This index is also checked to see if it is Unique or Primary and the appropriate Indexed property is displayed.

However, if the field is included in a complex index expression ( i.e. Upper(<fieldname>) ) ARC may not indicate that an index exists. In the screenshots below the LastName field index property is no, however, the LastName field is contained in the Name index (LastName;FirstName).

Index Property Index Expression

This index property does not affect how the Advantage server uses the available indexes. If the field is part of an index it can still be used to optimize filters even if ARC reports no index on the field.

Restoring a Database

With Advantage version 9.0 new default user groups were added. One of these new groups is the DB:Backup group. Members of this group have permission to backup the data dictionary. However, to execute sp_RestoreDatabase  you must supply the Adssys password for the dictionary you wish to restore. The sp_RestoreDatabase command can be run from a Dictionary or Free Table connection.

Setting Rights-Checking Off for ODBC

The Advantage ODBC Driver Setup utility does not have an option for setting the rights checking for free tables. By default Advantage clients check the network rights for free table connections. Therefore the ODBC clients require network rights to the free tables.

To change this setting so the client ignores rights and does not need permission to the share you must change this setting in the registry. User DSNs are located in HKEY_CURRENT_USER\Software\ODBC\ODBC.INI and System DSNs are in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI.

Open the key that matches your DSN name and add a new string (REG_SZ) value named RightsChecking. To ignore rights set the key value to OFF and to check rights set the value to ON. Additional information about the Advantage ODBC registry keys is available in the help file.

ODBC Setup Does not List all Available Character Sets

When creating an ODBC connection there is an option to select the Character Set you wish to use when making the connection. This is particularly important when connecting to Visual FoxPro (VFP) table types.


The list of character sets comes from the adscollate.adt table which is included with all of the Advantage 9.x servers and clients. This ODBC Driver Setup dialog attempts to open this table using the Advantage Local Server (ALS). If the table cannot be found or an error occurs when opening the table the dropdown will only display ANSI and OEM.

If you are creating a DSN using a remote desktop or terminal server connection then a 5185 error will occur and the table will not be opened. You can verify this by creating the DSN directly on the machine, the entire list of character sets should be visible. Otherwise make sure the adscollate.adt and adscollate.adm are on the machine.