Saturday, July 20, 2013

SQL Server -List of Procedure modified / created within specified date

Below is the SQL query which we can use to find out if any procedure has been modified recently in last 7 days or if any procedure has been created in last 7 days

Modified Procedure
use Northwind
select name
from sys.objects
where type='P' and DATEDIFF(D,modify_date,GETDATE())<7

Below is the result you would see





Created Procedure
select name,create_date
from sys.objects

where type='P' and DATEDIFF(d,create_date,GETDATE())<7


Hope this small tip would be beneficial for you in your coding. Till then enjoy !!

Thursday, June 27, 2013

Article - C# Corner

Hello Everyone, I have uploaded my article 'ASP.NET 4.5 Features - Key HTML Editor Features' on C# corner.
Below is the link for the same:

http://www.c-sharpcorner.com/UploadFile/e1a047/Asp-Net-4-5-features-key-html-editor-features/

Please read the article and get back to me in case of any questions.

Monday, May 13, 2013

ASP.NET 4.5 Features - Key HTML Editor Features

With release of ASP.NET 4.5, we have seen many new enhancement in HTML.Today, we would be go through HTML key editor features introduced in ASP.NET 4.5.
Below are the most important / productive enhancement introduced in HTML with ASP.NET 4.5

a) Smart Tasks
b) Extract to User Control
c) HTML5 Snippets
d) Automatic Renaming of matching tag
e) Event Handler Generation

Automatic Renaming of the matching tag

In ASP.NET 4.5, we have very productive feature where matching tag is automatically renamed when we change the opening tag.
Consider the below code in HTML side















Now in earlier version of ASP.NET if i have to make a change in the starting tag then i had to manually update the end tag too. However, with ASP.NET 4.5, you would see that if you update starting tag, then end tag would also update automatically.
Please see below image for more details.















Extract to User Control
ASP.NET 4.5 has come up with very unique and productive feature where at any point of time, we can change code present in web form to user control.
Consider i have a web form containing textbox for userName and Password for authentication. While working on this page, we found that we need this user name and password authentication in different modules of the project.









With this said, ASP.NET 4.5 provides us the greate feature where we have to simply select the code and we can change that selected code to User Control

























Smart Task in HTML Editor
One of the productive feature added in ASP.NET few years back was addition of smart task. On the click of the smart available on the control, you can accomplish some of the common task on that control.

















Now with ASP.NET 4.5, we have same feature while working on HTML side. Hence, we don't have to go to design mode to use this feature.










If you click on the line present under 'a' , this would open up the smart task for that control.













You can see that you can perform all the common task for that control

Code Snippets in HTML
With ASP.NET 4.5, we have code snippets available in HTML.
If you want to add Audio or video on you page, you simply have to type video on HTML and press TAB twice. You will see that full audio / video control is available with you, mentioning all the common properties














Event Handler generation

Before the release of ASP.NET 4.5, if we have to create any event handler for any control, we either have to double click on that control, which will generate an event for that control or define the even in the properties of that control. However, with ASP.NET 4.56 we have new property added in the control, where we can generate an event for control at HTML side and we don't have to switch to design mode.








Clicking on 'Create New Event' would create default event for that control;however we can give any name of that event and you would see that Visual Studio will then automatically generate the appropriate server side event handler within your code behind file for you.











Hope this article of mine has been helpful in giving some knowledge new features of ASP.NET 4.5. To read more such articles visit my blog - http://varunkhanna.blogspot.com/





Saturday, May 11, 2013

Setting Reminder in Windows Phone Application

We have already seen how to set Alarm in Windows Phone. Please follow this link to read my article. Today, we would see how to set reminders in Windows Phone application. Its pretty much same as we did setting up Alarm in Windows Phone.

1) To start with, we would create windows application.

2) Then we need to add the following namespace in the code behind
using Microsoft.Phone.Scheduler

3) Below are the reminder properties that are available in Reminder class

  • Content - Message to be displayed when reminder triggers
  • Title - Title of the Reminder screen
  • BeginTime - Time when reminder would be triggered
  • ExpirationTime - End time of the reminder
  • NavigateURI - URL of the page when anyone clicks on the reminder screen
