Wednesday, September 30, 2009

Using Bing API in .NET

To start using the Bing API, you will need to apply for an AppID from Microsoft. With the AppID in hand, you can have Visual Studio get the WSDL and auto-generate .NET classes for your use. Follow these steps (which are for Visual Studio 2008):

1. Right-click your project references and choose Add Service Reference.
2. Click the Advanced button.
3. Click Add Web Reference.
4. Enter http://api.bing.net/search.wsdl?AppID=YourAppId&Version=2.2 for the URL. Make sure to put your correct AppID in there.
5. Change the reference name if you want; I left it as-is.
6. Click Go and, when the process completes, click Add Web Reference.

If you prefer, you can use XML or JSON to access Bing, although the SOAP interface makes the most sense for the majority of .NET apps, thanks to Visual Studio’s integration with SOAP services.

You’re ready to get to work. To start using the newly created references, add the appropriate using (for C# folks) or Imports (for VB.NET) statement to your code that needs to use Bing. The full name is your default namespace for the project, plus the service reference. In this case, my project’s namespace is TestProject, so this is my line to bring it in:

using TestProject.net.live.search.api;

I’ll show you how to create a basic request for Web results; however, you should know that Bing is capable of providing various kinds of results, including videos, images, and phonebooks, and you can have a search request look for multiple types at the same time. I will leave it as an exercise for you to try the other search types out there.

All search requests share some basic required parameters and offer additional parameters of their own. The required parameters are:

* AppID (string): The AppID you were issued.
* Query (string): The query you want to run; this is identical to what you would enter at the Bing site to perform a search.
* Sources (Sources[]): An array of Sources (an enumeration in the namespace) indicating what type(s) of search to perform.

This is a simple method that takes a query and performs a search:

private void Lookup(string Query)
{
using (var service = new LiveSearchService())
{
try
{
var request = new SearchRequest();

// Common request fields (required)
request.AppId = "BingAppID";
request.Query = Query;
request.Sources = new SourceType[] { SourceType.Web };
var response = service.Search(request);

if (response.Web.Results == null)
{
return;
}
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Swallow exceptions for the time being
}
catch (System.Net.WebException ex)
{
// Swallow exceptions for the time being
}
}
}

Attribution: This is a greatly stripped down, modified version of the sample code in the Bing documentation. This is all you need to do a search.

From here, you can work with the results of the query. I found LINQ to be a great way to work with the results. In my application, I created a Results class that encapsulated not only the information I needed from Bing but also my post-search processing. So, I populated a List with a simple LINQ query:

results = (from result in response.Web.Results
select new Result(result.Url, result.DisplayUrl, result.Title, 0, 0, new
List())).ToList();

Some of the items populating the Result objects in the list come from the Bing results in the response object, and some of the items are just initialization values for my later processing to build on.

With this simple piece of code, you are well on your way to writing a Bing-enabled application.To start using the Bing API, you will need to apply for an AppID from Microsoft. With the AppID in hand, you can have Visual Studio get the WSDL and auto-generate .NET classes for your use. Follow these steps (which are for Visual Studio 2008):

1. Right-click your project references and choose Add Service Reference.
2. Click the Advanced button.
3. Click Add Web Reference.
4. Enter http://api.bing.net/search.wsdl?AppID=YourAppId&Version=2.2 for the URL. Make sure to put your correct AppID in there.
5. Change the reference name if you want; I left it as-is.
6. Click Go and, when the process completes, click Add Web Reference.

If you prefer, you can use XML or JSON to access Bing, although the SOAP interface makes the most sense for the majority of .NET apps, thanks to Visual Studio’s integration with SOAP services.

You’re ready to get to work. To start using the newly created references, add the appropriate using (for C# folks) or Imports (for VB.NET) statement to your code that needs to use Bing. The full name is your default namespace for the project, plus the service reference. In this case, my project’s namespace is TestProject, so this is my line to bring it in:

using TestProject.net.live.search.api;

I’ll show you how to create a basic request for Web results; however, you should know that Bing is capable of providing various kinds of results, including videos, images, and phonebooks, and you can have a search request look for multiple types at the same time. I will leave it as an exercise for you to try the other search types out there.

All search requests share some basic required parameters and offer additional parameters of their own. The required parameters are:

* AppID (string): The AppID you were issued.
* Query (string): The query you want to run; this is identical to what you would enter at the Bing site to perform a search.
* Sources (Sources[]): An array of Sources (an enumeration in the namespace) indicating what type(s) of search to perform.

This is a simple method that takes a query and performs a search:

private void Lookup(string Query)
{
using (var service = new LiveSearchService())
{
try
{
var request = new SearchRequest();

// Common request fields (required)
request.AppId = "BingAppID";
request.Query = Query;
request.Sources = new SourceType[] { SourceType.Web };
var response = service.Search(request);

if (response.Web.Results == null)
{
return;
}
}
catch (System.Web.Services.Protocols.SoapException ex)
{
// Swallow exceptions for the time being
}
catch (System.Net.WebException ex)
{
// Swallow exceptions for the time being
}
}
}

Attribution: This is a greatly stripped down, modified version of the sample code in the Bing documentation. This is all you need to do a search.

From here, you can work with the results of the query. I found LINQ to be a great way to work with the results. In my application, I created a Results class that encapsulated not only the information I needed from Bing but also my post-search processing. So, I populated a List with a simple LINQ query:

results = (from result in response.Web.Results
select new Result(result.Url, result.DisplayUrl, result.Title, 0, 0, new
List())).ToList();

Some of the items populating the Result objects in the list come from the Bing results in the response object, and some of the items are just initialization values for my later processing to build on.

With this simple piece of code, you are well on your way to writing a Bing-enabled application.

Reference from http://blogs.techrepublic.com.com/programming-and-development/?p=1713&tag=nl.e055 by Justin James
read more...

Wednesday, September 16, 2009

Scott Cole's Best Abs on Earth





read more...

Windows Vista Tips & Tricks

Some Useful tips and tricks in Windows Vista





read more...

Speed up your browsing of Windows 2000 & XP machines

Here's a great tip to speed up your browsing of Windows XP machines. Its actually a fix to a bug installed as default in Windows 2000 that scans shared files for Scheduled Tasks. And it turns out that you can experience a delay as long as 30 seconds when you try to view shared files across a network because Windows 2000 is using the extra time to search the remote computer for any Scheduled Tasks. Note that though the fix is originally intended for only those affected, Windows 2000 users will experience that the actual browsing speed of both the Internet & Windows Explorers improve significantly after applying it since it doesn't search for Scheduled Tasks anymore. Here's how :Open up the Registry and go to :
HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/Current Version/Explorer/RemoteComputer/NameSpace
Under that branch, select the key :
{D6277990-4C6A-11CF-8D87-00AA0060F5BF}
and delete it.
This is key that instructs Windows to search for Scheduled Tasks. If you like you may want to export the exact branch so that you can restore the key if necessary.
This fix is so effective that it doesn't require a reboot and you can almost immediately determine yourself how much it speeds up your browsing processes.
read more...

Monday, August 24, 2009

Tricks: Access Windows programs easily from Run Dialog

Run commands are very useful when we dont know the correct location of the windows programs. There are lot of windows programs which can be accessed directly through Run dialog. Some of them which are really useful are given below.

Run Commands
appwiz.cpl — Used to run Add/Remove wizard
Calc –Calculator
Cfgwiz32 –ISDN Configuration Wizard
Charmap –Character Map
Chkdisk –Repair damaged files
Cleanmgr –Cleans up hard drives
Clipbrd –Windows Clipboard viewer
Control –Displays Control Panel
Cmd –Opens a new Command Window
Control mouse –Used to control mouse properties
Dcomcnfg –DCOM user security
Debug –Assembly language programming tool
Defrag –Defragmentation tool
Drwatson –Records programs crash & snapshots
Dxdiag –DirectX Diagnostic Utility
Explorer–Windows Explorer
Fontview –Graphical font viewer
Fsmgmt.msc — Used to open shared folders
Firewall.cpl — Used to configure windows firewall
Ftp -ftp.exe program
Hostname –Returns Computer’s name
Hdwwiz.cpl — Used to run Add Hardware wizard

iexpress- tool for creating self extracting/ self installing package
Ipconfig –Displays IP configuration for all network adapters
Logoff — Used to logoff the computer
MMC –Microsoft Management Console
Msconfig –Configuration to edit startup files
Mstsc — Used to access remote desktop
Mrc — Malicious Software Removal Tool
Msinfo32 –Microsoft System Information Utility
Nbtstat –Displays stats and current connections using NetBIOS over TCP/IP
Netstat –Displays all active network connections
Nslookup–Returns your local DNS server
Osk —Used to access on screen keyboard
Perfmon.msc — Used to configure the performance of Monitor.
Ping –Sends data to a specified host/IP
Powercfg.cpl — Used to configure power option

Rasphone - Remote Access phonebook
Regedit –Registry Editor
Regwiz — Registration wizard
Sfc /scannow — System File Checker
Sndrec32 –Sound Recorder
Shutdown — Used to shutdown the windows
Spider — Used to open spider solitaire card game
Sfc / scannow — Used to run system file checker utility.
Sndvol32 –Volume control for soundcard
Sysedit — Edit system startup files
Taskmgr –Task manager
Telephon.cpl — Used to configure modem options.
Telnet –Telnet program
Tracert –Traces and displays all paths required to reach an internet host
Winchat — Used to chat with Microsoft
Wmplayer — Used to run Windows Media player
Wab — Used to open Windows address Book.
WinWord — Used to open Microsoft word
Winipcfg –Displays IP configuration
Winver — Used to check Windows Version
Wupdmgr –Takes you to Microsoft Windows Update
Write — Used to open WordPad
read more...

Thursday, August 13, 2009

Tip to Shutdown a computer connected in a network

Windows XP has a built-in feature (shutdown tools) that is used to shutdown any connected computers from any one computer. Using this feature, you can log off, restart and shutdown any computer in your network. This tip is very useful for you, if you are a Network Administrator at your company, because if you have experience to shutdown all connected computers daily in your local area network one by one, definitely that job is annoying responsibility for you.

Follow the given steps to configure shutdown tool on your computer:

To use this feature, you will need to be logged into your computer with administrative rights.

To perform this task, first make sure your both computers are directly connected or connected to network.

Click Start button then type shutdown -i in Run option then press Enter for next.

A small windows dialog box will appear with the title “Remote Shutdown Dialog”.

Here first click on “Add” button to add computer, a small Add computers window will open, here type the name or IP address of the computer (you can add many computer for same action) that you want to turned off, then press OK for next.

Now select the action “What do you want these computers to do (log off, restart or shutdown)”. If you want to warn your users about this action, select the check box “Warn users of the action” then set time, display warning for 30 seconds or more.

Now when you press the OK button, the users will see a “System Shutdown Windows “with time and comments that you had

Reference from : http://itzone.lovebeats.org/archives/204

read more...

Most Common IM Chat Acronyms and Emoticons

Looking for common chat acronyms, smileys and emoticons? Micro-blogging and text messaging are the hottest trends now a days with the up come of websites like Twitter, Facebook, etc., which allows you to post short messages limited in number of characters. To make the most of the available characters, using short forms of words, acronyms and emoticons is a brilliant idea and most of the people use these short forms in chatting and IM's.

While you are chatting online using an instant messenger or via SMS you need to work out your fingers really fast on the keyboard to keep up with the chat. By using short forms and symbols this task is really easy but most of the users do not know the meaning or which short forms to use. Online gamers also use these short forms to stay in contact with their friends.
SMS & Chat: Acronyms, Smileys, Emoticons

Herein are the most used short forms and symbols in chatting.
Starting with the numbers:
121 - One-to-one
143 - I love you
2G2BT - Too good to be true
2MI - Too much information
2NTE - Tonight
4 - for
9 - Parent is watching

Special characters
? - I have a question/ I don't understand what you mean
?4U - I have a question for you
;S - Gentle warning, like Hmm? what did you say?
^^ - Meaning read line or message above
^5 - high five
<3>:-( - angry
:-O - shouting, or shocked
;-P - sticking tongue out
:-( - sad

Short Forms / Acronyms
A3 - Anytime, anywhere, anyplace
AA - As above
AAP - Always a pleasure
ACK - Acknowledge
ACPT - Accept
AND - any day now
AFK - Away from keyboard
AH - At home
ASAP - As Soon As Possible
ASL - Age/Sex/Location
AT - At your terminal
B - Back
B2W - Back to work
B4 - before
BBL - be back later
BF - boyfriend or best friend
BFN - bye for now
BTW - by the way
BDAY - Birthday
BOL - Best of luck
BRB - Be right back
CAM - Camera
CM - Call me
CSL - Can't stop laughing
CU - See you
DH - Dear
D/L - Download
DM - Direct message
DUR - Do you remember?
E1 - Everyone
EMA - E-mail address
EZ - Easy
F2F - Face to face
FW - Forward
G - Grin, Giggle
GN - Good night
HF - Have fun
HRU - How are you?
I2 - I too (me too)
IB - I'm back
IC - I see
IK - I know
ILY - I love you
IM - Instant message
IMS - I am sorry
JW - Just wondering
JK - Just Kidding
KB - Keyboard
L2G - Like to go?
LOL - Laughing out loud
LOTI - Laughing on the inside
LVM - Left voice mail
N1 - Nice one
NE1 - Anyone
NT - Nice try
NVM - Never mind
NVR - Never
OOH - Out of here
PCM - Please call me
PIC - Picture
PLS or PLZ - Please
PM - Private Message
POS - Parent over shoulder
PZA - Pizza
RU - Are you?
RX - Regards
S2S - Sorry to say
SC - Stay cool
SH^ - Shut up
SIT - Stay in touch
SOS - Meaning help
SS - So sorry
STW - Search the Web
SUP - What's up?
SYS - See you soon
THX - Thanks
TY - Thank you
U - You
UL - Upload
UNA - Use no acronyms
UR - Your / you're
VIP - Very important person
VRY - Very
W@ - What?
W3 - WWW
WAS - Wait a second
W/B - Write back
WB - Welcome back
WC - Welcome, Who cares
WKD - Weekend
WU - What's up?
WUF - Where are you from?
XD - really hard laugh
XLNT - Excellent
Y? - Why?
YR - Yeah right
YW - You're welcome
Z - Zero
ZUP - What's up?
read more...

Tip: Maintaining Scroll Position of TreeView via Ajax

Update Panel will solve the problem of maintaining the scroll position of treeview in a div

Place the treeview inside and update Panel. The sample structure is as follows.


<div id="TreeDIV" runat="server" style="overflow:auto">
<asp:UpdatePanel ID="PnlTree" ChildrenAsTriggers="true" runat="server">
<ContentTemplate>
<fieldset>
<asp:TreeView ID="Treeview1"
runat="server"
SelectedNodeStyle-ForeColor="White"
SelectedNodeStyle-BackColor="Navy"
OnSelectedNodeChanged="Treeview1_SelectedNodeChanged">
<Nodes>
<%-- Dynamically constructing the treeview from code behind --%>
</Nodes>
</asp:TreeView>
</fieldset>
</ContentTemplate>
</asp:UpdatePanel>
</div>

read more...

Start/Stop ASP.NET 2.0 AJAX 1.0 Timer control using javascript

There is a way to start/stop ASP.NET 2.0 AJAX 1.0 Timer control from client side.

There are 2 methods _startTimer() and _stopTimer() which is not documented anywhere.

Here is the sample javascript functions on how to use these 2 methods:

function startTimer()
{
var timer = $find("<%=ajaxTimer.ClientID%>")
timer._startTimer();
}
function stopTimer()
{
var timer = $find("<%=ajaxTimer.ClientID%>")
timer._stopTimer();
}

where ajaxTimer is the Timer control.
read more...

Tip to Validate MaxLength property of Textbox when Textmode is set to Multiline

This is known issue in ASP.NET Standard Text box control when set its TextMode="MultiLine" the MaxLength property does not work.


There is a workaround to accomplish this using RegularExpressionValidator. Following is the markup that will restrict the text box to maximum of 100 characters.


<asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine" Height="100px"
Width="320px" MaxLength="10"> </asp:TextBox>

<asp:RegularExpressionValidator ID="Address" runat="server" ControlToValidate="txtAddress" ValidationExpression="^[\s\S]{0,100}$" ErrorMessage="Maximum 100 characters are allowed in Address box." Text="Maximum 100 characters are allowed in Address box." > </asp:RegularExpressionValidator >
read more...

Sunday, August 9, 2009

To Open Multiple Google talk and Yahoo instance

Tip to Open Multiple Google talk instance in same computer

Right Click the Google Talk Shortcut

Select Properties

In Target

add /nomutex as last word, as shown below

"C:\Program Files\Google\Google Talk\googletalk.exe" /nomutex

----------------------------------------------------------------------------------------------
Tip to Open Multiple Yahoo Messenger instance in same computer

Go to START->RUN-> Type ‘regedit’ and press ENTER.

Then navigate to ‘HKEY_CURRENT_USER\Software\Yahoo\Pager\Test’

Now in the right pane right click New->DOWRD Value. Name it as ‘Plural’.

Now Double click the the Plural DWORD you created & set the value to 1
read more...

Thursday, August 6, 2009

Tips & Tricks For DJs

An expert explaining the tips & tricks to become a professional DJ

read more...

SQL Tip: Custom Paging from T-SQL

In ASP.NET programming it is a big problem when we will have to show lots of data . for eg. when we want customer list or users list.. etc. Usually we display the list in normal gridview and use gridview's default paging feature.

But what it actually does is that it loads all the data in the page and then does the paging even though we are not seeing the whole no of rows at a time. There are a lot of possible ways to do custom paging. One of the simplest and effective way of doing custom paging is from SQL itself, so that it fetches only the required no of rows from database . The below procedure helps us to achieve Custom paging.

Procedure
Create Procedure Paging
@PageSize int,
@PageNo int
As
Begin

Declare @sql varchar(200)

set @sql='Select * FROM (SELECT TOP
'+ @PageSize + ' * FROM (SELECT TOP '+ @No + ' *
FROM TableName ORDER BY ColumnName) AS t1 ORDER BY ColumnName DESC) AS t2
ORDER BY ColumnName'

exec (@
sql)
End
read more...

Snippet: Random Password Generator

A Simple Function for generating Random Password in .NET by passing length of password

Function

Private Function generatePassword(ByVal passwordLength) As String
'Declare variables
Dim sDefaultChars, sMyPassword, iPickedChar As String
Dim iCounter, iDefaultCharactersLength, iPasswordLength As Integer
'Initialize variables
sDefaultChars="abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
iPasswordLength = passwordLength
iDefaultCharactersLength = Len(sDefaultChars)
Randomize() 'initialize the random number generator
'Loop for the number of characters password is to have
For iCounter = 1 To iPasswordLength
'Next pick a number from 1 to length of character set
iPickedChar = Int((iDefaultCharactersLength * Rnd()) + 1)
'Next pick a character from the character set using the random number iPickedChar
'and Mid function
sMyPassword = sMyPassword & Mid(sDefaultChars, iPickedChar, 1)
Next
Return sMyPassword
End Function



read more...

Wednesday, August 5, 2009

Tip: Create a Glowing Text in Photoshop

1. Start with a new image and fill with your background color
2. Create a new layer and use the Type Mask toolto enter your text.


3.Use Select>>Modify>>Expand to expand the Type Mask


4.Now feather the selection Select>>Feather, I used 4 for the example.
5.Fill the sellection with whatever color you want to be the glow.


6.Now that you have your glow use the Type tool in Layers mode and enter your text again using any color.



Reference from Jeff's Photoshop Tips & Tricks
read more...

Tip: Creating a 3D Button in Photoshop

You can easily create a 3D button by following the steps given below

1. Create a new file, 100x100 pixels.
2. Use the selection tool, make a square.
3. Choose a dark foreground color and a light background color.
4. With the gradient tool set on Linear.
5. Click on the top-left corner and drag to bottom-right.


6. Click SELECT>MODIFY>CONTRACT, and enter "6".


7. Reselect the gradient tool.
8. Click bottom-right to top-left to draw gradient.


9. Once again click SELECT>MODIFY>CONTRACT, and enter "3".

10. Click on SELECT>FEATHER and enter "2".


11. With the gradient tool click top-left and drag to bottom-right.


12. There you have it. an easy to create button.

Reference from Jeff's Photoshop Tips & Tricks
read more...

Tuesday, August 4, 2009

Tips and Tricks :Visual Studio .Net IDE

A collection of tips and tricks, features, for the Visual Studio .NET IDE.

Read from the book Best Kept Secrets in Dot NET from the APress publishing house.

1. Multiple copy/pastes

Ctrl+Shift+V cycles through the clipboard ring. You can copy/cut multiple times from one area of code, then go to another area and paste them one after another.

2. Previous cursor positions

Ctrl+ - i.e. Ctrl + Hyphen. This cycles you through the code positions you visited.

Ctrl+Shift+- to navigate in the opposite direction.

3. Incremental search

To incrementally search for text as you type, first press Ctrl+i. Then type the word you want to search. Hit backspace to clear a character and enter to finish. Pressing F3 after this will work as usual, i.e. search for the next occurrence of previous search.Ctrl+Shift+i is used for Reverse Incremental Search.

4. Matching brace/comment/region/quote

Ctrl+] takes you to the matching brace. It also takes you to the matching comment, region or quote depending on what is at the cursor now.

5. Vertical block selection

Press Alt and then select the area you want with your mouse.this is very useful when you have to delete line numbers or some common unwanted text in all the lines,like for eg. Using a WITH block and removing the object name from multiple lines of the code.

6. Closing/Showing support windows

There are a bunch of necessary/useful windows in the Visual Studio IDE like Properties (F4), Solution Explorer (Ctrl+Alt+L), Output Window (Ctrl+Alt+O), Task List (Ctrl+Alt+K) etc. However, they take up a lot of space. An easy way around this is to use the auto hide feature.

Open the window you want. Right click on its title and choose Auto Hide. The window will dock in whenever your mouse is not hovering over it.

7. Track things you have to do with Task List

The Task List window (Ctrl+Alt+K) allows you to keep track of the things you have to do. Right click on the Task List window and choose Show Tasks|All to see a list of tasks. Ctrl+Shift+F12 to cycle through your list of tasks.

By default, comments marked with a TODO will appear in the task list.

8. Edit Task List Comment Tokens

You can add your own set of comment tokens (like the TODO comment token). Goto Tools|Options|Environment|Task List|Comment Tokens and make your changes. You can change the priority appearance of each comment token too.

9. Add Task List Shortcut

Add a shortcut to the task list with Ctrl+K, Ctrl+H. This will add the current line to the task list.

10. Auto-complete (Almost everyone knows this one)

Press Ctrl+Space or Alt+RightArrow to auto-complete the word. Intellisense suggestions may pop up a window if there is more than one possibility.

11. Intellisense suggestions window

Press Ctrl+Shift+Space to bring up the intellisense suggestions window. When giving parameters for functions, I often need to escape the suggestions window to check another part of code. To bring it back, I used to delete a comma and then type it again; but this is easier.

12. Line numbering

Tools|Options|Text Editor|All Languages|General|Line numbers.

If you want to set this option for only one language, then choose the appropriate language instead of All Languages.

13. Bookmarks

Bookmarks are available through Edit|Bookmarks. Bookmarks allow you to mark places in your code that you would want to come back to.

  • Create/Remove Bookmark – Ctrl+K, Ctrl+K
  • Move to next bookmark – Ctrl+K, Ctrl+N
  • Move to previous bookmark – Ctrl+K, Ctrl+P
  • Clear all bookmarks – Ctrl+K, Ctrl+L

14. Code Formatting

  • Auto-format selection – Ctrl+K, Ctrl+F
  • Convert to lower case – Ctrl+U
  • Convert to upper case – Ctrl+Shift+U
  • Comment selection – Ctrl+K, Ctrl+C
  • Uncomment selection – Ctrl+K, Ctrl+U

15. Outlining

I like this feature that allows me to hide code that is irrelevant to what I’m currently working on.

  • Fold/Unfold the current code block – Ctrl+M, Ctrl+M
  • Unfold all – Ctrl+M, Ctrl+L
  • Stop outlining – Ctrl+M, Ctrl+P
  • Fold all – Ctrl+M, Ctrl+O

16. Build and Debug

  • Build – Ctrl+Shift+B
  • Run – Ctrl+F5
  • Debug – F5

17. Wrapping Code

If you have long code lines, you’ll find that you do a lot of horizontal scrolling to view the entire line. As an alternative, you can wrap the code lines so you can view the code without needing to scroll.The easiest way to toggle word wrapping is by pressing Ctrl+R and then Ctrl+R again or by selecting Edit –> Advanced –> Word Wrap from the menu. When word wrapping is turned on, the horizontal scroll bar is removed and any lines of code that exceed the width of the code window will automatically wrap to the next line. This wrapping does not require any additional line-continuation characters (for VB), nor does it affect how the code is compiled
read more...

Monday, August 3, 2009

Google Searching Tricks

This video shows various quick tricks on how to utilize Google to the fullest. There are many search features that can enhance your experience online.
Use Google as your:
- Online Dictionary with define:word
- calculator for formulas and conversions
- World Time
- Local Movie Showtimes
- Search for Music files using:
-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "title here"


read more...

Tips for Playing Pool


Leah D'Emilio becomes a hustler for a day: a pool player, that is! Leah takes a lesson on how to play pool with 3-time national champion Max Eberle. From how to pick the right cue to the various forms of hand bridges, Max takes us through some helpful hints as well as how to pull off a few trick shots.


read more...

Some Very Useful Windows Xp Hidden Programs List

There are so many functionality in xp such that microsoft does not require to put some functionality into the start menu or place any shortcut anywhere. it is not that they are not useful, they are useful but are used mostly by computer professional for troubleshooting because a normal user may damage system by using it(low knowledge).
they can be run by typing into the run(win +r).

Some Hidden Programs:-

1)Character Map
Type "charmap"
used for finding unusual characters.

2)Dr Watson
Type "drwtsn32"
It is a debugger used for Troubleshooting purpose.

