Wednesday, April 23, 2008

Many to many lazzziii

NHibernate's rock I scratched my head for a few hours looking at this code
DetachedCriteria filter = DetachedCriteria.For(typeof(Project))
.Add(Expression.Eq("ID", pid))
.SetProjection(Projections.Property("Type"));

DetachedCriteria q = DetachedCriteria.For(typeof(List_Output), "op")
.CreateCriteria("ProjectTypes")
.Add(Subqueries.Exists(filter));

return q.GetExecutableCriteria(
holder.CreateSession(typeof(List_Output))
).List();
Wonder why I got so many sql call to the server? the domain objects in the discussion context are Project has a Type and base on selected Type a project can choices a bunch of Outputs.
So Project is belong to a Type [One-to-Many], and Type has many Outputs where Output belong to Many Types [Many-to-Many].

What I found and fix is Lazzzzzzzziiiiiiiiiiiiiiii :))
I forgot to tell Type to load Outputs in a Lazy way and vise versa once that done I got only one YEAH ! I mean ONE sql call to the server to get what I asked for instead of 2 + N (where N is number of relevant Outputs in a Type)

Thanks to DetachedCriteria & the Laziness until next time today magic word is "Lazy = true"

Friday, April 18, 2008

Woh Woh storedprocedure no more ...

Read the title and want to know how to do that? come with me hacking the Castle code base or to be accurate hack NHibernate code base, what you need to bring along? not much but a SubVersion, NAnt, MbUnit and NUnit that sound enough ;)

Enjoy plug & play your database and let the Jedi rise
Happy Friday everyone !

Sunday, April 06, 2008

... and so there is a response

As I sad I love to see thing happen without me touching the code base :)) and how about the full fill my wish list?
Oh ! how about eclipse & it partner PDT? Vote it up so we "eclipse fan" can have it goes for Hardy as well ;)
Last but it the beast Ship Mono.19 with Ubuntu 8.04 go vote for it if we're true friend.

Encoded message

Rob Conery the man behind "SubSonic" a blogger like to post his though in a hex; wonder what on his mind? try this online hex converter http://www.dolcevie.com/js/converter.html

Thursday, April 03, 2008

Ubuntu 8.04 Hardy Heron - that for my mom

If you follow my previous post you might know what I've been doing so far, well i was messing around with Ubuntu 8.04 and if you ask me how was that? I would say "Yeah, It is an OS for my mom". How about you buddi? you asked. See the problem is Ubuntu 8.04 was developed for my mom it wasn't me ! :( that kind of sad isn't it?

Now let me express what make me feel this way, I guess you know who I am right? Oh ! com'on I knew you did hahaha I write VB, PHP, Java & C# tool I am expected to see in Hardy Heron
  • Eclipse 3.3 (sorry we got 3.2 )
  • Mono 1.9 (hm hmm, wait and see u might have it next release cycle)
  • MonoDevelop 1.0 (oh, isn't beta 3 work great for ya ?!)
the Ubuntu guy love to play with giant snake therefore all they care about is Python.

After all I might have to do I miss catch for 8.04 cuz my mom don't use any computer :(

Sunday, March 09, 2008

Ubuntu 8.04 Hardy Heron Alpha 6

Khmer Script Line break solved see screenshot bellow

However I am not sure what was wrong with a few character which can't render properly.

Any thought?

Friday, March 07, 2008

IP Switch WS_FTP die die

I always been a fan of WS_FTP up until last night I just can't get on with that freaking slow file transfer. I just told myself to blame ISP for not taken care of FTP connection however after tried a few different ISP connection I start to belive that was not the case. I must had to do something about it or else I better shot myself in the foot. So here come the decision:

Get rid of WS_FTP install CuteFTP from GlobalSCAPE and voilá all the pain gone thanks Budha !
Last word die die die WS_FTP.

Wednesday, March 05, 2008

Tabify why I never care?

I thought I was one of the coder who obey coding standard, but hell no until a guy told me I wasn't. That kind of make me feel like a fool :))

Well, this is how I get around:
  • Tools -> Options -> Text Editor -> C# -> Tabs (Hell no ! "Insert spaces" was selected)
  • select "Keep tabs"
Alright let see will this work "Tabify"
  • Edit -> Advanced -> View White space (Crtl + R, Crtl + W)
  • Now reformat your code [ Ctrl + A; Ctrl + K, Ctrl + F]
Is that "Tabify" you talking about Ken ;)

Tuesday, March 04, 2008

What a storm !

No no there is no weather news to tell ya, just being one of Ubuntu's fan I got to tell you how I love the project as well as the people behind it.

They try so hard to make it possible for everyone to contribute back and like every kids love x-mas hope their wish will come true. Now there is a new Santa looking for your wishes @


To cut the long story short here is the latest tool brainstorm ;) I find it cool to vote/write down great idea and got it build "without us do the hard work" what a storm !

Friday, February 01, 2008

ASP.NET Fileupload

