Saturday, September 13, 2008

Code Snippets and Samples to start with WCF

Hi
Make windows communication foundation is one of the skill of your Skills set practising Code snippets @
1)WCF.netfx
2)dotnetslackers

some more i will be adding shortly......

Friday, September 5, 2008

WCF Videos..Worth Watching

Hello All,

Nice videos on WCF can be found

1)@ http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2006/09/13/8875.aspx

2)And some more interesting videos at

Pluralsight


Wednesday, August 20, 2008

WCF SlideShow

Hi create your own slide shows at http://www.slideshare.net/widgets
and find more

Tuesday, August 5, 2008

Learn with Implementation ---The WCF Videos on Channel9

1)Web Programming with WCF
You need to Install Silverlight to view this video which is readily available on the
the site

VS2008 Training Kit: Web Programming with WCF


2)You can get the Latest Video alerts from Google in you mailbox setting your search term
at http://www.google.com/alerts?hl=en&gl=

Which is the easiest and efficient way of learning new technology

Tuesday, July 22, 2008

Some Common Obstacles While Implementing WCF

1)Error:Unknown directive ServiceHost in WCF service
Solution:
Reinstall the VS2008 for fixing the error .Confliction in version 2.0.0.0 of Windows Communication Foundation (pre-release) as well as version 3.0.0.0 (rtm)causes this error

2)Sending large amount of Data with WCF service
Solution:1)WCF Message Streaming
If InsufficientMemoryException is thrown when writing to the channel
then you need to stream both request and response data from client and server
respectively..

Some more problems and solutions yet to be added.Comments are welcome from the readers

Thursday, July 17, 2008

Exporting Data From Excel to SqlServer

Following are the ways to export data from excel to sql server
1)With SQLBulkCopy
create file info.xls and create table in respective database named ExcelData
Source code as follows
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data.Common;
public partial class ExportFromExcelToSQL : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{


// Connection String to Excel Workbook

string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\excel\Info.xls;Extended Properties=Excel 8.0";


// Create Connection to Excel Workbook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand("Select ID,Data FROM [Sheet1$]", connection);


connection.Open();

// Create DbDataReader to Data Worksheet
using (DbDataReader dr = command.ExecuteReader())

{

// SQL Server Connection String
string sqlConnectionString = "Data Source=ITCUBE-4M1HVRHY; Initial Catalog=ITC;User ID=cp;Password=cp;";

// Bulk Copy to SQL Server
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "dbo.ExcelData";
bulkCopy.WriteToServer(dr);
}
}
}




}
}

2)With DTS utility of SQL

Friday, July 4, 2008

Catching Errors in Event Log in root folder

Hello All,

This function helps you write the errors to event.log
which can be called in the catch block of try and catch.

public void CatchError(Exception objErr)

{
//Exception objErr = Server.GetLastError().GetBaseException(); --This is
//to be used in application_error and Page_error events


string err = "Error Caught in try and catch block \n" +
"Error in: " + Request.Url.ToString() +
"\nError Message:" + objErr.Message.ToString() +
"\nStack Trace:" + objErr.StackTrace.ToString() ;
err = err + System.DateTime.Today.ToString() +" " + txtPhoneNumber.Text +"\n";



// EventLog.WriteEntry("SAWeb", err, EventLogEntryType.Error); This s //to be used while writing to event log
//Server.ClearError();
// additional actions...
// TextWriter tw = new StreamWriter("C:/Inetpub/wwwroot/SAWeb/logs/error.log",true);

TextWriter tw = new StreamWriter(Request.PhysicalApplicationPath.ToString() + "logs\\error.log", true);
// write a line of text to the file
tw.WriteLine(err);

// close the stream
tw.Close();



}

Friday, June 20, 2008

Helpful Tips...Online...

Folder Lock without any S/W
Here you go with an alternative way to lock folders without the use of any alternative software

Open Notepad and copy the below code and save as locker.bat. Don't forget to change your password in the code it's shown the place where to type your password.
Now double click on locker .bat
First time start it will create folder with Locker automatically for u. After creation of the Locker folder, place the contents u want to lock inside the Locker Folder and run locker.bat again. To release the lock again run locker.bat. It prompts to enter your password. On entering the correct password we can unlock the folder.

I hope this comes in handy J

**********************************************************
cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==type your password here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End

