Speed report

http://gtmetrix.com/reports/blog.eramax.org/8eWDVXxe

ثورة الغضب : ثورة شباب مصر

يوم 25 يناير قام العديد من شباب مصر بالنزول الى الشارع للمطالبه برحيل النظام الفاسد الذى لطالما نال من ابناءه الشرفاء واقمع افواههم وقتلهم واغتصب نسائهم

نظام الظلم نظام حسنى مبارك –عليه لعنة الله

ومازال مبارك لا يريد ان يجيب طلب هذه الجماهير التى فاقت عددها ال 5 مليون فى جميع محافظات مصر بان يتنحى

واليكم هذا التقرير الشامل لما حدث حتى الان

YouTube Preview Image

YouTube Preview Image

YouTube Preview Image

YouTube Preview Image

وفى ظل هذه الاثناء بدات بعض وسائل الاعلام العالمية ان تبحث فى شان ثروة مبارك وقد كانت تفوق الوصف اذ انها تجعله من اثرى اثرياء العالم

YouTube Preview Image

لمتابعة جديد الاخبار عن طريقة صفحة كلنا خالد سعيد

او متابعة التاج #jan25

Examssssssssss

I will stop posting until ending of my exams in 25-1-2011

thank you.

HelloDroid using C# with MonoDroid

Hello Droid

As a developer, you know that the first impression of a development framework is how easy it is to write “Hello, World.” Well, with MonoDroid, it’s pretty easy.

This tutorial assumes that you’re using Visual Studio 2010. If you’re using MonoDevelop, it should also be very straightforward to follow, as the usage is almost identical.

Before you start, you should already have the SDK installed and created an Android emulator (AVD). If you have not done this, see Installing the MonoDroid SDK and return here when you’ve completed the installation.

Create a New MonoDroid Project

The first step is to create a new MonoDroid project in Visual Studio.

  • From Visual Studio, select File > New > Project…If the MonoDroid Plugin for Visual Studio has been successfully installed, the resulting dialog should have a Visual C# > MonoDroid category which should contain “MonoDroid Application”.
  • Select “MonoDroid Application”, set the project name to “HelloMonodroid” and click Ok.

Your MonoDroid project is now ready. It should be visible in the Solution Explorer on the right. By default it contains a single Activity in the Activity1.cs file, a subclass of MonoDroid’s Activity class.

An Activity is simply a class that can run and do work. It can create a UI if it chooses, but it doesn’t need to. An Activity is almost always used as the basis for an application.

Open the Activity1.cs file. It should look roughly like this:


using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace HelloDroid
{
 [Activity(Label = "My Activity", MainLauncher = true)]
 public class Activity1 : Activity
 {
 int count = 1;

 protected override void OnCreate(Bundle bundle)
 {
 base.OnCreate(bundle);

 // Set our view from the "main" layout resource
 SetContentView(Resource.layout.main);

 // Get our button from the layout resource,
 // and attach an event to it
 Button button = FindViewById<Button>(Resource.id.myButton);

 button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
 }
 }
}

Notice that the class is based on the Activity class. An Activity is a single application entity that is used to perform actions. An application may have many separate activities, but the user interacts with them one at a time. The OnCreate() method will be called by the Android system when your Activity starts — it is where you should perform all initialization and UI setup. An activity is not required to have a user interface, but usually will.

Run the Application

The Visual Studio plugin makes it easy to run your applications:

  1. Select Debug > Start without Debugging, or press Control-F5
  2. You will be prompted to select the device you want to deploy your application to with the following dialog:select_device_dialog.png

    There probably won’t be any devices showing up because we haven’t started our emulator image (AVD) we created earlier.

    If there are no devices, click “Start emulator image”.

  3. Now you will be prompted with a list of every Android emulator you’ve created:start_emulator_dialog.png
  4. Select the emulator you want to start and click “OK”.
  5. Once your emulator boots up (which may take a minute or two), it should be choosable from the Select Device dialog. Go ahead and select it and hit “OK” to deploy and run your application on the emulator.

Visual Studio will now package up your application, copy it to the emulator, and launch it. You should see something like this once it’s done:

Ref: http://monodroid.net/Tutorials/Hello_World

Installing MonoDroid for Visual Studio 2010

Installing MonoDroid for Visual Studio 2010 involves five steps:

  1. Install the Java SDK
  2. Install the Android SDK
  3. Configure your simulator
  4. Install the MonoDroid for Visual Studio 2010 Plugin

Visual Studio 2010 Professional, Premium, or Ultimate. MonoDroid for Visual Studio 2010 willnot work with Visual Studio Express.

Install the Java JDK

Download and install the Java 1.6 (Java 6) JDK.  The JRE is not sufficient.  The Android SDK requires the 32 bit JDK, that is, select “Windows” for your platform, not “Windows x64″.

