Wednesday, November 3, 2010

SharePoint 2010 installation guide

Nice link for reference

http://mosshowto.blogspot.com/2009/11/installing-sharepoint-2010-windows-2008.html

Thursday, September 9, 2010

To fetch tables having records in db

select * from sys.objects where object_id in (
select id from sysindexes where indid <2>0 )
and type ='U'

Friday, August 20, 2010

Partial PostBack animations handeled at Clientside

var postbackElement;
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(PageLoading);
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);

function beginRequest(sender, args) {
postbackElement = args.get_postBackElement();
}

function PageLoading(sender, args)
{
var ShowDiv = document.getElementById("dv" + divID);
if(ShowDiv != null)
{
$(ShowDiv).fadeOut();
}
}
function pageLoaded(sender, args) {

var ShowDiv = document.getElementById("dv" + divID);
if (typeof(postbackElement) === "undefined") {
return;
}
else if (postbackElement.id.toLowerCase().indexOf('cancel') > -1) {
$(ShowDiv).fadeIn();
}

}

Friday, July 23, 2010

HelpFull links on SSRS

http://www.simple-talk.com/sql/reporting-services/ten-common-sql-server-reporting-services-challenges-and-solutions/

http://www.beansoftware.com/ASP.NET-Tutorials/SQL-Server-Reporting-Services.aspx

Thursday, July 15, 2010

Decryption Code for AlertPay EPD

string Salt_Key = [Your IPN Security Code];
private readonly byte[] Ivector = Encoding.Default.GetBytes("alertpay");
private string Decrypt(string Input)
{
byte[] Buffer = Convert.FromBase64String(Input);
TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
tripleDES.Key = Encoding.Default.GetBytes(Salt_Key);
tripleDES.IV = Ivector;
//tripleDES.Padding = PaddingMode.Zeros;
tripleDES.Mode = CipherMode.CBC;
ICryptoTransform Transform = tripleDES.CreateDecryptor();
return HttpUtility.UrlDecode(Encoding.Default.GetString(Transform.TransformFinalBlock(Buffer, 0, Buffer.Length)));
}

protected void Page_Load(object sender, EventArgs e)
{
string data = [your encrypted Data];
string[] Result = Decrypt(data).Split(new char[] { '&' });
foreach(string s in Result)
Response.Write(s + "
");
}

Friday, July 9, 2010

Image Thumbnails Nice Code

using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Drawing.Imaging;



string photoPath = Server.MapPath("1.jpg");
int thumbnailSize = 50;
Bitmap photo = new Bitmap(photoPath);
int width, height;
if (photo.Width > photo.Height)
{
width = thumbnailSize;
height = photo.Height * thumbnailSize / photo.Width;
}
else
{
width = photo.Width * thumbnailSize / photo.Height;
height = thumbnailSize;
}
Bitmap target = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(target))
{
graphics.CompositingQuality = CompositingQuality.HighSpeed;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.DrawImage(photo, 0, 0, width, height);
target.Save(Server.MapPath("/2.jpg"));
img.ImageUrl = "~/2.jpg";
}

Thursday, April 29, 2010

calling pagemethod / Web methods from jquery

Thursday, April 22, 2010

Removing html tags in coding, .Net Syndication

