This blog is subject the DISCLAIMER below.

Monday, October 27, 2008

New .NET Logos announced.

Microsoft announced last friday the new .Net logos.


Source :-
http://blogs.msdn.com/chkoenig/archive/2008/10/24/new-net-logos-announced-today.aspx

.. more.

Sunday, October 19, 2008

dotNetWork.org 8th gathering



Date:

Saturday, October 25th 2008,
12:00 - 16:00

Attendance is FREE =)

Note:
Again (like the last gathering), we are having 2 parallel tracks, but this time we have 5 sessions presented by 5 speakers.. Waiting for your feed-back about that..

Speakers

Ahmed Sidky
Director of Business Technology - X2A Consulting.

Ahmed Bahaa
Principal Technical consultant - CompuPharaohs.

Mohamed Samy
Technical Architect - ITWorx.

Mostafa ElBrarbary
Software Engineer - ITS.

Mohamed Bahaa
CompuPharaohs.

Agenda


12:00 - 13:30
Introduction To Agile Development
by Ahmed Sidky.
14:00 - 15:30
Use cases and requirement analysis
by Mostafa ElBarbary.
12:00 - 13:00
VSTS (Part 1)
by Ahmed Bahaa.
13:30 - 14:30
VSTS (Part 2)
by Mohamed Samy.
15:00 - 16:00
VSTS (Part 3)
by Mohamed Bahaa.


Location:

Canadian International College, @ "El-Tagamo3 El-5ames"

Buses will be available at: Nady El-Sekka (11:00 AM - 11:30 AM)
Please be there before 11:30 coz we will leave on time..


For those who wanna keep tuned with further news about this event & other upcoming events of the dotnetwork.org user group, please check the following links:

Yahoo!Group:
http://tech.groups.yahoo.com/group/dotnetworkorg/

Facebook Event:
http://www.facebook.com/event.php?eid=36111496329
You'd better join the above event if you have a facebook account so we can roughly estimate the attendees count..

Facebook Fan Page:
http://www.facebook.com/pages/netWorkorg/13135685545

Facebook Group:
http://www.facebook.com/group.php?gid=2409268236

.. more.

Sunday, October 12, 2008

Learning Jakarta Struts Project


Struts

The Jakarta Struts Project

The Jakarta Struts project, is an open−source project sponsored by the Apache Software Foundation. The Struts project was designed for creating Web applications that easily separate the presentation layer and allow it to be abstracted from the transaction/data Layers.

Model View Controller

Model : Represents the data objects. The Model is what is being manipulated and presented to the user.

View : Serves as the screen representation of the Model. It is the object that presents the current state of the data objects.

Controller : Defines the interaction between the view and the model .

The MVC (Model-View-Controller) model 2 :

all the views connect to one controller (Servlet) and this servlet works as a dispatcher where it handle all the requests and do whatever it needs in the business layer (Model).

What is Struts?

Struts is a web application framework to force

the user to follow the MVC models.
Struts don't cover the business layer at all (Model)
It concerned only with the controller.
Also Struts support a tag library for the
presentation layer.


life Cycle :

