Saturday, December 25, 2010

Greenshot - a free screenshot tool


Greenshot is a light-weight screenshot software tool for Windows.

Greenshot was published under GPL, i.e. this software can be downloaded and used free of charge, even in a commercial environment.
Share/Bookmark

Sunday, December 19, 2010

Smallest Dot Net

Get smallest .Net framework possible!

An interesting one page web site can help you to find out which version of .NET has been installed in your system. It also provide details and estimate about the size of download which makes your system up to date with latest .NET version.
Share/Bookmark

Sunday, November 14, 2010

Free ebook: Programming Windows Phone 7


Charles Petzold wrote the book in 24 chapters, you can download the e-book version and enjoy learning how to program for Windows Phone 7 from here.
Share/Bookmark

Sunday, September 19, 2010

Core JavaScript files in the Microsoft AJAX Library

The JavaScript files provide client side functionality for your web pages. Three JavaScript files are stored as resources in the System.Web.Extensions assembly.

At runtime, the HTTP handler ScriptResourceHandler loads the files, caches them for future use, compresses them, and sends them to the web browser when they’re requested:

* MicrosoftAjax.js, contains most of the Microsoft AJAX Library’s functionality, the browser compatibility layer, the core JavaScript classes, and the Base Class Library.

* MicrosoftAjaxTimer.js, contains classes to support the Timer server control. This control enables you to update either part of or an entire web page at regular intervals,

* MicrosoftAjaxWebForms.js, contains classes to support partial page rendering, this functionality allows portions of a page to be updated asynchronously.
Share/Bookmark

Sunday, June 13, 2010

Visual Source Safe - Recursive get items

The following codes work around Visual Source Safe (VSS), it's to get latest items from a project path in VSS.

using System;
using System.IO;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Configuration;
using Microsoft.VisualStudio.SourceSafe.Interop;

namespace VssDiff
{
public class VssItem
{
#region Fields
private string cnStr;
private string dtaTblName;
#endregion

#region Properties
public string CnStr { get { return cnStr; } set { cnStr = value; } }
public string DtaTblName {
get { return dtaTblName; }
set { dtaTblName = value; }
}
#endregion

public DataSet VssDataSet;

public VssItem()
{
VssDataSet = new DataSet();
CnStr =
ConfigurationManager.ConnectionStrings["cnStr"].ConnectionString;
DtaTblName = "VSS";
}

public bool VssDataTableAdd()
{
bool retVal = false;
string errMsg = string.Empty;

if ( VssDataSet == null )
{
errMsg = "Data Set is Null, add new data table failed.";
MessageBox.Show( errMsg, "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error );
return retVal;
}

DataTable vssDtaTbl = new DataTable(DtaTblName);
vssDtaTbl.Columns.Add("vssItemEnv",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemName",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemType",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemVer",
System.Type.GetType("System.Int32"));
vssDtaTbl.Columns.Add("vssItemSpec",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemLabel",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemComment",
System.Type.GetType("System.String"));
vssDtaTbl.Columns.Add("vssItemDate",
System.Type.GetType("System.DateTime"));

VssDataSet.Tables.Add(vssDtaTbl);

retVal = true;
return retVal;
}

public void VssGetLatest(string vssPrjPath)
{
VSSItem mainVssItem;
string userId = Environment.UserName;

Microsoft.VisualStudio.SourceSafe.Interop.VSSDatabaseClass
vssDb = new VSSDatabaseClass();

vssDb.Open(@"\\MyServer\VSS\srcsafe.ini", userId, "");
vssDb.CurrentProject = vssPrjPath; // "$/MyApp/SOURCE";

mainVssItem = vssDb.get_VSSItem(vssDb.CurrentProject, false);
foreach (VSSItem vssSubItem in mainVssItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);

if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);

Application.DoEvents();
}

vssDb.Close();
}

private void VssChildGetLatest(
VSSDatabaseClass vssDb,
VSSItem vssItm)
{
try
{
VSSItem vssChildItem = vssDb.get_VSSItem(vssItm.Spec, false);
foreach (VSSItem vssSubItem in vssChildItem.get_Items(false))
{
VssItemSave(vssDb, vssSubItem);

if (vssSubItem.Type == (int)VSSItemType.VSSITEM_PROJECT)
if (vssSubItem.Spec.Contains("MyApp"))
VssChildGetLatest(vssDb, vssSubItem);

Application.DoEvents();
}
}
catch { }
}

public bool VssItemSave(VSSDatabaseClass vssDb, VSSItem vssItm)
{
bool retVal = true;

try
{
DataRow vssItmDtaRow = VssDataSet.Tables[DtaTblName].NewRow();
vssItmDtaRow["vssItemEnv"] = DtaTblName;
vssItmDtaRow["vssItemName"] = vssItm.Name;
vssItmDtaRow["vssItemType"] = vssItm.Type;
vssItmDtaRow["vssItemVer"] = vssItm.VersionNumber;
vssItmDtaRow["vssItemSpec"] = vssItm.Spec;

foreach (VSSVersion vssVersion in vssItm.get_Versions(0))
{
if (vssVersion.VersionNumber == vssItm.VersionNumber)
{
vssItmDtaRow["vssItemLabel"] = vssVersion.Label;
vssItmDtaRow["vssItemComment"] = vssVersion.Comment;
vssItmDtaRow["vssItemDate"] = vssVersion.Date;
break;
}
}

VssDataSet.Tables[dtaTblName].Rows.Add(vssItmDtaRow);
}
catch (Exception ex)
{
retVal = false;
MessageBox.Show(ex.Message);
}
return retVal;
}
}
}

Share/Bookmark

