Wednesday, July 6, 2011
Developing Android applications using .Net
click here to open the tutorial .
Tuesday, January 26, 2010
.Net Coding Best Practices
I do some Google and collect some links for you:
.Net Coding Stranded : click here
ADO.Net Best Practices : Follow this article click here
.Net Performance Best practices : Follow this click here
ASP.Net Best Practices: Follow this click here , here , here
Exception Handling : follow this article click here
SQL Server : Follow this click here , here , here
I hope that this links help every one trying to code better.
Monday, September 14, 2009
Nuno Silva » Blog Archive » Divs instead of tables
Nuno Silva » Blog Archive » Divs instead of tables
Tuesday, August 4, 2009
Changing Table Schema – what goes behind the scenes – Part I - SQLServerCentral
Changing Table Schema – what goes behind the scenes – Part I - SQLServerCentral
Tuesday, June 23, 2009
Differences between SET and SELECT in SQL Server
Differences between SET and SELECT in SQL Server : Narayana Vyas Kondreddi's home page
Saturday, June 13, 2009
Wednesday, April 16, 2008
Cosmos what`s next ?
i`ll let you see the project page and read documentation , please follow this link
http://www.codeplex.com/Cosmos
Recently , i know that this project showed in Microsoft EDC (Egyptian Developer Conference) but i did not have the chance to attend to the conference , you can wait until the videos of the conference be available and i`ll paste a link here for this session
this is another resources and examples :
http://gocosmos.org/
http://www.gocosmos.org/Docs/UserKit/index.en.aspx
http://lab.obsethryl.eu/content/cosmos-one-opensource-csharp-c-based-kernels
Wednesday, March 19, 2008
Change MDI Container Background Color
MdiClient ctlMDI;
// Loop through all of the form's controls looking
// for the control of type MdiClient.
foreach (Control ctl in this.Controls)
{
try
{
// Attempt to cast the control to type MdiClient.
ctlMDI = (MdiClient)ctl;
// Set the BackColor of the MdiClient control.
ctlMDI.BackColor = this.BackColor;
}
catch (InvalidCastException)
{
// Catch and ignore the error if casting failed.
}
}
Sunday, March 9, 2008
Collection of WCF Sessions
http://www.youtube.com/view_play_list?p=2471E942C68A6925
Source profile here
Saturday, March 8, 2008
Creating a simple user interface with MonoDevelop
Sunday, March 2, 2008
C# and .Net on Linux
another article talking about Compile and run C# command line and GUI applications on Linux by Shekhar Govindarajan
Saturday, March 1, 2008
Mono brings .NET apps to Linux
Click to read article
Sunday, February 24, 2008
Some useful wmi links
Everything In WMI via C# :
http://www.codeproject.com/KB/cs/EverythingInWmi03.aspxGet System Info using C# :
http://www.codeproject.com/KB/cs/nitinsysteminfo.aspx
Wednesday, February 6, 2008
Extract Tables from HTML page and store it in data set using Regular Expressions
here you will find how to do it using regular expression , this code is written using C# :
private static DataSet ConvertHTMLTablesToDataSet(string HTML)
{
DataTable dt;
DataSet ds = new DataSet();
dt = new DataTable();
string TableExpression = "<table[^>]*>(.*?)</table>";
string HeaderExpression = "<th[^>]*>(.*?)</th>";
string RowExpression = "<tr[^>]*>(.*?)</tr>";
string ColumnExpression = "<td[^>]*>(.*?)</td>";
bool HeadersExist = false;
int iCurrentColumn = 0;
int iCurrentRow = 0;
MatchCollection Tables = Regex.Matches(HTML,
TableExpression,
RegexOptions.Singleline |
RegexOptions.Multiline |
RegexOptions.IgnoreCase);
foreach (Match Table in Tables)
{
iCurrentRow = 0;
HeadersExist = false;
dt = new DataTable();
if (Table.Value.Contains("<th"))
{
HeadersExist = true;
MatchCollection Headers = Regex.Matches(Table.Value,
HeaderExpression,
RegexOptions.Singleline |
RegexOptions.Multiline |
RegexOptions.IgnoreCase);
foreach (Match Header in Headers)
{
dt.Columns.Add(Header.Groups[1].ToString());
}
}
else
{
int myvar2222 = Regex.Matches(
Regex.Matches(
Regex.Matches(
Table.Value,
TableExpression,
RegexOptions.Singleline
| RegexOptions.Multiline |
RegexOptions.IgnoreCase)[0].ToString(),
RowExpression, RegexOptions.Singleline |
RegexOptions.Multiline |
RegexOptions.IgnoreCase)[0].ToString(),
ColumnExpression,
RegexOptions.Singleline |
RegexOptions.Multiline |
RegexOptions.IgnoreCase).Count;
for (int iColumns = 1; iColumns <= myvar2222; iColumns++)
{
dt.Columns.Add("Column " + System.Convert.ToString(iColumns));
}
}
MatchCollection Rows = Regex.Matches(Table.Value,
RowExpression,
RegexOptions.Singleline |
RegexOptions.Multiline | RegexOptions.IgnoreCase);
foreach (Match Row in Rows)
{
if (!((iCurrentRow == 0) & HeadersExist))
{
DataRow dr = dt.NewRow();
iCurrentColumn = 0;
MatchCollection Columns = Regex.Matches(Row.Value,
ColumnExpression,
RegexOptions.Singleline |
RegexOptions.Multiline |
RegexOptions.IgnoreCase);
foreach (Match Column in Columns)
{
dr[iCurrentColumn] = Column.Groups[1].ToString();
iCurrentColumn++;
}
dt.Rows.Add(dr);
}
iCurrentRow++;
}
ds.Tables.Add(dt);
}
return ds;
}
Friday, February 1, 2008
Validate Input Using Regular Expressions
Problem :
You need to validate that user input or data read from a file has the expected structure and content.
For example, you want to ensure that a user enters a valid IP address, telephone number, or e-mail
address.
Solution :
Use regular expressions to ensure that the input data follows the correct structure and contains only
valid characters for the expected type of information.
How It Works :
When a user inputs data to your application or your application reads data from a file, it’s good
practice to assume that the data is bad until you have verified its accuracy. One common validation
requirement is to ensure that data entries such as e-mail addresses, telephone numbers, and credit
card numbers follow the pattern and content constraints expected of such data. Obviously, you cannot
be sure the actual data entered is valid until you use it, and you cannot compare it against values that are known to be correct. However, ensuring the data has the correct structure and content is
a good first step to determining whether the input is accurate. Regular expressions provide an excellent
mechanism for evaluating strings for the presence of patterns, and you can use this to your
advantage when validating input data.
The first thing you must do is figure out the regular expression syntax that will correctly match
the structure and content of data you are trying to validate. This is by far the most difficult aspect of
using regular expressions. Many resources exist to help you with regular expressions, such as
The Regulator (http://regex.osherove.com/) and RegExDesigner.NET by Chris Sells http://www.sellsbrothers.com/tools/#regexd). The RegExLib.com web site (http://www.regxlib.com/) also provides hundreds of useful prebuilt expressions.
Regular expressions are constructed from two types of elements: literals and metacharacters.
Literals represent specific characters that appear in the pattern you want to match. Metacharacters
provide support for wildcard matching, ranges, grouping, repetition, conditionals, and other control
mechanisms. Table 2-2 describes some of the more commonly used regular expression metacharacter
elements. (Consult the .NET SDK documentation for a full description of regular expressions.)
Input Type | Description | Regular Expression |
Numeric input | The input consists of one or more decimal digits; for example, 5 or 5683874674. | ^\d+$ |
Personal identification number (PIN) | The input consists of four decimal | ^\d{4}$ |
Credit card number | The input consists of data that matches the pattern of most major credit card numbers; for example, 4921835221552042 or 4921-8352-2155-2042. | ^\d{4}-?\d{4}-?\d{4}-?\d{4}$ |
Simple password | The input consists of six to eight characters; for example, ghtd6f
| ^\w{6,8}$ |
E-mail address | The input consists of an Internet expression
| ^[\w-]+@([\w-]+\.)+[\w-]+$ |
HTTP or HTTPS URL | The input consists of an HTTP-based or HTTPS-based URL; for example, www.hotmail.com | ^https?://([\w-]+\.)+[\w-]+(/[\w-./?%=]*)?$ |
The Code :
The ValidateInput method shown in the following example tests any input string to see if it
matches a specified regular expression.
using System;
using System.Text.RegularExpressions;
namespace mahmoud_alam
{
class new292
{
public static bool ValidateInput(string regex, string input)
{
// Create a new Regex based on the specified regular expression.
Regex r = new Regex(regex);
// Test if the specified input matches the regular expression.
return r.IsMatch(input);
}
public static void Main(string[] args)
{
// Test the input from the command line. The first argument is the
// regular expression, and the second is the input.
Console.WriteLine("Regular Expression: {0}", args[0]);
Console.WriteLine("Input: {0}", args[1]);
Console.WriteLine("Valid = {0}", ValidateInput(args[0], args[1]));
// Wait to continue.
Console.WriteLine("\nMain method complete. Press Enter");
Console.ReadLine();
}
}
}