Google Search

Jul 2, 2009

Create your own shortcut in SQL Management Studio 2008

Hi All,

Shortcut is good way to increase the speed of development and work. SQL Server Management Studio 2008 have numerous shortcuts.

We are writing various SQL statement, few statements are common like, SELECT * FROM [TABLE_NAME] which we are using very frequent. its always tedious job to write SELECT * FROM statement, can’t we create shortcut for that? Yes we can. Here is the steps to create your own shortcut with screenshot may be it helps you to increase productivity.

Step 1: Find the Keyboard setting [Tools – Options – Keyboard]

ToolsOptions

Step 2: Pick the available Shortcut [Query Shortcuts]

Here you can see the default query shortcuts. Find the available and create your own.

QueryShortcut

Lets create one shortcut for SELECT Statement

SelectStatement 

Press OK, you are done with your first shortcut. Before we use the shortcut and it get applies we need to restart IDE so our shortcut will get effected.

After restarting IDE, in Query write the table name, select it and apply your shortcut [Ctrl+f1].

SelectDemo

You can see it works like SELECT * FROM EmpMaster. Now let’s apply WHERE clause and see if its works or not?

SelectWithWhere

It’s working perfectly. Use shortcuts be more productive.

Jun 30, 2009

Get query string value using JavaScript

Here is the JavaScript function getQuerystring which finds the key form query string and returns the value.

/*
* <summary>
* Get the querystring value
* </summary>
* <param name="key">A string contains the querystring key</param>
* <param name="defaultVal">Object which get returns when there is not key</param>
**/
function getQuerystring(key, defaultVal) {
if (defaultVal == null) {
defaultVal = "";
}
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
var qs = regex.exec(window.location.href);
if (qs == null) {
return defaultVal;
}
else {
return qs[1];
}
}

Jun 22, 2009

Register for PHP Developers Day

Microsoft invites you to this exclusive session on Microsoft InterOp initiatives tailored for open source developers to create cutting-edge business applications.

 

Title

Level

Speaker

Details

1.

Build Mission Critical Applications on the Microsoft Platform using Eclipse

300

Nahas Mohammed, Technology Advisor, Microsoft

Microsoft has delivered multiple technologies that focus on interoperability with non-Microsoft and Open Source technologies. Learn how to use Eclipse tools today to build Silverlight applications that run on PCs and Macs, how to work in a cross-platform environment and yet integrate your solution with your designer team. Also get to know about Microsoft's commitment to openness with the Azure Services Platform.

2.

jQuery - the write less do more javascript library

300

Deepak Gulati, Lead Architect, Cricinfo.com

jQuery has gained tremendous popularity in little over two years. It aims to allow web developers to write clear, concise code that cleanly separates the behavior of a page from its design without having them fret over details of cross-browser Javascript development. With its formal inclusion into Microsoft's Ajax stack, it is bound to become an important tool in an ASP.NET Web
Developer's toolbox.
We'll begin with a whirlwind tour of some advanced features of Javascript and then move on to using jQuery for:

-

Efficient DOM traversal and manipulation

-

Using a unified event handling mechanism
across browsers

-

Increasing visual and functional appeal of your web-pages with special effects and plugins

3.

MS SQL Business Intelligence with mySQL

300

Praveen Srivatsa, Director, Asthrasoft

Have your data residing on mySQL but want to leverage MS SQL server capabilities to build Business Intelligence solutions? Then this is the right session for you. This session looks at leveraging your existing investments in mySQL and leveraging the Reporting and Analysis Services from MS SQL server to extract data out from your mySQL data store to build meaningful dashboards. It looks at how we can integrate SQL Reporting Services and use SSIS to harvest the data from mySQL. It also looks at how we can replicate or sync data between MS SQL Server and mySQL to be able to share the relevant data across these databases.

4.

Trouble Ahead? Know Your Project Warning Signs! How Successful Leaders Recognize and Deal with Project Warning Signs

 

Sanjay Dugar, instructor, ESI International