Sunday, May 23, 2010

Visual Studio - Search order for assemblies

Search order for assemblies when building a project of a solution in Visual Studio:

* Files from the current project indicated by {CandidateAssemblyFiles}.
* $(ReferencePath) property that comes from .user/targets file.
* $(HintPath) indicated by reference item.
* Target framework directory.
* Directories found in registry that uses AssemblyFoldersEx Registration.
* Registered assembly folders, indicated by {AssemblyFolders}.
* $(OutputPath) or $(OutDir)
* GAC

If the desired assembly is found by HintPath, but an alternate assembly can be found using ReferencePath, it will prefer the ReferencePath to the HintPath one.
Share/Bookmark

Visual Studio - Specify assemblies location by registry key

- Open registry by Regedit
- Search for following key (Depend on VS version use the correct number to point to this key in registry):
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\AssemblyFolders]
- Set the value of the key [AssemblyFolders] of type REG_SZ to the path of your assemblies.
Share/Bookmark

Saturday, May 22, 2010

to specify where Visual Studio search for the assemblies which you reference in your project

Unfortunately Visual Studio doesn't allow you to edit to reference assemblies, then you need to open the project file by a text editor and directly edit the ta and save the project file. When Visual studio detects the file change, it will ask you to reload the file.

Example:
<Reference Include="YourAssembly.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\CommonAssemblies\YourAssembly.dll</HintPath>
</Reference>

Share/Bookmark

Sunday, May 9, 2010

Rounding line T-SQL in .NET


Share/Bookmark

Tuesday, May 4, 2010

T-SQL Object types in sysobjects (xtype column)


Share/Bookmark

Monday, April 26, 2010

Dynamic SQL with iBatis


Share/Bookmark

Sunday, April 25, 2010

iPhone - Apple's NDA-protected license agreement changed in April 2010

The original clause stated:

3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs.

The new version of 3.3.1 reads:

3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).

It means frustrating news for developers with lot more restrictions to develop applications on iPhone. Then developers can no longer use software like Novell's MonoTouch, Unity3D, or Ansca's Corona to develop iPhone applications, and tools like Appcelerator's Titanium and PhoneGap are looking uncertainty. Generally it restricts users from utilizing different programming languages, libraries, and tools.
Share/Bookmark

Monday, April 19, 2010

NUnit - Unit Testing


Share/Bookmark

Sunday, February 21, 2010

C# - send email by SmtpClient using Gmail SMTP


...
using System.Net.Mail;
using System.Net;
...
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("me@sampleApp.com");
mail.To.Add("you@sampleApp.com");

//set the content
mail.Subject = "C# mail - Sent by System.Net.Mail";
mail.Body = "this is the body content of the email.";
mail.BodyEncoding = UTF8Encoding.UTF8;

// Delivery notification setting
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

// SMTP client settings
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.EnableSsl = true;
smtp.Timeout = 10000;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("iborn2code", "farhad2006");

//send the message
smtp.Send(mail);
...

Share/Bookmark

Tuesday, February 16, 2010

Windows Phone 7 Series


During the Mobile World Congress 2010 in Barcelona, Microsoft revealed details of Windows Phone 7 Series
In a nutshell, Xbox Live games and Zune music are now features of Windows Phone 7. These phones arrive by holiday 2010 (may be it's too late).

With the specification requiring all Windows Phone 7 Series devices to feature three buttons, Back button, Start button and Search button. On the other hand, HTC released three new phones and proclaimed the company's commitment to Windows Phone 7 on Tuesday (Feb 16, 2010).

About hardware requirements, No mention has been made of the underlying hardware, although in one of the videos on the Series 7 YouTube page, a Qualcomm representative talks about its Snapdragon chip, a 1GHz ARM-based chip that currently powers Google’s Nexus One.

Windows Phone 7 Series
Windows Mobile
Image gallery
Picture gallery
A 22 minutes demo about Windows Mobile 7
Share/Bookmark

RollBack in VSS when you don't have rollback permission

When you don't have rollback permission, you can replace a version of file with the new version and keep the project running safely.

It's based on Visual Source Safe but the idea is simply general.

• Select the file in VSS Explorer.
• Check out the file using the Check Out command on the SourceSafe menu or by right clicking on the file and choosing the command from the context menu.
• Choose Show History from the Tools menu.
• To show the History of File, click OK.
• Select a file version which you want to back to and click on Get.
• In the Get dialog box, click OK.
• In response to the message asking whether to replace the checked out file, click on Replace.
• Click Close to quit the History of File dialog box.
• Use Check In command on the SourceSafe menu or from context menu which appears by right clicking.
Share/Bookmark

VS 2008 - Microsoft.VisualStudio.DataDesign.SyncDesigner.SyncFacade.SyncManager Error

I experience the following error message when I wanted to get connected to a database on a SQL 2008 Express from a machine with a newly installed Visual Studio 2008.

When I tried "Add New Data Source" and after creating connection string at the time of proceeding to finalize the connection, the Error Message came up:

Could not load type 'Microsoft.VisualStudio.DataDesign.SyncDesigner.SyncFacade.SyncManager' from assembly 'Microsoft.VisualStudio.DataDesign.SyncDesigner.DslPackage.Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

The simple solution which worked for me was installing VS 2008 SP1, at this moment it's available at:
http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=fbee1648-7106-44a7-9649-6d9f6d58056e&displayLang=en
Share/Bookmark

Sunday, January 31, 2010

SQL - Cross Apply


Share/Bookmark

Friday, January 29, 2010

C# - Call method of a string namespace


Share/Bookmark

Friday, January 8, 2010

.NET - Hashtable vs ArrayList


Share/Bookmark