Create new class for each transaction (will call it an action
this class extends Action Class(in Struts Api) and override execute() to handle the business login which this action will perform.
then add struts-config.xml and define each action with his properties in action element.
in web.xml we define the ActionServlet (provided by struts).

How Struts works

· When you Browse http://....../login.do

· The server check web.xml and found the servlet (ActionServlet)

· Then check the actions in struts-config.xml and found this action associated with specific action class.

· The action class Perform the code in execute() and return ActionForward

· ActionForward will give the result url

Struts Main Components:

ActionServlet : The role of the controller.

Action Mapping :

· tells the ActionServlet each request associated with specific Action.

· In Struts-Config.xml you type the element and this translated to java interface called ActionMapping.

Struts-Config.xml

· Three important elements in Struts-Config.xml
{form-bean, ActionMapping , global-forward }


To Be Continued….

.. more.

Tuesday, September 30, 2008

Monday, September 29, 2008

Wine -- Windows Applications On Linux

Wine is a program that runs MS Windows applications on Unix-based systems by providing a compatibility layer by implementing some of the Windows APIs and wrapping the others to call native Unix functions, X server, and OpenGL. Wine implementation is all in userland (outside the kernel and doesn't need special privileges)[1].

Wine was originally short of WINdows Emulator, but I a am not sure about if that's still the case. "Wine" is originally a recursive acronym "Wine Is Not an Emulator"[A]. (Update) Wine is more of a compatibility layer than of an emulator. An emulator usually emulates hardware, like a Playstation emulator (offtopic: I know a good one called pSX).

Wine doesn't only implement Windows system calls, but also most of the DLLs that comes with
Windows. Most notably DirectX (which is one of the top reasons to use Wine; playing Windows games on Linux). If you are a windows license owner you can use some of the native Windows DLLs instead (but others can't be used).

ReactOS[8] is to Windows as Linux is to Unix. A free and open source alternative. It uses Wine code. Several other commercial projects uses Wine too, like TransGaming Cedega and CodeWeavers CrossOver (and others). The former is a fork of Wine specially for gaming, they do NOT send their patches to the main-stream Wine. The latter is both a general-purpose and gaming-purpose dedicated development for Wine. Unlike the former, the latter sends it patches instantly to the main-stream Wine. It relies mostly on support for profit (as for what I understood).

Google have paid CodeWeavers to make Wine able to run Photoshop CS 2 on Linux[2]. CodeWeavers also have acted quickly to to make Wine able to run Google Chrome on Linux, and they made it in 11 days[3]. Google has actively encouraged Wine development through their interns [4] and through student participation during the Summer Of Code 2008 [5].

The only Microsoft acknowledgment about Wine, is to state it is not Genuine Windows and therefore deprived from Windows Genuine Advantage (some downloads). [6] Generously, Microsoft still allows some updates, like Office updates to Wine users. [same source]. (See [7] for instructions how to install Office 2003 on Linux.)

Wine is not small at all. WINE 1.0 have over 1.8 million lines of C code (with blank lines and comments), ~300,000 of which are tests, and ~87000 are related to Direct3D (a subset of DirectX) implementation[original research]. I am not sure how big is the Micorsoft Subsystem for Unix-based Applications (SUA)[9](*1), but I am sure it is much less. That's because what a Unix program assumes to find in a system is much less that what a Windows application assumes to find (which are thousands of Windows APIs[10]).

(Update)
Due to the large amount Wine has to implement, it doesn't implement all of the Windows APIs yet. A program that depends on an unimplemented API might not function correctly. Wine developers try to implement high-priority APIs first. Those are the ones used by the most popular applications. (For a list of which programs are compatible with Wine check Wine AppDB[11])

(Update)
Wine have been in development for more than 16 years (since 1992); even before Linux was born[12]. Wine's still not complete, because it faces the problem with catching up with more recent Windows systems. For example (not saying that this have actually happened), when they completely supported Windows 95 applications, they were struck by XP, and then XP SP 1 and Windows 2000 (just an example, I know there are several editions in the middle). Wine development is indeed much slower than the real development pace of the real Windows (thousands of organized developers vs. hundreds of random contributers - ~700 have contributed to Wine somehow [12]).

(*1)
Wine is binary compatibility layer, which means the binary executable can be executed both on Windows and Linux without modifications. While MS SUA is source compatibility layer, which means the same program will have two executables, compiled differently, but from the same source, in order to run on both platforms.

Wine's web page: http://winehq.org/ .

Other references and links:

[1] Linux Unified Kernel is a project to implement Windows system calls (only, not the entire set of APIs) natively in Linux kernel.
[2] http://apcmag.com/google_behind_photoshops_new_linux_compatibility.htm
[3] http://www.heise-online.co.uk/news/CodeWeavers-bring-Chrome-to-Mac-and-Linux--/111535
[4] http://code.google.com/opensource/wine.html
[5] http://wiki.winehq.org/SummerOfCode
[6] http://www.microsoft.com/genuine/downloads/faq.aspx
[7] http://www.wine-reviews.net/microsoft/running-ms-office-2003-under-linux-with-wine-0952.html
[8] http://www.reactos.org/en/index.html
[9] http://mohnabil.blogspot.com/2008/09/microsoft-subsystem-for-unix-based.html
[10] Unlike Windows system calls (http://www.metasploit.com/users/opcode/syscalls.html), which are less than 400 in Windows Vista, the entire set of the windows APIs are much more (http://www.codase.com/windows.html)
[11] http://appdb.winehq.org/
[12] http://www.winehq.org/site/history
[A] http://wiki.winehq.org/FAQ?action=recall&rev=217#head-8b4fbbe473bd0d51d936bcf298f5b7f0e8d25f2e

.. more.

Saturday, September 20, 2008

Iterative Development – there is a simpler way to work - Part II (finale)

NOTE: This text (part I and part II) is just an introduction to the existence of an alternative, not a guide to use that alternative.

Because I -personally- believe that an example is worth a thousand words, I will tell you my personal experience with iterative development; the story of our graduation project. We only tried iterative development when other ways failed.

Our graduation project was a clustered server for massive multiplayer online games. The entire period for the project to come out was approximately 10 months, overlapping an academic year.

We've spent almost 9 months of them in the design phase; the project turned out to be very big and needed some research and novel techniques. For 5-members team who doesn't know anything about clustering we needed that much time.

Anyways, having only one month left to hand the project, there was no single line of code. We thought that we already have an exhaustive list of classes and functions and it's only a matter of implementation.

Trying to implement the classes we designed, we had no idea how to start, and just -exactly- after 4 functions we totally lost contact with the design and didn't know how to proceed. We were overwhelmed by the complexity and inter-dependencies between modules that it was NOT possible to see anything running before at least thousands of lines of code, which will need even more time to fix (cuz they were not tested).

That seemed inappropriate for the 1-month due time. Our main problem was the inter-dependencies of the modules. That's where iterative development kicked in. (Note that changes in the server and the game affect each others so they have to be done according to each-other step by step).

You will notice in the following sequence that at any point of time we could
A. Hand something that worked, not complete, but works.
B. Features are added incrementally. That means at the dead line we will have N features working, compared to a complete set of features that doesn't work at all.

1- The ping server
The first thing we did is to implement a simple server and test if the game (which was not practically a game then :D) can connect and exchange messages with it. - day 1

2- Simple actions
Then we implemented simple actions to make the game work and players interact - the server is not clustered and there is no state persistence or anything. - day 3
(Starting from here, the server development and game development was going in parallel)

A. Server development

3- Splitting the server
After that we implemented a simple layer above Java Remote Method Invocation (RMI) to be able to split the server on the set of computers in the clusters, and to make debugging easier (that layer could be disabled to run the whole server on a single machine). - day 9

4- Persisting the state
Also, we've developed something we called Object Store to provide transparent persistence using aspect oriented programming. - day 26

5- Work that was not complete until we handed the project
Proper Object Store synchronization between several machines, database replication, security checks, traffic control and traffic load balancing, server peer to peer load balancing, distributed administration.

B. Game development

3- Adding a few actions each day to extend the things the player can do. First walking, then attacking, then riding a car etc. (That's very simple view, the actual actions are numerous and much more complicated than that). - Until we handed the project

Conclusion:
Using iterative development, we've faced the overwhelm we had from the extreme complexity and actually delivered something that was working and people can actually play and enjoy. Compared to waterfall model, nothing would have been delivered in the deadline, and there would have been an implementation paralysis, and an elongated testing phase which might require lots of parts to be reimplemented too.

It's like splitting a big project into smaller projects with limited set of features, and doing that over and over until it's enough or you meet the deadline.

Pros:
Early feedback
More visibility, for the developer and for the client, the client can make changes early (cuz client don't know what they want !
Can deliver at any point of time

Cons:
Adding new features later can result in modifying existing code or removing it, which is the cost tradeoff of using iterative development

.. more.

Tuesday, September 16, 2008

Fun: Linux sudo command

I think it might be nice to send something funny every now and then.

.. more.

Wednesday, August 27, 2008

IoC (Inversion Of Control) and Dependency injection (DI)


Introduction:

Lots of us hear this word and also hear that this container is using IoC (inversion of control) so what is it all about and what does this mean? we will be working using Spring IoC through this article so lets start by checking the formal definition of the Dependency injection:“Dependency injection (DI) in Computer programming refers to the process of supplying an external dependency to a software component. It is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency.”Ho ho sounds little bit confusing, so lets make it more simple so first we need to know what is IoC and what is DI .Well we can say that IoC is a generic term and the DI is a more specific term so this mean that Dependency injection is more specific term than the IoC but still don't understand the IoC thing.


Life Without IoC and DI

In a standard component container,the component themselves ask the container for the resources they want for example lets check this segment of code (which you can find in most of EE application):

Context context=new InitialContext();
DataSoruce dataSource=(DataSource)context.lookup("jdbc/TestingDS");
Connection connection=dataSource.getConnection("yourUser","yourPassword");
Statement statement=connection.CreateStatment();
ResultSet results=statement.executeQuery("select * from users");
.
.
. //i didnt include all the code just the important thing

so in the above code we just initialize a context (JNDI)
and perform a lookup for a resource bounded at jdbc/TestingDS and then get the results and cast it as a DataSource after that we use it and continue with our processing.

oh yea so every time i want to do so i will have to make the lookup thingy to get the data source or any resource i might need.
mmm so i will keep asking my container to give me what i want? yup you will.
well lets see how would the container and the component interact with each other (without IOC)

A Day in the Container's Life !

Component: Hi Mr.Container.
Container:Hi Component.

Component:how is your day?
Container :oh i have been busy serving all other components and don't have time for myself :( .

Component:oh poor you Mr.Component.
Container:ahh what can i do this is my job :) , so how can i serve you ?
Component :oh yea i forgot , i want to you to serve me the resource bounded at bla bla bla
Container:ok sure no problem, just a min. here you are (hehehe now we got what we want :D )
Component:oh many thanks MR.Container, have a nice day.
Container:you too component bye.

so in here as we can see the component keeps asking the container to provide the needed resources.

Hollywood and IoC:

IoC as most of people say it apples Hollywood principle which is :

Component: Hello Mr.Container !Container :don't call Me, I will call you.TEET TEET TEET (the container hanged the phone :S )
Component : Shocked :|

This is what they call: don't call us , we will call you principle.

yup it is what you are thinking in , yes the container will take control over the resources for the
component but without involving the component in that, in other words the control of the resource will be inverted from component to container and its configuration(through XML as most of people do and as i do)


Life With IoC:


what if we want to apply IoC on the previous example?

Ok, so we will just need to modify some stuff (adding a property for the DataSource and also using spring framework)

//class that contains the code for spring IOC
private DataSource dataSource;

public void setDataSource(DataSource ds)
{
dataSource=da;
}

public static void man(String[] args)
{
//so now dataSource is set by Spring IOC
Connection connection=dataSource.getConnection("yourUser","yourPassword");
Statement statement=connection.CreateStatment();
ResultSet results=statement.executeQuery("select * from users");
. . . //i didnt include all the code just the important thing
}

//segments from XML configuration file

<%bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<%property name="driverClassName" value="youDriverClassName" />

<%property name="url" value="DBUrl" />

<%property name="username" value="yourUsername" />

<%property name="password" value="youPassword" />

<%bean name"ourComponent" class="com.springIoC.IoCTesting">

<%property name="dataSource" ref="dataSource">

<%/bean>


as we can see in the above XML we just stated that we have a bean from class bla bla which has a property named dataSource so spring IoC will just think like that :

mmm (spring IoC thinking...)
oh yea i have a bean named ourComponent .
wait a minute this bean have a property named dataSource! .
this property refers to another bean named dataSource which have some property (url,username,password,driverclassname) .
oh great so now what i need to do is inject this bean property (data source property in the ourComponent ) with the Datasource ,TA DA now it is done.

so we can see here that we didn't make any lookup , so there is zero times component did ask the container about the DataSource.
in this case the control over deciding which DataSource to use is in the container not the component so once the container gets a DataSource it will pass it to the component by calling the setter (SetDataSource).when spring IoC container loads at runtime it will inject the dependency into our component (this is done at runtime by XML configuration as we can see above) so the Data Source will be injected into ourComponent and now we can make anything with this data source (with zero component to container call).

below is a diagram that shows the interaction in case we are using IoC or non IoC Container.

in the first we can see that the component ask the container to provide the resource it need (data source in our case ) but in the second image the container creates and inject the resource into the component































Types Of Injection:
We have seen in the previous sample that spring do the injection through setter (property) thats one way of injection , another way it to inject through the constructor (which spring also support)
this mean that i can inject all resource in the component through a constructor (and that constructor takes all the needed resource through arguments supplied)


so now we know what is Dependency injection and also the IoC concept , there are also some IoC containers other than spring IoC container for example :Pico container and also Avalon framework.

my Blog

.. more.

Monday, August 25, 2008

Playlist creation Mobile App in Python !

This is a simple program i have made for my mobile phone (Nokia N70).

To cut a long story short, i have a a 1GB memory card more than half of them are mp3's, and i wanted a simple program to organize them (Playlist for each folder). At the same time, i wanted to play with something new and non-usual ( ! J2ME), i wanted to write it in python :) , and it turned out to be very easy.



  • At first i needed to install the suitable python runtime for my phone, and found this link (provides some information about your device, including the development platform). Then i had to download it from here . You just need to install it on your cell phone just as any other program.

  • Then i wrote the program in python and tested it on my Ubuntu PC and here is the code. I forgot to mention that playlist files have a ".m3u" extension and are only a text file containing a list of mp3(|| m4a) files separated by a new line character.


    import os
    import sys

    # Test folder
    searchDirectory="/media/sda6/Songs/fdsfsd"

    if not os.path.isdir ( searchDirectory ) :
    print searchDirectory + " is not a directory."
    sys.exit ( 0 )

    m3uFilename = os.path.split ( searchDirectory )[1] + '.m3u'

    # Get all files.
    dirList=os.listdir(searchDirectory)

    fileList = []

    # Get mp3 or m4a files only.
    for fname in dirList:
    if fname.lower().endswith ( '.mp3' ) or fname.lower().endswith ( '.m4a' ) :
    fileList.append ( fname )

    # Begin : Generate the m3u file.
    m3uFile = open( searchDirectory + os.path.normcase('/') + m3uFilename ,'w')

    filesAdded = 0

    for aFile in fileList:
    print 'Adding ' + aFile
    m3uFile.write ( aFile + '\n' )
    filesAdded = filesAdded + 1

    print 'Files Added : ' + str ( filesAdded )

    m3uFile.close()
    # End : Generate the m3u file.

  • Third, I needed a simple control to select the files visually, after a 5 minute googling i found this fileselector control. and I needed to add only two extra lines of code :D , Those -->

    import fileselector
    searchDirectory = fileselector.fileselect()

  • Fourth, Put them on a folder on your memory card, then from your cell phone install fileselector.py (remember you got it from the third step) and install it as a python lib, and install m3ucreator as a script. Then run python on your phone, select options --> Run Script and you will find it as my\m3ucreator.py . When you run it the file selector should open, after you select your folder it will report how many files are added to the playlist. And when you open Nokia Music Manager the next time, you will find it in the list of playlists.

  • Fifth, There is no fifth step :) . I just want to note that there is no code changes from the desktop version except in the folder selection (THIS IS GREAT) . Here is the code listing

    import os
    import sys

    # Begin : Mobile Specific Code.
    import fileselector
    searchDirectory = fileselector.fileselect()
    # End : Mobile Specific Code.

    if not os.path.isdir ( searchDirectory ) :
    print searchDirectory + " is not a directory."
    sys.exit ( 0 )

    m3uFilename = os.path.split ( searchDirectory )[1] + '.m3u'

    # Get all files.
    dirList=os.listdir(searchDirectory)

    fileList = []

    # Get mp3 or m4a files only.
    for fname in dirList:
    if fname.lower().endswith ( '.mp3' ) or fname.lower().endswith ( '.m4a' ) :
    fileList.append ( fname )

    # Begin : Generate the m3u file.
    m3uFile = open( searchDirectory + os.path.normcase('/') + m3uFilename ,'w')

    filesAdded = 0

    for aFile in fileList:
    print 'Adding ' + aFile
    m3uFile.write ( aFile + '\n' )
    filesAdded = filesAdded + 1

    print 'Files Added : ' + str ( filesAdded )

    m3uFile.close()
    # End : Generate the m3u file.

    Enjoy it :)
Note that the code is not displayed properly here. Python code blocks depend on indentation.

.. more.

Introduction To WAP


Introduction:
Through this topic we will work together to understand Technology of Wireless Application Protocol (WAP), also we will take a fast tour about developing WAP Applications using ASP.net.

Technology Description:

Mobile Application :
When First Mobile arrived, it was only smart way for sending and receiving voice calls and after sometime for sending and receiving text messages. But now, it is become the most growing market for services and recreational purposes. It is also being used for accessing internet and multimedia world.

For this reason, a lot of developing and programming concepts changed to become compatible with mobile world, one of these concepts was WAP as a mobile alternative of WEB concepts for regular computers.

What is WAP ؟

From Wikipedia, WAP is an open international standard for application layer network communications in a wireless communication environment. Its main use is to enable access to the Internet (HTTP) from a mobile phone or PDA.

How it Work ؟

The Biggest different between WAP and WEB is that WAP able to work through less capabilities and slow speed in comapre with the configuration of regular computers.

WAP starts since an order come from mobile customer, it is convert HTML page to WML pages that is able to browsing through mobiles.

What is WML ؟

It is description language very similar to HTML tags, it have only some few different:

- The main Tag is <wml> instead of <html>.

- Documents splits to <card></cards>.


Introduction To WML:

This is sample from Wiki about WML document:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"
http://www.phone.com/dtd/wml11.dtd" >
<wml>
   <card id="main" title="First Card">
     <p mode="wrap">This is a sample WML page.</p>
</card>
</wml>

Reading and Writing Variables in WML:

<setvar name="First_Name" value="Ahmed"/>
<setvar name="Age" value="21"/>

Later you can display it like that:

<p>First Name: $(First_Name)</p>

You can also read textbox value with the same way:

<card id="card1" title="Tutorial">
<do type="accept" label="Answer">
<go href="#card2"/>
</do>
<p>
<select name="name">
<option value="HTML">HTML Tutorial</option>
<option value="XML">XML Tutorial</option>
<option value="WAP">WAP Tutorial</option>
</select>
</p>
</card>
<card id="card2" title="Answer">
<p>
You selected: $(name)
</p>
</card>
</wml>

ASP.net Application using WAP:

Do you remember our first WAP Application in this topic?

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"
http://www.phone.com/dtd/wml11.dtd" >
<wml>
   <card id="main" title="First Card">
     <p mode="wrap">This is a sample WML page.</p>
</card>
</wml>

If you want to use it through ASP.net, you have to convert it to something like that:

<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %>
<%@ Register TagPrefix="mobile" Namespace="System.Mobile.UI" %>
<mobile:Form runat="server">
<mobile:Label runat="server">
This is a sample WML page.
</mobile:Label>
</Mobile:Form>

If you want to work through VB.net instead of C#, just modify the first line like that:

<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %>


And now, if your web site ordered from PC, the response will contain HTML tags, if it is ordered from Mobile, the response will contains WML tags.

.. more.

Forth Arabic Wikipedia Day

.. more.

Sunday, August 24, 2008

.NET Framework 3.5 Service Pack 1 has been released

ASP.NET in the .NET Framework 3.5 Service Pack 1 release includes numerous bug fixes. In addition, it includes features for the following:

  • Enabling high-productivity data scenarios by using ASP.NET Dynamic Data.
  • Supporting the browser navigation in ASP.NET AJAX applications by using ASP.NET AJAX browser history.
  • Increasing the download speed for ASP.NET applications by using ASP.NET AJAX script combining.
More about .NET Framework 3.5 Service Pack 1, Press Here

.. more.

Expression Blend

 

When WPF - the new .net technology- arrived, Microsoft try to provide some tools makes life easy to WPF Developers, one of this tools was Expression Blend, we will try to show some features about it in this topic.

Try to download it form Microsoft web site, then run it and choose new Project - WPF Application (*.exe):

 

You can now choose your name, folder and .net language you want.

Click View-Active Document View then click split view to show both code and design view:

 

In the left side, you will find all tools you need for your design including painting tools such as brushs and pens. You can find also .net components such as commandbuttons. You can also click the link to more item to show all tools:

While you are painting, you will find additional properties for each tool in the right side:

Example:

Add new <canvas>, this will the container of our picture for this example:

<Canvas>
<Canvas x:Name="MainImageCanvas" Canvas.Left="40" Canvas.Top="120">

Add new MediaElement to add a picture:

<MediaElement x:Name="MainImage" Source="c:/example/futex.jpg" Width="300" Height="300" ></MediaElement>

Now we will apply some effects through properties, this is an example of code results from some operations:

<Canvas.RenderTransform><TransformGroup>
<SkewTransform x:Name="MainSkewTransform" AngleY="-19" AngleX="0" CenterX="0" CenterY="0"/> <ScaleTransform x:Name="MainScaleTransform" ScaleY="1" ScaleX = "1" CenterX="0" CenterY="0"/></TransformGroup> </Canvas.RenderTransform></Canvas>

Press F5 now, this is a snap shot of expected results:

Now we will try to apply some shadow to the picture, so we will add <canvas> for a new picture object refer to the same file with new transformation parameters to make the second picture seems to be a shadow:

<Canvas x:Name="ReflectionImageCanvas" Canvas.Left="260" Canvas.Top="640">

<MediaElement x:Name="ReflImage" Source="c:/example/futex.jpg" Width="300" Height="300" Volume="0">

</MediaElement>

<Canvas.RenderTransform>

<TransformGroup>

<SkewTransform x:Name="ReflectionSkewTransform" AngleY="19" AngleX="-41" CenterX="0" CenterY="0" />

<ScaleTransform x:Name="ReflectionScaleTransform" ScaleY="-1" ScaleX="1" CenterX="0" CenterY="0" />

</TransformGroup>

</Canvas.RenderTransform>

</Canvas>

Previous Code Result:

Last topic in this lesson is to add some transparent to the shadow of picture through opacity property, the result XAML maybe like that:

<Canvas x:Name="ReflectionImageCanvas" Canvas.Left="260" Canvas.Top="640">

<MediaElement x:Name="ReflImage" Source="c:/example/futex.jpg" Width="300" Height="300" Volume="0">

</MediaElement>

<Canvas.RenderTransform>

<TransformGroup>

<SkewTransform x:Name="ReflectionSkewTransform" AngleY="19" AngleX="-41" CenterX="0" CenterY="0" />

<ScaleTransform x:Name="ReflectionScaleTransform" ScaleY="-1" ScaleX="1" CenterX="0" CenterY="0" />

</TransformGroup>

</Canvas.RenderTransform>

<Canvas.OpacityMask>

<LinearGradientBrush StartPoint="0.5,0.0" EndPoint="0.5,1.0">

<GradientStop Offset="0.345" Color="#00000000" x:Name="ReflGradientStop1" />

<GradientStop Offset="1.0" Color="#CC000000" x:Name="ReflGradientStop2" />

</LinearGradientBrush>

</Canvas.OpacityMask>

</Canvas>

Now, you have to try to edit the position of shadow by changing top and left manually, the result must be something like that:

Full XAML Code:

<Canvas>
            <Canvas x:Name="MainImageCanvas" Canvas.Left="40" Canvas.Top="120">

                <MediaElement x:Name="MainImage" Source="c:/example/FUTEX.JPG" Width="300" Height="300" >
                </MediaElement>
                <Canvas.RenderTransform>
                    <TransformGroup>
                        <SkewTransform x:Name="MainSkewTransform" AngleY="-19" AngleX="0" CenterX="0" CenterY="0"/>
                        <ScaleTransform x:Name="MainScaleTransform" ScaleY="1" ScaleX = "1" CenterX="0" CenterY="0"/>
                    </TransformGroup>
                </Canvas.RenderTransform>
            </Canvas>
            <Canvas x:Name="ReflectionImageCanvas" Canvas.Left="267" Canvas.Top="645">
                <MediaElement x:Name="ReflImage" Source="c:/example/futex.jpg" Width="300" Height="300" Volume="0">
                </MediaElement>
                <Canvas.RenderTransform>
                    <TransformGroup>
                        <SkewTransform x:Name="ReflectionSkewTransform" AngleY="19" AngleX="-41" CenterX="0" CenterY="0" />
                        <ScaleTransform x:Name="ReflectionScaleTransform" ScaleY="-1" ScaleX="1" CenterX="0" CenterY="0" />
                    </TransformGroup>
                </Canvas.RenderTransform>
                <Canvas.OpacityMask>
                    <LinearGradientBrush StartPoint="0.5,0.0" EndPoint="0.5,1.0">
                        <GradientStop Offset="0.345" Color="#00000000" x:Name="ReflGradientStop1" />
                        <GradientStop Offset="1.0" Color="#CC000000" x:Name="ReflGradientStop2" />
                    </LinearGradientBrush>
                </Canvas.OpacityMask>
            </Canvas>
        </Canvas>

 

Don't forget that MediaElement can accept any type of media, try to attach video and see the result.

Anyway, you can copy this XAML code to a WPF .net solution and the same result will apply to your form.

.. more.

Friday, August 22, 2008

dotNetWork.org 7th gathering


Date:
Saturday, August 30th 2008,
12:00 - 16:00

Attendance is FREE =)

Note: This time we are having 2 parallel tracks, that's 4 sessions presented by 3 speakers.. Waiting for your feed-back about that..

Speakers


Mohamed Ahmed Meligy
Senior Software Engineer - SilverKey Technologies Egypt.

Tamer Mohammad Fathy AL-Khouly
Information Specialist - EDS.

Mohammad Yousri El-Farsi
Senior Software Engineer - ITWorx.

Agenda
12:00 - 13:30:
Design Patterns via C# 3 (Part 1)
by Mohamed Ahmed Meligy.

Tec-Talk Wiz BizTalk (Part 1)
by Tamer Mohammad Fathy AL-Khouly,
Mohammad Yousri El-Farsi.


13:30 - 14:00: Break

14:00 - 15:30:
Design Patterns via C# 3 (Part 2)
by Mohamed Ahmed Meligy.

Tec-Talk Wiz BizTalk (Part 2)
by Tamer Mohammad Fathy AL-Khouly,
Mohammad Yousri El-Farsi.

Location:

Canadian International College, @ "El-Tagamo3 El-5ames"

Buses will be available at: Nady El-Sekka (11:00 AM - 11:30 AM)
Please be there before 11:30 coz we will leave on time..


For those who wanna keep tuned with further news about this event & other upcoming events of the dotnetwork.org user group, please check the following links:

Yahoo!Group:
http://tech.groups.yahoo.com/group/dotnetworkorg/

Facebook Event:
http://www.new.facebook.com/event.php?eid=29202125063
You'd better join the above event if you have a facebook account so we can roughly estimate the attendees count..

Facebook Fan Page:
http://www.facebook.com/pages/netWorkorg/13135685545

Facebook Group:
http://www.facebook.com/group.php?gid=2409268236

Please don't hesitate to contact me if you have any further questions..
See u on the gathering ;)

.. more.

Tuesday, August 19, 2008

When database log file increases incredibly?

Working as DBA, I face problems daily and for the importance of the organization I work for; problems should be solved immediately.  past days I had log file which its size exceeds 70 GB unreasonably... I've low disk space problem, clients access this database denied from doing any operation since log file can't allocate more free space on storage area, really all solutions weren't applied due to some restrictions, one of the solutions is to copy data from this database and transmit it to another database (which you can control  log file growth) this solutions failed because SQL Server needs the new database has a log file its size like the old one aka 70 GB!!!!!

Another is to detach the database and trying attaching it without log file, fails also, since log file not exists.

While searching on this problem I've found someone has big size log file asks this question and I found the solution is to create a new database from the .mdf file of the old one and you shouldn't put the .ldf (log file(s)) besides. because SQL Server searching for the .ldf and if it didn't it creates another one with small size. and now old log file isn't belong to new created database and you can delete it and save more space :)

