This blog is subject the DISCLAIMER below.

Tuesday, February 27, 2007

Linux Tip #3 : Using Arabic keyboard

It is really simple to use Arabic in Linux. This command enables it:
setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,ar

You can make this command run each time the computer starts by adding to ~/.bashrc .

This command in short, set the switch keys to alt-shift (left alt and left shift), the mode of this key is to toggle, and it specifies that the state of the scroll-lock LED will show the language currently used. Use 'man setxkbmap' for more details on advanced use.

.. more.

The Windows Hosts file

windows has a very special file named the hosts file, it is located in
%SystemRoot%\System32\drivers\etc\hosts
this file allows u to define a domain & its IP, just like a DNS, but a local one but
without server, it also allows u to block a specific website, domain or any thing, only by giving it an IP that is not the real one, so there will be nothing to accept the connection
Q: WHAT MAKES IT A HELPFUL THING ??
A: coz simply if u have a program that makes some sort of validations on the server, that u dont want to happen, u can do that
ur only problem is just u have to know where it connects, but there is alot of tools & ways to determine that.
its also useful since u wont need a firewall to do that, its just a local file
1- just open it from the RUN command
2- select notepad & thats it
u'll actually find the LocalHost IP there, with the domain named "localhost"
add whatever u want in the same format as the other & that should be it

.. more.

Installing JDK6 On Ubuntu

Ubuntu is a great linux distribution. I have been using it for some time and it has never failed me. I have tried to use JDK6 with it but i didn't find a .deb package neither on sun's website nor ubuntu repositories. Fortunately, there is a way around that.

First, you need to download the JDK binary from here. I have downloaded jdk-6-linux-i586.bin the one suitable for my computer and most of us.

Second, chmod it to make it executable:

chmod 755 ./jdk-6-linux-i586.bin

Third, run the binary you have downloaded using this command:

./jdk-6-linux-i586.bin

then press yes to agree to the licence. After that you will find a new folder called jdk1.6.0

Then, you need to move this folder to use/lib/jvm using this command:

sudo mv jdk1.6.0 /usr/lib/jvm

You will need to enter the root password to do that.

sudo update-alternatives --config java

Selection    Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-gcj/jre/bin/java

Press enter to keep the default[*], or type selection number:
Those are the JVM's that currenlty exist.

Now we have moved the JDK to the folder where JVM's exists, but we need to enable the system to recognize it really exists

This command will finish all these thing:
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0/jre/bin/java 60 \
--slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jvm/jdk1.6.0/man/man1/java.1

Check the JVM's again:

sudo update-alternatives --config java

There are 3 alternatives which provide `java'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-gcj/jre/bin/java
3 /usr/lib/jvm/jdk1.6.0/jre/bin/java

Press enter to keep the default[*], or type selection number:
Now JDK 1.6 exists but it's not the default.
sudo update-alternatives --config java

There are 3 alternatives which provide `java'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
+ 2 /usr/lib/jvm/java-gcj/jre/bin/java
* 3 /usr/lib/jvm/jdk1.6.0/jre/bin/java

Press enter to keep the default[*], or type selection number:
Now, select the one that contains JDK1.6.0, which will be 3 in this case.

You are done.

References:
http://trac.centricware.org/wiki/2007/01/28/21.58

.. more.

Monday, February 26, 2007

MySQL .Net Connector Error 2869 on Windows VISTA

I've solved an error I had while installing the .net connector of MySQL on windows VISTA.
I had an error number 2869 and the setup rolled back.
The solution that I found on the MySQL website was to run the command prompt in administrator mode and run the setup from there.
it worked with me, & I hope it does the same for u

.. more.

Windows Vista Boot (Add or Remove)

I've just fixed my computer's boot system & saved my self 48 hrs of reinstalling a system.
I''ll take this chance to explain about the Vista's Boot manager (either removing it or Deleting it)
I currently have a dual boot of windows XP & VISTA
my XP for some reason crashed so I had to repair it, which rewrote the bootsector & over written the VISTA's boot sector. so I couldn't load windows VISTA.
The recovery stuff that u can find when u boot from the windows VISTA DVD were the way to solve it (add VISTA to the boot) not the startup recovery, but the command line

How to use the Bootrec.exe tool in the Windows Recovery Environment to troubleshoot and repair startup issues in Windows Vista

type:
bootrec.exe /Fixboot
& that should be it

To remove the VISTA Boot record, boot from windows XP CD, press r on the first screen (open the recovery console)
type fixboot
then fixmbr
then fixboot again for safty
that should be it

.. more.

A reasonable solution for serious Game Programming

There is a very reasonable solution if u seriously want to consider game programming, I dont advise making ur own engine, unless u just want to learn, but its never a good idea to use it for production, coz u'll need years of hard work to make a technology that is several years old when its done.
Simply u can buy or get an engine for free (there are several economical & free engines on the net), concentrate in the game u want to make, & leave the engine issues to the engine programmers.
Even when they make a new version of it, u wont have any hard time updating ur game.
Current game markets are in serious needs for original ideas (I KNOW, I"M FOLLOWING THAT MARKET :D) so if u want to succeed in this business, u'll have to offer what it needs.
Dont reinvent the wheel if u want to make money, coz whatever u do ur wheel wont be more circular than the existing ones ;)

.. more.

Sunday, February 25, 2007

Running Netbeans on XGL

If you tried to use Netbeans on XGL before, you probably know that you can't do it. It shows like an empty window. The solution being around is that you use a nested X server and so on. Other solutions include recompiling the JRE.

Well, I ran into a simple solution. You can add this to /etc/environment, and viola, it is working:
AWT_TOOLKIT="MToolkit"

For command line guys:
sudo echo 'AWT_TOOLKIT="MToolkit"' >> /etc/environment

Have fun ;)

http://ubuntuforums.org/showpost.php?p=1687890&postcount=4

.. more.

Enabling Dual-core/Hyper-threading in Ubuntu

Ubuntu 6.10 (Edgy) doesn't enable dual-core out-of-the-box. Maybe the next one will. Anyway to enable it, you have to use a different kernel.
I started to hear people screaming. I can see you clicking away of this article right now!

