Time to say good bye to my SgDotNet's Blog

Dear all,

  I had been thinking a lot. If you notice my earlier post on "3 months no blogging", I did mentioned something about changing a new blog. I was waiting for this, and finally I got it.

   I will like to take this opportunity to thanks the team for creating a blog for me in SgDotNet. I appreciated this so much. I will be moving into a new blog. Check this out http://weblogs.asp.net/wenching/default.aspx

  I am grateful to Joe and I will try my best to blog there as often as possible.

Thank you.

Posted by chuawenching with 5 comment(s)
Filed under:

Presented C# 3.0, LINQ and Visual Studio 2008 Beta 2 in office

Wow. It was challenging. I received a lot of questions especially on the new features of C# 3.0.

LINQ is quite new to them. They found it hard to accept writing query in codes and not relying on Stored Procedures.

Then there were questions ORM vs Stored Procedures.

Looks like I will focus a lot on LINQ and hopefully when my next presentation on the same topic, I am able to convince all of them.

Posted by chuawenching with no comments

Missing FuncletExpression and LiftExpression in Visual Studio 2008 Beta 2

I believe this is good to share this to everyone. Basically I find nothing about this in the search engine. Furthermore, you can find about Mono or some very old post. Not in Beta 2.

Anyway I was looking for a replacement for FuncletExpression and LiftExpression in Visual Studio 2008 Beta 2. I am actually trying to migrate the NHibernate.LINQ (http://blogs.magiconsoftware.com/files/folders/8/download.aspx) example to support VS 2008 Beta 2. I emailed Ayende Rahien but he asked me to refer to the release notes.

So I decided to post in the C# Mailing List. Below is the response:

// Response from Microsoft

Chua Wen Ching –

There are no direct replacements for these two Expression Tree nodes in the Beta2 or RTM versions of the LINQ API – but uses of either should be possible by other means:

-          In place of FuncletExpressions, you will typically just use a ConstantExpression with the pre-evaluated version of the value that node represents. 

-          In place of LiftExpressions, the other expression tree nodes, such as BinaryExpression and UnaryExpression now automatically handle lifting for you.  For example, if passed nodes of nullable type as arguments, the Expression.Add(…) constructor will generate a BinaryExpression which has Lifted==true.

Hope that helps.

Thanks,

Luke

///////////////////

Cheers.

"NHibernate Part 1: Hello World with NHibernate" article - Getting to work in Microsoft SQL Server 2005

You can check out this article here http://sdesmedt.wordpress.com/2006/04/05/hello-world-with-nhibernate/

I can say it is really easy to get started. However if you follow the codes in there, you will start to realize to face problems getting it running.

I will provide some tips to get it work.

1)      Requires Virtual on each property

As on original article:

public class MessageProvider

{

    private int id;

    private string message;

 

    public MessageProvider()

    {

 

    }

 

    public int Id

    {

        get { return id; }

        set { id = value; }

    }

 

  

    public string Message

    {

        get { return message; }

        set { message = value; }

    }

}

Errors that you will get:

The following types may not be used as proxies:

TheData.MessageProvider: method get_Message should be virtual

TheData.MessageProvider: method get_Id should be virtual

TheData.MessageProvider: method set_Id should be virtual

TheData.MessageProvider: method set_Message should be virtual

Solution:

public class MessageProvider

{

    private int id;

    private string message;

 

    public virtual int Id

    {

        get { return id; }

        set { id = value; }

    }

 

  

    public virtual string Message

    {

        get { return message; }

        set { message = value; }

    }

}

You can remove the empty constructor. There is no reason to keep it there too.

2)      Hibernate-Mapping namespace

I check in search engine and I realize a lot of people are frustrated about this. Easy. If you are using NHibernate 1.2.0.4000

As on original article:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="property">

Solution:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property">

Change it from 2.0 to 2.2. It solves the problem.

3)      If you are using Microsoft SQL Server 2005

As on original article:

config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MySqlDialect");

Solution:

config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2005Dialect");

Just to make sure you have the right settings for your database, do check at this link http://www.hibernate.org/361.html?cmd=comphist&histnode=2604

There is no updates for Microsoft SQL Server 2005 but it worked the same with Microsoft SQL Server 2000.

Just to add that you can do this:

config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, @"Server=wenchingpc\sql2005;initial catalog=nhibernate_test;Integrated Security=SSPI;");

 

config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, @"Server=wenchingpc\sql2005;initial catalog=nhibernate_test;User ID=sa;Password=sa;");

The 2nd one is not part of the url above. But it will work just fine J

The connection string is very important especially to execute the code below:

IList messages = session.CreateCriteria(typeof(TheData.MessageProvider)).List();

4)      How do you name the hbm.xml file?

You can name it anything that you want. As for this case, I have only one mapping file and a MessageProvider class. I will call it MessageProvider.hbm.xml.