3)Private character editor
Type "eudcedit"
It is used for creation and modification of characters.

4)Disk Cleanup
Type "cleanmgr"
It is used for getting free space by removing unused file.

5)Clipboard Viewer
Type "clipbrd"
Used to view data present on the clip board.

6)Group Editor
Type "gpedit.msc"
used to manage group policies, and permissions

7)System configuration
Type "msconfig"
Used to see and change the start up program(System programs + Application program).

8)Registry Editor
Type "regedit"
Used to change and see the settings of System application as well as Software application.

9)System Monitor
Type "perfmon"
Very important tool for knowing anything i.e., every type of resources whether it is software or hardware.

10)Network shared folder wizard
Type "shrpubw"
Used for creating shared folder over the network(workgroup/Lan).

11)File siganture verification tool
Type "sigverif"
Used to maintain the integrity of your system It will detect if any of the critical file is changed.
for example delete or rename your logoff.exe file in system32 folder it will automatically changed it back.

12) Microsoft Telnet Client
Type "telnet"
Used to connect any remote computer for file sharing.

13)Driver Verifier Manager
Type "verifier"
Used to monitor your drivers it is useful if any of the driver is creating problem.

14)Windows for Workgroups Chat
Type "winchat"
Used to chat over the workgroup/lan.

15)Check Disk Utility
Type "chkdsk :" //command line
Used to check any disk error on drives.

