Saturday, October 31, 2009

Comodo Firewall - Remote desktop rule

Scenario
I have upgraded Comodo Firewall to a new version recently. Unfortunately, I haven't been able to remote desktop to my work pc since.

Ruled out vpn settings and no http tunnelling on remote desktop. The remote desktop works if the firewall is turned OFF. This sounds like firewall has the remote desktop port blocked.

Bingo. The problem lies in the remote desktop port 3389 is blocked by Comodo Firewall.

Resolution
- Add a firewall rule to allow TCP stream coming through port 3389. Voila, everything is back to normal.

What to do in Comodo firewall?
  1. Open the firewall application. Click on the Firewall tab (next to Summary tab).
  2. On the Firewall tasks, select Advance.
  3. Click on Network Security Policy. You will see a window with 2 tabs appears. Application Rules and Global Rules.
  4. Click on Global rules, click Add to bring up Network Control Rule dialog.
  5. Action: Allow
  6. Protocol: TCP
  7. Direction: In
  8. Description: type the label for this rule. i.e. Remote desktop 3389
  9. Source Address/Destination Address/Source Port: Any
  10. Destination port: a single port. Port: 3389.
  11. Click Apply to add the rule.
  12. Select the newly added rule from the Global Rules listing and move it to the top. This is to make sure our new rule is given the highest priority.
  13. Done. Why not try it now.

Tuesday, October 27, 2009

British date time regular expression dd/mm/yyyy

I came up with the following before which is not entirely correct.

^\d{2}/(\d{2})/(\d{4})+


Why? You can enter the date as 45\23\0088. This is just digit matching.

thus, i refactor to the following:


((0{1}[1-9])|([1-2][0-9])|(3{1}[0-1]))/((0{1}[1-9])|(1{1}[0-2]))/((19|20)\d\d)


This regex only allow you to enter
dd from 01-31.
mm from 01-09 and 11-12
yyyy range restricted to 19xx-20xx.


How to get it tested? Try the following flash regex engine:
http://gskinner.com/RegExr/



Friday, October 09, 2009

How to terminate remote desktop session

List the session id on the host server
qwinsta /server:[host]


Terminate the specific rdp session on the host
rwinsta [sessionID] /server:[host]

Saturday, September 05, 2009

LlblGen - ORM tool

What is Llblgen?
It is a tool that generate data access layer from your database . Thus, saving developer time you on writing CRUD (create, retreive ,update, delete) code in the .net framework.

Feature list:
- Multiple databases support. MsSQL, Oracle, MySQL, MS Access and etc
- All .net framework version support. This include compact framework.
- Most database access operation is supported. Table record operation, retrieve views and store procedure execution.
- Linq is supported.
- DAL supports both desktop and window application development.

I am still not impressed, who is using it?
Check the company list here

Read more about Llblgen Pro

Where to download Northwind database?

I am working with Llblgen recently. The sample code requires the SQL2000 Northwind database. It took me some time to locate it. Let share the link then:

Download Northwind database samples

The sample installs the samples on 'C:\SQL Server 2000 Sample Databases' folder.

How about just download Northwind sql script?
Here you go . Rename the file to instnwnd.sql after download.

Is the script compatible with other version of SQL server (SQL2005, SQL2008) ?
Yes. Use the instnwnd.sql. Execute the sql script in your SQL Management Studio. The script create the Northwind database schemas with sample data. At least database backup (mdf and ldf) compatibility is least of your problem.

I didn't try the mdf backup restore but did create the db in SQL2008 instance using just sql script. No problem at all.

Happy trying. :)

Monday, August 17, 2009

How to change SQL server 2008 instance name

Find out the server instance name

  1. sp_helpserver
  2. select @@servername

Modify the instance name

  1. sp_dropserver ‘old_name’
  2. go
  3. sp_addserver ‘new_name’,‘local’
  4. go
Restart the service

Friday, August 14, 2009

Vs2008 snippets

Snippet Designer (MSDN blog)
http://www.codeplex.com/SnippetDesigner

C# snippet library
http://snippetlibcsharp.codeplex.com/

Visual Studio snippet directory
C:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C#\