This session is run by ESI and provides detailed guidance on conducting project health checks, what warning signs to look for, how to find them and finally, when to pull the plug on a project. For more than 25 years, ESI International has helped many of the world's most successful organizations-including Fortune 1000 companies and nearly every major agency of the United States federal government-align strategies, build talent and achieve organizational goals. To date, ESI has helped more than 850,000 technical and specialized professionals around the world improve the way they manage their projects, contracts, requirements and vendor relationships.

 

Jun 13, 2009

Long word breaks the UI

Hi All,

Working with long word into Web application some times break the UI. There always be a question for How to break long words?? As a long word without space kills your user interface.

I found the reason, in general when you system is tested by QA first thing he is going to break if you don’t limit the size and then it try to break UI with adding a loooooong space less word :)

There can be lots of other solutions, like create function which finds the long word and break it out. But I like is Regx, yes the regular expression is very optimum, but you have to learn them which is not like eating piece of cake :)

Following is the Regx which validate the text box and allow user to add 35 character long word although it seems to be not possible :)

<asp:RegularExpressionValidator ID="regNoLongWords" runat="server" ControlToValidate="txtText"
ErrorMessage="Word is too long" Display="None"
ValidationExpression="(?!.*?\S{36,}).*"></asp:RegularExpressionValidator>

Have fun with Regx !!!

Jun 12, 2009

Tech.Ed India 2009

Its a great pleasure to make announcement that Tech.Ed 2009 its now in Ahmedabad, its FREE event and you should go and attend it. If you missed TechEd Indian 2009 at Hydrabad then you can now attend it in Ahmedabad, Gujarat, India on June 20, 2009 Saturday at Rock Regency.

techedonroad

You may get change to meet/talk to two MVPs Pinal Dave and Jacob Sebastian, who will also going to attend this event. If you are interested then register here it’s based on First Come First Serve.

Jun 8, 2009

Best way to hiding Telerik Grid Column

Hi All, I was just looking into list of function while applying some logic for show/hide column of Telerik it provides two methods to do so.

public GridColumn FindByUniqueName(string UniqueName);
public GridColumn FindByUniqueNameSafe(string UniqueName);


As name suggest first method is not safe, it can throw GridExceptions if no column is found, where second one is returning null if no column is found. Along with these tow method, it have one property name UniqueName; this property helps FindByUniqueName and FindByUniqueNameSafe to find the column. So now we don’t need to remember the column id also we can now easily change the sequence of column as they are not referring with unique name.

<telerik:GridTemplateColumn UniqueName="Clients" HeaderText="Clients">


And server side write following code.

GridColumn gridColumn = dgTest.Columns.FindByUniqueNameSafe("Clients");
if (gridColumn != null)
gridColumn.Visible = false;

Jun 3, 2009

Viewstate in dynamic Control

Hi All,

There is general problem to having issue with ViewState in dynamic control.

I have posted one article Code Project you can find it here.

May 27, 2009

Using let in LINQ to Objects – Performance killer if used wrong way

C# 3.0 LINQ has one more hidden and powerful feature; which provides you to store result of sub-expression in order to use subsequence clause. You can achieve this with the help of let keyword. The variable created using let is readonly; once initialized it can’t use to store another value only good this is it can be queried.

Let’s see this with example. We have employees details in text file delimited my ‘:’, also each employee have it’s own details separated by ‘,’.

string strEmployees = "1, John, Methew:2, Nick, Althoff:3, David, Oliver:4, Sam, Peterson";

Lets write query to grab all the employee details.

string strEmployees = "1, John, Methew:2, Nick, Althoff:3, David, Oliver:4, Sam, Peterson";

//Split with :
var query = from empData in strEmployees.Split(':')
select empData;

//Split with ,
foreach (var q in query)
{
var e = q.Split(',');
Console.WriteLine("Id - {0}, First Name - {1}, Last Name - {2}",
e[0], e[1], e[2]);
}

As you can see we have to write two different logic to split one more time employee details, now let’s use let keyword and make coding easy.

