Wednesday, December 16, 2009

Ken Levy “Advantage with VFP” Screencast

Ken has recorded a cool screencast that covers the following topics:

  • Advantage Database Server (ADS) Components
  • ADS Overview
  • ADS Scenarios with Visual FoxPro
  • Demo: ADS for VFP and .NET
  • Resources

The screencast can be found here: http://video.sybase.com/products/advantage/Sybase_ADS_VFP.wmv

Thursday, December 10, 2009

Delphi Help System WITHOUT Microsoft SDK

The help system in newer versions of Delphi and C++Builder is a pain to navigate. This blog post describes a way you can remove the Microsoft SDK from the help system. This significantly increases the odds you will find the Delphi methods/properties/etc you are looking for instead of Microsoft SDK info you likely don’t care about and can already search for on MSDN.

http://blogs.embarcadero.com/deeelling/2009/12/07/38310

In addition, if you would like to see the SDK documentation removed by default in the future, leave Dee a comment.

Thursday, October 15, 2009

Advantage Delphi Components

I’m currently in Delphi modifying and improving some of the Advantage property editors (the dialogs that help you read and set property values in the Object Inspector).

If you have ideas for improvements, or if there are things that drive you crazy, post a comment to this post and I’ll see what I can do.

Monday, September 21, 2009

Tuesday, September 15, 2009

Advantage CHM Help File

The next Advantage 9.1 service update will include a CHM help file to replace the WinHelp files we are currently shipping. If you would like to try it out early, you can download a copy from http://devzone.advantagedatabase.com/jeremym/advantage_chm.zip

In the past we only installed the help files for the client kits and products you where using. While this kept the installations smaller, it would often hide the fact that other clients existed and had functionality you might be interested in. This new help file is an “all-in-one” help file that contains ALL Advantage documentation, and is still a relatively small help file (roughly 7MB).

This CHM help file will work in Windows Vista and Windows 7 without the buggy WinHelp plugin that was required in the past. Note if you want to view a CHM file stored on a network drive you will need to download and run this utility from EC Software.

Our new help file is built using Help & Manual from EC Software. So far it has been a great tool. I really like having access to the raw XML files the help is built from. In the event I need to manipulate the content and H&M doesn’t have the functionality I need, I can quickly write a Ruby or Perl script to zip through the help files and make my changes.

If you encounter any problems with the help file or notice any formatting errors please use the feedback email button to send us bug reports.

Monday, August 31, 2009

Advantage Delphi 2010 Support

As many of you have heard, Delphi 2010 (or “RAD Studio 2010”) has shipped. We will be updating the Advantage Delphi Components and releasing 8.1 and 9.1 updates in the next few weeks.

Our first update will include basic changes in the Advantage Delphi Components to support Delphi 2010. This update will let you use our components in Delphi 2010 just as you do in Delphi 2009 and older versions today.  A subsequent release will include updates that expand on some of the new functionality in Delphi (verb hints in the Object Inspector, JSON serialization, etc.).

Tuesday, July 28, 2009

I’m Not Dead Yet

Couldn’t resist the Monty Python reference…

It’s been a long time since I’ve posted to my blog. I’ve been caught up in Twitter land which appeals to my lazy programmer side (140 characters is much easier to conjure up than a blog post is). I’ve also been spending most of my free time (when I normally write these blog entries) playing with .NET, Visual Studio, Ruby, Ruby in Steel, and ASP.NET MVC. Add to that some C and Delphi stuff at work, and my brain has been mush for the last few months.

I’m skipping Southwest Fox this year, but I’ll be in Washington D.C. at the end of August for our next Advantage Technical Summit. I believe we will be hosting a Visual FoxPro user group meeting while we are in town as well.

As for technical blog content, I hope to post some more soon. I’ve recently had the need to slurp up a specific portion of the ads_err log and post it to a remote exception logger. I hope to publish and post a .NET version of that code when I’m finished. Unless of course some of you have already done that, in which case it would be cool if you could e-mail me the code…  ;)

Wednesday, June 3, 2009

Advantage Data Architect Update

An update to the Advantage Data Architect (ARC) has been posted to the DevZone today.

These recent releases include a fix allowing ARC to be run from a remote desktop connection without the need to modify the ads.ini file. You will no longer receive 5185 (AE_LOCAL_CONN_RESTRICTED) errors when using local server ARC connections from a remote desktop session.