Code to create database from .mdf file

sql code

.. more.

Friday, August 15, 2008

How to use dataset and adapters with stored procedures?

Q: How to use dataset and adapters with stored procedures?

A: I've asked this question two times today, and for that I thought to do a post and send the link better to answer everyone separately..

Right now, I've be_settings table, its schema (SettingName nvarchar(50) and SettingValue nvarchar(MAX)) what I need is to create stored procedure to get SettingName and SettingValue when the SettingValue = some value

SP  

then let's go to Visual Studio and create windows application and drop DataGridView on the form; press on the smart arow located on its top right, new dialog appears, choose to add new data source->Add project data source->Database

dataconnection

next->next->

databaseobjects

then finish...

Your form should look like

after choosing datasource

in Load data onClick event handler, write this code

code to load data

Just, Ctr + F5 and lets test our work

result

Hope, I answered your question ",)

Tip: if you using Windows Vista you need to run Visual Studio and SQL Server as administrator....

.. more.

Friday, August 08, 2008

Iterative Development – there is a simpler way to work - Part I

NOTE: This text (part I and part II) is just an introduction to the existence of an alternative, not a guide to use that alternative.

Probably the only way you know when you want to start a new project (for college for example), is the famous Waterfall mode. That's (Planning,Analysis,Design,Implementation,Testing).
When ever you get a project idea that you like and want to start in, your first thought is to gather all your team* to start doing the analysis.