16)Computer Management
Type "compmgmt.msc"
it is the most important application as for as computer administrator is concerned because this contain all the feature that a computer expert need for troubleshooting.
read more...

Trick for Hiding your Entire partition or drive

Diskpart is windows inbuilt program utility, it lets us do many things like making any partition active, changing/assigning drive letter, creating MBR(master boot recorder), extend any volume, create a volume or partition, making any disk online etc. but here i m only telling you about how to hide your drive and also changing drive letter.

Steps:-

  1. First press "win+r" or go to run and type diskpart here and hit enter.
  2. Now type "list volume" to see volume available in here and "list disk" to see disk available in here(see the figure).
  3. Now to hide lets suppose my drive d first type "select volume 2" [for selecting my d drive for processing].
  4. Since we have selected my drive d so now type "remove letter d" for hiding it.
  5. Now once you have done last step your drive will not be seen in my computer[Some times it is required to reboot your system].
  6. Now to give your hidden drive some letter so that it will appear again first type "select volume 2"[my drive d].
  7. Then type "assign letter d" [you can assign any letter except letters assign already].
  8. exit[your drive will appear again].
read more...

How to Speed Up Slow Torrent in Utorrent/Bitorrent

There are some Setting in torrent Client that you need to change to Increase your download Speed. Some of the setting(with value) are listed below.
  • Torrent Download and upload Speed:-
    1. Go to Options>Preferences in your utorrent Client.
    2. Click Bandwidth option as shown below.

      Utorrent preference window setting
    3. Here put zero for both max. upload rate and max. download rate.

  • Port:-
    1. Go to connection option from the same window as shown above.

      change port on utorrent using connection in preference
    2. Press random Port option as shown above to change your port.

      Note:-The concept behind changing port is that sometimes your isp may block your some ports(active torrents port) so it is good to change your port at regular interval.

  • Increase TCP Connection:-
    1. Download patch from here.
    2. Open this file in cmd(open cmd and then run it from there).

      NOTE:-

      1. This will increase the limit of no. of connection that you can make. this is for windows xp sp2.
      2. This setting require restart of computer so restart your computer after you have applied all the these settings.

  • Increase Tracker(Most Effective):-
    1. First, download Tracker list from here.
    2. Now Go to property of the torrent having slow download speed(right click the torrent in utorrent).

      property window on utorrent file for increasing trackers
    3. Now in the box highlighted above past content of file just downloaded.
    4. Make sure "Enable DHT" and "Peer Exchange" and "Local peer Discovery" are checked.
    5. Press OK.

      NOTE:-make sure you do not include more than 10 tracker for a single torrent.

  • Make Continues Connection with Internet
    1. Make a Batch file(bat extension) with Ping to 192.168.1.1(router/modem) address with unlimited time
      OR
      Download file from here. and then change extension from mp3 to bat.
    2. Start this file whenever you starts your torrent application.

      NOTE:-I have realized that whenever i excess my intenet my torrent download speed remain up but once i go somewhere else or go for sleep speed goes down.
      therefore i made this or use this cmd command to make my torrent client realize that i m working. i can't explain why this is happening but this is working very well on my PC

  • Tips:-
    1. Right click torrent in utorrent and press Update Tracker.
    2. Press Force download on torrent required first.
    3. Right click torrent required first then go to Bandwidth allocation>high.