2)Share Folders and Files online
1)Scribd.com
2)esnips

Thursday, May 15, 2008

Frequently needed source Code for WebApplications

In this post I am going to enlist the sources for generalise asp.net web applications
1)Spellcheck for Web
Its a very easy way to integrate the spellchecker with less efforts
step I Download the required files
Extract and copy
webdir.wsf ,bin ,dic ,doc ,lib, src, web.config files and folders to root folder
step II Just include the js file spell.js
step III Call the function checkSpelling() on button click


2)Hidden control to get javascript variable value at server side

Thursday, May 8, 2008

Hands-On articles by MVPs

1)Articles by Bilal Haider on aspalliance
2)Some Practicals using Ajax
3)Matt Bersett's excellent Articles
4)Learn In asynchronus Way
....Some more yet to be added

Convering SQL resultset to XML file

Hello All,
Here's the simplest way to convert SQL result to XML output
-- declare an XML variable
DECLARE @x XML
SET @x = ''

-- create another XML variable
DECLARE @t XML
SELECT @t = ( SELECT TOP 3 name FROM sys.tables FOR XML AUTO)

-- insert the second XML variable to the first one
SET @x.modify( '
insert sql:variable("@t")
as last into (/Root)[1] ' )

-- Let us check the results
SELECT @x

/*





*/

Monday, May 5, 2008

Adding Attributes to Server Controls

Hi
If you dont find the required property of a partcular control like Linkbutton
Add the attributes to this control as follows
lnkButton.Attributes.Add("Target", "frame");
Basicaly when linkbutton is rendered at client side ,its in form of anchor control
so All server controls are have the attributes of corresponding html controls
in above case linkbutton have attributes of anchor control.
If you have additional comments on this .please post your most valuable comments
thanxs

Tuesday, March 18, 2008

Technology Geeks

Useful computer Geeks









Auto email on commit in CVS





Geeks by hosam kamel -A must Read
Geeks by Ryan Ternier -A must Read
Some more geeks.. Yet to be Added












Sunday, February 24, 2008

Cool Stuff for Developers

1)For code search
1)For Studies
http://www.google.com/codesearch?hl=en&q=show:ARc_vTOc7Oc:wZf222A4j8E&sa=N&ct=rdl&cs_p=http://examples.oreilly.de/english_examples/adonetckbk/AdoDotNetCookbookCS.zip&cs_f=AdoDotNetCookbookCS/Main/Chapter+01
2)For Real time webapplication
http://www.google.com/codesearch?hl=en&lr=&q=gridview&btnG=Search
2)To debug javascript code
Go to IE's View tab -->Script debugger
javascript code wil be opened in microsoft script debugger window
put breakpoints where u want to debug the javascript code
If its not available on your IE browser then you have to download it from
http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en
or
http://www.script-debugger.com/download/
To debug javascript with Visual studio2005
http://geekswithblogs.net/lazydeveloper/archive/2006/07/10/84552.aspx
1. Start your application from Visual Studio IDE.
2. Open "Script Explorer" from your menu bar (Debug->Windows->Script Explorer). "Script Explorer" window will open. If "Script Explorer" is not available in menu; follow this
a. Enable script debugging options in your browser (Tools->Options)
b. Change your Visual Studio IDE settings to "Web Development Settings" (Tools->Import and Export Settings)
c. Enabled your Visual Studio IDE Just-In-Time debugger for "Script" (Tools->Options Debugging-> Just-In-Time)
3. In your application navigate to the intended page OR refresh your current page.
4. All .js file attached to you page and embedded javascript will be seen in "Script Explorer".
5. Double click (in "Script Explorer") to open the script you wish to debug.
6. Script file will be open in main window of Visual Studio IDE.
7. Insert the break point where you wish to debug.
8. Start execution in your application and debug your script (as usual as your server side code).

4)To implement remote debugging in Visual Studio 2005
http://support.microsoft.com/kb/910448

.........Keep awaiting ......Still I have to add some more stuffs to this post

Monday, January 21, 2008

My Favourite Books

1)Visual Studio Tips and Tricks
2)The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks
3)Visual Studio .NET Tips and Tricks: Books: Minh T. Nguyen
4)How to Code .NET: Tips and Tricks for Coding .NET 1.1 and .NET 2.0 Applications Effectively
5).NET Gotchas
6)The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks