Archive

Author Archive

C# – Reverse Strings

April 6, 2010 1 comment

Sometimes we might need to reverse string letters order. unfortunately, String class in .Net Framework up to version 3.5 doesn’t have a Reverse Method. here I will try to add Reverse Extension Method  to String class.

The idea behind string reverse is converting the string to an array of chars and then apply Array.Reverse() method and again convert the array of chars to string. see code

public string ReverseString(string originalString)
{
 char[] strArray = originalString.ToCharArray();
 Array.Reverse(strArray);
 string strReversed = new string(strArray);
 return strReversed;
}

For simplicity, StringHelper class is created to provide string.Reverse method as Extension Method
public static class StringHelper
{
 public static string ReverseString(string originalString)
 {
  char[] strArray = originalString.ToCharArray();
  Array.Reverse(strArray);
  string strReversed = new string(strArray);
  return strReversed;
 }

 public static string Reverse(this string originalString)
 {
  char[] strArray = originalString.ToCharArray();
  Array.Reverse(strArray);
  string strReversed = new string(strArray);
  return strReversed;
 }
}

Easy to use
string str = "abcdef";
string ReversedStr = str.Reverse();

Happy Coding…

Shout it kick it on DotNetKicks.com Retweet

Categories: C# Tags: ,

My Trip to The Holy Places

April 5, 2010 3 comments

Hi Guys, I have been to Saudi Arabia last few days. it was very good trip to Islamic Holy Places.

Here are some photos I captured during my trip.

Kaaba

Kaaba

Kaaba

Kaaba

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Prophet's Mosque

Quba Mosque

Quba Mosque

Al-Baqi' cemetery

Al-Baqi' cemetery

Mount Uhud

Mount Uhud

Mount Uhud

Mount Uhud

Monkeys live in Mountains!

Monkeys live in Mountains!

“Sound Like” Strings

March 31, 2010 2 comments

Two days back, a colleague of mine asked How can he retrieve all rows which have similar employee names.

The situation, there are two tables/Excel sheets he has got from two different sources for the same set of employees. he needs to extract some information from both. the employee name column is the key to identity each one of these employees. the challenge here, employee name is not exactly the same in the two files.

The first solution jumped on the table is similar names. SQL Server provides us with some functions which will help us to achieve this task such as SOUNDEX() and DIFFERENCE().

Here is an example, assume there is a table like below

This table contains some of my friends’ names. as this table shows I have 5 friends share similar names with “Mhmd” letters but with different form for each one of them.

Now I want to write T-SQL query which should give me all friends whose name sounds similar “Mhmd”.

I wrote this query

SELECT     FriendFisrtName, FriendLastName
FROM       MyFriends
WHERE      SOUNDEX('Mhmd') = SOUNDEX(FriendFisrtName)

And I got this result set

Hope this helps…

Shout it kick it on DotNetKicks.com Retweet

My SQL Server Reporting Services Presentation

March 31, 2010 Leave a comment

First off, good night or it might be good morning in the other side of the world. however, I am here to share my presentation about SQL Server Reporting Services (SSRS) with you/DEVelopers.

It was a quick overview to clarify and simplify the concepts under the Reporting Generation Tools and did some practices using  MS SSRS.

Session Slides are shared through SlideSahre

Categories: SQL Server Tags: ,

Windows 7 – Hotkey Keyboard Shortcuts

March 31, 2010 2 comments

The HotKey shortcuts make it faster and easier to navigate through the applications and functions.
Windows 7 has some new handy hotkeys including the following:

  1. Win+Home: Clear all but the active window
  2. Win+Space: All windows become transparent so you can see through to the desktop
  3. Win+Up arrow: Maximize the active window
  4. Win+Down arrow: Minimize the active window or restore the window if it’s maximized
  5. Win+Left/Right arrows: Dock the active window to each side of the monitor
  6. Win+Shift+Left/Right arrows: If you’ve got dual monitors, this will move the active window to the adjacent monitor
  7. Win+T: Shift focus to and scroll through items on the taskbar
  8. Win+P: Adjust presentation settings for your display
  9. Win+(+/-): Zoom in/out
  10. Shift+Click a taskbar item: Open a new instance of that particular application

Shout it kick it on DotNetKicks.com Retweet

Windows 7 – AppLocker

March 31, 2010 Leave a comment

Hi friends,

As Windows 7 promised more security and control over your machine. Windows 7 introduced AppLocker. AppLocker is an administration tool included with Windows 7 which enables you to control which applications you want to run in your desktop.

Michael Pietroforte’s article is a good place to start with AppLocker.
also this video from Microsoft TechNet.

Categories: Windows 7 Tags: ,

My T-SQL Presentation @INJAZAT

March 30, 2010 Leave a comment

Hey guys,

I’d like to share my T-SQL session I’ve presented since few last months.
I tried my best to cover the most important concepts and fundamentals related to SQL Programming and Database Design best practices. it’s a good place to be if you need quick start.

Slides are shared through SlideShare.

Categories: SQL Server Tags: ,

Karting, I’ll give it a try!

March 30, 2010 Leave a comment

Yes, it was so excited to Karting. I (left side) and my affable friend Eyad have enjoyed new experience :)

Categories: Personel Tags:

ASP.NET 4 – Web.config File Minification

March 27, 2010 2 comments

Do you agree that ASP.NET Application’s web.config became very big and hard to read?
ASP.NET Team Development also agreed on that and introduce some enhancements to make web.config content simple and easy to read.

ASP.NET Platform configurations based on two config files, First one is machine.config which contains common configuration data like define available configSections to be used in this version of framework and other global elements such as processModel.
You can find machine.config for framework 2.0,3.0 and 3.5 through C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG. you should notice that all these frameworks working under the CLR v2.0.50727 which means they use the same machine.config

web.config is the second file you need to properly configure your ASP.NET application. web.config should contain only application specific information. because of mentioned-above frameworks upgrade the framework Class Library and introduce new services which working under the same CLR. these new services and libraries should be configured and registered in web.config such as Ajax, routing, and integration with IIS 7.

In Framework 4, we have new CLR and new machine.config, so all common configuration data have been moved to the new machine.config and made web.config simple and clear.

In ASP.NET 4, web.config might be empty or contain very few lines

ASP.NET 4 Web.Config Minification

ASP.NET 4 Web.Config Minification

Shout it

kick it on DotNetKicks.com

Retweet

Categories: ASP.NET Tags: ,

Hello Everybody!

March 24, 2010 3 comments

Welcome to my Web Log. I just wanted to write my first post and start blogging!

This blog would be my gate to share and discuss  ideas, thoughts and information about Web Development, especially ASP.NET and Microsoft based technologies.

Ahmed Elbaz

Happy Programming…

Categories: General
Follow

Get every new post delivered to your Inbox.