4) Below is the code for the same

            var Myremider = new Reminder("MyReminder");
            Myremider.Title = "My Reminder";
            Myremider.Content = "Reminder Application";
            Myremider.BeginTime = DateTime.Now.AddMinutes(1);
            Myremider.ExpirationTime = DateTime.Now.AddMinutes(10);
            Myremider.NavigationUri =new Uri( "www.google.com",UriKind.Relative);

            ScheduledActionService.Add(Myremider);


Hope this article of mine would give you some basic knowledge of setting reminder in windows phone.

Monday, May 6, 2013

Setting Alarm in Windows Phone

Today, we would see how we can set notifications in Windows phone application. There are two type of notifications that can be set in Windows phone

  • Alarm
  • Reminder
We would see how we can set ALARM in windows phone application.

1) Create a Windows phone application
2) Add following namespace
using Microsoft.Phone.Scheduler;

3) Following are the properties of Alarm class

a) Content - Specify the text you want to show when Alarm is triggered
b) Sound - You can specify any sound file to be played when Alarm is triggered
c) BeginTime - Specify the time when you want Alarm to be triggered
d) Expiration Time - Specify the time / days / month / year you want Alarm to be triggered

4) Below is the code for setting the Alarm in Windows Phone

            var NewAlarm = new Alarm("MyNewAlarm");

            NewAlarm.Content = "Testing Alarm";
            NewAlarm.Sound = new Uri("MaulaMere.mp3", UriKind.Relative);
            NewAlarm.BeginTime = DateTime.Now.AddMinutes(1);
            NewAlarm.ExpirationTime = DateTime.Now.AddDays(30);

            ScheduledActionService.Add(NewAlarm);

Hope this article of mine provide the basic knowledge of Alarm in Windows Phone

Tuesday, April 30, 2013

Use Hardware keyboard with Windows Phone Emulator

I have just started working with windows phone programming and i was thinking how we can use hardware keyboard or desktop keyboard while working with Windows phone Emulator.

So, today we would see how to enable / disable hardware keyboard with windows phone emulator

Enable Hardware Keyboard


  • Press PAGE UP key 


Disable Hardware Keyboard


  • Press PAGE DOWN Key
Hope this TIP would help you in working with windows phone emulator.

Monday, April 29, 2013

TextMode Property in ASP.NET 4.5

With ASP.NET 4.5 we have been provided full HTML5 support. Taking the example of textbox, we have text mode property which can be set to different values such as :
a) SingleLine
b) Multiline
c) Password
d) Number
e) Range
f) Date
g) Color















Now, all these textmode property support varies from browser to browser. Some textmode property values are supported by IE or chrome.

So, let's start and see important textmode property values

1) Set the textmode property = "Password"

It would give you textbox, where you have to enter the Password but you would see that when you enter the characters in the textbox, they would be shown as "DOTS". Please see below image














Also, if enter the character as 'abc' rather than entering the complete email address, then it provides me alert to 'Enter the email address'. Below is the image
















2) Setting the textmode property="URL"
Below is the code
<asp:TextBox ID="txtUrl" runat="server" TextMode="Url" ></asp:TextBox>

However, i don't enter the URL in correct format, it would display the error as below















3) Setting the textmode property="Range"
<asp:TextBox ID="txtRange" runat="server" TextMode="Range" ></asp:TextBox>



















4) Setting the textmode peoperty="Number"
 <asp:TextBox ID="txtNumber" runat="server" TextMode="Number"  ></asp:TextBox>


















This means that in this textbox we can only enter numbers. However, if one enters characters it would give alert message like below

















5)  Setting the textmode peoperty="Date"
 <asp:TextBox ID="txtDate" runat="server" TextMode="Date"  ></asp:TextBox>
This would give option to enter the date from calendar.
















































6 )  Setting the textmode peoperty="Color"
<asp:TextBox ID="txtColor" runat="server" TextMode="Color"  ></asp:TextBox>

This would give option to select color like below

























Hope this article of mine gives you clear idea of textmode property of textbox.




Saturday, April 27, 2013