read more...

Loose weight of ASP.NET pages!!

If we don’t take care about how we feed our ASP .net pages… we will find that they will tend rapidly to gain too much weight, this can provide us a lot of headaches like:


  • Things go dam slow when moving into production (everything in localhost was running so smoothly…).

  • If you are using Partial Rendering (AJAX), your pages can become “not usable”, final users complaining about this.

  • Your server will have a hard time generating huge pages (I have seen ASP .net with a weight of 1 Mb or even 2 Mb.).

  • You can even flood your intranet network.

Does your web site generates pages that are over 100 K’s… even over 500 K’s… even over 1Mb… oh oh, you are in a trouble, We are going to do:


  • A fast action plan: just performing some small changes we can reduce the size of our page in-between the following range: 5% - 30 % (depends on the content that you are showing).

  • Other measures to reduce the size of the page, they require more work from your side but you can get quite good improvements.

First of all… How can I measure the weight of my page or partials posts? Download Fiddler, it’s a free sniffer that will let you check the size of your site requests / responses.

Ok, now we have the weighing machine, let’s start with the Action Plan:


  • Compilation: a thing that sometimes we forget and can make us add garbage in our pages; before compiling and deploying ensure that this setting is set to false (*):
                      
    <system.web>
    <compilation debug="false">

    (*) In your development environment you will need this set to true in order to debug.

  • Blank Spaces: in your development environment source code (ASPX) is indented using blank spaces, tabs… Do you really need that in your production environment? Just give a try, deploy your project and over that deployed pages (not your original source code) remove all the unnecessary blanks spaces on the left side… in some cases I have seen even an 20/ 30 % rate of improvement , and… if you even need to debug or edit a production web page, just when you open it with Visual Studio you will get it automatically reformatted(**). If you think this is not useful, just imagine a huge GridView with a lot of TR / TD… you really can save a loooot of weight there.

    (**) A good idea is to make a console application to trim spaces (give a folder, traverse subfolders and remove spaces on aspx, ascx…).

  • Master page: This one is lovely… find your contentplaceholder and change the id to one that is not more than two letters lenght… this can save you a lot of space, take into consideration this ID is repeated on every single control under it as a prefix(***).
                          
    <asp:ContentPlaceHolder runat="server" ID="phSidebar">

    Change it to:
                      
    <asp:ContentPlaceHolder runat="server" ID="sd">

    (***) You will have to perform a find/replace on all the old Id’s in the child pages (well and ensure that nobody had the bad idea of hardcode this ID’s in javascript instead of using CLIENTID).

  • Styles: If you are applying styles to GridViews and you are showing a big bunch of rows en sure that you apply them via CSS styles and using short names (every style definition is repeated on every single row / cell).