Also, the changes to the Remote Management Utility I mentioned in this post in March are included in this update. You can now rearrange columns, sort and filter. You can also multi-select users to disconnect, and we added the option to disconnect users to the "Open Files" tab so you can see all users with a particular file open and disconnect all of them.

Tuesday, June 2, 2009

Advantage Data Architect 9.10.0.9 Crashes

I upgraded some third party components we use for the 9.10.0.9 release, and they seem to be causing more problems than they are fixing. Please keep sending in crash reports, just in case they are issues we are not already aware of.

I'm hoping to have a fix released this week.

Update: ARC 9.10.0.11 was posted on June 3rd to fix these issues.

Tuesday, May 26, 2009

Jump to a Column in the Advantage Data Architect

In the most recent service update of the Advantage Data Architect (version 9.10.0.9), you can now quickly jump to a specific column in a grid.

The search can be activated by clicking the magnifying glass in the top left corner of the grid, by right-clicking and choosing "find column..." from the quick menu, or by using the keyboard shortcut CTRL-ALT-F.

Friday, May 22, 2009

ARC: Did You Know #6

The ARC "Did You Know" post today comes from Advantage Senior Software Engineer Lance Schmidt. Thanks Lance!

Did you know the Advantage Data Architect (ARC) can be configured to  automatically limit the width of columns in grids? On the User Interface tab under Tools –> ARC Settings, you can configure ARC to limit the width of columns by selecting “Limit amount of data displayed in grid cells”. This option sets the maximum width of a grid column in pixels. Instead of a grid that looks like this:

 

blog_before

 

you get a grid that looks like this (after setting the option and opening a new query window):

 

blog_after

Wednesday, May 6, 2009

Search All Things Advantage from Visual Studio

After watching this post on the DevExpress blog, I thought it would be cool to do the same thing and search all of the Advantage documentation quickly from inside the Visual Studio IDE.

Follow the same steps Mehul used in his post, just use the following for your macro definition in place of the DevExpress search:

Sub DevZoneSearch()
        DTE.ExecuteCommand("View.WebBrowser")

DTE.ExecuteCommand("View.URL", "devzone.advantagedatabase.com/dz/content.aspx?Key=17&SearchKeyWords=" + _

DTE.ActiveDocument.Selection.Text + "&tab=-1")

End Sub

 

Now you can highlight any Advantage property or class name in the editor and run this macro to quickly pull up all help file documentation, knowledge base articles, newsgroup posts, service updates, tech tips and screencasts that match your search term.

Friday, May 1, 2009

Writing twiPing

A few months ago I started using Twitter. As with most first time users I was slightly confused and disappointed. I found building a network slow and cumbersome, and without a network of followers I found little value in the service. I kept at it, posting a tweet whenever I published a new blog post. At one point one of my 5 or 6 followers re-tweeted one of my blog posts. I took a look at his profile and noticed that not only did he have 400 followers, but he had 400 followers that almost entirely consisted of my target audience. At that point the light bulb turned on and I started to see the value in Twitter. 

In addition, once you have a set of relevant followers with similar interests, you can ask questions like "What third-party controls do you use when developing WinForms applications". If you have 20 followers, you probably won't get any answers. If you have a few hundred developers following you however, the replies and suggestions are almost instant.

 

My Motivation

I found building my network via the Twitter web site cumbersome. I slowly fumbled around finding people with similar interests and following small handfuls of their followers. In turn these people would usually follow me, helping to build my network. While this process worked, it was a manual process that could be automated and it was way too slow. Twitter is by definition all about real time conversations and instant gratification, yet first time users are met with no facilities to get them up to speed quickly.

From a technical aspect I wanted to learn a bit about RESTful services I had been hearing so much about. I also wanted to write a WinForms application to see how far WinForms had come since the last time I evaluated it and blew it off (Visual Studio 2003).  I normally write GUI Windows applications using Delphi, but wanted to force myself to use WinForms.

The Twitter API is a RESTful API and is fun to play around with so it seemed like a great candidate for my experiment. If you ever wonder why there are 4,078 different twitter applications out there, I think a big part of that is simply because the API is fun to use and returns active real time data.

 

The Application

The application was fairly easy to write and I have posted it for others to use. It is called twiPing. The name came from a mixture of "Twitter" and "ping", as I felt like I was pinging people to let them know I existed and might be an interesting person to follow. Yep, if you haven't caught on yet this is where you notice I'm a developer and not a creative marketing-type. Anyway, it's out there so I'm stuck with the name now. At least the name is unique which makes searching for references on the Internet easy!

