27 July 2004

Remoting Basic

MarshalByRef executes remote method calls on the server side. Only ObjRef-networked object pointer is passed around. Client doesn't have the complied object, but the interface or base class to the object.

ByValue - class need to be serializable. Object is serialized to binary or string(xml) and transport between server/client. It then restored to a copy of the original object at the other end. Which means client and server both need the complied class prototype. State info is preserved.

Basic Architecture
At least three three assemblies are needed for a .net remoting project:
1. Shared Assembly: Client and server both need to have access to the same interface definition (MarshalByRef), serializable objects(ByValue)
2. Server
3. Client

Implement remoting project: Life Cycle
1. Implement SharedAssembly
1.1 Define the remote interface
1.2 Define data class that will be passed around in the shared

2. Implement Server
2.1 Implement the interface by Server.
2.2 Create a new channel and register it to the remoting service.
2.3 Register the server service as "RegisterWellKnownServiceType"

3. Implement client
3.1 Registering client channel
3.2 create local proxt object to forward calls to server

12 July 2004

A dose of anti-depression

Having been feeling nothing exciting to do on the techie bits- well, in fact not many things to do at work at all for a while, I doubt I got the Clinic Depression after taking a 10 minutes quiz online*.

Clinic Depression is not a work-avoidance excuse or can be taken lightly. As the reference material says, you need to take counselling and some pills for a really long time. It is a mood in that, you loss interests on everything and don’t want to get in with those even most fascinating things before. You tell yourself to ‘I need to put everything together’, but you just can’t’.

Instead of loss in this hollow, I booked a Microsoft ASP.NET exam (70-315) bluntly. It costs about 100 pounds for about two hours. I decided to pay it myself instead of ask my boss to sign the bill- just to full load the pressure on myself.

Thought I have done some ASP.NET for about a year so far, I never have a proper or well scheduled learning period before. Got three weeks to prepare for it at that time. At some points I start to think ‘should I re-schedule the exam?’ I didn’t.

Instead, I told everyone in the team about it three days before the exam, so the pressure is at the explosive point. (Actually, it is quite silly to do that, not even leave a fail-back place.)

I took the exam this morning.

And I passed! With a score 906 out of 1000. The pass mark is 700.

It is really good news in any sense. I did learn a lot of new ASP.NET stuff, and lights shed on to those corners in normal developer’s lives will probably missed, such like deployment or security configuration. And I got out from the depression mood completely and feeling fully charged and in control now.

I wouldn’t say it is the end/top of the ASP.NET skills I will have. It wouldn’t stop there. I take it as a bench mark which means I can progress further.

And overall, I just proofed MCSD exams are most effective anti-depression drugs money can buy.

*As Nick pointed out, the online quiz is targeting female audience. I reckon it should work for both.

11 July 2004

Debug JavaScript in ASP.NET Apps

Debug JavaScript in ASP.NET Appstells how to debug client script:
Assuming we 'inject' following code snippets to create client side script



<script language="javascript">
function DoSomething()
{
alert("Hello");
}
</script>

//in the code behind test.aspx.cs
private void Page_Load(object sender, System.EventArgs e)
{
btnClick.Attributes.Add("OnClick","JavaScript:return DoSomething();");
}


We can set break point at DoSomething() by:
1) Open Internet Explorer, choose Tools | Internet Options. Click the Advanced tab and find Disable script debugging. Clear the checkbox.
2) In VS.NET IDE, press F5 to launch process in debug mode.
3) Navigate to the web page contains the script- test.aspx
4) Open 'Running Ducuments' window on IDE by selecting Debug | Windows | Running Documents, Running Ducuments Window launch and give a tree list of all document;
5) Double click test.aspx to load it into IDE browser window.
6) Place break point, monitoring variables as usual.