string strEmployees = "1, John, Methew:2, Nick, Althoff:3, David, Oliver:4, Sam, Peterson";

var query = from empData in strEmployees.Split(':')
let emp = empData.Split(',')
select new { Id = emp[0], FName = emp[1], LName = emp[2] };

foreach (var q in query)
{
Console.WriteLine("Id - {0}, First Name - {1}, Last Name - {2}",
q.Id, q.FName, q.LName);
}


In both query output will be same.

output

emp is intermediate enumerable type which we are using in next line! This is very simple example, now what compiler treats the code above? Compiler will create one sub-query that returns the anonymous type composed of the original value along with new value specified by the let.

As its creating sub-query if you write bunch of let statements, it will kill your performance. If its implemented in proper way let is very good option to go with, the scenario where you need some function which operates on your select clause more then 2-3 times, you can create let variable and use them into your select which makes your faster.

static void SummOfferNoLet()
{
var q = from c in Products
where SumOffers(c) < 10000 && SumOffers(c) > 1000
select c;
int count = q.Count();
}
static void SummOfferWithLet()
{
var q = from c in Products
let offerValue = SumOffers(c)
where offerValue < 10000 && offerValue > 100
select c;
int count = q.Count();
}


In this case SummOfferWithLet will faster as you can see SummOfferNoLet we need to call SumOffers twice.

Conclusion: Using let is powerful but if you used wrong way then it will kill the performance.

May 25, 2009

Issues with Web.config in IIS 7 and Modules (in Vista)

A simple web application runs fine on internal web server, but the time we put it on IIS7 specially in Windows Vista, its start giving configuration error, first and foremost is issue with Modules.

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

And its points to <handlers> section under <system.webServer> section. The issue related to IIS don’t have ASP.NET installed. You can check your Windows feature, although you have installed IIS7 and compatibility for IIS6, ASP.NET is not getting installed automatically. Here is the Windows feature should look like as in following image.

No_ASP.Net

You can find this window from Control Panel –> Programs and Features –> Turn Windows features on or off [Left panel]

TurnWindowsFeaturesOnOrOff

If you have ASP.NET installed on your IIS 7.0 then you have to change the configuration from applicationHost.config file, which resides in %windir%\system32\inetsrv\config\applicationHost.config. You can find the entry for handlers and it has value Deny for property overrideModeDefault, change it to Allow.

<section name="handlers" overrideModeDefault="Deny" /> to <section name="handlers" overrideModeDefault="Allow" />

While saving file I am pretty much sure that it asks for Administrator account although your role is Administrators as you are not owner of that file you can’t make change to file, so solution for this is login as Administrator and do the changes. For vista Administrator is not active for login so find my post which help you to login as Administrator.

May 23, 2009

How to login as Administrator in Windows Vista

Hi All,

In working with Visa, you always get Alert saying “You don’t have permission to access this folder, click continue to get access”, or “Windows needs your permission to continue” or “Destination Folder Access Denied” or due to security you are not able to save file or change who owned by System…. Lots more. Although you have Administrative privileges still its says sometime “You should have administrative permission”. Or if a program needs Admin permission then you can run that application using “Run as Administrator”!!!!

So we need to do login using Administrator account, but the question is from where?

In Vista, the Administrator (or an administrator) is no longer the most trusted object in the operating system. Yes this is to "ostensibly" protect the system, and is part of a general concept of protecting the integrity of the system. The Administration is not activated and you don’t find any User Interface [Up to now, I didn’t fine] which make it active!!! Does it means you can’t make it Active? NO.

To make it active, you have to run command prompt with Administrator permission. Go to Start –> All Programs –> Accessories –> Command Prompt [right click and RUN AS ADMINISTRATOR]

RunAsAdmin

Write following commands to make Administrator active and set the password.

CommandPrompt 

First command will make Administrator account active and another will set yourpassword as Administration account password. Last command Exit.

Now, reboot or switch user or logoff from current user; you can see it will ask for Administrator account password.

USE AT YOUR OWN RISK.