Below is the actual source code:

** Take note, I will base on that article. So I have not implement any best practices. So readers who face problem from that article can refer it here.

MessageProvider.cs

using System;

using System.Collections.Generic;

using System.Text;

 

namespace TheData

{

    public class MessageProvider

    {

        private int id;

        private string message;

 

        public virtual int Id

        {

            get { return id; }

            set { id = value; }

        }

 

        public virtual string Message

        {

            get { return message; }

            set { message = value; }

        }  

    }

}

MessageProvider.hbm.xml

<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property">

      <class name="TheData.MessageProvider, HelloNHibernate" table="HelloWorld">

            <id name="Id">

                  <generator class="identity" />

            </id>

            <property name="Message" />

      </class>

</hibernate-mapping>

Program.cs (or MainClass.cs)

using System;

using System.Collections;

using NHibernate;

using NHibernate.Cfg;

 

namespace HelloNHibernate

{

    class Program

    {

        static void Main(string[] args)

        {

            Configuration config = new Configuration();

            config.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");

            config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2005Dialect");

            //config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, @"Server=wenchingpc\sql2005;initial catalog=nhibernate_test;Integrated Security=SSPI;");

            config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, @"Server=wenchingpc\sql2005;initial catalog=nhibernate_test;User ID=sa;Password=!pandu@;");

            config.AddAssembly("HelloNHibernate");

 

            ISessionFactory factory = config.BuildSessionFactory();

 

            try

            {

                ISession session = factory.OpenSession();

                IList messages = session.CreateCriteria(typeof(TheData.MessageProvider)).List();

 

                Console.WriteLine("No Messages: {0}\n", messages.Count);

 

                foreach (TheData.MessageProvider aMessage in messages)

                {

                    Console.WriteLine("Id: {0} - Message: {1}", aMessage.Id, aMessage.Message);

                }

 

                session.Close();

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.Message);

            }

 

            Console.Read();

        }

    }

}

 

Hope you find it useful.  Thank you.

Posted by chuawenching with 6 comment(s)
Filed under: ,

3 months no blogging. What actually happens?

It had been 3 months not blogging. I could say I was busy with work and probably giving an excuse not to blog. Just to summarize what had happened the past 3 months J in no particular order

a)      Preparing on video shooting for techNation site. You can check the videos here http://www.technation.com.my/ Make sure you have Microsoft Silverlight installed.

b)      I was not involved in any development of the site but I was more to moral support and planning though to get it ready before Microsoft TechEd 2007 SEA. Gave 2 O’Reilly books to the 2 developers from ISA Technologies. Good work guys. The best part was the site was showcased in Silverlight.net. Check it here http://silverlight.net/Showcase/

c)       Spoke in .NET University for TechED 2007 SEA. Honestly speaking, it turned out quite bad. The reason as I was really sick the whole TechED 2007 SEA and I only managed to have access to the WCF slides on Monday. I needed to delivery on Wednesday. I had spoken to Microsoft to speak in either WPF or WF, however was assigned WCF. I would never speak on a topic which I had no experiences on. However there was something I learned from Doug Turnure from .NET University was to speak more so I could improve myself. I will love to speak in a developer track next year in TechED 2008 SEA.

d)      I was involved in the Malaysia Integrity Circle. The program was called TSAZAIC and I was in the 3rd batch. Bring Malaysian proud J Based on my colleague, I was one of the few ambassadors  (3 people selected by the CEO) to represent my company for this Integrity Circle in Malaysia

e)      I organized a few team building gatherings at office. Guess the morale of my colleagues increased more than before. Last time I only covered my own team which I was working in. But now it covered around 7 managers. Again I like to see everyone happy.

f)       Learn a few technologies and I guess you will see me blogging about it.

g)      Was deciding whether to create a site of my own so people can recognize me. Not sure yet on this one.

h)      Think more Solutions than just entirely on technology. Not only that I will pick up more skills other than just Information Technology – sales, marketing, HR, corp comm., etc. I was to bias on JavaFx thing. I will try my best not to be bias on any technologies.

i)        I was one of the 60 or 80 people (can’t remember the exact number) selected in the CEO Diamond Club for my company. Basically it was a program to recognize top performers for Quarter 1 and 2 in my company. Take note, my company has 800 employees. Very lucky and appreciate this. Managed to chat with the CEO. I was very happy.

j)        I got a call from a CEO one day and he enquired for advises on Windows Vista graphic driver issue. I gave a few suggestions and even commented on the UAC thing. I explained to him on the usage and he agreed with that. Why was this special? As you know everyone know the CEO and it was always hard for the CEO to remember you. Thanks god. This might not be anything to other people, but it was remarkable to me.