protected void Page_Load(object sender, EventArgs e)
{
// Get the books ordered by pubdate in descending order
//PubsDataContext db = new PubsDataContext();
//var dataItems = from book in db.Titles
// orderby book.pubdate descending
// select book;
// Determine the maximum number of items to show in the feed
DataSet ds = new RSSBAL().GetRSS();
const int maxItemsInFeed = 10;
// Determine whether we're outputting an Atom or RSS feed
bool outputRss = (Request.QueryString["Type"] == "RSS");
bool outputAtom = !outputRss;
// Output the appropriate ContentType
if (outputRss)
Response.ContentType = "application/rss+xml";
else if (outputAtom)
Response.ContentType = "application/atom+xml";
// Create the feed and specify the feed's attributes
SyndicationFeed myFeed = new SyndicationFeed();
myFeed.Title = TextSyndicationContent.CreatePlaintextContent("Published Pages by Ingram");
myFeed.Description = TextSyndicationContent.CreatePlaintextContent("A syndication of the most recently published Pages by Ingram.");
myFeed.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(GetFullyQualifiedUrl("~/Home.aspx"))));
myFeed.Links.Add(SyndicationLink.CreateSelfLink(new Uri(GetFullyQualifiedUrl(Request.RawUrl))));
myFeed.Copyright = TextSyndicationContent.CreatePlaintextContent("Copyright Ingram Micro");
myFeed.Language = "en-us";
// Creat and populate a list of SyndicationItems
List feedItems = new List();
foreach (DataRow t in ds.Tables[0].Rows)
{
// Atom items MUST have an author, so if there are no authors for this content item then go to next item in loop
//if (outputAtom && t.TitleAuthors.Count == 0)
// continue;
SyndicationItem item = new SyndicationItem();
item.Title = TextSyndicationContent.CreatePlaintextContent(t["PageTitle"].ToString());
item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(GetFullyQualifiedUrl(t["URL"].ToString()))));
item.Summary = TextSyndicationContent.CreatePlaintextContent(StripTagsCharArray(t["PageDesc"].ToString()));
item.PublishDate = Convert.ToDateTime(t["ModifiedDate"]);
if (Convert.ToBoolean(t["IsMain"]) == true)
{
item.Categories.Add(new SyndicationCategory("Main Pages"));
}
else
{
item.Categories.Add(new SyndicationCategory("Sub Pages"));
}
// Add the item to the feed
feedItems.Add(item);
}
myFeed.Items = feedItems;
// Return the feed's XML content as the response
XmlWriterSettings outputSettings = new XmlWriterSettings();
outputSettings.Indent = true; //(Uncomment for readability during testing)
XmlWriter feedWriter = XmlWriter.Create(Response.OutputStream, outputSettings);
if (outputAtom)
{
// Use Atom 1.0
Atom10FeedFormatter atomFormatter = new Atom10FeedFormatter(myFeed);
atomFormatter.WriteTo(feedWriter);
}
else if (outputRss)
{
// Emit RSS 2.0
Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(myFeed);
rssFormatter.WriteTo(feedWriter);
}
feedWriter.Close();
}
private string GetFullyQualifiedUrl(string url)
{
return string.Concat(Request.Url.GetLeftPart(UriPartial.Authority), ResolveUrl(url));
}
public static string StripTagsCharArray(string source)
{
char[] array = new char[source.Length];
int arrayIndex = 0;
bool inside = false;
for (int i = 0; i < source.Length; i++)
{
char let = source[i];
if (let == '<')
{
inside = true;
continue;
}
if (let == '>')
{
inside = false;
continue;
}
if (!inside)
{
array[arrayIndex] = let;
arrayIndex++;
}
}
return new string(array, 0, arrayIndex);
}

Tuesday, April 6, 2010

SQL Badams

SQL: To fetch all procedures where a table name is used


sp_depends

Wednesday, March 10, 2010

web cam using silverlight

http://www.silverlightshow.net/items/Capturing-the-Webcam-in-Silverlight-4.aspx

Friday, March 5, 2010

jquery ASP.NET controls

http://my123web.blogspot.com/2009/05/aspnet-user-controls-and-jquery.html

Ref:
on blog spot.

Wednesday, March 3, 2010

Google map interaction using flash

http://code.google.com/apis/maps/documentation/flash/tutorial-flash.html

Thursday, February 25, 2010

Heap V/S stack

http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory01122006130034PM/csharp_memory.ASPx

Saturday, February 13, 2010

Performance Tuning in .Net

http://www.sql-server-performance.com/articles/asp_ado/asp_net_performance_2_p1.aspx

Friday, January 29, 2010

Thursday, January 28, 2010

Thursday, January 14, 2010

Custom Error in Sql Server 2008

declare @un tinyint
declare @UserName Varchar(200) = 'abc'
declare @RoleID int = 3
select @un = COUNT(*) from LoginDetails where UserName = @UserName and RoleID = @RoleID
if @un > 0
begin
declare @ErrorMessage1 nvarchar(max), @ErrSeverity1 int
set @ErrorMessage1 = 'UserName Already Exists. Try different User Name'
set @ErrSeverity1 = 16
RAISERROR(@ErrorMessage1, @ErrSeverity1, 1)
end

Delete Duplicate records from a table in sql

DECLARE @Duplicate TABLE (ID INT,FNAME VARCHAR(10),MNAME VARCHAR(10))
INSERT INTO @Duplicate VALUES(1, ‘AAA’,'CCC’)

INSERT INTO @Duplicate VALUES(2, ‘BBB’,'DDD’)

INSERT INTO @Duplicate VALUES(1, ‘AAA’,'CCC’)

INSERT INTO @Duplicate VALUES(2, ‘BBB’,'DDD’)

INSERT INTO @Duplicate VALUES(1, ‘AAA’,'CCC’)

INSERT INTO @Duplicate VALUES(2, ‘BBB’,'DDD’)

INSERT INTO @Duplicate VALUES(3, ‘BCB’,'DGD’)

WITH CTE as(SELECT ROW_NUMBER() OVER(PARTITION BY ID, FName, MName ORDER BY (SELECT 1)) AS RowID,*FROM @Duplicate)

SELECT ID, FName, MNameFROM CTEWHERE RowID = 1

ref: http://blog.sqlauthority.com/2007/03/01/sql-server-delete-duplicate-records-rows/

http://www.databasejournal.com/features/mssql/article.php/3572301/RowNumber-function-in-SQL-Server-2005.htm

autocomplete with jquery

http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/