Well, don't be afraid, it is as easy as a single click nowadays. All you need to do, if you have Intel (non-AMD) processor is this:
From synaptic package manager choose these 2 packages:
kernel-686-smp
kernel-restricted-modules-686
And then reboot.
For command-line people just type:
sudo apt-get install linux-686-smp linux-restricted-modules-686
and reboot.

To make sure your kernel now sees the both processor type:
cat /proc/cpuinfo | grep -i '^processor' | wc -l
This command will show you how many processors is recognized by the kernel.

For AMD users, the packages are not named 686, they are named k7.
Good luck.

A last hint: (thanks to my dear friend Shereef Sakr)
To speedup the booting process, you might want to enable concurrency in the booting processes.
In the /etc/init.d/rc file, there is a line called CONCURRENCY=none, it is probably the first un-commented line. Change 'none' to 'shell' or to 'startpar'.

Shell and startpar both are concurrent but shell cares about the order or the printed output. I used startpar and it didn't work, so I used shell and it is working fine, although not as fast as startpar; startpar booted in a blink, but shell just cuts few seconds off.

.. more.

Saturday, February 24, 2007

Windows Presentation Foundation Part 2

In this post,I will speak about the features that lead WPF to make a great interface revolution in the design world.
So now we have to ask, is WPF different from previous technologies?And if it is, what are the new features it provides?
Surely, it is different and the evidence is the new features in Windows Vista
that depend on WPF.
So,let's list the most important WPF features.

WPF features:
1. A unified platform for modern user interfaces:
Providing a unified technology foundation for creating full-featured user interfaces. As shown in this screen,it contains text and images along with both 2D and 3D graphics produced using WPF. The developer doesn't need to write code that uses specialized graphics technologies such as GDI+ or Direct3D.


2. The ability for developers and designers to work together:
Before using WPF, there was a problem: how can designers and developers work together?!! Now it is very easy as WPF enables designers to use the same common language (XAML) as developers and visa versa. This is the key change as shown on the following figure.


3. Graphical and Media Services:
-All graphics will be routed through Direct3D. This aims to provide a unified avenue for displaying graphics and to allow Windows to offload graphics tasks to the Graphics Processing Unit found on the computer's graphics card to reduce the workload on the computer's Central Processing Unit.

-WPF supports the 3D capabilities provided by Direct3D and provides tighter integration with other features like user interface (UI), time-based animations, 3D documents, vector graphics and 3D media and it also supports the video formats WMV, MPEG and AVI.

- A powerful concept in the WPF is the logical separation of a control from its appearance as the control's template can be overridden to completely change its visual appearance and control can contain any other control or layout.

4. Imaging:
Windows Imaging Component (WIC) for WPF will allow developers to write image codecs for their specific image file formats as well as custom bitmap effects and metadata.

5. Effects:
Special effects such as dropshadows and blurring are built-in and other effects such as reflections can be easily implemented.

6. Text:
WPF includes a number of text rendering features that were not available in GDI and it is the first Windows programming interface to support Open Type, TrueType, and OpenType CFF (Compact Font Format) fonts.

7. Deployment:
WPF isn't just for building traditional standalone applications but also offering XAML Browser Applications (XBAP).

8. Interoperability:
WPF provides interoperability with Win32: Via hosting, one can use WPF inside existing Win32 code, or one can use existing Win32 code inside WPF.

9. Data Binding:
WPF has a built-in set of data services to enable application developers to bind and manipulate data within applications.

After these features are known,I think it is the time to see and apply them yourself to enjoy with the great interface revolution using WPF.I found good link of WPF video tutorials using Microsoft Expression Blend.
Download them and begin to learn.
http://www.contentpresenter.com/index.php
To be continued……

.. more.

Explore the Java Platform- part3 APIs (J2ME-Configurations and profiles)

3.1.1 CLDC
The Connected Limited Device Configuration (CLDC) is a specification for applications targeted at devices with very limited resources such as pagers and mobile phones. The CLDC was developed under the Java Community Process as JSR 30 (CLDC 1.0) and JSR 139 (CLDC 1.1).

Typical requirements
16-bit CPU, a total of 160 KB memory available to the Java platform, as well as a limited connection to some kind of network.

Profiles
MIDP
Designed for cell phones, it supports an LCD orientated GUI API, with MIDP 2.0 including a basic 2D gaming API. Applications written to use this profile are called MIDlets. Almost all new cell phones come with a MIDP implementation, and it is now the de facto standard for downloadable cell phone games.

The Information Module Profile
(JSR 195) is designed for vending machines, network cards, routers, telephone boxes and other systems with either simple or no display and some form of limited two way network access. Only APIs for application creation, storage, and network access are defined. These are a subset of the javax.microedition.io, rms and midlet packages in MIDP. Siemens Mobile and Nokia put forward this specification to the JCP.

DoJa
The DoJa profile was designed for DoCoMo's i-mode mobile phone by NTT DoCoMo.

General APIs
java.io
java.lang
java.util

3.1.2 CDC
The Connected Device Configuration (CDC) is a framework for building J2ME applications on embedded devices ranging from pagers up to boxes. The CDC was developed under the Java Community Process as JSR 36 (CDC 1.0) and JSR 218 (CDC 1.1).

Typical Requirements
32-bit CPU, 2 MB of RAM, and 2.5 MB of ROM.

Profiles
Three profiles are based on the CDC
Foundation Profile
Java SE-like API
No graphical user interface (GUI)

Personal Basis Profile
Extension to Foundation Profile
Lightweight GUI support

Personal Profile
Extension to Personal Basis Profile
Full AWT and applet support
Easy to port PersonalJava-based applications

3.1.3 Getting into action
The previous sections described an overview of the components of the J2ME which appears easy, simple and small, although; do not trust the first impression, J2ME applications are considered the most challenging applications to develop, because getting yourself used to limited libraries is a difficult task, specially for CLDC which provides a very basic set of functionality. J2ME developer must always put system resources in the first priority, especially when developing an application that depends on resources in the first place such as a game. You can get J2ME resources from http://java.sun.com/javame/index.jsp

.. more.

