Wednesday 14 November 2012

Copy Your Database on Same Server (Windows Azure SQL Database)

to copy your database to a new database on the same server

CREATE DATABASE Database1B AS COPY OF Database1A;

Tuesday 30 October 2012

Error!!! Could not load file or assembly

When you get this error like I did, and it tells you the assembly file version or error says The located assembly's manifest definition does not match the assembly reference.



you'll have to follow the steps to get the dll files from windows assembly GAC
my example is about the ReportViewer.ProcessingObjectModel version so I'll use this. However you can use whatever is missing dll in your error

Open a command prompt in Administrator mode


Type cd \windows\assembly\gac_msil\Microsoft.ReportViewer.ProcessingObjectModel press Enter

Type dir so it lists the files/folders inside and press Enter and check your required version folder is available


in my case my required version was 11.0.0.0__89845dcd8080cc91 so I typed cd 11.0.0.0__89845dcd8080cc91 and press Enter

you'll be able to find Microsoft.ReportViewer.ProcessingObjectModel.dll in this folder

now we will copy this dll type command copy*.dll c:\dll (or any folder you wish to copy) and press Enter

now the dll is copied to your specified folder and you can use it as a reference in your project folder.





Monday 24 September 2012

Add SQL Azure as Linked Server

Just a quick note on how to set SQL Azure on your local SQL Server as Linked Server.

EXEC sp_addlinkedserver
@server='LinkServerName',
@srvproduct='',
@provider='sqlncli',
@datasrc='ServerName.database.windows.net',
@location='',
@provstr='',
@catalog='DatabaseName'

EXEC sp_addlinkedsrvlogin
@rmtsrvname='LinkServerName',
@useself='false',
@rmtuser='username@ServerName.database.windows.net',
@rmtpassword='Password'

EXEC sp_serveroption 'LinkServerName', 'rpc out', true;

I added user@ServerName because I kept on getting error from SQL Azure.

Server name cannot be determined.  It must appear as the first segment of the server's dns name (servername.database.windows.net).  Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername).  In addition, if both formats are used, the server names must match.



Tuesday 17 January 2012

Get Mouse Pointer Position

Get the mouse pointer position by Imports System.Windows.Forms
and assign the Cursor.Position.ToString() to any control you wish to :)

Thursday 12 January 2012

GIT User error after re-installing windows

if you have reinstalled your computer and found after GIT setup first publish that your username is showing as unknown you might need the following steps to correct the issue.

Did you try to set the user name with the following commands:
// global settings
$ git config --global user.name "FirstName LastName"
$ git config --global user.email "user@example.com"
or
// for a specific project
$ git config user.name "FirstName LastName"
$ git config user.email "user@example.com"

Edit: global settings are stored in the folder designated by the HOME environment variables, which should be unique for each Windows user, so you will have real data about the logged in user.

Git Host Key Verification Failed Error

if you re-formatted your computer like me and faced errors with GIT, you might need the following steps to setup the ssh key again.

1. Set your global settings first:
git config—global user.name “Your Name”
git config—global user.email “email@email.com
Your email address must be same as in Assembla

2. Generating a new key:
ssh-keygen -t rsa -C “name@email.com
Do not give it a filename. Just hit enter.
Creates a public and private key. Will ask for passphrase but you don’t need one. Just hit enter.

3. In Windows, the key will appear at C:\Users\name\.ssh on default
Copy public key (rsa_id.pub) into your Profile on Assembla
Best way to do this is to open it in Notepad and save it as rsa_id.txt without making any changes. Then upload it to your profile.

Wednesday 4 January 2012

Validate Email using RegEx

Dim regex As New
System.Text.RegularExpressions.Regex("^[\w-\.]+@([\w-]+\.)+[\w-]{2,3}$")
Dim match As System.Text.RegularExpressions.Match
match = regex.Match(myEmail)

If Not match.Success Then
ErrorMsg = ErrorMsg & "Email Not Valid"
End If