Install the Android SDK

Download the Android SDK from Google:

  • Download Windows SDK installer (e.g. installer_r08-windows.exe) from: http://developer.android.com/sdk/index.html
  • Run the installer.
  • Run the SDK Manager after install.
  • Install at least:
    • Android SDK Tools, revision 8
    • Android SDK Platform-tools, revision 1
    • SDK Platform Android 2.2, API 8, revision 2

If you receive an error message when opening the SDK Setup application that states “Failed to fetch URL https://…”, you should check the “Force https://… sources to be fetched using http://…” option under “Misc” in the “Settings” list before returning to the “Available Packages” list.

Configure Your Simulator

The Android Simulator can be run in a variety of configuration to simulate different devices.   You should configure at least one to get started.   You do this by selecting the “Virtual Devices” option from the Android SDK installer:

Select “New” in this dialog box, and then configure your device.   This is a good starting configuration:

Once you do this, you are done configuring the emulator. There is nothing left to do in the Android SDK Setup application.

Note: You should not start the emulator from the Android SDK Setup application.  MonoDroid will handle this for you.

Install the MonoDroid for Visual Studio 2010 Plugin

Once you make it this far, you are ready to install MonoDroid, download the plugin from:

Note: you must close all copies of Visual Studio 2010 before installing!

Follow the prompts to install, read the carefully crafted End-User License Agreement that our lawyers wrote with all the love and dedication that a lawyer puts into writing EULAs, and once you accept the terms, MonoDroid be installed:

windows-monodroid-install.PNG

Source : http://monodroid.net/Installation

Mono for Android

Now that we feel that we have fixed all the embarrassing bugs in Mono for Android, so we have opened up our Mono for Android preview program to anyone that wants to take it out for a spin.

Mono for Android brings the full Mono VM to Android. We use a library profile that is better suited for mobile devices, so we removed features that are not necessary (like the entire System.Configuration stack, just like Silverlight does).

In addition to bringing the core ECMA VM to Android, we bound the entire set of Android Dalvik APIs to C# and in the process C#-ified them. This includes using C# properties for metadata (less XML config file messing around), exposing C# events, C# properties, strongly typed generic types where necessary, implicit conversions where needed, using the C# API style, IEnumerable where appropriate (to let you LINQ over your Dalvik, and we turn IIterable into IEnumerables for you).

On the OpenGL front, we brought the same OpenTK library that is popular among .NET developers on both Windows, Linux and iPhone, so you can share the same OpenGL logic across all platforms.

Unlike iOS where the JIT is not supported, Mono on Android supports the full JIT, so you can use Reflection.Emit and dynamic code compilation as much as you want.

This initial release only comes with templates for C#, but other .NET compilers should work, as long as they reference Mono for Android’s libraries (as we removed a few methods that make no sense on mobile devices).

Support for OSX

Through the lifetime of our preview program, Mono for Android only supported Windows development using Visual Studio. Today we are also releasing support for developing Android applications on MacOS X using MonoDevelop.

Getting Started

Please check our Welcome page, it contains installation instructions, links to tutorials, mailing lists, chat rooms and more.

I strongly advise our users to join our mailing list and to check the previous discussions on the mailing list for some tasty insights.

You can also browse the API that we expose to C# developers.

Upcoming Features

We are working as fast and as hard as we can to complete Mono for Android. This includes Linux support and bringing MonoDevelop to Windows, for users that can not run Visual Studio 2010 Professional.

Source : http://tirania.org/blog/archive/2011/Jan-04.html

Installing Android Froyo on your Desktop/Laptop

Well, it might seem crazy but it doesn’t. I have installed Android on my laptop in just …15 minutes. And that was because I don’t have a high speed internet connection speed and took some time to download the necessary tools. What’s the point? The point is that either you don’t have an Android phone yet or you don’t want to mess up your Android phone by installing and testing lots of stuff and applications. Of course, once installed, you will say that you can’t test GPS based applications since your desktop/laptop does not have a GPS. Yet, you can install and test non GPS applications from internet or Android Market. So, what do you need?

First you need a virtual machine, I used Oracle VM VirtualBox which you can download from here. Then, you need Android ported to x86 architecture which you can download from here. Make sure you download froyo-vm-20100812.iso . After you install Oracle VirtualBox, which is trivial, you need to create a virtual machine which will host your Android. Uhh, be aware that during installation of Oracle VirtualBox your internet connection will be shut down and restarted. But don’t be afraid, no processor will be hurt during this installation :-) .

I followed these steps when creating the virtual machine:

1. I have chosen Operating System: Linux and version: Other.

2. Memory was left by default: 256MB.