Explore the Java Platform-part3 APIs (J2ME - OverView)

Explore the Java Platform
Part 3
APIs

Well, it has been a long time since our last post in this series. I’m sorry for the delay, but I was really busy and I didn’t have any time to do any thing, any way lets get to the subject directly.

This part starts showing the APIs of the java platform, as discussed before, the java APIs are grouped into 3 main groups which are; Java Micro Edition (J2ME), Java Standard Edition (J2SE), and Java Enterprise Edition (J2EE), the 2 in the acronyms stands for a standardization level, as mentioned before, java has passed through many standardization levels and Java2 is considered an important milestone in the standardization of java because it added an extra huge functionality to the previous versions. Now the new acronyms will omit the 2 using the names as Java ME, Java SE and Java EE, however, we will use the old names in the article because we will just talk about common concepts, but it is always good to know the new acronyms.

3.1 J2ME
Java 2 Micro Edition (J2ME) is Sun's version of Java aimed at machines with limited hardware resources such as PDAs, cell phones, and other consumer electronic and embedded devices. J2ME is aimed at machines with as little as 128KB of RAM and with processors a lot less powerful than those used on typical desktop and server machines. J2ME actually consists of a set of profiles. Each profile is defined for a particular type of device -- cell phones, PDAs, microwave ovens, etc. -- and consists of a minimum set of class libraries required for the particular type of device and a specification of a Java virtual machine required to support the device. The virtual machine specified in any profile is not necessarily the same as the virtual machine used in Java 2 Standard Edition (J2SE) and Java 2 Enterprise Edition (J2EE).

To date, Sun has released the following profiles:
The Foundation Profile -- A profile for next generation consumer electronic devices
The Mobile Information Device Profile (MIDP) -- A profile for mobile information devices, such as cellular phones and two-way pagers, and PDAs

A profile in itself does not do anything; it just defines the specification. Profiles are implemented with a configuration. You can think of a configuration as an implementation of a J2ME profile for a particular type of device such as a PDA. Some of the configurations currently available are

Connected Device Configuration (CDC)
An implementation of the Foundation Profile for next-generation, consumer electronic and embedded devices

Connected Limited Device Configuration (CLDC)
An implementation of MIDP for small, resource-constrained devices such as Palm OS devices.


Since each profile defines a different set of Java class libraries, you cannot take a Java application written for one profile and run it on a machine that supports another profile. Likewise, you cannot take an application written for Java 2 Standard Edition (J2SE) or Java 2 Enterprise Edition (J2EE) and run it on a machine that supports J2ME. You can only use the Java classes provide in the Java class library included in your target device's profile.

.. more.

Friday, February 23, 2007

AUC English Course

Here is the English course of the AUC, I guess it’s good :)
The password of the zip files is: taha
Here is how it is working
You first set up the main setup ISO file
You will have 12 levels; each level has its own ISO file if you want to run a certain level you have to insert its ISO file in your virtual CD room
That’s it hope you enjoy :)

The Main Setup File
SetUP.ISO

The basic level 1
Basic1.ISO

The basic level 2
Basic2.ISO

The basic level 3
Basic3.ISO

The intermediate level 1
Part1
Part2
Part3
Part4
Part5

The intermediate level 2
Part1
Part2
Part3
Part4
Part5

The intermediate level 3
Part1
Part2
Part3

Part4
Part5
Part6

The advanced level 1
Part1
Part2
Part3
Part4
Part5
Part6

The advanced level 2
Part1
Part2
Part3
Part4
Part5
Part6

The advanced level 3
Part1
Part2
Part3
Part4
Part5
Part6

The review
Part1
Part2
Part3
Part4
Part5
Part6

The executive
Part1
Part2
Part3
Part4
Part5
Part6
Part7

I have downloaded all the parts of all levels and put them on DVD in case if any one in FCI-H wanaa them :)

.. more.

Thursday, February 22, 2007

How to design something?

I am not a designer, sure I am not.
But, through these years, I've learnt some tips, I decided to discuss that with you:

1- Before design a logo, search for logos in the same category, like if I assigned task to design a logo for Bank, first step I should do is to go to any search engine and search on "Bank logo" then review all logos then do my one (Do not steal, just see how other think!)

2- Read this, it contains a lot of logos, and more beautiful tips, really it helped me a lot, thanks to Amr Ghoniem who gave me it

3- Your design should be simple as you can

4- Try to read more about UI and its principles

5- You've to know what users like to see, your family is very valuable, you have to know how they interact with your software, because they are the users NOT YOU!!!

.. more.

Quick Overview on Linq project

in the name of ALLAH

Language Integrated Query or what we are calling it LINQ project .

first lets know the difference between Declarative and imperative query programming.

in declarative Q P : - u tell the system what u want, but u don't tell it what to do to find the solution. like the sql query ( select id from student where name like 'fci-h') here the system will get the solution with the best plan it can see it.

in imperative Q P :- use the imperative query in logic work, when u want the system to run with assigned steps ( do .... if ... else ... exit ..) etc.

before Linq project there were diferent ways to work with data ( data from XML files, data from database or from Collections like arrays and lists ) , but now linq project came with the Solution;
Linq project manipulate the data with the same queries Although its different type (from xml , db or collections ).

we have : - Dlinq - to work with the data from database.
Xlinq - to workwith the dta from XML files.
linq to object to work with the collections.

see this example :-
from c in .....
where .........
select .........

by this query u can select from(xml , db or collections) .

the Most powerful thing in linq project is Plinq( parallel Linq ) Plinq enables the system to decide the best execution plane in the multiple processor machines not me who choose the execution plane, and sure this give us the best Automatic memory optimization.

this was a Quick Overview on Linq project hope it be useful.
for further reading Click here

My Resources : - Microsoft Documentation and silverkey demo day.

Good Luck

.. more.

Wednesday, February 21, 2007

#'s Family

There are two categories of Sharps: .NET languages and libraries. This list includes a sampling of some of each.

A#, a port of the Ada programming language to the .NET platform, is distributed by the Department of Computer Science at the United States Air Force Academy under the GNU general public license. http://asharp.martincarlisle.com