twiping

twiPing is a fairly functional Twitter contact management application. It allows you to mine other users friends and followers, apply filters to batches of users, follow and un-follow batches of users, find friends who are not following you, find followers you are not yet following, and quickly build a network of like-minded people.

 

The Components

I used three third-party components building twiPing:

  • JSON.NET
  • Developer Express XtraGrid, XtraBars and XtraEditors
  • Advantage Local Server database engine

JSON.NET

I've written about JSON.NET in the past. I had a blast using it. I also came away with Advantage product ideas based on JSON.NET.

 

Developer Express Components

I was leaning towards using DevExpress components initially, as I'm familiar with them from years of Delphi development. After a quick post to Twitter asking what components WinForms developers were using, there were plenty of votes for DevExpress so I made the purchase. I ended up using their grid component as well as their ribbon control. I still need to add some icons to the buttons on the ribbon control, but I'm on a fixed budget and have little artistic ability so they only contain text for now.

I love DevExpress components. My core competency is system-level programming, which means by definition it is hard for me to construct a user interface that doesn't make people cringe! DevExpress components allow me to simply drop their components in and have a great looking application with very little effort.

I was also REALLY impressed with how similar the grid control is to the original Delphi version of the DevExpress grid. The properties and layout are almost exactly the same, which put a big dent in my learning curve and instantly made me more productive.

I'm certain there are less expensive options, but the grid alone is worth the money. This was a play project I wrote at home, so I certainly thought twice before buying my own personal DevExpress license, but I'm glad I did.

I've mentioned this in the past, but I still think DevExpress has the best support portal in the business. I enjoy asking questions there and always get outstanding help. The interface and feedback mechanism are outstanding. I seriously think they should package their support portal and sell it to other companies.

 

Advantage Local Server

The Advantage .NET Provider and the Advantage Local Server were a perfect fit for this project. I needed a free in-process database server with royalty free distribution. In addition, twiPing is a multi-threaded application, and performance and locking were a concern. The Advantage Local Server is fully concurrent and uses row level locking. This means I can have multiple threads all using the database and the job queue at the same time without any bottlenecks or serialization of database requests.

Future twiPing features are also going to utilize the full text search engine built in to Advantage and also available in the local server product.

 

What I've Learned So Far

No matter how many times I read it, it is incredibly hard to post a utility or application that is not "feature complete". You will often hear people suggest you ship the first version that is useful, and then iterate on that and take direction from your community. I agree this is a great approach, but as an engineer it just kills me to publish something that doesn't have all of my ideas already incorporated. It is easy to feel like it could reflect negatively on your skills. In addition, other developers are often so quick to point out flaws it makes it even harder to adhere to this advice. With that said, I've learned so much from this experiment I'm still extremely glad I made the utility public. I've received some great feedback.

Old school desktop applications can still be cool. I pay next to nothing for web hosting, and I can scale no matter how many people keep downloading the application. If this application were hosted, not only would I be paying for bandwidth for the incoming traffic, I would also be paying for all of the traffic from my application out to Twitter.com

With automatic update functionality in the application, I can still push frequent updates to users, even though this isn't a web application.

Marketing people want Macintosh, Adobe Air, or web applications (duh).

Web proxies are a pain.

I had to modify my assembly to specifically target the x86 platform in order to load my 32 bit database drivers when run on a 64 bit OS. See Scott Hanselman’s Back to Basics article about platforms and .NET.

The Delphi VCL shows its age after using the .NET framework. The VCL really needs serialization and reflection (among other updates).

Building installations and dealing with version numbers and upgrades is not fun.

I've heard the intellisense in Eclipse is better, but I REALLY like the intellisense in Visual Studio 2008.

BackgroundWorker threads in .NET are awesome. I loved how easy they are to set up and I like the built in facilities for reporting progress from the thread.

Google Analytic stats are addictive. I wake up at 6:30 every morning and check the new web site statistics immediately.

Requiring the .NET framework 3.5 to be installed for a simple application like this is a bit of a pain. Delphi really excels here with native win32 applications and very simple installations.

Delegates in .NET are cool once you use them a bit, but I'm a C guy at heart and would still rather use a function pointer!

 

My Twitter Accounts

For more ramblings on software development you can follow my @jdmullin Twitter account. For twiPing updates you can follow @twiPingSoftware.

