A very (extremely) simple ASP .Net Hello World example, Just for fun…

I was going through an ASP.Net book, and thought of writing extremely simply Hello World example. This will give an insight of how simple and small page you can write using ASP .Net.

For each example I have given asp .net code and corresponding browser generated code.

Example1

<%@ Page Language="c#"  %>
<%Response.Write("Hello World");>

Brower Source:

Hello World

Example2:

<%@ Page Language="c#" %>
<script runat="server">
void SayHello()
{
Response.Write("Hello World !");
}
</script>
<html>
<body>
<% SayHello(); %>
</body>
</html>

Brower Source:

<html>
<body>
Hello World !
</body>
</html>

Adding macro in to toolbar as tool bar button, creating macro and adding it, with small example

How nice it would be if your favourite macro is available as toolbar button. Its really easy to do. Suppose you have created a macro hello and you want to add it, then just follow these step:

Adding macro to toolbar

  1. Go to menu: tools->Customize… => it will open Customize window.
  2. In Customize window go to ‘Commands’ tab and select ‘Macros’ at left pane, all the macros you have created would be visible at right pane.
  3. Just drag the macro you want to toolbar.
  4. It would automatically create a button with macro name.

Customizing toolbar macro button

  1. Write click on macro toolbar button while Customize window is open.
  2. In this menu you can do all the customization. Changing name, image etc.
  3. You can also assign a shortcut key. Just put &1(if you want alt+1 to a shortcut key) or which ever combination you want.

Office tips and tricks: Creating and adding new toolbar in ms office, a very simple example

You would have seen many toolbars in your office app. Have you ever thought of having toolbar with your own name ;). Yes you can add new tool bar with some really simple step in to your office app(word/outlook/excel etc.). So here we go:
1. Go to menu: tools->Customize… => it will open Customize window.
2. In Customize window go to Toolbars tab and click on “New…” button. It will open a small window here you need to give toolbar name.
3. Your toolbar is ready to add.
4. You can drag buttons from Customize window’s Command tab.
5. For ex. in Command tab select ‘File’ at left pane and drag ‘Open’ in right pane to the newly created toolbar. Its done.

You can also add previously created macro in to this toolbar.

finding information about an IP address on the web

Today i need to find information about an ip address, i got from internet. This thing can also happen when you get any spam or something from an ip and you need information about that ip. ARIN WHOIS Database Search helped me to get more information about ip. following is the URL of it:
http://ws.arin.net/whois/

For example if you want to know whom 216.239.51.99 ip belongs, you can type this ip in left text box on the site and on clicking submit query button you will have complete information.

HTML/JavaScript: Dynamically populating combobox/select options

I got a problem that how to dynamically populate values in html combo box using javascript. Or rather say, how to dynamically add options in select element of html.
here is our html code:

<select id="id_s">
 <option value="a">first</option>
 <option value="b">second</option>
</select>

Now suppose i want to add one option ‘third’, here is the code for it:

var combo = document.getElementById('id_s');
combo.options[2] = new Option ("third", "c");

Courtesy : This forum.

C# tips & tricks: Do you want to rethrow exception ?

Many times during development we really don’t want to handle exception every where, rather we like to throw it again. But what is the best way to do it:

catch(Exception ex)
{
throw;
}

OR

catch(Exception ex)
{
throw ex;
}

This article I found in net gives really good insight of it. It suggests to use first method, as it would not truncate previous stack trace information.

C# tips & tricks: String Concatenation, Best practices

When we are struggling with String concatenation issues, specially which is the best way to concatenate the strings. One of my colleague suggested following articles to me.

though this may not be giving every thing you are looking for, but really very nice and worth readable for the .NET developers.

Hiding grid lines in Excel

This was the thing i want to do in excel. Hiding all the grid lines and showing only tables which i have created.

Hiding grid lines:

1.  Go to tools-> Options… Menu

2. It will show Options dialog box.

3. Go to View tab.

4. In view tab, at down Window Options part, uncheck Gridlines checkbox.

Published in: on August 6, 2009 at 4:49 pm  Leave a Comment  
Tags: , , ,

MySql: Give Root User Logon Permission From Any Host

Following article describes you how to do this. I was not able to connect with MySQL server using MySQL Query Browser from remote machine then i got this article.

http://www.howtogeek.com/howto/programming/mysql-give-root-user-logon-permission-from-any-host/

You can do the same from query browser. Just edit the MySQL.user tables host column. Here for any user you can give the client name which you are expecting or just give ‘%’ if you are want to connect from any host.

Remote control of a W2K3 Console session

You can log on to a window 2003 server easily, and each time it will give you same session, called console session. If you log on to the same server remotely, it will start new session, it will not give you the same console session.

If you want to access same Console session remotely, same as original server session just use /console switch in mstsc command. For example if your server name is, myServer type the following command:

mstsc -v myServer /console