Now it’s time to upload your site and check with Fiddler the weight difference with your old pages.

Not good enough? Let’s go for plan B (a bit more of work, a bit more of performance):


  • ViewState:Remove the viewstate in your GridView (if possible in your whole page). ASP .net 2.0 incorporates ControlState, this makes easier to remove the viewstate on server controls (e.g. on a readonly GridView , if you remove the ViewState you will be still able to sort and perform paging). Take care with this, test well the controls where you remove the viewstate.

  • DOM: If some of the markup that you are going to show doesn’t need to be posted, just generating them on the client side via javascript.

  • Nonsense listboxes / combo's:Try to avoid having listboxes or other similar controls that hold more than 80 entries, this reduce the usability of the page and increases the weight, you can change it to an AJAX autocomplete extender, … if your client doesn’t approve that just try to generate the items via webservices + javascript.

read more...

Insert row in a gridview from the client side without postback

Step 1: Register your Web service

First you have to register your Web service to use it in your page:

<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="./ContactService.asmx" />
</Services>

</asp:ScriptManager>


Step 2: Create header and the row to insert

Secondly, you have to create the header and insert row. Note that the link buttons save and cancel, call client methods and return false to interrupt the post back.

<%--Header--%>
<div style="width: 500px" class="HeaderStyle">
<div style="width: 200px; float: left;">