Cocoa#, a wrapper for Cocoa that works within the Mono environment. http://www.cocoasharp.org

F#, a mixed functional and object-oriented programming language developed by Microsoft Research. http://research.microsoft.com/fsharp/fsharp.aspx

Gtk#, a .NET wrapper for GTK+ and other GNOME libraries. http://www.mono-project.com/GtkSharp

J#, Microsoft's implementation of Java, which the company is in the process of phasing out. http://msdn2.microsoft.com/en-us/vjsharp/

Spec#, an extension of C# from Microsoft that has its own compiler that's integrated into the Visual Studio platform. http://research.microsoft.com/specsharp

Sing#, a Spec# extension and compiler for Microsoft Research's Singularity project. Singularity is an attempt to write a completely managed operating system from the ground up. http://lambda-the-ultimate.org/node/1081

X# (also known as "Xen" and now officially dubbed "C Omega") is an extension to the C# language (specifically the asynchronous wide-area concurrency Polyphonic C# language). It also provides a data-type extension for XML. http://research.microsoft.com/Comega You can read more here

.. more.

Linux Shell Tip #2

In the previous post, I mentioned a case when you have run a program through the shell and you want to close the shell without closing your program.

So before you close the shell, you may notice that you can't type any other command untill you close the running program.

What if you need to use the shell for another purpose?

This is when you need to place an ampersand "&" at the end of the command. so for the gedit example i have mentioned before, the command would be like this:

gedit &

The ampersand (&) placed at the end of the command starts the process as a background process which means that this process will not capture your keyboard input in the shell, so you can use the shell for typing any other commands.

Remember that if u close the shell the programs you have run will close. To overcome this situation you will need to use nohup in association with the "&". So if you want to run gedit the command will:

nohup gedit &

and the general form of it would be:

nohup "your command" &

Now you can:

# Use the shell for any purpose after running the programs you want.
# Close the shell without disrupting the operation of the programs you have run.

.. more.

Monday, February 19, 2007

How to enable glass view in Vista?

Glass view: all your windows have a kind of transparency to each other, maximizing and minimizing windows in animating way, navigating through opened windows like below, a small viewing for any application opened in Start bar by moving your mouse on, etc...

By default Vista does not enable glass view, to enable it make sure that your VGA driver is installed.

First, I'd Like to thank Ehab el Gindy (Hobzy) he helped me in that.

To do right click on Desktop->Personalize->Windows Color and Appearance->Open classic appearance properties for more color options then from Color scheme select Windows Aero

.. more.

Per-application sound settings

Per-application sound settings feature in Vista enables you to adjust sound volume for each application can access your sound device as you see below

Usually, we want to decrease MSN sound because of our cute friends who give us Nudges and Guitar Smash wink while listening to bond team music or Beethoven symphonies loudly, if you don't use per-application sound settings in this case, you'll be homeless :-)

To adjust it, open "Volume Mixer" right click on Speaker Icon in Start bar then Open Volume Mixer. Now you can adjust any opened application displayed by adjusting the TrackBar.

.. more.

Sunday, February 18, 2007

Linux Shell Tip #1

As you use linux you will have to type commands into the shell. In this series of posts i am going to tell you how to overcome some annoyances when using the linux shell.

If you open gedit (a simple text editor) through the command line (by typing gedit) you will find that the terminal is still open. And if you close the terminal gedit will be closed too.

To override this behaviour you can type :
nohup gedit

This way if you close the terminal gedit will not be closed.

So what happens and how does nohup solve it??

When you run any program through the shell, this program is opened as a child process to the shell process. That means that the shell is a parent process to the program you have just run. So when you close the parent process(The shell in our case), a hangup signal is sent to the child process (Your program) which closes as a result.

nohup (means "no hangups") lets your program ignore those hangup signals, so that you can close the shell safely without mistakenly closing the program you have run.

Ofcourse, nohup is not constrained to gedit only. You can use it for any other program:
nohup "Your command"

.. more.

Saturday, February 17, 2007

Windows Presentation Foundation part 1

In this post, I will speak about the Windows Presentation Foundation (or WPF) which is one of the most important technologies in .NET framework 3.0.
Before beginning in WPF, we have to reply on some questions:
What is Microsoft .NET Framework 3.0? And what is the difference between it and previous releases?

Briefly, the Microsoft .NET Framework 3.0 (formerly WinFX), is the new managed code programming model for Windows. It combines the power of the .NET Framework 2.0 with four new technologies: Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), Windows Workflow Foundation (WF), and Windows CardSpace (WCS, formerly “InfoCard”).

Use the .NET Framework 3.0 today to build applications that have visually compelling user experiences, seamless communication across technology boundaries, the ability to support a wide range of business processes, and an easier way to manage your personal information online.

Windows Presentation Foundation (WPF)
The Windows Presentation Foundation (or WPF), formerly code named Avalon, is the graphical subsystem feature of the .NET Framework 3.0 and is directly related to XAML "Extensible Application Markup Language ". It is pre-installed in Vista the latest version of the Microsoft Windows operating system.

WPF is also available for installation on Windows XP SP2 and Windows Server 2003. It provides a consistent programming model for building applications and provides a clear separation between the UI and the business logic.

A WPF application can be deployed on the desktop or hosted in a web browser. It also enables richer control, design, and development of the visual aspects of Windows programs.
It aims to unify a host of application services: user interface, 2D and 3D drawing, fixed and adaptive documents, vector graphics, raster graphics, animation, data binding, audio, and video.

There are a number of development tools available for developing Windows Presentation Foundation applications.
One of the good tools is Microsoft Expression Blend.To download it, please follow the installation instructions:

http://www.microsoft.com/products/expression/en/expression-blend/try.mspx
This was just introduction to WPF.
To be continued….

.. more.

Types of web site in ASP.NET 2.0

In the name of Allah ,
1- File system Web sites .
2- Local IIS Web sites .
3- FTP Web sites .
4- Remote Web sites .

This are types of web site that you can develop it by ASP .NET 2.0 as illustrate in picture .This article will be useful isA , if you interest to know the different between them , want to know why this types or want increase your knowledge .