3. I created a new virtual hard disk leaving default options.

4. Hard disk storage type chosen: Dynamically expanding storage.

5. Virtual disk and location: I have chosen an 8 GB disk size (plenty of space for testing, huh ?).

6. The finish summary.

7.  I went to File->Virtual Media manager -> CD/DVD images and added the android iso image downloaded earlier.

8.  Started  the virtual machine, and got the error. I went went to Device->CD/DVD images and selected froyo-vm-20100812.iso

9. I restarted the virtual machine and chose to install the Android image. After installation virtual machine restarted …and there is was Android. But…one problem. I could not use my laptop pointing device. So I turned off the virtual machine, went to Settings->System and unchecked Enable absolute pointing device. Funny thing, after starting my Adndroid virtual machine I was able to use the pointing device. Don’t ask me why, because I don’t know.

10. Voila..My Android on top of Windows 7 Ultimate using Oracle VM VirtualBox.

11. Android menu and all the goodies.

Happy testing, happy playing.

Tip: to simulate the ‘Back’ button from the phone, you have to press Escape.

Source : http://www.mono-droid.com/installing-android-froyo-on-your-desktop-laptop/

What every beginning programmer should learn

Are you the kind of person who enjoys thinking about this kind of stuff?

Then seek therapy immediately!

Or, just for fun, consider this…

A young programmer, fresh out of computer programming school and still wet behind the ears, asks you — tough old seasoned professonal software developer that you are — for suggestions for things that he/she should learn in order to become as tough, as old, as seasoned, and as professional as you. What do you tell him/her?

Here is a jumbled grab-bag of concepts, jargon, ideas, resources (books), etc.  Basically, a list of the tools in the toolbox of a working business software developer.  Or at least, the first cut at such a list.

If this was YOUR list for a beginning programmer, what things would you add to it, or change?


relational database concepts

data modelling (entity-relationship modelling)

  • Chen-style (relationships shown as nodes)
  • Information Engineering (IE) style (relationships shown as lines)

data-driven program design

  • “Principles of Program Design” by M. A. Jackson
  • “Jackson Structured Programming: A Practical Method of Programme Design” (Paperback) by Leif Ingevaldsson

software requirements and specifications

  • “Structured Analysis and System Specification” by Tom Demarco & P. J. Plauger (Paperback 1979) Dataflow diagrams can still be useful tools in certain contexts, even though they are obsolete for sofware systems analysis.
  • “Software Requirements and Specifications:” by Michael Jackson     STRONGLY RECOMMENDED
  • “Problem Frames” by Michael Jackson

object-oriented programming

  • class, object (or instance), method, static method, instance variable
  • ”Beginning Java Objects” by Jacquie Barker

domain-driven design

  • “Domain-Driven Design” by Eric Evans

event-driven programming

data structures and algorithms

  • variables (in non-object oriented languages), objects (in OO languages), pointers (references)
  • stack, queue, LIFO, FIFO, linked list, tree, node (and how to program them)
  • recursion (for traversing trees)
  • “Thinking Recursively” or “Thinking Recursively in Java” by Eric Roberts

process modelling, entity life-history modelling

  • finite-state machine (FSM) and state-transition diagrams
  • “Software Engineering Fundamentals: Jackson Approach” (Paperback) Leif Ingevaldsson

popular software design methods/tools/ideas

  • UML and its various diagram types
  • design patterns –  “Head First Design Patterns” might be a painless introductory book

software development management

  • iterative/evolutionary development (as opposed to “big bang” development)
  • “waterfall” methods
  • “agile” methods