Thursday, April 30, 2009

Cary Jensen's New Blog

In addition to consulting, training, writing books, writing training documentation and writing white papers, Cary Jensen has started blogging now as well.

You can check out his first post here.

Tuesday, March 24, 2009

Create .NET Objects Directly from any DbDataReader

Recently I was using the JSON.NET library to deserialize JSON objects into my own .NET class instances. I love serialization and was having way too much fun.

It occurred to me that even though every database I use does not support XML or JSON result sets, that doesn't mean I can't write a small wrapper that facilitates deserialization of a DbDataReader into my own custom classes.

I started out with a small library that took a DbDataReader as input and produced JSON text I then fed to JSON.NET and deserialized. That worked, but was a bit of a hack. I figured others had tried similar approaches so I started searching the web for a similar implementation. Rick Strahl's article DataTable JSON Serialization in JSON.NET and JavaScriptSerializer was exactly what I was looking for. Rick had already posted code that could deserialize DataSet, DataRow and DataTable objects. Using that code as a template, I created my own library that deserializes DbDataReader objects.

This approach differs from Rick's as it skips the step of moving data into an ADO.NET data structure of any sort. I simply query the database and use a DbDataReader to generate my own class instances.

Take the following class as an example:

   1:  class Employee
   2:     {
   3:        public int empid { get; set; }
   4:        public string firstname { get; set; }
   5:        public string lastname { get; set; }
   6:        public int deptnum { get; set; }
   7:        public string phone { get; set; }
   8:        public DateTime doh { get; set; }
   9:   
  10:        public string ShortFormat()
  11:        {
  12:           return string.Format( "{0} {1} {2}", this.empid, this.firstname, this.lastname );
  13:        }
  14:           
  15:     }   // class Employee

 

I can now query the database and create a new Employee object in one simple call (line 5):

   1:              cmd.CommandText = "select * from demo10";            
   2:   
   3:              // create a single instance of the Employee class using GetOneObject
   4:              AdsDataReader r = cmd.ExecuteReader();               
   5:              Employee e = (Employee)DbSerialize.GetOneObject( r, typeof(Employee) );

 

Or even better, create a generic list of Employee objects (line 5 again):

   1:              cmd.CommandText = "select * from demo10";            
   2:              
   3:              // create a generic list of Employee objects using GetObjectList
   4:              AdsDataReader r = cmd.ExecuteReader();               

5: List<Employee> AllEmployees =

(List<Employee>)DbSerialize.GetObjectList(r, typeof(List<Employee>));

 

DbSerialize Library

There isn't much to the library. I've made it available for download here. I've included a JSON.NET binary I built based on the latest code (the binary on the JSON.NET site had a few bugs that had been fixed in the trunk, so I downloaded the trunk and built it).

The library and example are Visual Studio 2008 projects. I'm sure the code will still work in Visual Studio 2005, but you might have to create your own project files.

The example uses the Advantage Database Server, but the DbSerialize library would work with any ADO.NET provider.

What's Next?

There are quite a few possibilities, most depending on your feedback.

The dependency on JSON.NET could be removed and these functions could be incorporated directly into the Advantage .NET Data Provider.

If Delphi adds better RTTI support, we could deserialize directly into Delphi objects too, which would be cool.

We could facilitate serialization so changes could be posted back to the database. A poor man's ORM solution of sorts. This could be rather nice when you want some of the benefits of ORM, but don't want the overhead of a model and another layer of complexity.

We could modify the Advantage server to return JSON directly. The JSON could then be used by web clients (think JavaScript) as well as .NET and other clients.

Sunday, March 22, 2009

New Advantage Database Server Book

Advantage Presales Engineer Joachim Duerr has written a book about Advantage in German.

In addition to his new book, Joachim will also be joining us in the U.S. at the upcoming Delphi Live 2009 conference in May, where he will be teaching a class on database notifications.

From Joachim:

Ich möchte auf diesem Wege die Verfügbarkeit meines neuen ADS Buches bekanntgeben. Es ist das erste deutschsprachige Buch zu ADS überhaupt.

Das Advantage Database Server 9 Programmierhandbuch
Autor: Dipl.-Ing. (FH) Joachim Dürr
Preis: 35€
380 Seiten, Paperback
weitere Informationen über meine Homepage
http://www.jd-engineering.de/adsbuch

Wednesday, March 18, 2009

Advantage Data Architect Management Screen