You would probably be happy when you finish your analysis document(s). But now you want to do the design (most probably you understand design as "UML Class Diagram" only).
So you put the analysis documents aside, and perhaps this time let each team member tries to figure out the classes of some part of the project.

So far, although that it contains a handful of mistakes, the life is smiling at you. But...

Once you finished the so called "class diagram", you start the implementation. Needless to say, you will end up probably nothing like the design, that's if you were lucky and your project isn't really a very complex one.

And because you end up with something different, i.e. changes are added randomly as you find them, the code complexity will increase, readability will decrease, lots of ad-hoc fixes**, and will take much longer than anticipated to get it to work as you wanted (and with high probability you will miss the dead-line, and deliver your project nonfunctional or with lots of bugs that makes it totally unusable).

Well, this mostly isn't really because you are bad, or you did something wrong. But this is due to the nature of both the Waterfall model, and your experience in the kind of project you are trying to do. I will explain.

The Waterfall model assumes that you know exactly what you are doing, and that's there will be no modifications -in the design- afterwards. To do that, you must have tried and did that -arguably exact- kind of projects several times before. Which in an academic settings is not always true; because in each subject you are assigned a project to apply what you've just learned. So the uncertainty factor is very high. Thus the Waterfall assumption fails, and now it is to hinder you more than to help you.