k)      Organized one of MIND community greatest event – impactful and meaningful. Even though we co-organized with iTrain on KL TechNite + MIND: Developers Rock, the contents and sponsors were managed by me J however I will like to thanks Mike, iTrain to reserve the venue. I managed to get 20 sponsors. Actually there were more but it was way too last minute. A piece of advice, look for sponsors at least 2 months ahead. The total sponsorship was RM 60,000 with 106 lucky draw items to be won. Wow.

l)        In this event, I was very lucky to get support from the MVP Lead Team for Southeast Asia. I found it lacking for companies to recognize their employees being MVPs in Malaysia. Not only are those Microsoft Developers in Malaysia not really aware of this program. Really hope I could lend some help to build awareness.

m)    I was interviewed by DotNetRocks for this event too but the interview was more focused on Communities in Malaysia. I managed to get the other 2 communities presidents and techNation president into this interview. It was fun. Mark Dunn praised me on the sponsorship. Got nice feedbacks from the speakers too. However the podcast is not released yet and I heard from Mark as it will be released somewhere in November 2007.

n)      As for the same event, I got 2 Full page editorial by PC.Com magazine. It was the 1st time I tagged along media. Thanks to Josh for the contacts and support. Without him, it wouldn’t happen to have this from PC.Com. I had submitted the event details to PC.Com and I really hoped they will publish it.

o)      I got a new desktop computer 2 months ago. It was the 2nd best specifications from Dell back then (Intel Core 2 Duo 2.66GHz, 2GB of Ram and NVidia GeForce 8600 GTS). I could say it was the best machine till today in office. Nevertheless, there were 2 issues. First I had to return by T60 laptop back and second I didn’t have a new monitor. Other than getting my new machine, I also helped my colleague Razie to obtain a powerful machine too.

p)      I had joined a new team in the current company. Thanks to my previous manager, Yang for the guidance in career and working opportunities. Now I am working with Megat. Looking ahead under his guidance.

q)      There are so many more which I can’t think off at the moment

I really hope I can give myself sometime to blog more. I have limitation to internet access, only able to access it in office. I have so many plans ahead on communities + career. Stay tuned J

Posted by chuawenching with no comments

Apple - Safari looks fascinating

I was reading Scott's blog today and found out a video in his post

http://www.hanselman.com/blog/VideoWindowsBrowserSpeedShootoutIE7Firefox2Opera9SafariForWindowsBeta3.aspx

My jaw opens wide open... wow. Safari speed is really amazing.

Posted by chuawenching with no comments
Filed under:

JavaScript - Hide status panel on mouseover asp.net button, hyperlinks, etc

My friend just asked me on last weekend on how to hide the status of Internet Explorer 7 (this doesn't happen in FireFox) when he "mouse over" on an ASP.NET button, Hyperlinks or pure html <a> links.

I had never noticed about it since then. So I did a bit of research online and tested it out. Looking at it, this link is a good one.

http://www.javascriptkit.com/script/script2/hidestatus2.shtml

The code below is extracted from the link above.

<script language="javascript">

function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus
</script>

Have fun :)

Posted by chuawenching with no comments
Filed under: ,

Framework/Improve Software Life Cycle in Mesiniaga

I am part of the initiatives to develop the new application framework as well as helping my team to improve the way we write software at my current team. Don;t get this wrong. There is actually no problems with writing software here, but this team is formed to make things easier + faster + so much better.

Take note, I am still new to a lot of things. That is why this is a continous process of building this and making things happen? Hope we can roll the initial release this year, and in fact integrating new features like LINQ into next gen :)

I had been looking at a lot of tools as well as technologies. This team is consists of 4 people. I am still the youngest in there :P The reason that I blogged a bit slow than before as I am learning a lot of stuff recently. I am not confidence enough to share with you my thoughts on that. 

Great stuff coming along. 

Posted by chuawenching with no comments
Filed under:

Enable JavaScript Save As "Webpage Complete"

If you do the normal way to show the SaveAs dialog box from JavaScript like below, you are limited to what you can save. “document.execCommand” is the API that you should used.

function doSaveAs(){

if (document.execCommand){

if (isReady){document.execCommand("SaveAs", true);}

}else{

alert('Feature available only in Internet Exlorer 4.0 and later.');

}

}

What if you want to go beyond that and able to save the complete website with images? You can do as below with a piece of advice, it works only in Microsoft Internet Explorer. In fact the top way doesn't work in firefox too haha!

function ShowSaveComplete() {

if (document.all) {

var OLECMDID_SAVEAS = 4;

var OLECMDEXECOPT_DONTPROMPTUSER = 2;

var OLECMDEXECOPT_PROMPTUSER = 1;

var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";

document.body.insertAdjacentHTML("beforeEnd", WebBrowser);

WebBrowser1.ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER);

WebBrowser1.outerHTML = "";

} else {

alert("This is only applicable to Internet Explorer");

}

}

Looks hardcore right J Hope you find this useful. It might not be the best way to achieve the best result.

