Thursday, January 25, 2007
Tuesday, January 23, 2007
말아톤 – Latest Korean Movie
말아톤 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.
Update of Drag and Drop, Paging,Sorting,Filtering Gridview.
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.
Thursday, January 18, 2007
The smell fuit (Durian) hits my local shops
Tuesday, January 16, 2007
Lancer Evo .... Glad I am waiting
Labels: cars
Monday, January 15, 2007
Tenacious D rocked…. And stayed at the same Hotel as me.
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.
Wednesday, January 10, 2007
Http Upload and send Attachments in .Net
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
Monday, January 08, 2007
Wrap up of Domino -> .Net Application Conversion Techniques
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.
.Net User Managable Access Control with AD User and Group Support.
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
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: C#, Code, RoleProviders
Thursday, January 04, 2007
First Movie of the Year
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.
Hangul by design
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.