Everything Science, Technology, Development, Gaming, Hardware and Music

Friday, May 26, 2006

Some useful MySQL Links

As usual, I'm having a hectic week and have even less time to blog. I however have run across some useful MySQL links. The first one is an article on Code Project on the use of MySQL 5.0 and ASP.NET. Straight-cut and to the point, the way I like it. Check it out at Code Project.

The second is an article at DevShed about the features and fixes planned for MySQL release 5.1, due sometime (I honestly must find out). Check it out at Developer Shed.

Thursday, May 18, 2006

Titan Quest Demo

Having being an avid player of Diablo II and it's expansion Lords of Destruction from Blizzard Entertaiment, I thought it would be hard for another future RPG to reach the same level of playability that Diablo II had. I tried Sacred, but the game failed in certain areas to excite me as much as Diablo II.

I recently tried the demo for Titan Quest, a new RPG from Iron Lore Entertainment. I am actually looking forward to the release in June 2006, as this game seems to have a great amount of playability and from what I have seen so far, can probally match Diablo II in this genre. Get more information at http://titanquestgame.com/

LinuxWorld SA Update

I attended the LinuxWorld SA and Futurex exhibitions yesterday and I must say I am sorely disappointed. What happened to the days of decent exhibitions and trade shows here in South Africa. We are meant to be competing in a global market and we are meant to be the forerunners in ICT on the continent.

Firstly, both exhibitions were merged into one very small hall. There was no atmosphere, no vibrance and at first look very little effort put in by the exhibitors into their stands. It felt like you were at a "I'll-pop-a-pile-of-paper-in-your-hand-and-you-read-it" type of conference. These guys might as well have saved their money and handed out pamphlets at traffic intersections.

Secondly, every other exhibitor was selling or promoting almost exactly the same kind of technology (eg: servers, anti-virus products, etc). Where is the diversification of technology? Are we all trying to sell the same thing to end-users, because if we are, we have a serious problem with the future of technology in this country.

Thirdly, and I think we can blame this on the organisers, is the venue itself. Being in the middle of a extremely upper class commercial complex, the venue can only be horrendously expensive, which translates into exorbitant costs for exhibitors. This limits the variation of exhibitors who can afford stands at a venue like this. The venue also resulted in limited paid parking, and very poor traffic planning. I remember the days the "Computer Faire" was at Nasrec, and Gallagher Estates, and it was far more exciting, much larger (4 huge halls of stands at Nasrec) and the whole exhibition had so much more energy.

Something needs to be done to the poor state the annual Futurex exhibition is in, or I fear it will be a lost cause by next year. LinuxWorld only held it's second event this year, and by matter of association to Futurex, I fear it was also a dismal flop, and also faces a bleak future if it does not dissociate itself and stands on it's own.

One good note though, congratulations to the guys from the Geeks Freedom League, LPI, and company whose stand impressed me. By far the best at this year's exhibition.

Tuesday, May 16, 2006

LinuxWorld South Africa

Today is the opening of the Futurex and LinuxWorld exhibitions in Johannesburg, South Africa. I will definitely be attending these two events and providing some feedback as to points of interest. Watch this space for more...

KPL : To opensource or not to opensource ??

There is currently a very interesting discussion going on at EZboard http://p211.ezboard.com/fkplfrm20.showMessage?topicID=1.topic about porting KPL (Kid's Programming Language) to the Linux operating system. I am in support of this project and I feel it is necessary to port this development framework to the OSS model.

We need to expose interested kid's at a very young age to development (seeming though they are so clever with technology now-a-days) and the KPL framework is the best introductory language for kid's since LOGO in the eighty's. Read the discussion for more...

Wednesday, May 10, 2006

Database Support for Non-Image MIME-type Objects

After recently having to implement a custom Project and Document management ASP.NET solution that required users to upload files to the webserver, I have come to a question which largely puzzles me.

Why is it that most DB systems (at least those I've used) only support Image related MIME-type objects in their 'BLOB' fields (typically MySQL). AFAIK, Microsoft Access is the only database system that you can upload MIME-type objects (like PDF's, Word Documents, etc) into the database and then retrieve the actual file from the database in it's original format (by setting the database field property as an OLE Object field).

After trying the same in MySQL, I can surely upload files, but when trying to retrieve the file data, I get gibberish as an output. Maybe it's something to do with the octet-stream into the database. Any ideas ?

Wednesday, April 19, 2006

MySQL & ASP.NET 2.0 - Part 1 - Connecting to a Database

I have recently seen a spate of posts in various forums on the net about people asking how to use MySQL and the .NET 2.0 Framework. After having implemented various production sites on the MySQL 5.0 / ASP.NET 2.0 model in IIS, the implementation of the model is simplistic.

I have found that using a mix of the ODBC providers along with the MySQL providers works best for most applications. As ODBC connectivity can provide an almost universal connection state to your MySQL DB, and the MySQL providers adds IDE functionality in Visual Studio equivalent to that of System.Data.SqlClient. It’s a bit of having the best of both worlds.

To implement the use of this model successfully, I recommend you do the following:

Requirements:

  • MySQL 5.0 (has support for stored procedures).
  • Microsoft Windows with IIS support (XP or Server 2003).
  • Microsoft Visual Studio 2005 (includes .NET Framework 2.0).
  • A database that has been set-up in MySQL – I will be using a database with the name BOOKS for this blog.
  • A Web Application designed in Visual Studio 2005.

Implementation:

  • Download the MySQL Connector .NET 1.0.7 from MySQL AB, and extract the installation. Also be sure to extract the MySql.Data.DLL file from the release folder in the installation ZIP.
  • In the Windows ODBC Control Panel Applet, define a system DSN for your BOOKS database and save this DSN with a name (e.g.: BooksDSN).
  • In your Web Application, add the extracted DLL to the Bin Directory of the application, right click on the Solution Name, and click on Add Reference. Browse to the DLL and click on OK.
  • In your web.config file, add a ConnectionString key for easy definition when using the SqlDataSource control e.g: (add name="BooksConnectionString" connectionString="
    DATABASE=books; DSN=BooksDSN; OPTION=0; PORT=0; SERVER=localhost;
    UID=username; providerName=System.Data.ODBC").
    In actual fact you can copy this key I have used here, changing just the key name, DSN, SERVER and UID to your own values.
  • In your ASPX pages, you need to inherit the usage of the MySQL provider by adding a using MySql.Data.MySqlClient statement in C# or imports MySql.Data.MySqlClient in Visual Basic.
  • You can now go to the Visual Editor, add a SqlDataSource, select the connection string out of the drop downlist and specify your SELECT query. The MySQL provider however does NOT provide UPDATE or DELETE statements for you, which I presume will be resolved in future releases of the connector.
  • You can now tie any DataBound Control to the SqlDataSource you have specified.

As mentioned, this I a simple example that works, for the more advanced users you can create a DataReader, DataSet, etc and populate these with the data from your Datasource. I have merely illustrated the shortest, straightest route to getting information out of your MySQL DB. In the next blog in the series I will discuss how to populate these controls with data from your datasource and handling addition, deletion and updating of data in your application.