Call me lazy cuz I am deserved it. It shocked me a bit when a production code crash on my face. As part of my job today I have to train a few admin staffs on how to operate our newly invented site www.ncdd.gov.kh/jobs it works out quiet well on my machine cuz I dev, test & teach on Mozill Firefox. But it turn out that I don't perform enough exercise cuz I haven't test the site with IE yeah, cuz I haven't use IE for almost 3 years enough to forgot about it :)) anyway here is the story.

Do you know this guy System.Web.HttpPostedFile? yeah, he is my best friend when it comes to uploading file in ASP.NET. However you should know that he acted bit strange with browse in used.

Let say file1 is an instance of HttpPostedFile and if we ask him file1.FileName
Firefox return :
"Hello My Friend.doc"
Nice , isn't it?

IE return :
"C:\Document & Setting ....\user_name\desktop\Hello My Friend.doc"
WWOWO WHAT?! it slap me so hard to make me laugh out loud :))
Not Nice !
Anyway quick fix would be add a small detection on the file1.FileName
int lastDirSeparatorChar = file1.FileName.LastIndexOf(Path.DirectorySeparatorChar);

if (lastDirSeparatorChar > 0)
{
filename = file1.FileName.Substring(lastDirSeparatorChar + 1);
}
else
{
filename = file1.FileName
}
Lesson learn - test dev. site with IE as much as I hate "IE"

Thursday, January 24, 2008

NCDD Recruitment Website is now online

Early release to take away my workloads; okay now it is the HR who got fun time with the new toy.
Check it out www.ncdd.gov.kh/jobs if think you have something to do with D&D

Wednesday, January 23, 2008

Sagernotebook.com's Product


Well, just the spec that would satisfy me :D

Tuesday, January 22, 2008

We had lost our buddy

We are so sad to congrats our buddi who had lost his freedom.
Don't worry my friend, we will always remember all bar, bear & karaoke room that we went together.

To You & Yours Happy Couple

Friday, January 18, 2008

Extending MonoRail ViewComponent

Quick note before I leave my desk for a meeting

Always apply ViewComponentDetailsAttribute on your custom ViewComponent like this
[ViewComponentDetails(string name, string sections, Type CacheKeyFactory, ViewComponentCache Cache)]


This will prevent your custom view component name clash with base component name.
Okay ! got to go

Thursday, January 17, 2008

Let do Projection

This would be a continue part from my previous post, what I tried to do is find out how to use ActiveRecord "NHiberate to be clear" in my reporting scenario (not a CRUD) after a quick search I come up with a few blog posts which give me some light:
It will take another post for me to wrap up how I come up with .... stay tune.

Edit: I shouldn't have missed, exploring test case
Castle.ActiveRecord.Tests\ActiveRecordGenericsTestCase.cs

Ubuntu "Dock It Mac Way"

It almost 2 months since my busy schedule started, I was unable to find sometime to spend with my beloved Gutsy until today * I am no expert in Ubuntu * in the exploration process I decided to upgrade a few packages to it latest version and well I come across one cool package:

Avant Window Navigator (Awn) is a dock-like bar which sits at the bottom of the screen. It has support for launchers, task lists, and third party applets.The Awn project is the development of the ‘dock’, avant-window-navigator, and its corresponding shared library ‘libawn’, which is used to develop applets.

For more detail instruction read it @ http://www.ubuntugeek.com or direct link Avant Window Navigator enjoy fun ;)

Monday, January 07, 2008

Visual Studio 2008 stink without ReSharper

Oh ! man I though VS2008 will give developer more productivity I was wrong.
Without ReSharper I feel like I take my time writing stupid code that do nothing.

VS2008 Refactoring tool is suck !

However the ReSharper 4.0 for Visual Studio 2008 is not yet release, but I can install the 3.1 with the following command
msiexec /i ReSharperSetup.3.1.Full.VS80.msi VSVERSION=9.0
And here we go all the goodness command are come back to me.
If you don't believe me watch demo video feature highlight.

Sunday, January 06, 2008

This is how a GIANT learn to copy files

Vista SP1 Notable Change - most notable change is MS is still learning how perform file operation (Copy/Move/Delete) the right way.
  • Improves performance over Windows Vista’s current performance across the following scenarios1:
    • 25% faster when copying files locally on the same disk on the same machine
    • 45% faster when copying files from a remote non-Windows Vista system to a SP1 system
    • 50% faster when copying files from a remote SP1 system to a local SP1 system
Oh and here is the funny part:
Improves the copy progress estimation when copying files within Windows Explorer to about two seconds.
What so exciting improvement to be expect in the list :D Well, it sound like we have to wait for SP1+ before purchasing product release by MS.
I wonder does SP1+ = version 3.0 :)) anyway enjoy reading detail here.

Tuesday, January 01, 2008

2008 hitting the road

Let me take this opportunity wishing you all the best,
2008 refresh our brain bring more innovations and best of all let rock the Net.


2008 Wish list:

  • Ubuntu 8.04 Hardy Heron - more hardware support out of the box please ...
  • NHibernate 2.0 GA - let persist the universe
  • Castle 1.0 GA - let become a great warrior
  • MySQL 5.1/6.0 GA - falcon data engine, data partitioning
  • Die, die Windows Vista - don't you know how much I hate you?
  • MonoDevelop 1.0 - let us all have a real IDE for Mono "Unleash the Monkey"