I'm in changing the grids in the Remote Management Utility in ARC to use DevExpress grids instead of the ancient (think Delphi 2/3) TStringGrid objects.

You can now rearrange columns, sort and filter. You can also multi-select users to disconnect, and I added the option to disconnect users to the "Open Files" tab so you can see all users with a particular file open and disconnect all of them.

What other changes would you like to see while I'm familiar with this form?

 

remote

Thursday, March 12, 2009

Encrypting Visual FoxPro Tables

This screencast (just over 10 minutes) is a continuation of my series explaining how to extend the life of your Visual FoxPro DBF tables using Advantage. In this screencast I show unencrypted data from DBF tables being transferred over the wire. I then create a data dictionary, reference the tables from that dictionary, and encrypt the tables and all database communications. The only change necessary for the client application is the need to provide credentials when connecting to the database.

Additional notes about Advantage encryption can be found in the online help file topics Advantage Encryption and The Advantage Data Dictionary.

If you have not watched the initial screencasts in this series, I've included the viewing order below. The topics stand on their own fairly well, but may be more meaningful if watched in order.

  1. Getting Started With Visual FoxPro and Advantage
  2. Use Visual FoxPro and Visual Studio - and Share Your Existing DBF Tables 
  3. Using Tables Over 2GB in Visual FoxPro
  4. Hiding DBF Tables

Watch the screencast directly

Download the screencast (open fox_encryption.html after unzipping): 40MB

Friday, February 20, 2009

Screencast Load Times Fixed

Thanks to Boudewijn on foxite.com for pointing out how slow my screencasts were loading. Turns out the default buffer before the flash video would start was set to 50 percent, which was WAY too high. I've lowered it to 2 percent and now the videos start up right away.

Requesting a Static Cursor

Did you know you can force Advantage to return a static cursor?

It is possible to force Advantage to return a static cursor on a SELECT statement that would normally result in a live cursor. To do this, use the {static} escape sequence after the SELECT keyword. For example:

   SELECT {static} * FROM emp WHERE hire_date < '1990-01-14'

Without the escape sequence, Advantage would create a live cursor for that query. With {static} specified, Advantage will create a static cursor.

From a performance standpoint, it is probably better in most circumstances to allow Advantage to create live cursors when possible. If, however, the WHERE clause is very restrictive (thus producing a small rowset) and the base table is very large, it may be faster to force a static cursor. This is because the live cursor would be implemented with a filter on the server, which would require an index scan. If the client forced the cursor to be static, however, the server may be able to quickly seek directly to the data for the rowset with minimal cost. And once the cursor is created, the server would not be required to do any filtering when the client traversed the rowset.

Wednesday, February 18, 2009

Hiding Tables

In this screencast (10 minutes) I follow up on my previous screencast where I converted a Visual FoxPro application to use Advantage in order to access DBF tables over 2GB.

While this screencast uses a FoxPro test application and DBF tables, it is not specific to those technologies. The same technique can be used with any Advantage client and any development environment. The technique applies to our proprietary ADT tables as well.

This time around we will modify OS file permissions and hide the DBF tables from all users. In addition, we will configure a server-side alias, which allows us to hide the path to the physical data files.

One important point I failed to mention in the screencast is that a server-side alias also allows us to close all file shares on the server machine. This is extremely important for security purposes. With this setup, you don't have any file shares exposed on your server, but can still access your tables via your Advantage connection from the client. In the case of a Visual FoxPro application, you would just put the DBC files on the client, and hide the data tables on the server.

We're not finished securing our tables, however. In my next screencast, I will show how easy it is to encrypt our tables, indexes and memo files.

Watch the screencast directly or download it (open the html file after unzipping).

Tuesday, February 17, 2009

Delphi Developer Days

Jim McKeeth has posted an interview with Cary Jensen and Marco Cantu about their Delphi Developer Days training courses which are coming up in March and April.

The depth of knowledge required to write their Delphi books combined with real world consulting experience provide them with a unique and very qualified perspective on Delphi development. I've attended presentations by both Marco and Cary in the past and they are not professional trainers by accident! They are very clear, easy to talk to, open to questions/feedback and professional. In addition, they are limiting attendance which means you will have plenty of opportunities for one-on-one questions and discussions.

Friday, February 6, 2009

Using Tables Over 2GB in Visual FoxPro

I have posted a 15 minute screencast showing how to support DBF tables over 2GB in Visual FoxPro.

