Now I have a very very useful Microsoft VX-1000 webcam!

By Mohammad Mahdi Ramezanpour at February 22, 2009 19:05
Filed Under: Microsoft

Microsoft VX-1000 LifeCam - Photo taken from http://images.amazon.com/images/G/01/electronics/detail-page/LCVX1.jpg After ages, finally I’ve bought a new Microsoft VX-1000 webcam and as I’m checking it out, think it’s out of this world!
As a matter of fact, it’s not the latest release of Microsoft webcams but I think this is what I was looking for!

Here’s some of its features I can see in its user-manual:

Photo Swap

Share and swap photos in real time with your friends and family using Windows Live Messenger—right in the video call window!

Windows Live™ Call Button

It's simple to start video calls. One touch of the Windows Live Call Button lets you see who's online, and you're on your way to making a video call.

LifeCam Dashboard

Add special effects and control your webcam—all from the Windows Live Messenger window.

One-Touch Blogging

Upload photos to your blog on Windows Live™ Spaces with any of your photos at the simple click of your mouse.

Superior Video and Photo Quality

See the smiles clearly with 640 × 480 pixels video and photo resolution.

Optimized for Windows Live Messenger

Seamlessly integrated with Windows Live Messenger for easy setup and use.

Universal Attachment Base

It’s a snap to attach the LifeCam to any monitor.

Built-In Microphone

The built-in microphone automatically picks up your voice with remarkable clarity.

Video Effects

Discover a fun way to express yourself with these entertaining video effects built into the LifeCam dashboard.

How to convert DateTime to a specific culture using CLR integration

By Mohammad Mahdi Ramezanpour at February 20, 2009 21:25
Filed Under: .NET General, SQL Server

During my Pocket PC project development, I needed to convert Gregorian date to Persian date. It’s easy to do such a thing in Windows or Web applications using System.Globalization namespace (PersianCalendar class) but this feature is not available when developing a Pocket PC application. I’ve tried a lot of things such as web services, windows services, etc but none of them is as good as converting it in your database and fortunately my database is Microsoft SQL Server 2005. So I decided to use CLR integration and create an UDF (User-Defined Function) in order to do so. In this post I wanted to show you how you can use CLR to create a function in .NET environment and execute it in SQL Server 2005-2008 environments.

The first thing you need is to create a SQL Server project which is available in Database node in new Project window:

Creating a SQLServer Project

Note that I used .NET Framework 2 because I wanted to create a CLR function in SQL Server 2005. If you’re using SQL Server 2008, there’s no problem to use .NET Framework 3.5 (SP1).

After you create a SQL Server project you can add any object that is common in SQL Server to your project by right click on the project and point to add; so you add a UDF, SP, etc:

Adding a new object 

As I mentioned before, we want to create an application which converts DateTime to another culture so I need to create a UDF. I select User-Defined Function and name it “PersianDateConvertor”. As you can see, Visual Studio will create a class named UserDefinedFunctions and add a method with the name you just specified:

using System;using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString PersianDateConvertor()
{
}
};

Now you need to convert a DateTime to a Persian DateTime like before using System.Globalization.PersianCalendar class. So our class will be something like this:

[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString PersianDateConvertor(DateTime dt)
{
PersianCalendar p = new PersianCalendar();
return String.Format("{0}/{1}/{2}",
p.GetYear(dt).ToString(),
p.GetMonth(dt).ToString(),
p.GetDayOfMonth(dt).ToString());
}

By the way, As you can see our method is a static method and it returns a SqlString. You can change the return type if you want.

You’ve created you CLR library! Now it’s time to use it in Microsoft SQL Server. By default, you cannot use CLR libraries in SQL Server unless you enable it. In order to enable CLR integration, you need to make use of sp_configure system stored-procedure:

EXECUTE sp_configure 'clr enabled' , '1'

Note: In order to enable CLR, you need administrative privileges.

In order to make use of an external assembly in SQL Server, you have to create an assembly like following:

CREATE ASSEMBLY DateConvertorFROM 'D:\MMR.CRL.DateConvertor.dll'WITH PERMISSION_SET = SAFE;GO

After you’ve created your assembly, you need to use it in an UDF, SP, etc:

CREATE FUNCTION dbo.GetPersianDate(@date datetime)
RETURNS nvarchar(max)AS EXTERNAL NAME DateConvertor.UserDefinedFunctions.PersianDateConvertor;
GO

You’re DONE! now you can use your UDF and the result will be something like this:

SELECT dbo.GetPersianDate(GetDate())

Result:
-------------------------------------------------------------
1387/12/2
(1 row(s) affected)

The first hard-working experience in 2009

By Mohammad Mahdi Ramezanpour at February 19, 2009 21:32
Filed Under: Other

Photo taken from: http://www1.istockphoto.com/file_thumbview_approve/3886489/2/istockphoto_3886489_hard_working_man.jpg It’s about 2-3 weeks that I’m very busy and I have no time to do anything! As a matter of fact, I’m handling 3 applications in one time and it’s very difficult to manage these works together. In this post I’m going to describe a little about my projects.

Pocket PC application

As I mentioned before, I’ve developed an application based on Windows Mobile which enables waiters to take customer’s orders much easier and without any paper. Most of this application’s sections are as same as other applications except that, they have lots of specific accounting calculations and some of them are extremely difficult to implement.

System.Web.Portal

This self-project needs a lot of codes! I’ve finished a starting point of its engine and one of its modules and currently I’m currently working on the second module of this portal. For more information about System.Web.Portal, you can check out my previous post about it.

Travel Agency Application

My main work is a reservation application for a travel agency. In fact, it has a lot to do and the application is so big! It’s about 4-5 months that I’m working on it and it doesn’t finished yet!

My usual work

It’s a natural thing that I’m working for a company; so I have to go to work every morning and come back every afternoon. This part waist my time a lot but it’s necessary and company doesn’t care about my other applications so I have to do my best at work.

Lose 10 Pounds in 5 Weeks

By Mohammad Mahdi Ramezanpour at February 13, 2009 19:49
Filed Under: Diet

An outstanding plan to lose weight in 5 weeks. I thought you might like this:

You Gotta Have a Plan - MSN Health & Fitness - Lose 10 Pounds in 5 Weeks

Moonlight 1.0 released - Open source implementation of Microsoft Silverlight for UNIX systems

By Mohammad Mahdi Ramezanpour at February 12, 2009 10:16
Filed Under: Silverlight

It might be the best news for web developers who’re developing applications under UNIX/Linux platforms that Moonlight 1.0 has been released today.

Moonlight 1.0 preview - Photo taken from http://tirania.org/tmp/xjgdwt.png

Moonlight is an open source implementation of Silverlight (http://silverlight.net), primarily for Linux and other Unix/X11 based operating systems. In September of 2007, Microsoft and Novell announced a technical collaboration that includes access to Microsoft's test suites for Silverlight and the distribution of a Media Pack for Linux users that will contain licensed media codecs for video and audio.

I have to thank all Novel Moonlight development team for this release.

You can download it right now by click here

Currently Reading

Quote of the day

Send Persian SMS