Fortunately, there is an alternative way that assumes the uncertainty and will help you in that regard; Iterative Development***.

I will talk in details about it in Part II isA.

* This in the context of under-graduate projects' teams in our faculty.
** For people who don't know what ad-hoc means, I quote from some of my friends ;) = "طلسأ طلسأ يا عم الحج". See it on wikipedia http://en.wikipedia.org/wiki/Ad_hoc . In Arabic it probably means اعتباطاً. It's not always bad in some conditions, but in programming, it usually is.
*** Iterative Development isn't a model or process by itself but it describes a feature of several different processes. Like -for example, not to list- the Rational Unified Process, Extreme Programming, SCRUM, and generally the agile software development frameworks, all of which, is beyond the scope of this text. This text is just an introduction to the existence of an alternative, not a guide to use it. If you were interested to use it, you should pursue a good book or a good reference in that regard.

.. more.

Monday, August 04, 2008

Microsoft Infrastructure IT Professional Sessions – August 19

Yet another event invitation from Kareem Salah(IT Professional Audience Marketing Manager Microsoft Egypt)

You are courteously invited to attend our August IT Pro Session on Windows Server 2008. This session is a very special one where we will be having an IT Professional, Waleed Omar, discussing his actual implementation of Windows Server 2008 with a focus on Terminal Services. Waleed from Mantrac is one of the very first IT Professionals in Egypt to deploy the new Terminal Services in Windows Server 2008 in his production environment, which is currently used to provide remote application access to users across multiple countries.
Microsoft has published a case study on the implementation of Windows Server 2008 Terminal Services at Mantrac by Waleed, which you can view at:
http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000002026
Waleed will be providing a technical overview of the new features of Terminal Services in Windows Server 2008, along with hands-on-lab and a discussion of the implementation at Mantrac.
Microsoft is delighted to invite you to attend our August session, entitled Windows Server 2008: Implementation at Mantrac. Attendance is free-of-charge but Seats are limited.

