SharpDeveloper
C# articles and tutorials on SharpDeveloper.NET
  • About Sameer Alibhai
  • Advertise Here

Annoying Nulls in SQLParameters

By Sameer On August 7, 2009 · 4 Comments

If you read Creating SqlParameters Best Practices you will find the fun you have if you have null values:

SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@Required", required), questionCode == null ? new SqlParameter("@Code", DBNull.Value) : new SqlParameter("@Code", questionCode) };

Here is a nice helper function to deal with nulls without having to manually [...]

Continue Reading →

recursively search a certain file for certain text (linux)

By Sameer On July 1, 2009 · Leave a Comment

Have you ever tried to do a recursive linux search for a text string inside a particular file? For example
grep -r “mail” *.php
and then it fails because the current folder doesn’t have any php files in it?

This below line will search all files for the text moo

find . [...]

Continue Reading →

Advanced File Deletion in Linux

By Sameer On June 13, 2009 · Leave a Comment

Here is a cool way to delete files according to some complex rules without knowing complicated bash commands.

First, create a file as follows that contains your deletion rules.

+ public_html/
+ public_html/*
– access-logs
– etc/
– logs/
– mail/
– .cpanel/
– .cpaddons/

Continue Reading →

ASP.NET 4.0 Features

By Sameer On May 27, 2009 · Leave a Comment

Here is a list of new features in ASP.NET 4.0.

Very interesting. Auto start feature, new ways to choose where data is cached, built in option for compression session (via gzip), and more!

Related Reading: JavaScript: The Good Parts Head First Java, 2nd Edition Effective [...]

Continue Reading →

LINQ to Entities Create Function Import Scalar Value Missing

By Sameer On April 9, 2009 · Leave a Comment

LINQ to Entities seems really great. It can save you a lot of time in writing unnecessary db connection code, improve the performance many fold, only connect to the db when required (lazy loading), and easy concurrency handling for you.

However there is a missing feature which I found out the hard way. If you [...]

Continue Reading →

Write .NET 3.5 in a .NET 2.0 World

By Sameer On April 2, 2009 · Leave a Comment

Wow, sweet. Use .NET 3.5 features in .NET 2.0.

A quick overview how to do it.
1. Edit your .CSPROJ file and manually add another reference to System.Core
Add a True

This will make the compiler copy it to the BIN folder.

Thats it. You can now use .NET 3.5 features

[...]

Continue Reading →

Copy Data from One SQL Instance to Another

By Sameer On February 3, 2009 · 5 Comments

When using SQL Server Management Studio you might want to copy data from one DB to another (using just a SELECT and INSERT statement)

It’s so easy you won’t believe it

sp_addlinkedserver @server='192.168.123.456', @provider='SQLNCLI',    @srvproduct='',@provstr='User Id=sa; Password=are-you-crazy-to-use-sa' insert into [192.168.123.456].MYDB.dbo.tblRecords select * from MYDB.dbo.tblRecords

and when you are done

sp_dropserver [192.168.123.456]

References:
sp_addlinkedserver [...]

Continue Reading →

What is hnc.cgi ?

By Sameer On December 13, 2008 · 1 Comment

hnc.cgi is a spam script. Its also known as dm.cgi.

If you have this script running, chances are your server has been exploited.

Here is the actual dm.cgi script if you want to see it.

Related Reading: JavaScript: The Good Parts Head First Java, 2nd Edition [...]

Continue Reading →

Changes in __doPostback in .NET 1.1 to .NET 2.0

By Sameer On November 27, 2008 · Leave a Comment

Before and After

If you manually want to simulate a postback, Here is how you would stick together a string manually calling __doPostBack in .NET 1.1
In this case its making a link in a particular linkbutton control inside a datagrid.

__doPostBack in .NET 1.0

string link = "<a href=\"javascript:__doPostBack('dataGridCart$_ctl" + i + "$linkButton','');\""; [...]

Continue Reading →

Tracking Influenza (flu) with Google Trends

By Sameer On November 13, 2008 · Leave a Comment

This is quite an astonishing use of Google Trends.  Google realized that when people get sick they (obviously) search for flu related keywords and they managed to find a correlation to actual published flu infection statistics.  Quite amazing and this is definately a unique and interesting application of technology.

How we track flu trends [...]

Continue Reading →
← Previous Entries Next Entries →
  • Categories

    • .NET articles
    • Deconstructing Subtext
    • Hosting
    • Linux
    • Software Engineering
    • SQL
    • Uncategorized
    • Updates
    • Visual SourceSafe
    • Work Related
  • Articles

    • January 2011
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • February 2009
    • December 2008
    • November 2008
    • October 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
  • Calendar

    February 2012
    M T W T F S S
    « Jan    
     12345
    6789101112
    13141516171819
    20212223242526
    272829  
  • Meta

    • Log in
    • Entries (RSS)

SharpDeveloper

Pages

  • About Sameer Alibhai
  • Advertise Here

The Latest

  • Allow Visual Studio to use more memory in 32bit windows
    Read this excellent guide on increasing the total memory Visual Studio can […]

More

Thanks for dropping by! Feel free to join the discussion by leaving comments, and stay updated by subscribing to the RSS feed.
© 2011 SharpDeveloper
Platform by PageLines