AutoComplete Text Box in Windows Phone

Today, we are going to see how to use Auto complete text box in Windows Phone. For this we have to first download the Silverlight toolkit.

We can download toolkit from codeplex
Once you have downloaded toolkit from above location, go ahead and install it.

So, let's start and see how we can use Auto Complete text box in our application

1) Open up the Windows Phone application and name it as 'WPAutocompleteTextBox'








2) Select Target Phone OS version as 'Windows Phone OS 7.1'





3) If you hover your mouse to Toolbox, you will find new toolkit controls added to it.




4) Now add the Auto Complete text box to your page and give the desired height and width





5) Update the Application Title to "Windows Phone Examples" and Page Title to "AutoComplete TextBox"

6) Move to code behind page, where we would be setting the Item Source of the Auto Complete textbox. Item source means from where data would be extracted.


 public MainPage()
        {
            InitializeComponent();
            txtPhone.ItemsSource = new string[]
            {
                "ASP.NET",
                "ASP.NET3.5",
                "VB.NET",
                "SQL",
                "Oracle",
                "ASP.NET 4.5",
                "LINQ",
                "MVC"
            };
        }

7) Once done, run the application and type keyword as "A" and you will find all the text starting with "A" such as "ASP.NET", "ASP.NET 3.5","ASP.NET 4.5".





Hope with this article of mine, you have become familiar with Auto complete textbox and how to use same in Windows Phone

Saturday, February 23, 2013

ASP.NET and Web Tools 2012.2 Released

I have just downloaded ASP.NET and Web Tools 2012.2 installer from ASP.NET site. I have read there are many new things w.r.t MVC, New Facebook Template, SignalR and so on...

Would keep everyone posted on the new items with complete details.

Till then enjoy.....

Saturday, February 16, 2013

Use of Facebook Plugin in ASP.NET - Part 2

Today, we would move forward and discuss more about the facebook social plugin. If you haven't read mine first post, please read it here.

Just to give all the overview we can user facebook LIKE button in our web site.
Advantages of using the Facebook LIKE button 
a) You can tell your friends what you have liked which could be beneficial for them too
b) Keeping the LIKE button make your website popular out in the world if someone clicks on LIKE Button

So, as discussed previously, placing the LIKE button is pretty simple

<iframe src="http://www.facebook.com/plugins/like.php?href=http://varunkhanna.blogspot.com"  style="border:none; width:450px;height:80px"/> 

Below would be visual appearance of LIKE button with above line of code















Now, there are certain features which can be added which would improve or make it more fascinating.
Let's start now:

a) We can show panel containing the button to post comment when clicking LIKE button
Below would be the code of line

<iframe src="http://www.facebook.com/plugins/like.php?href=http://varunkhanna.blogspot.com" scrolling="no" frameborder="0" style="border:none; width:450px;height:80px"/>

Below is the screenshot for the same











b) We can change the text of LIKE button from "Like" to "Recommend". There is a parameter named ACTION which we could set to 'Recommend'

Following is the updated code of line

<iframe src="http://www.facebook.com/plugins/like.php?href=http://varunkhanna.blogspot.com&action=recommend" style="border:none;width:450px;height:80px"></iframe>

Below is the screenshot












c) We can also change the color of LIKE button from Light to Dark. Default is Light. There is parameter named COLORSCHEME that can be set.

Below would be line of code

<iframe src="http://www.facebook.com/plugins/like.php?href=http://varunkhanna.blogspot.com&colorscheme=dark" style="border:none;width:450px;height:80px"></iframe>

Below is the screenshot for the same












d) We can change the Layout of the LIKE button by setting the value of parameter named LAYOUT. 
We can have 3 values for Layout parameter
- Standard (Default one)
- Box_Count
- Button_Count

Below is the line of code

   <iframe src="http://www.facebook.com/plugins/like.php?href=http://varunkhanna.blogspot.com&layout=box_count" style="border:none;width:450px;height:80px"></iframe> 


Below is the screenshot when layout is set as 'box_count'











Below is the screenshot when we set Layout value as 'Button_count'











Hope this article of mine is informative for you.