1-Local IIS Web sites :
First of all to create a local Web site:
  • *you need to have administrative rights (Windows administrator) .
  • *you must have IIS installed on your computer.
Local IIS Web sites store the pages and folders in the IIS default directory structure (that is, \Inetpub\wwwroot). By default, Visual Studio creates a virtual directory under IIS. However, you may create a virtual directory ahead of time and store the code for your Web site in any folder. The virtual directory just needs to point to that location. One important reason to create a local Web site is to test your application against a local version of IIS, for example, if you need to test such features as application pooling, ISAPI filters, or HTTP-based authentication. Even though a site is accessible from other computers, it's often much easier to test these aspects of your application when you can see it interact with IIS on your computer.

2-File System Web Sites :
  • *File system Web sites live in any folder you specify .The folder may be on your local computer or on another computer sharing that folder.
  • *File system Web sites do not require IIS running on your computer. But , you run pages by using the Visual Studio Web server( Visual Studio 2005 includes its own built-in Web server. This lets you develop Web applications effectively even if you don't have IIS installed on your development machine).
Form File System Web Sites advantage is you may develop your Web site on your computer even when logged on as a user without administrative rights. This scenario is only useful for developing and testing those features of your site that you develop. Because IIS is out here, you won't be able to work with (or have to deal with) such IIS features as ISAPI filters, application pooling, or authentication.

3-FTP Web Sites :
Via Visual Studio you can create HTTP-based sites or manage Web sites available through an FTP server. For example, if you use a remote hosting company to host your Web site, an FTP offers a way to move files back and forth between your development location and the hosting location. You then use Visual Studio to manage the content on the remote FTP server.
  • *You might use this option to test the Web site on the live server where it will actually be deployed.
  • *By default, Visual Studio logs you in to the FTP server as an anonymous user. However, some FTP servers require you to provide a username and password. In that case, you can deselect the Anonymous Login option and then enter your username and password. The username and password are saved until you end the Visual Studio session.
4-Remote Web Sites
  • *Remote Web sites use IIS on another computer that is accessible over a local area network.
  • *To create this type of web site, FrontPage Server Extensions must be installed on the remote computer.
  • *By default, a web application that you create on a remote server doesn’t have the permissions needed to change files in the web site at runtime. If an application needs to change a file, then, you’ll need to contact the system administrator about giving it the appropriate permissions.
This option is useful if you decide you want to test the Web site on its actual deployment server. In addition, the entire development team can work on the site simultaneously.
My source :
http://en.csharp-online.net/How_to_Test_and_Debug_an_ASP.NET_Application%E2%80%94How_to_create_a_remote_IIS_web_site

.. more.

C# Software Transactional Memory

Software Transactional Memory (STM) is an API for multithreaded computation in which shared data is synchronized without using locks. Threads synchronize by means of memory transactions, short-lived computations that either commit (take effect) or abort (have no effect). Transactions avoid the well-known problems of locking, including deadlock, priority inversion, and fault-intolerance. The SXM is a software transactional memory package written in C#. It is much easier to use than prior STMs because it uses Reflection.Emit to transparently add synchronization code to sequential data structures.
More on here
From Microsoft Research website

.. more.

Friday, February 16, 2007

Building your CV

1- You don't know what career to choose.
2- You don't know how to build your CV.
3- Strange Education.Can't write cover letter.

Download this file and enjoy ......
http://www.hasebat.com/OldWebsite/bo/doc_file/career.zip

.. more.

Thursday, February 15, 2007

Suggestions

This post is dedicated for your suggestions. You are free to express what you like/don't like in the comments as well as suggest new ideas on how to improve it.

FCIH Bloggers

.. more.

What happens behind the scene??!

Did you think a day what happens when you create a windows application and run it?

Did you think what function(s) called to show you the form with the controls associated with it?

I know I know, you think or thought in that... me too, back to old days, I remembered something, Shreef Sakr and I were working on Visual Studio.net 2003 in our FCI-H lab. I noticed that Shreef writing some lines of code, I've attracted then I've asked him what's this?

He replied "I saw in MSDN this class StackTrace, and I am still discovering it"

Today in the meeting with Hanaa, I remembered this class and I decided to write about it.

No..., I did not forget, did you think a day how many functions should be called to show you a simple form? so think, if you did not. Guess!.... your answer may be 1, 2, 3 or even 4 functions, but my answer is main, Run, form constructor, addcontrols, initializecomponent and load.

We got the big zero :-), although C# is not open source but you can easily know what's happen behind the scene and StackFrame can remove the curtain to see, so the answer is little weird. To show a simple form, just 22 functions called.

Show me!
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
ShowMeWhatHappend();
}
/// Shows me the name of functions called in the stack frame till execution of
/// ShowMeWhatHappend
public void ShowMeWhatHappend()
{
int counter = 0;
System.Diagnostics.StackTrace ST = new StackTrace();
System.Diagnostics.StackFrame[] SF = ST.GetFrames();
foreach (StackFrame sf in SF)
{
System.Reflection.MethodBase MB = sf.GetMethod();
listBox1.Items.Add(MB.Name);
counter++;
}
label1.Text += counter;
}

23, because of ShowMeWhatHappend calling.

.. more.

What's new in C# 3.0 ? Part 5

Lambda Expressions : -

in earlier versions of C# when we were using delegate it was like that : -
suppose the delegate for multiply function.

in C# 1.0
first , i would create a delegate of type int

