The Hoju Saram

Thursday, January 25, 2007

Borat was lies -- Kazakhstan has the net.


Today for the first time my blog has been receiving hits from Kazakhstan. I am not sure why, but it at least it proves borat wrong... On the other hand maybe it is Borat, he does work for the ministry of information.


Tuesday, January 23, 2007

말아톤 – Latest Korean Movie


In keeping with my news year resolution, last week I watched 말아톤 (E:)Marathon. It is a story an Autistic boy/man and his mothers’ wish for him to run a Marathon.



말아톤 is a movie about disability, and about the lack of tolerance society has for
people who are different. Based on the true story of an autistic boy who
completed the Chuncheon Marathon four years ago, the film's protagonist is
20-year old Cho-won (played by Jo Seung-woo), who was diagnosed with autism at
the age of five. His mother, played by Kim Mi-Sook, is a major character in the
film, vividly illustrating the hardships experienced by families living with
autistic people.

The movie was brilliant and I recommended it to everyone , even if you cannot speak a word of korean, it is well worth it. Jo Seung-woo is brilliant and the dream sequences and conversations he has about zebras are wonderful and inspiring.

I give it 4 kimchis out of 5.

Labels: ,

Update of Drag and Drop, Paging,Sorting,Filtering Gridview.



kick it on DotNetKicks.com

The Drag and Drop, Paging,Sorting ,Filtering Gridview is one of the most popular pages on my blog (1000+ page impressions since it was put up ).

So given the interest I have decided to update it. I have now added the ability to filter date columns as well as text/number columns. A couple of additonal screen shots are on this post (others can be seen on the original post) and the source of the new vs2005 solution is available here.



You will again need to follow the same instructions to set it up as the previous version. These instructions are:

You need to create a new empty database on your SQL server and run the SQL code file that is in the DatabaseSetup folder of the solution this will:


  • Create a customer table

  • Create a stored procedure to query the customer table as required

  • Fill in the customer table with some test data.

You will then need to grant access to those SQL elements so that you can access them from your .net solution.

The solution file contains a single aspx page that holds a standard gridview and code that does all of the logic. The data is accessed from the database via DataClass. I have created an Interface called IpagingFilterDataSource that matches what is required if you want to write your own class to do the datahandling. This will obviously be required if you are going to extend this in anyway.

int GetDataSize();
int GetDataSize(string FilterField, string FilterVal);
int GetDataSize(string FilterField, DateTime SearchDateStart, DateTime SearchDateEnd);

DataSet GetPage(int Pagesize, int CurrPage, string SortCol, string SortDirection);
DataSet GetPage(int Pagesize, int CurrPage, string SortCol, string SortDirection, string FilterField, string FilterVal);
DataSet GetPage(int Pagesize, int CurrPage, string SortCol, string SortDirection, string FilterField, DateTime SearchDateStart, DateTime SearchDateEnd);

In this solution I put together a class MyCustomSQLPageFilterDataSource which supports the IpagingFilterDataSource and retrieves data from the customers table of the test database via a stored proc called up_Customers_list.

In the page_load event in the default.aspx.cs file there is a line

MyCustomSQLPageFilterDataSource MyDataSource = new MyCustomSQLPageFilterDataSource("SQLServer", "CustomerTestDatabaseName", "Uid", "passwd");

You will need to change this to suit your setup based on the database that you created and the userid and passwd for it.

The solution provides a page with a gridview that supports the following features:



  • Click on headers to sort columns

  • Drag & Drop headers to re-order columns, changes persist over pages.

  • Right click on Column headers and filter on entered values ( Version 2 now supports filtering dates in a selected Month)

  • Page through data and page size is adjustable in the URL (Count Parameter)

  • Exporting to excel and a highly experimental mail merge via word using the “client siding” techniques I have blogged about before.

Labels: ,

Thursday, January 18, 2007

The smell fuit (Durian) hits my local shops


mmm... Durian
It is banned on the MRT ( Singapore Subway ) and it is without a doubt the smelliest fruit in the world. Many malaysia's describe it as "eating ice cream in the toliet". But I have tasted it myself and it is actually like "eating the toilet in the toilet".. Well I found it today at Woolworths.... I hope no one accidently cuts it open in the shop.



Tuesday, January 16, 2007

Lancer Evo .... Glad I am waiting