You can watch the screencast directly or download it (open the html file after unzipping).

You can check out other Advantage screencasts in the Advantage Developer's Zone screencast area.

Wednesday, February 4, 2009

Delphi Keyboard Shortcuts

In the Advanced Delphi class I often teach at our Advantage training events I spend some time at the end of the session discussing keyboard shortcuts. Usually at least half of the class learns a useful shortcut they were not aware of, and they also often tell me about a shortcut I did not know about.

Today while reading a blog post from Nick I stumbled on a Delphi shortcut I imagine a majority of my readers already know, but hopefully you are not in that majority as this post will mean a lot more to you that way!

I did not know you can use CTRL+SHIFT+UPARROW/DOWNARROW to quickly jump between a method declaration and its body.

I know how to accomplish this in other editors, but I did not know the Delphi editor could do this. Of course, I have never spent any time looking to see if there were shortcuts I was unaware of that could increase my productivity. I usually just settle into my normal habits and it's business as usual.

Here is a comprehensive list of Delphi IDE shortcuts. I hope you find one or two that will instantly increase your productivity.

Wednesday, January 28, 2009

ASP.NET Applications with Delphi and Advantage Database Server

The white paper written by Cary Jensen I mentioned in a previous post about using the Advantage .NET Data Provider in Delphi for .NET and Delphi Prism is now available on the Advantage web site at the following link:

http://www.sybase.com/detail?id=1061908

Monday, January 26, 2009

Delphi Prism - Correction

In a previous post on Prism I said its dataset designer does not work with the Advantage data provider. That was not correct. Our legacy AdsDataAdapter designer does not work, but that designer has not been necessary since the Visual Studio 2002-2003 days.

With Visual Studio 2005 and newer, the ObjectDataSource object has removed the need to directly use an AdsDataAdapter.

Today I wrote some Prism tests that used the Advantage .NET Data Provider both directly and via drag and drop actions from the Server Explorer, and everything worked well. False alarm. Let me know if you have any problems with Prism, but so far it looks like a good solution for Delphi .NET developers. I really like the fact you can use our .NET data provider directly, without dbExpress or any other technologies in the way.

Saturday, January 24, 2009

Find Files Quickly

I’ve published a free command line utility that can be used to quickly find files on your hard drive. You can download it here.

I’ve always been frustrated with the file search capabilities in Windows. The search is slow and turning on the indexing service rarely increases performance. I know I’m not alone, as there are a handful of freeware and shareware utilities that provide enhanced file search capability. Even Google has tried to address this deficiency with Google Desktop. All of those solutions slowed my PC down or came with a ton of overhead and security concerns.

I wrote this utility sometime in 2004. I’ve been using it since then on all of my development and home PCs. Last week after performing steps to manually install it on some new laptops, I decided to create an install. Once the installation existed, I figured I might as well share it with everyone else.  :)

If you’ve used Linux before this is basically my own implementation of the Linux “locate” command.

The database locate uses will build in the background after installation, and be automatically updated each night via a scheduled task the installer creates. You can start using locate immediately after installation, but it will take a few minutes for the database to be populated. Searches during this time frame (immediately after installation) will not locate all files on disk.

The download is only 2 meg and installation takes seconds. Try it out and let me know what you think.

Friday, January 23, 2009

Using Advantage from Delphi Prism

I wrote my first Delphi Prism method today. Nothing crazy, just added a method to their existing ASP.NET example to verify our .NET Provider worked. It did. Our visual dataset designer does not currently work in Prism, as it has portions that make decisions based on the language, and it doesn't currently understand Oxygene. [correction: dataset creation works well. See my post correcting this error.]

It was kind of weird writing Pascal inside of Visual Studio. My hands kept trying to use Delphi keyboard shortcuts to start and control the debugger.  :)

In a few days we are going to release a white paper written by Cary Jensen about building ASP.NET applications using Delphi for .NET and Advantage. It covers the concept and benefits of using a "hand written" data layer as opposed to littering your pages with design-time components. The concept applies to Delphi Prism as well as Delphi for .NET.

I'm including my test method below as a starting point if you feel like experimenting with Prism and Advantage.

To use the code:

  • Open the Prism Simple ASP.NET example application.
  • Add a project reference to Advantage.Data.Provider.dll (right click the project in the Solution Explorer, Add Reference...)
  • Then just copy this text over all of the text in the Prism example index.aspx.pas
namespace;
 
interface
 