First Name
</div>
<div style="width: 200px; float: left;">
Last Name
</div>
<div style="width: 100px; float: left;">
Command
</div>

</div>
<%--Row to insert--%>
<div runat="server" id="divInsert" style="display: none">
<div style="width: 200px; float: left;">
<asp:TextBox runat="server" ID="txtFirstName" Width="180"></asp:TextBox>
</div>
<div style="width: 200px; float: left;">

<asp:TextBox runat="server" ID="txtLastName" Width="180"></asp:TextBox>
</div>
<div style="width: 100px; float: left;">
<asp:LinkButton runat="server" ID="lnkSave"
OnClientClick="Save();return false;"
Text="Save"></asp:LinkButton>
<asp:LinkButton runat="server" ID="lnkCancel"
OnClientClick="Cancel();return false;"
Text="Cancel"></asp:LinkButton>

</div>
</div>

Step 3: Create the grid view

To accomplish this task I use an external component named AjaxDataControls

The Ajax Data Controls is a DotNetSlackers project. Developed on top of Asp.net Ajax Extension, the main goal of this project is to provide rich set of data controls for Client Centric Development Model. Since the data controls of Asp.net like GridView, DataList, Repeater etc does not have any Client Side Object Model thus it is not possible to work with these controls with Web Service / Page Methods call.

  1. Add the reference to AjaxDataControls.dll
  2. Register the control:

If you want to do that in the page:

<%@ Register Assembly="AjaxDataControls" Namespace="AjaxDataControls"
TagPrefix="AjaxData" %>

You can also do that in the Web.Config:

<add tagPrefix="AjaxData" namespace="AjaxDataControls" assembly="AjaxDataControls"/> 

Add the following code to create the gridview:

<div style="clear: both; width: 500px;">
<ajaxdata:gridview id="grvContacts" runat="server"
cssclass="DataWebControlStyle" cellspacing="0" cellpadding="3">
<AlternatingRowStyle CssClass="AlternatingRowStyle" />
<RowStyle CssClass="RowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EmptyDataTemplate>
There is no records available.
</EmptyDataTemplate>
<EmptyDataRowStyle HorizontalAlign="Center" />
<Columns>
<AjaxData:GridViewBoundColumn DataField="FirstName" ItemStyle-Width="200" />
<AjaxData:GridViewBoundColumn DataField="LastName" HeaderStyle-Width="200" />
<AjaxData:GridViewBoundColumn HeaderStyle-Width="100" />
</Columns>
</ajaxdata:gridview>

</div>

Step 4: Add the javascript event

On page load, you bind the grid. When you click the save button you call the web service insert method and onSaveSuccess you bind the grid again.

<script type="text/javascript">

function pageLoad(sender, e) {
TestGridView.ContactService.GetContacts(onLoadSuccess);
}

function onLoadSuccess(result) {
var gridView = $find('<%= grvContacts.ClientID %>');
gridView.set_dataSource(result);
gridView.dataBind();
}

function Add() {
$get("<%= divInsert.ClientID %>").style.display = 'block';
}

function Save() {
TestGridView.ContactService.InsertContact(
$get("<%= txtFirstName.ClientID %>").value,
$get("<%= txtLastName.ClientID %>").value,onSaveSuccess);
}

function Cancel() {
$get("<%= txtFirstName.ClientID %>").value = '';
$get("<%= txtLastName.ClientID %>").value = '';
$get("<%= divInsert.ClientID %>").style.display = 'none';
}

function onSaveSuccess(result) {
$get("<%= txtFirstName.ClientID %>").value = '';
$get("<%= txtLastName.ClientID %>").value = '';
TestGridView.ContactService.GetContacts(onLoadSuccess);
$get("<%= divInsert.ClientID %>").style.display = 'none';
}


</script>

Web Service for this example

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class ContactService : System.Web.Services.WebService
{
[WebMethod]
public List<Contact> GetContacts()
{
ContactBAL contactBAL = new ContactBAL();
return contactBAL.GetContacts();
}

[WebMethod]
public void InsertContact(string firstName, string lastName)
{
ContactBAL contactBAL = new ContactBAL();
Contact contact = new Contact();
contact.FirstName = firstName;
contact.LastName = lastName;
contactBAL.InsertContact(contact);
}
}


read more...

Parse/Get QueryString with Client-Side JavaScript

Nearly all server-side programming languages have built-in functions to retrieve querystring values of a URL. In web browsers you can access the querystring with client-side JavaScript, but there is no standard way to parse out the name/value pairs. So here is a function to return a parameter you specify. The following javascript code snippet facilitates Javascript's built in regular expressions to retrieve value of the key. Optionally, you can specify a default value to return when key does not exist.

function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}

The getQuerystring function is simple to use. Let's say you have the following URL:

http://www.asp.net.com?author=microsoft

and you want to get the "author" querystring's value:

var author_value = getQuerystring('author');