programming languages

  • Dynamically-typed language: Python (or Ruby)
  • Statically-typed language: Java (or C#)
  • A good IDE (Eclipse: don’t try to program Java without it!)

Source : http://pythonconquerstheuniverse.wordpress.com/2011/01/04/what-every-beginning-programmer-should-learn/

WCF Services with .NET 4.0 Simple Host-Client example

In .NET 4.0, initial ramp-up with WCF services has been greatly simplified. This bare bones guide gets you up and running with the basics in about 10 minutes, without any of the onerous XML file hacking that WCF has been known for.

This post assumes you are working with Visual Studio 2010 and the 4.0 version of the .NET framework.

Starting Up – The Host

Our simple example will consist of two console applications, a host and a client. Our service will be a string reversal service. We will start with the host.

We start with a new console application, adding a reference to System.ServiceModel.

addReference

Next we define our service interface. Note the attributes that we decorate the interface and method with.


[ServiceContract]
 public interface IReverserService
 {
 [OperationContract]
 string Reverse(string input);
 }

We need the System.ServiceModel namespace for the attributes that tell the framework that this is a service contract. We then decorate the class with the ServiceContract attribute, and the method with the OperationContract attribute.

Next up is our implementation.


public class ReverserService : IReverserService
 {
 public string Reverse(string input)
 {
 char[] i = input.ToCharArray();
 Array.Reverse(i);
 return new String(i);
 }
 }

Nothing fancy going on here, just a simple implementation of string reversal.

Finally, we modify the main method of the console application to host our service.


class Program
 {
 static void Main(string[] args)
 {
 using (ServiceHost host = new ServiceHost(typeof(ReverserService),new Uri("net.tcp://localhost:9000")))
 {
 host.Description.Behaviors.Add(new ServiceMetadataBehavior());
 host.AddServiceEndpoint(typeof(IMetadataExchange),MetadataExchangeBindings.CreateMexTcpBinding(),"mex");
 host.AddServiceEndpoint(typeof(IReverserService),new NetTcpBinding(),"net.tcp://localhost:9000/ReverserService");
 host.Open();
 Console.WriteLine("press enter to stop service...");
 Console.ReadLine();

 host.Close();
 }
 }
 }

Things get a lot more interesting here. Note that we could reduce the code if we added some configuration to our app.config; given that one of the goals of this post was to demonstrate a simple WCF service scenario without XML fun, we are eschewing that option.

We start by declaring a new ServiceHost for our service. This is the class that will be listening for incoming requests. We want our service to be functional but also descriptive; this is what the next 2 lines do for us. We are enabling metadata exchange by adding the corresponding behavior and endpoint. The endpoint addition required inclusion of the System.ServiceModel.Description namespace so that we could specify the type of binding we wanted for our metadata endpoint.

The next line adds our actual service endpoint – this is what clients will use for to reverse their strings. Next, we start our host and await client calls until someone presses a key. Pretty simple, and again, zero configuration. Building and running our solution produces the grand display of functionality below.

Service Running

Service Running

The Client

Leaving our host running, we start up another instance of Visual Studio 2010 and begin a new console application. We now add a new service reference as below.

addServiceReference

Note the URI that we typed in the address box. This is using the metadata exchange endpoint that we configured in the host, and makes it terribly straightforward to both get a reference to our service and to write the code that will use the service.


static void Main(string[] args)
 {
 ReverserService.ReverserServiceClient reverser = new ReverserService.ReverserServiceClient();

 string st = "";
 Console.Write("Enter a String to sent it to the service (e for exit) : ");
 st = Console.ReadLine();
 while (st != "e")
 {
 string reversed = reverser.Reverse(st);
 Console.WriteLine("Response : " + reversed);

 Console.Write("Enter a String to sent it to the service (e for exit) : ");
 st = Console.ReadLine();
 }

 reverser.Close();
 }

Adding the service reference the way we did instructed Visual Studio 2010 to pull down the service definition and generate code based on this service definition. It’s this generated code that allows us to write the first two lines in the main method as cleanly as we did; we simply instantiate the generated class and call the method. The only other (very important) use of the generated class is the last line in the method where we close out the connection. Running our test client (again, ensure that the host is still running) gives us the below.

Client using My Service

Client using My Service

Download Projects

Source : http://www.barebonescoder.com/2011/01/wcf-services-with-net-4-0/

Printing 1 to 1000 without loop or conditionals

From StackOverflow

Task: Print numbers from 1 to 1000 without using any loop or conditional statements. Don’t just write the printf() or cout statement 1000 times.

How would you do that using C or C++?

Solutions:

1: Compile time recursion! :P

#include <iostream>
template<int N>
struct NumberGeneration{
static void out(std::ostream& os)
{
NumberGeneration<N-1>::out(os);
os << N << std::endl;
}
};
template<>
struct NumberGeneration<1>{
static void out(std::ostream& os)
{
os << 1 << std::endl;
}
};
int main(){
NumberGeneration<1000>::out(std::cout);
}

2: C Statndards

void yesprint(int i);
void noprint(int i);

typedef void(*fnPtr)(int);
fnPtr dispatch[] = { noprint, yesprint };

void yesprint(int i) {
printf("%d\n", i);
dispatch[i < 1000](i + 1);
}

void noprint(int i) { /* do nothing. */ }

int main() {
yesprint(1);
}

3: 1000 = 5*5*5*8 :D


#include <stdio.h>
int i = 0;
p()    { printf("%d\n", ++i); }
a()    { p();p();p();p();p(); }
b()    { a();a();a();a();a(); }
c()    { b();b();b();b();b(); }
main() { c();c();c();c();c();c();c();c(); return 0; }

4: using array of objects witch have a cout in constructor

<div>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

class Printer
{
public:
Printer() { cout << ++i_ << "\n"; }
private:
static unsigned i_;
};

unsigned Printer::i_ = 0;

int main()
{
Printer p[1000];
}