uses
  System,
  System.Data,
  System.Configuration,
  System.Web,
  System.Web.Security,
  System.Web.UI,
  System.Web.UI.WebControls,
  System.Web.UI.WebControls.WebParts,
  System.Web.UI.HtmlControls,
  Advantage.Data.Provider;
 
type
  IndexPage = public partial class(System.Web.UI.Page)
  protected
    method btnRefresh_Click(sender: System.Object; e: System.EventArgs);
    method QueryAdvantage;
  end;
 
implementation
 
method IndexPage.QueryAdvantage;
var
   Conn : AdsConnection;
   Cmd  : AdsCommand;
   Rdr  : AdsDataReader;
begin
   Conn := new AdsConnection;
   Conn.ConnectionString := 'data source=c:\;ServerType=local;TableType=ADT';
   
   try
      Conn.Open;   
      Cmd := Conn.CreateCommand;
      
      // Create temp table
      Cmd.CommandText := 'try drop table #quicktest;' +
                         'catch all end try;' +
                         'create table #quicktest( id integer, name cichar(20) );' +
                         'insert into #quicktest values( 1, ''Windham'' );' +
                         'insert into #quicktest values( 2, ''Reed'' )';
      Cmd.ExecuteNonQuery;         
      
      // Quick Query
      Cmd.CommandText := 'select * from #quicktest';
      Rdr := Cmd.ExecuteReader;
            
      // Spit out some data
      while ( Rdr.Read ) do
      begin
         Response.Write( 'ID: ' + Rdr[0].ToString + ' Name: ' + Rdr[1].ToString + '<br/>' );
      end;   
                
   finally
      Conn.Close;     
      Conn.Dispose;
   end;
   
end;
 
method IndexPage.btnRefresh_Click(sender: System.Object; e: System.EventArgs);
begin
 
  QueryAdvantage;
 
  try
    var lValue: Double := Double.Parse(edInput.Text, System.Globalization.NumberFormatInfo.InvariantInfo);
    
    edCtoC.Text := (lValue).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edFtoC.Text := ((lValue - 32) / 1.8).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edKtoC.Text := (lValue - 273.15).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edCtoF.Text := (lValue * 1.8 + 32).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edFtoF.Text := (lValue).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edKtoF.Text := (lValue * 1.8 - 459.67).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edCtoK.Text := (lValue + 273.15).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edFtoK.Text := ((lValue + 459.67) / 1.8).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edKtoK.Text := (lValue).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edMItoKM.Text := (lValue / 0.621371192).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
    edKMtoMI.Text := (lValue * 0.621371192).ToString(System.Globalization.NumberFormatInfo.InvariantInfo);
  except
    edCtoC.Text := 'Invalid number';
    edFtoC.Text := 'Invalid number';
    edKtoC.Text := 'Invalid number';
    edCtoF.Text := 'Invalid number';
    edFtoF.Text := 'Invalid number';
    edKtoF.Text := 'Invalid number';
    edCtoK.Text := 'Invalid number';
    edFtoK.Text := 'Invalid number';
    edKtoK.Text := 'Invalid number';
    edMItoKM.Text := 'Invalid number';;
    edKMtoMI.Text := 'Invalid number';
    exit;
  end;
end;
 
end.

Tuesday, January 20, 2009

Delicious Bookmark Search via Chrome

I had been avoiding Google Chrome for a while due to my addiction to easily searching my delicious bookmarks. This post by Fernando back in September 08 has a solution that has me using Chrome again.

While this search is nice and will do the job for now, I still like the Firefox delicious plugin because it automatically sorts my bookmarks by popularity (how often I click them).

Adding the Advantage Developer's Zone search to Chrome as described by Chris and Edgar makes using Chrome even more fun. Especially since Edgar updated the DevZone search this week to search the online help files as well. Now with a single search you can quickly get search results from the following locations: help files, knowledge base, release notes, tech tips, screencasts and newsgroups.

Wednesday, January 7, 2009

Friday, January 2, 2009

Great Utility for Mounting ISO Images

There are a variety of methods to directly mount an ISO image so you don't have to burn a CD or DVD in order to view its contents.

Methods I've used in the past involved installing weird drivers and at least 4 or 5 cumbersome steps.

This week I used a very cool utility called Virtual CloneDrive from SlySoft. Just install it. Then right-click on any ISO file and select "open".

Kudos as usual to the How To Geek for pointing me to this utility.