If you execute code shown in the above line, the author_value will be "microsoft". The query string is parsed by the regular expression and the value of the author_value parameter is retrieved. The function is smart in a couple of ways. For example, if you have an anchor in your URL like our example URL above does (#top) the getQuerystring() function knows to stop before the # character. Also, if a requested parameter doesn't exist in the query string and the default value is not specified as a function parameter then an empty string is returned instead of a null.
read more...

Tips to Improve Your Web Site Performance

There are two types of performance:

  • Server Performance
  • Perceived Performance

Server Performance is associated with the number requests that a server can handle at a time and the time needed to process these requests. On high volume websites, since it determines the number of users a machine can serve before additional server is needed, this performance aspect is very important.

Perceived Performance is the speed of websites in visitors’ perspective. Even if the server performance is high, a site may appear slow to a visitor because of slow client-side performance.

This article focuses perceived performance tuning by supplying reasons for poor client-side performance and details out how we can achieve better client-side performance.

#1. Make Fewer HTTP Requests

A dedicated team focused on quantifying and improving the performance of Yahoo! Products worldwide conducted experiments to learn more about optimizing web page performance. They discovered that popular sites spend between 5% and 38% of the time downloading the HTML document. The other 62% to 95% of the time is spent making HTTP requests to get components in the HTML document.


Each bar represents a specific component requested by the browser - Only 10% of 2.4 seconds is spent for downloading the html of Yahoo.com

Since browsers only are able to download two components on parallel per hostname, and every HTTP request has an average round-trip latency of 0.2 seconds, that causes a 2 second latency alone, if the site is loading 20 items, regardless of whether they are style sheets, images or scripts. (on an average broadband connection with a browser capable of downloading two components at a time).

Since browsers spend approximately 80% of t he tim e fetching external components such as scripts, style sheets and images. Reducing the number of HTTP requests has the biggest impact on improving website performance. Moreover, it is the easiest way to make a performance improvement.

#2. Enforce Caching

If you examine the preferences dialog of any modern

Web browser (like Internet Explorer, Safari or Mozilla), you’ll probably notice a cache setting. This lets you set a section of your computer’s ha

rd disk to store copies of web pages, images

and media for faster browsing.

This cache is especially useful when users hit the back button or click a link to see a page they’ve just looked at. Also, if navigation im ages throughout a site are the same, they’ll be served from browser's cache.

Web caching is useful for three important reasons:

  • Reduce user-perceived Web-site delays,
  • Reduce network bandwidth usage,
  • Reduce server loads.
The Yahoo! Performance Team conducted another experiment to understand the difference between an empty cache (browser requests all the components to load the page) and full cache (most of the components are found in the disk to load the page and the HTTP requests corresponding to these components are avoided).

Loading with an empty cache took 2.4 while loading with a full cache took 0.9 seconds. The full cache page view had 90% fewer HTTP requests and 83% fewer bytes to download than the empty cache page view.

#3. Use HTTP Compression

The time it takes to transfer an HTTP request and response across the network can be significantly reduced by making fewer http requests. On the other hand, the end-user's bandwidth speed, Internet service providers are beyond the control of the development team. However compression reduces response times by reducing the size of the HTTP response.

In the case of HTTP compression, a standard gzip or deflate encoding method is applied to the payload of an HTTP response, significantly compressing the resource before it is transported across the web.

HTTP Compression is implemented on the server side as module which applies gzip algorithm to responses as the server sends them out. Any text based content such as static HTML content, style sheets, JavaScript. It is usually possible to cache the static content in order to avoid repeatedly compressing the same file. On the other hand, dynamic content such as .asp, .aspx, .php files must be recompressed before served. This means that there is trade off to be considered between processor utilization and payload reduction.

If the primary goal is bandwidth savings, the strategy should be to compress all text-based output. Ideally, this should include static text files (such as HTML and CSS) and files that produce output in text media MIME types (such as ASP and ASP.NET files), as well as files that are text based but of another media type (such as external JavaScript files).

#4. Increase the Number of Parallel Requests

As I mentioned earlier, browsers are able to download two or four components on parallel per hostname. So we may increase the number of parallel downloads by using additional aliases such as images.bloggingdeveloper.com. According to the results of experiments conducted by Yahoo! Performance Team, using too many hostnames increases the amount of simultaneous HTTP requests but it will also increase the amount of DNS requests which affects the performance negatively. The Performance Team mentioned a strong balance between the number of parallel HTTP requests and required DNS requests to be performed of 2 to 4 hostnames. For higher number of hostnames, you may negatively affect the performance.

#5. Place StyleSheets into the Header

Web developers that care about performance want browser to load whatever content it has as soon as possible. This fact is especially important for pages with a lot of content and for users with slow Internet connections. When the browser loads the page progressively the header, the logo, the navigation components serve as visual feedback for the user.

When we place style sheets near the bottom part of the html, most browsers stop rendering to avoid redrawing elements of the page if their styles change.

#6. Put Scripts to the end of Document

Unlike StyleSheets, it is better to place scripts to the end of the document. Progressive rendering is blocked until all StyleSheets have been downloaded. Scripts cause progressive rendering to stop for all content below the script until it is fully loaded. Moreover, while downloading a script, browser does not start any other component downloads, even on different hostnames.

#7. Make JavaScript and CSS External

Using external files generally produces faster pages because the JavaScript and CSS files are cached by the browser. Inline JavaScript and CSS increases the HTML document size but reduces the number of HTTP requests. With cached external files, the size of the HTML is kept small without increasing the number of HTTP requests.
read more...

Apple iPhone secret phone codes

*3001#12345#* and tap Call. Enter Field Mode.

Field mode reveals many of the inner settings of your iPhone, specifically up-to-date network and cell information.
*#06# Displays your IMEI. No need to tap Call.

IMEI is the unique identifier for your cell phone hardware. Together with your SIM information it identifies you to the provider network.
*777# and tap Call. Account balance for prepaid iPhone.

*225# and tap Call. Bill Balance. (Postpaid only)

*646# and tap Call. Check minutes. (Postpaid only)

These three are pretty self explanatory.
*#21# and tap Call. Setting interrogation for call forwards.

Discover the settings for your call forwarding. You'll see whether you have voice, data, fax, sms, sync, async, packet access, and pad access call forwarding enabled or disabled.
*#30# and tap Call. Calling line presentation check.

This displays whether you have enabled or disabled the presentation of the calling line, presumably the number of the party placing the call.
*#76# and tap Call. Check whether the connected line presentation is enabled or not.

State whether the connected line presentation is enabled or disabled. Presumably similar to the calling line presentation.
*#43# and tap Call. Determine if call waiting is enabled.

Displays call waiting status for voice, data, fax, sms, sync data, async data, packet access and pad access. Each item is either enabled or disabled.
*#61# and tap Call. Check the number for unanswered calls.

Show the number for voice call forwarding when a call is unanswered. Also show the options for data, fax, sms, sync, async, packet access and pad access.
*#62# and tap Call. Check the number for call forwarding if no service is available.

Just like the previous, except for no-service rather than no-answer situations.
*#67# and tap Call. Check the number for call forwarding when the iPhone is busy.

And again, but for when the iPhone is busy.
*#33# and tap Call. Check for call control bars.

Check all the usual suspects (voice, data, fax, sms, etc) to see whether barring is enabled or disabled for outgoing.
read more...