I am now very glad I am going to South Korea in 2008. If I had stayed in OZ, then I would have been tempted to buy the 2006 lancer Evolution. Well now I have seen the pics of the 2008 version I am very very glad I am waiting until I get back from Korea.
The new one is a vast improvement on the style front. Check out the difference. The one below is the 2006 version .. The one at the top is the new one..

Labels:

Monday, January 15, 2007

Tenacious D rocked…. And stayed at the same Hotel as me.


Flew to Brisbane on the weekend to Tenacious D. Their concert was brilliant. I was going to upload some video to youtube, but I found that a couple of people with much better cameras than me had already done so. If you want to see the band in action just go to Youtube.com and search for “Tenacious D Brisbane”.

While I was in Brisbane I stayed overnight at the Stanford . I usually would not stay there as I think it is about $500/night but I got a great deal on wotif. On Sunday morning I went down to breakfast wearing my new Tenacious D t-shirt only to see Kyle eating his breakfast. He looked at me , then looked at my shirt and then sort of got a paniced look on his face. I left him alone though, I paid $65 to see him play music , not eat breakfast. I didn’t see Jack Black, but I assumed he was there. The newspaper said he was travelling with his whole family.

Later when I was checking-out the receptionist asked me if I went to the concert. I said I did and that I assumed that the Band was staying there as I saw Kyle in the breakfast room, She said “Oh no no” , while nodding.

Code for .Net File Uploader/Downloader with backend SQL storage.


Probably one of the most popular controls that are talked about on web forums and available from third parties are file upload controls. I have found however there is a lack of information and code for people who want to manage those files once they get to the server.

Since I have recently been doing a lot of work with secure workflow in .Net I have needed to use this functionality, so I have created a sample project showing what I have done. The sample project performs the following functions:

  • Multiple file upload on the client (similar to gmail’s file upload facility)
  • Storage of uploaded files in SQL Server.
  • Display of existing uploaded files with associated icons and file size information.
  • Ability to add and remove file attachments from an existing record.
  • Download and display the uploaded files.

The zipped C# vs2005 solution can be downloaded here .

You will need to create a new SQL Database and run the sql code in the DBSetup Folder of the Project to create the required database tables and stored procs. You may also need to setup the security for these SQL elements depending on how you have your test environment setup. You will then need to adjust the AttachmentDatabase connection string in the web.config to match your settings.

I have used Typed Datasets through a Data Layer. I have included all of the DataSets and Data Link layer in the Web Project. Usually I would separate these out into their own projects, but for this sample I haven’t done that.

Some screen shots of it in action are below.

A record with various types of files attached.
Adding more files to an existing record.
A blank record.

Labels: ,

Wednesday, January 10, 2007

Http Upload and send Attachments in .Net

A while ago as part of a .net based web mail client I wrote some code to upload and then send files. This was in .Net 1.0 and there was no way to do this in-memory on the server. You had to do a temporary store->attach->send->delete.

This is was due to the fact that the Attachment class only worked with a file on disk. In 2.0 this has been updated so you can use an inputStream. So now attaching the uploaded files from a web page to a System.Net.Mail.MailMessage is as easy as:

public void AddUploadFilestoMessage(MailMessage msMessage)
{

System.Web.HttpFileCollection httpfiles = System.Web.HttpContext.Current.Request.Files;
Attachment mailAttachment;

if (httpfiles.Count != 0)
{
for (int iFile = 0; iFile < httpfiles.Count; iFile++)
{
System.Web.HttpPostedFile postedFile = httpfiles[iFile];

if (!(postedFile.FileName == ""))
{

String[] FileNameArr = postedFile.FileName.Split(@"\".ToCharArray());


mailAttachment = new Attachment(postedFile.InputStream, FileNameArr[FileNameArr.GetUpperBound(0)], postedFile.ContentType);
msMessage.Attachments.Add(mailAttachment);

}

}
}

}

Tuesday, January 09, 2007

Tenacious D this weekend


I am off to brisbane this weekend to see Tenacious D ("the continous non-stop rockers" and "the greatest rock band in the world") in concert at the Brisbane Entertainment Centre. I am so looking forward to it.. I will post some pics of my trip after I return..
My ever-loving wife gave this trip and tickets to me as a suprise Christmas present. She knows me so well.


Can't wait .... Yeah !!!!!!!!!

Monday, January 08, 2007

Wrap up of Domino -> .Net Application Conversion Techniques

Well with the previous post I have finished all of the posts for converting Custom IBM “Domino” applications to a Microsoft Environment (.Net / SQL Server / Exchange).

An overview of these posts is below:

To get data out of Domino and into SQL I use a custom Domino Agent with some DXL tricks

To support the routing of mail including attachments into the .Net databases I use a .net data router that uses WEBDAV to read exchange mailboxes and stores the data in SQL

To support the workflow of binary attachments I implement a secure-webstore in .net

To support User Managable Role based access control I use an extended SQLRoleProvider that supports AD groups and a custom Access Control Page with AD Search Support.

Labels: ,

.Net User Managable Access Control with AD User and Group Support.

For all articles relating to Domino to .Net conversion please see this post

Previously I posted about extending the SQLRoleProvider to allow for the use of AD groups.

This by itself is not that useful, so I have now created a project that uses this to show how to create a system for User-Managable Access Control with AD User and Group Support.

I have a zipped copy of this project available for dowload here.

The features that is project provides are:



  • SQL Roleprovider that supports AD group membership to determine application roles.

  • Access Control page to support the administration of users and groups and granting them application roles.

  • AD Search system to allow for the easy look-up of users and groups in the Active Directory and add them to the Access Control List


By using this system you can allow a specific group of users to manage access to the .net application themselves, as it supports AD group membership then the Access Control is very easy to use.

A couple of screen shots of the system in action are below.

Access Control List

Roles Tab

Searching Active Directory

To set it up you will firstly need to download the project, then install the standard .net SQLProvider system on your server . This can be found here, with additional set-up instructions in my previous post.

Once you have that set-up then you will need to run the additional SQL against the database found in the DBSetup folder of the project (this will add two new stored procedures to the standard SQLProvider database – you may need to alter the SQL permissions on these two stored procs to make them run in your environment).

After you have done that then you will need to alter the web.config of the project so that is matches your environment. You will need to adjust the connections string for the SQLRoleManagerConnection and some appsetting keys:

ADUser – this is the Domain\userid of the id used to query the Active directory when searching for users and groups

ADPasswd – this is the password of the ADUser

ADBrowsableDomains – this is a comma seperated list of all of the available domains in your environment.

DBRolesEdit – true or false to determine if the Access control Roles are editable. If you are implementing a system that uses static roles for access with a web.config setup like. Then set this to false. Otherwise set it to true to allow uses to update it.

ACLAdminRole – this is the Application Role that can edit the Access Control of the system. If the user ( or one of the users AD membership groups , if the user isn’t explicity listed ) is in this role then they can edit the ACL via the ACL.apsx page.

You will need to make sure that you have at least run the SQL statements

EXEC aspnet_Roles_CreateRole 'SQLProviderTest', '[ACLAdminRole]'
EXEC aspnet_UsersInRoles_AddUsersToRoles 'SQLProviderTest', ' YourDomain\YourId', '[ACLAdminRole]', 8

Once you have added yourself to the role that can edit the ACL (the value of the ACLAdminRole web.config key ) then you will be able to update the ACL.aspx page. You can then go to the default.aspx page and see which roles you are in.

For a better user experience I would suggest wrapping the content of the ACL.aspx page in a AJAX panel. I have purposely not done this because they are a variety of AJAX implemetations around, so this is up to you.

Happy Coding.

Labels: , ,

Thursday, January 04, 2007

First Movie of the Year


So far, so good with New Years resolution no 2. This week I watched week I watched 집으로. A very nice movie I give it 3.5 kimchi’s out of 5, and showed me I have a long way to go with my conversational korean.

I did however find a frame that beautifully displayed the animal noise standards problem I ranted about earlier last year. Take a look at this frame.



The subtitled reads “(cow crying noise) eermmae”. That’s “eermmae” not “moooo”. Oh and cows cry not talk in korea.

Labels: , ,

Hangul by design

Finally someone realises that hangul is worth designing.

OK, maybe not finally, but I think this is a real step forward for korean design, and something that has been lacking all around the world.

link

I just hope they don’t move into t-shirts before I do **GRIN**.

Happy New Year. – 2007

Well for me this is a year of counting down until I go to Korea for 12 months. Lots to arrange this year, need to pack up the house and rent it out and prepare everything.

Have 2 resolutions this year:

  • Go to gym - ( circuit class – Tuesday nights, Gym – Fridays)
  • Practice more korean, speak more and watch more movies. I am endevouring to watch at least one korean program/movie a week.

I have found that my reading and writing of korean is quite ok, but my conversation is terrible. I was talking to one of my Korean friends about this and he said that he found that people who studied books where far slower learners that people who just went out and started speaking. So this year I am going to endeavour to do this.