delegate int MathOp ( int x , int y ) ;
MathOp Multiply = new Mathop ( Multiply) ;
Console.Write(Multiply( 2 , 3 ) ;

Sure first you must make function Multiply :D

Private int Multiply ( int x , int y )
{
return x*y;
}

then it became more easy with the anonymous methods in C# 2.0

if i will use this method for once i don't have to declare methods and ....
anonymous methods allow us to make it as a block of code like this :-

delegate int MathOp ( int x , int y ) ;
MathOp Multiply = delegate ( int x , int y )
{
return x*y;
}
Console.Write(Multiply( 2 , 3 );

then it became more and more easy with Lambda Expression in C# 3.0

MathOp Multiply = ( x , y) => x*y;
Console.Write(Multiply( 2 , 3 );

So whats going on ?
on the left hand side : - we wrote the declared delegate and the name of the function
on the right hand side : - we wrote the parameters which we will apply the operation on them followed by the arrow followed by the operation.

hint : - if the code more than one line make them in a scope by { }.

this was the last post about C# 3.0 hope it was useful for you, and c u in another topic Soon isA.

.. more.

Wednesday, February 14, 2007

What's new in C# 3.0 ? Part 4

in this post i will speak about 3 small things:-
1: - Object initializers.
2: - Query expression.
3:- implicitly typed arrays.

1: - Object initializers :-
Now i can initialize any public property in object construction, so there is no need to write multiple
constructors like this eg ..

point p = new point { x = 5 , y = 9 } ;
button btn = new button { Text = "username" , Width = 20 , Height = 5 } ;
and so on .. where Text,Widht and Height are Public properties in the Button Class.


2: - Query expression :-
i will explain it directly in a small example : -

from c in students
where c.Name == "BillGates"
select c.address.
now this became apart of C# syntax now we can get a compilation error if i wrote wrong
statement ( in the previous versions of C# we were writing it between " ".
the query expression not just for sql statements but also i can use it in my arrays or any structure i made in my code.
( really this is great ) .

3 : - implicitly typed arrays :-
it is same as implicitly typed variable the type of the array is inferred from the initialization value like this :-
var a = new [] { 1, 2, 3 } ; //array of intergers.
var b = new [] { "hi","man"}; // array of srings.
var c = new [] { 1, 2, "kkk"}; // Compilation error.

That’s it.
See you in the Next Part isA

.. more.

MDC07 - Day3 Slides updated

Those are some slides for presentations held on Day3:

Ngen to build more performant managed applications by Surupa Biswas
JIT-ing (Dynamic Compilation for managed code) by Surupa Biswas

Enjoy them :)

.. more.

Get your Video Series: SQL Server 2005 Express Edition for Beginners CD

We would like to announce about we have downloaded “Video Series: SQL Server 2005 Express Edition for Beginners
So, for whom they like to take it, kindly, drop a comment! just to know the number of people, 3rd year students have higher priority as they study Microsoft SQL Server 2000
So, volunteers who will burn more CDs kindly, drop a comment!
Actually there are 5 CDs for anyone and 5 CDs for volunteers (who should copy at least one CD for other people)

.. more.

Announcement

Now you can access our blog through www.hasebat.com

Dr. Ayman Ezzat (Teaching Assistant in our faculty) has forwarded his domain www.hasebat.com to our blog. So now you can access our blog through this domain.

Many thanks to him.

Dr.Ayman's Web site: http://www.iplab.cs.tsukuba.ac.jp/~ayman/

.. more.

Tuesday, February 13, 2007

INotifyPropertyChanged

If you know it, do not go through. This article just points to the importance of INotifyPropertyChanged and how to use it in our real world.


Almost of us use OOP technique so GUI in place and objects in other. And frequently GUI should response to objects updates.


I do not know how many lines I should write to update GUI when a specific object updates if I do not use INotifyPropertyChanged



So, let’s demonstrate how to use it

1-using System.ComponentModel;

2-Let’s your specific class inherit from INotifyPropertyChanged interface and expose its member public event PropertyChangedEventHandler PropertyChanged


3-Create your function to fire the event.


4-In each property you need to be in synchronization with GUI in your class in its setter call the function you have created in point 3


After following my instruction I managed to write these lines:


using System.ComponentModel; //point 1

class Person:INotifyPropertyChanged //point 2

{


string name;

public string Name
{


get { return name; }


set { name = value;

OnPropertyChanged("Name");//point 4


}


}


protected void OnPropertyChanged(string property)//point 3

{

if (PropertyChanged != null)

{

PropertyChanged(this,new PropertyChangedEventArgs(property));
}


}

public event PropertyChangedEventHandler PropertyChanged;//point 2


So, whenever person name has changed I’ll know that.


I’ll write a function in the Form class that uses this event and responses to it.

Person p = new Person("FCI-H", 1);

nameTxt.Text = p.Name;

p.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(p_PropertyChanged);

void p_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs
e)

{

switch (e.PropertyName)

{

case "Name":

nameTxt.Text = p.Name;

break;
}

}

So, whenever person name changed, Form textbox (nameTxt) will have the recent value, without writing additional code


You can download the full and commented sample from here


.. more.

What's new in C# 3.0 ? Part 3

assume you want to make a fly variable(which i will use it once in my code) of complex type, all what i have to do is go to the solution explorer and add a new class for this type, by this way if i want to make 10 new types i will make 10 different class, but this is not the best solution so C# 3.0 came with the the best solution with the Anonymous Type.

now i don't have to write a class foreach type i wanna use, the compiler will do this for my :)
eg .. i want to make a new type which will hold my firstname , lastname and my age
it will be like this :-
var UserData = new {Fisrtname = "Mohamed", LastName = "Gamal" , age = 19 };

in the compilation time the compiler will generate a temp class for this type , the Members of this class is a Read\Write properties which inferred from the Object initializer (i will speak about it in another post isA ).
back to our example .. here the compiler will make 3 properties in this class, 2 of type string and the third of type int, the compiler can do this job during the compilation time depending on the initialization value.

by this way i don't have to generate classes for fly variables and this increases the code readability and save many lines of code to be written.


That’s it.
See you in the Next Part isA




.. more.

Singularity: A research OS written in C#

Yes, it's an OS written using managed code with C#.

Here are some videos that illustrate how this idea works and provides some demonstrations of it in action

Singularity: A research OS written in C#

Singularity Revisited

Singularity III : Revenge of the SIP

Singularity IV: Return of the UI

And here is the link i got the videos from it: channel9.msdn.com

This videos are part of a series called: Going Deep which contains many videos illustrating the Internals of Windows, Research projects as well as some future products.

Enjoy it :)

.. more.

Monday, February 12, 2007

Video Series: SQL Server 2005 Express Edition for Beginners

Getting Started with SQL Server Express

This video series is designed specifically for SQL Server beginners—individuals who are interested in learning the basics of how to create, manage, and connect to SQL Server Express databases. Whether you’re just a beginner or somewhat familiar with databases, these video lessons will help you get better acquainted with SQL Server 2005 Express.

Getting Started

The series includes almost 9 hours of video-based instruction that walks SQL Server beginners through the steps of learning about SQL Server databases to actually connecting a SQL Server database to a Web application. Select your starting point below based on your skill set.
Introduction
Learning Video 1: What is a database?
Designing Tables
Learning Video 2: Understanding Database Tables and Records
Learning Video 3: More about Column Data Types and Other Properties
Learning Video 4: Designing Relational Database Tables
Database Functions
Learning Video 5: Manipulating Database Data
Learning Video 6: More Structured Query Language
Learning Video 12: Creating and Using Stored Procedures
Learning Video 13: Enabling Full-Text Search in your Text Data
Creating and Using Reports
Learning Video 10: Getting Started with Reporting Services
Learning Video 11: Embedding, Packaging and Deploying SQL Server Express Reporting Services
Database Security
Learning Video 7: Understanding Security and Network Connectivity
Database Management
Learning Video 9: Using SQL Server Management Studio Express
Publishing to the Web
Learning Video 8: Connecting your Web Application to SQL Server 2005 Express Edition

For more information, here

.. more.

Data Normalization

Abstract:
After gathering required information from end-users who are going to use your application, you move to design database and you should spend sometime to design it well because any mistake in your design would cost you a lot of effort, money and time if your application built on it…

Introduction:
Data Normalization is the process of organizing information in your database to should be able to develop professional code to update and retrieve data efficiently and your code comes from a series of rules of standards called NORMAL FORMS

FIRST NORMAL FORM:
Let's execute that code [SELECT * FROM student] so the output is


It's definitely wrong as what about if I want to sort by Student's Last Name I have no way except writing functions to do this job and that's wrong

After modification solution is:
Let's execute that code [SELECT * FROM student] so the output is


So now it's very easy to make all operations I need to sort by any attribute and update and retrieve needed data

Let's execute that code [SELECT * FROM student] so the output is


Unquestionably very wrong to do that for many reasons first of them I can not count all students who take Microsoft SQL Server 2005 course second what about if a student intend to take another course you need to modify the schema or the design of the relation and never ever put yourself in a case according to it you may change your database schema, believe me if you did, you would be fired, assume well to design well…

After modification solution is:


Now I can count all students who take any specific course and also update data smoothly without any modification in database schema

So we can summarize FIRST NORMAL FORM as:

1- Each attribute in a relation should contain only one piece of information that you can care about.
2- And also each piece of in formation that you can care about should be contained in just ONE attribute.

SECOND NORMAL FORM:
It focuses on relation itself and its concepts are:

1- Database must be in FIRST NORMAL FORM.
2- Every attribute should be functionally dependant on the entire primary key.
3- Every relation should model just one entity, object or event.

Let's execute that code [SELECT * FROM student] so the output is



According to SECOND NORMAL FORM concept we see that relation violate SECOND
NORMAL FORM as CourseName dependant on to primary keys they are StudentID and
CourseID

After modification solution is to have two tables one for
StudentCourse and one for Course respectively as shown


Here, we divided first table to two tables to avoid violation of SECOND NORMAL FORM as in last table CourseName became just dependant on CourseID.

THIRD NORMAL FORM:
Let us show what the concepts of the THIRD NORMAL FORM

1- Database must be in SECOND NORMAL FORM.
2- The attributes in addition to be dependant on entire primary key it should not be dependant on another attributes.

3- Don't store any calculated or derived values, only store the raw data and use queries to perform calculations and looks up as needed.

Let's execute that code [SELECT * FROM Item] so the output is


Here, all attributes dependant on ItemID as it's the primary key of this table however the problem is in TotalCost as you see TotalCost is a calculated value result FROM multiplication of ItemCost by ItemQuantity and that's a violation of THIRD NORMAL FORM.

Conclusion:
As we saw applying normalization to our design is very easy and logical but also not applying it will cost us a lot and a lot, and while designing large database you will find some difficulty to achieve the equation that you must attain performance, normalization, efficiency, all end-users requirements and so forth so they are cases you should DENORMALIZE your design i.e. what about if end-user asked you to store calculated or derived values in this case if you didn't find solution you would be forced to say "Ok".

In the article I just mentioned 3 forms of NORMALIZATION and there are other forms like Boyce-Codd normal form – BCNF, Forth normal form - 4NF and fifth normal form - 5NF, may next article will mention them in details

.. more.

Saturday, February 10, 2007

Source Control and Team Development Part 4

See previous parts here

The Only Chapter


In the first meeting, you defined a set of features, classes, and functional tests. You got Class A and Class B. You go home. You start writing a set of unit tests for your features. You write a skeleton of your classes. Just empty functions that returns dummy values. You compile, it compiles fine. Now you Check-In your files to the Source Control Server; just a single click. Before the check-in starts, unit tests are run, of course non of them are passed; you only have skeleton classes. Now check-in is complete. You go to sleep.
Next day you wake up, open you PC, in your home. You click "Update" to get the latest version of other people source code. Then you continue developing your classes. You implement seven functions. You compile, test, and find that 30% of tests have been passed. You check-in your code with a message stating a description of the change.

After 3 days, you find that some previously-passed tests have failed. You browse the history of the class that have failed the test, you click a single button and you have a side-by-side view of the current file version and the last-working version. The changed lines are highlighted for you. You compare only 3 lines, and decide to change one of them, and viola: that test have been passed again. You check-in your code with a message stating the correction.

Now you go to the second failed test, you remember that you have made a change that corrected that before and that maybe you have removed that change forgetting what it was for. You perform a search of the check-in messages using the keyword you used for that change, you got the file version that has that bug corrected, the exact lines that you changed to fix that bug is highlighted for you. You fix the current version with that code, and here it is; the test have been passed. You check-in your code with a message saying that you re-fixed that bug again.

Someday you find something inside someone else's code that preventing your code from working. You fix it in his file. You check his file in with a message describing your change. When he checks-in his file with different changes, the server merges both of your files if you haven't modified the same lines. The server lets him know that he doesn't have the latest version and that a merge will happen, he previews the merge and approves it.

The big day has come. You sit together, you don't have anything to do. The project was already integrated each day, and all the tests have been passed, you just go to college and get the maximum grade and go home having 4 feelings:
1- I love programming
2- We CAN make things right
3- I WANT to make a much bigger project next time
4- "Weeee are the champions"

See:

Test-Driven Development
Source Control

Other team management stuff:

Scrum

Other development techniques:

Extreme Programming (XP)

Finally, this is all about Agile Software Development

Big thanks to the MDC 2007 ;)

.. more.

Source Control and Team Development Part 3

See part 1 here
See part 2 here

Chapter 7

Suddenly some remembers that he has the flash memory that they used to transfer the last working version of the file. He gets is and replaces the non-working file, compiles, runs, and there it is. It works now. Still it doesn't have the bugfix that they wanted to restore.

They accept that, and prepare to go to college, each one thinking how they are going to hide that bug from being noticed, or how they would convince the professor to have mercy on them if he noticed it.

Later that night, each one of them have four feelings:
1- I hate programming
2- We can never make anything right
3- I won't spend much effort in such project again
4- WE ARE LOSEEERS :'(

The End

So what we have here ??
We have people who lost self-confidence thus will never be able to make something big, not because they can't, but only because either they don't want to, or they believe they can't.

So, what's the solution ? What do these people who make big software do ? Can this scenario ever be different ??

"Yes, sure it can be different, those people are just idiots!" Says someone smartly "They could've named the folders better!!"

Well, there is indeed a different scenario. But it is not like that smart one said.
This scenario is MUCH shorter than the former. It even consists of only one chapter.

To be con... Ops, sorry, I mean see the next article :D



.. more.

Unit Test

Testing, testing, and testing, the most important phase especially in case working with group

So, testing anything before delivering it, is equal to develop it itself. And to avoid what
happens in teams refer to TeamDevelopment to know.

In this article, I’ll demonstrate the basic test that applied on functions in particular public functions and the called Unit Test. (Private functions will be the next)

Walk with me to test these simple functions:

public static int Add(int op1, int op2)
{
return op1 + op2;

}
public static int Subtract(int op1, int op2)
{
return op1 - op2;

}
public static int Multiply(int op1, int op2)
{
return op1 * op2;
}public static int Divide(int op1, int op2)
{
return op1 / op2;

}
static void Main(string[] args)
{
Console.WriteLine(
"Add: " + Add(5, 0));
Console.WriteLine(
"Subtract: " + Subtract(5, 0));
Console.WriteLine(
"Multiply: " + Multiply(5, 0));
Console.WriteLine(
"Divide: " + Divide(5, 0));
}

Good, but something waiting you

So, I’ll try and catch the Divide function to not get this error.


But till now I give up fatal error, what about logic error, should I write a program to test my function to by passing different parameters each time, yes, I should, what Unit Test actually do is that plus some information.

So, in our Math library, right click on any public method then select Create Unit tests, a cute dialog appeared in tree mode (Project, namespace, Class, Members, Methods) we then select Divide method to apply unit test on it, NOO, do not press Ok, we almost done, below output project: select create a new visual C# test project, enter a name for this unit test project say, DivideMethodUnitTest.

Going to Solution Explorer, we notice a new project has been added, yes, it’s DivideMethodUnitTest test project. It contains a class called [YourClassNameTest]
open it

[TestMethod()]

public void DivideTest(){//some code}

It generates a method to test Divide method, and some code, we going to put our
edits

int op1 = 5; // TODO: Initialize to an appropriate value
int op2 = 0; // TODO: Initialize to an appropriate value

int expected = 0;
int actual;
actual = UnitTestSample.Math.Divide(op1, op2);


Right click on DivideMethodUnitTest test project and select Set as startUp project, Ctr + F5 Test result window opened to inform me that the test has been faild : double click on failed it opens new windows contains some information about what has happened

Error Message:
Test method DivideMethodUnitTest.MathTest.DivideTest threw exception: System. DivideByZeroException: Attempted to divide by zero..

So, what should I do now is to catch this error, after that I’ll go to retest Divide method, and Comment Assert.Inconclusive(“A method…..”);


int op1 = 5; // TODO: Initialize to an appropriate value
int op2 = 0; // TODO: Initialize to an appropriate value
int expected = 0;
int actual;
actual = UnitTestSample.Math.Divide(op1, op2);

Congrats, your test window tells you Passed, double click on passed, it tells you Standard Console Output: Attempted to divide by zero

By passing more parameters I can get the logic error and the unit test informs me about that
int op1 = 5; // TODO: Initialize to an appropriate value
int op2 = 1; // TODO: Initialize to an appropriate value
int expected = 2;
int actual;
actual = UnitTestSample.Math.Divide(op1, op2);

Again, the test has been failed double click on failed it opens new windows contains some
information about what has happened


Error Message:
Assert.AreEqual failed. Expected:<2>, Actual:<5>. UnitTestSample.Math.Divide did not return the expected value.

So, give the right op1, op2, and expected values, to check for logic error

.. more.

Friday, February 09, 2007

What's new in C# 3.0 ? Part 2

Consider the following , iam working in a project and i made a class and i made a simple method inside this class after small period i wanted to modify or add something in this method all what i have to do just back to the code of this function and modify its code , this is good

but what if this Method was in dll or was in a sealed class or i wanted to add method in a class of the primitive data types ? what can i do ?? the Extension Method was the Solution.

eg.. i want to add a small Method to the string type which return the second word in a given string
it will be like this

static class beta
{
public static string GetSecondWord(this string input)
{
string y="";
int count = 0;
bool flag = false ;
foreach (char c in input)
{
if (c == ' ')
{
flag = true;
count++;
}
if (flag == true && count == 1)
{
if( c != ' ')
y += c;

}
}
return y;
}
}


Notes :
  1. Make sure that the class is static
  2. Add this keyword before the type of the argument you want to extend.
so now you can write this code,

string x = "some string value";
string y = x.GetSecondWord();
That’s it.
See you in the Next Part isA


.. more.