Posted by chuawenching with 1 comment(s)
Filed under:

My new Career Success in Mesiniaga

This week had been very good weeks for me ... cool

a) If you read my earlier blog here http://community.sgdotnet.org/blogs/chuawenching/archive/2007/03/20/Got-11.33_2500_-Increment-_1320_-Is-this-a-lot_3F00_.aspx I got another one earlier today 0.081%. Not too much though... but just in 2 months time.

But I manage to hit my dream figure at age 25 :) Unbelievable… In fact I had never performed that well. In the past, I prioritize money more than passion. But in Mesiniaga, I placed passion as number 1. Same to team work.

b) Upon salary raise, my boss praised me on

"People made mistakes, but I learned from mistakes unlike others. The team I work for liked working with me. Keep up your hard work". As you know I always fight for my colleagues, in getting computers and team building sessions. I had been very supportive for Mesiniaga’s internal club too.

c) I was chosen as .NET Champion in Mesiniaga last Monday. Well I am more to .NET 2.0 and new technologies. In fact a lot of colleagues voted for me. Thanks guys, and I will work hard for it.

d) My boss encouraged me to focus on both career and community. I was kinda suprised too. No boss that I worked with last time actually told me to balance things up. Mesiniaga is really different. 

She knew that I had been over focus on work which might neglect my community. She told me that I chose the community journey and it was my responsibility to make MIND successfully. It gave me a slap at my face. I stood back and looked at my community and INETA Academics. Looks like I had not been working hard for it enough. I promised that I would not neglect my community anymore.

In fact I always say passion ... where is my passion if the things I do doesn't lead me or anyone anywhere. She also told me that when you voluntary to help in community, it portrayed that you would be committed to it and make sure it is delivered with best quality.

** I got to know that a lot of Malaysians jealous of me being a MVP. A lot of them think I do community for MVP. In fact they perceived wrongly on me. It was a dream since year 2002. I do community because of passion. Think about it, I can spend my time doing freelancing which can generates me revenue. In fact a lot of people ask me to do projects, but I turned them down.

e) This is nothing related to career success. Just my dreams … Last but not at least, I hope to work with Microsoft US one day. Hope my company Mesiniaga will recognize me in my resume. One day but not sure when haha J probably I gained more industry experiences. I am just too fresh in my technical skills. I need to improve my softskills too.

I really learned a lot and be more mature in both my technical and mentality. Thanks.

Posted by chuawenching with no comments
Filed under:

I am on PopFly now

Interesting concept. Nice ideas though. From the website's help page, it is stated that the project is under closed alpha. So I better not blog too much about it. If you manage to get an account in Popfly, it is great to give it a try yourself.  

http://www.popfly.ms

Posted by chuawenching with no comments
Filed under:

Plenty of Hack Kiddies nowadays

Check this blog and you gonna laugh

http://www.electric-escape.net/node/1475

How's naive this so called hacker claims to be? 26 years old ...

Posted by chuawenching with no comments
Filed under:

StarCraft 2 is coming soon

Check this out http://www.starcraft2.com/ Awesome...

Posted by chuawenching with 2 comment(s)
Filed under:

SearchDotnet - a site for .NET Developers

Found this site when I was watching the latest DnrTV Scott Hanselman's video. Nice stuff.

http://www.searchdotnet.com/

This site utilizes google search and only customize to any info related to .NET Technology.

Well I tested it out a bit. I entered "linux" word inside the textbox. Hmmm... I could still find some linux results that had no relations to .NET though...

Example,

Linux / Unix / BSD Forum - Community Site Map

Linux, Unix and BSD administration and support help. Post your Linux, Unix and BSD questions in this forum.
www.thescripts.com/forum/archive/index.php/f-136.html

Managing Storage in Red Hat Enterprise Linux 5 > Understanding ...

Managing Storage in Red Hat Enterprise Linux 5 > Understanding Partitioning.
www.informit.com/articles/article.asp?p=725218

Posted by chuawenching with no comments
Filed under:

Maxis Postpaid Background Music ... Interesting

Check this out... http://bgm.musicunlimited.com.my/index.jsp?r=8438

Only applicable to Maxis end users like me :) I am quite supportive to Maxis. Just a bit of my mobile history ...

My 1st mobile account was Celcom back in year 2000. Then I believed that I switched to Hotlink prepaid (under Maxis) somewhere year 2002. Then I switched to Maxis postpaid in year 2006 after my friends at Microsoft Malaysia complained ... haha coz I eventually asked them to call me most of the time :( shy shy...

Now by calling someone, the person I call including myself can hear the same background music. Nice. I bought the elvis presley music under Tone ID 100109. The music is kinda romantic hope the gals will not misunderstand.

Cool :)

Posted by chuawenching with no comments
Filed under:
More Posts Next page »