Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Archive for June 2008

ASP.NET FileUpload Revisited

with 2 comments

It is very interesting early on this week the HR’s guy come to my desk and told me he no longer be able to upload job’s annoucement attachment file ??! I said woh woh what you said? because we hosted the app and he successfully uploaded files many times.

After confirm that was the problem I run through the net to find what cause the problem why it just occur now? Well it must be something change along the windows update anyway I solved the problem and now the app back to it normal operation.

But I am glad to see the topic of File Upload has been digged up again let un-DRY it shall we?

Written by Chorn Sokun

June 29, 2008 at 12:00 am

2 Years? 3 years?! I don’t know …

leave a comment »

Recently I was requested by an old friend (as known as my loyal client) which I helped him a few years back to fill in a task that his core developer could not do to help him again.

Back in history I used to work for him as a consultant. I suppose to his staff solve their problems using relevant technology and techniques. However at that time the developer was unable to catch up with the trend. So he asked me to transform myself into an developer and implementing the missing pieces. That was kind of interesting project so I agreed to take it.

By the way I mean to say bad about the my friend staff. The developer worked for my friend at that time he did his job very well. He completed 90% of the work that their client wanted “Restaurant Management Application” via “RAD” VB6 + SQL Server 2000 :) oh and he wrote a few wrapping method for data & UI creation call which is nice. However at the very last week the client came and asked them to implement additional feature which was used by his competitor restaurant and yeah they want to allow their staff to record customer ordering through a Pocket PC devices.

Since then the project gone live and everyone are happy with it. So what the heck I am saying all of these? Because now it more than just me filling the missing pieces. This time he has no longer employee any developer.  He approached me this time with the full source code that his old developer staff did (VB6 + SQL SERVER 2000) and asked me to upgrade this software for his new client, well of cause with additional feature request.

As much as I tried to escape from VB6 it always come back to me time and time again. I think I have no longer willing to forget it but to live with it. And if I count recent CMS customization work that I did with my newphew and man that was Joomla! CMS hacking for smoth integration of various extensions for at less 4 different clients ( and you should know they shall each has their unique requirements).

Within two weeks I got that much to do, It really a greate experience to trick my brain from confusing the system especially ending a VB6 code with semi colon :)) and big big and I mean BIG thanks to the Joomla! CMS community without their excellent work done I should have been slept well in my grave.

Written by Chorn Sokun

June 26, 2008 at 11:10 pm

Posted in Development, OSS, Programming

Tagged with , ,

Brail DateTime – StripTime() Extension Method

leave a comment »

Do you agree DateTime is the most annoying thing to deal with? .Net doesn’t have Date type where I can just store date value only. Oh bother why not define your own type? blame me I am lazy coder.

I have and object that hold date value which can be null, when it time to display the value I pass it from Controller -> View

But when the view render date field it render like this: 09/11/2008 12:00:00 AM What ???!!! oh yeah that is DateTime not Date.

What I can do (since I am using Brail View Engine) <% emp.DateOfEntry.ToString(“dd/MM/yyyy”) %> and I should get 09/11/2008 that fine right ;)

But I got problem with <% emp.DateOfResignation.ToString(“dd/MM/yyyy”) %> the app will blow cuz the employee is still work so the DateOfResignation is null.

Here come my very first Boo Extension method Views\CommonScripts\StripTime.brail:

import System
static def StripTime(val as duck) as string:
    return string.Empty if val is null
    return val.ToString("dd/MM/yyyy") if val.GetType().Name == "DateTime"
  except e as System.MissingMethodException:
    return string.Empty

This code block is inspired from Ayende’s post.

And this is how I use it <% emp.DateOfResignation.StripTime() %> it will return empty string is null detected otherwise it will strip out 12:00:00 AM, isn’t that cool?

Written by Chorn Sokun

June 9, 2008 at 10:22 am

Posted in MonoRail, Tips & Tricks

Tagged with ,


with 3 comments

Ayende’s Rhino-Tools become the most wanted library for my next project, consuming open source library with lack of walkthrough sample/enough test suite is always a painful experience “at the beginning”. It makes me stress for sometime as I can’t find any peer near by to share the experience with and yeah I tell you if you’ve got weak heart and usually depend on external person to walk you through the percentage of success is very low.

“No Pain, No Gain”, although the OSS’s troop are miles aways I’ll keep standing still until my last breath and hopefully, hopefully the support troop would come along.

So on the next day(s) I found the following post appear on the net which help me stand again.

Now I know how to spend my next weekend, thanks to all the good works and the sharing.

Written by Chorn Sokun

June 3, 2008 at 10:47 am