Sunday, November 30, 2008

LINQ with MySQL

LINQ to SQL from Microsoft supports only their SQL Server. How about other popular DBMS such as MySQL ?

I investigate the first result returned from Google using "LINQ with MySQL" query: DbLinq. It's an opensource project which provides "LINQ to SQL" for other databases include MySQL, PostgreSQL, Oracle and SQLite.

However, the project is still at its very beginning stage and I think it will take some time before we can use it in production environment, IMHO.

Here is my setup of DbLinq with MySQL

  • Visual Studio 2008 Professional
  • MySQL 5
  • DbLinq 0.18
  • Windows Vista
1. I first have my database prepared, its name is "Items".

2. Run DbMetal which is a tool comes with DbLinq in "build" folder. I use the following command for my MySQL server. I have user root with no password.

C:\Downloads\DbLinq-0.18\DbLinq-0.18\build>DbMetal /server:127.0.0.1 /database:items /provider:MySQL /user:root /code:Items.cs
DbLinq Database mapping generator 2008 version 0.18.0.0
for Microsoft (R) .NET Framework version 3.5
Distributed under the MIT licence (http://linq.to/db/license)

>>> Reading schema from MySQL database
<<<>


3. You will have a C# code file, Items.cs in my case, automatically generated. This file contains C# classes generated from database schema and the mapping attributes.

4. You may want to compile the project now. I found some errors in my cases:
  • There is no type specified for fields of MySQL's Enum type. You can fix this easily by insert C#'s "string" type. In my case: private _gender; to private string _gender;
  • EntitySet cannot be resolved. Change every occurances to System.Data.Linq.EntitySet instead.

If you can compile your project, you can proceed to the next step.

5. Here is my code for querying from MySQL database. From my setup, it's an ASP.NET web application with a single GridView on the Default.aspx page.



6. Run and see the result : )

Monday, November 17, 2008

Com Eng Undergrad Project Showcase at Nitad 15




If you are in Thailand you must not miss this! :)

I will also, hopefully, arrange the showcases of my course projects in Computer Graphics and Image Processing there too.

The venue will be Building 4 of Faculty of Engineering, Chulalongkorn University, between 26 - 30 November 2008.

Here are some screen shots taken from my project with my friend, Opalism, in Image Processing course. Can you guess what's it all about :) ?


Friday, November 14, 2008

How to Lock Zoom level in Firefox


Since Firefox 3.0, I find the "Full Page Zoom" function very useful in daily life. The only problem with this function in Firefox is that it has no support for "default" zoom level. That is, when you navigate to the new web pages, you need to adjust the zoom level every time.

Fortunately, someone has built the extension to solve this problem. The No Squint add-on allows you to set default zoom level. And I'm living happily with it for a week so far :)

Get No Squint Now

Monday, November 10, 2008

Invitation to 15th Nitad, Bangkok, Thailand

Nitad: 26-30 Nov 2008

"Nitad" is an engineering exhibition held at Faculty of Engineering, Chulalongkorn University, Thailand, once every three years. You don't want to miss this chance! Here are what you might expect from Nitad
  • Course project showcases from many students in all engineering fields.
  • The famous RoboCup world champ team, Plasma-Z, in action!
  • Guidance for high school students who are finding more info about faculty of engineering and its sub departments.
  • Fun activities!

You may like to watch a promotion video by SlaSua :) It's a great one in my opion. And it summarizes what we have in Nitad.

Saturday, November 1, 2008

Google DevFest Bangkok Wrap-up

Yesterday, I attended the DevFest Bangkok workshop, organized by Google team, at Chulalongkorn University.

The event was fun and I spent most of my time in Chat room o__O (huh ??) There are 3 sessions which are

OpenSocial: It is an API which serves as middle-tier for Social Network. So the social network application developers don't have to re-implement their application for every different social networks they target. The first presenter, Patrick Chanezon, described the overview of OpenSocial API before passed the control to other API implementers from Hi5 (it is actually a video session), Friendster, eXo Platform, and Globant.

  • Add as friends: chanezon, pamela.fox, ...
  • chanezon, jeremi23,

OpenSocial Foundation Vote

Coding Resources
Links about opensocial in general, many tags to refine what you want to read
http://delicious.com/chanezon/opensocial

Links to code samples and resource for opensocial
http://delicious.com/chanezon/opensocial+code

OpenSocial tutorial
http://code.google.com/apis/opensocial/articles/tutorial/tutorial-0.8.html
code:
http://opensocial-resources.googlecode.com/svn/samples/tutorial/tags/api-0.8/


Google Maps: Presented by Pamela Fox. The session demonstrated various uses of Google Maps API and its flexibility. The API is flexible enough to created a Zombie-shooting game also demonstrated in the session. @pemela.fox is also very active user in the chat room : ) Slides

App Engine: I think the attendees are interested in this session the most. The presenter, Patrick, gives overview of App Engine. I personally like Google-style presentation. The slides are simple and embedded many humour (BigTable.) The Simple AJAX Chat demo app is actually the chat room attendees were using.





Wiki Code Walkthrough (not used in talk, may be useful)



The event finished around 10 PM, which is very unusual for any formal event in Thailand. And I would like to say special thanks to my friends in CP32 who makes this happen : ) Because of my constraint (there is only one thing, you know :P), I can't help them much in organizing the event at my university. And what they have done is one of very great technical event in Thailand.

Most of the material are from this page: http://docs.google.com/View?docid=dggjrx3s_2390ww9hw5fh