.. more.

Monday, July 21, 2008

C# 4.0 is not a dream, it is comming :)

I Have Nothing to say, just Check this Link

------ Welcome C# 4.0 ------

.. more.

Saturday, July 19, 2008

dotNetWork.org 6th gathering


Date:

Saturday, July 26th 2008,
12:00 - 16:00

Attendance is FREE =)

Speakers
Marwan Tarek
Team leader, MOSS MVP - ITWorx

Mohamed Samy
Technical Architect, VSTS MVP - ITWorx.

Agenda
12:00 - 13:30:
SharePoint WebParts Development
by Marwan Tarek.

13:30 - 14:00: Coffee Break

14:00 - 15:30:
Patterns and Anti-patterns of SOA (Part 2)
by Mohamed Samy.

15:30 - 16:00: Lunch

Location:

Canadian International College, @ "El-Tagamo3 El-5ames"

Buses will be available at: Nady El-Sekka (11:00 AM - 11:30 AM)
Please be there before 11:30 coz we will leave on time..


For those who wanna keep tuned with further news about this event & other upcoming events of the dotnetwork.org user group, please check the following links:

Yahoo!Group:
http://tech.groups.yahoo.com/group/dotnetworkorg/

Facebook Event:
http://www.facebook.com/event.php?eid=18319879657
You'd better join the above event if you have a facebook account so we can roughly estimate the attendees count..

Facebook Fan Page:
http://www.facebook.com/pages/netWorkorg/13135685545

Facebook Group:
http://www.facebook.com/group.php?gid=2409268236

Please don't hesitate to contact me if you have any further questions..
See u on the gathering ;)

.. more.