Wednesday, February 27, 2008

Make3D: Convert your image into 3d model

Today, While I was browsing my RSS reader... I stopped when my eyes picked this title "Make3D: Turn a 2D Picture Into a 3D Model". I followed the link to be impressed by what I saw.

Make3D is a service provided by Stanford University. Make3D takes a single two-dimensional image, process it, and creates a "fly around" three-dimensional model. You can then view the three-dimensional model and feel the depths of the pixels in the image.
"The service is based on an algorithm created by Stanford students Andrew Ng, Ashutosh Saxena and Min Sun that won the best paper award at the 3D recognition and reconstruction workshop at the International Conference on Computer Vision in Rio de Janeiro in October 2007." [Make3D: Turn a 2D Picture Into a 3D Model, accessed on: Feb 27, 2008]
Make3D uses powerful machine learning techniques, to learn the relation between small image patches and their depth and orientation. This allows it to model 3-d structures such as slopes of mountains or branches of trees. [Make3D home page, accessed on Feb 27, 2008]

I created and account and gave it a try. Result of my trial doesn't look so good but they have other models in the Gallery which look so good. Here is my try:

I uploaded this...
and I got this 3D model...

Just follow this link to Make3D home page, and you will find other links to the information you may need. You can view their publications in this area of 3D image construction; You can download their code; You can navigate to the FAQ for how it works and other questions; You can browse their Gallery; You can create an account and upload your images to get their 3D model; ...etc

Before I end this post, I would like to highlight that one of the graduation projects this year in class 2008, Computer and Systems Engineering Department, Alexandria University is working in this area -3D image construction- let's hope them the best of luck and wish we can see something impressive by the end of this semester.

Tuesday, February 26, 2008

Quantum Computers

Quantum Computer:
It is any device for computation that makes direct use of distinctively quantum mechanical phenomena, such as superposition and entanglement, to perform operations on data. The word “quantum” came from the Latin word which means "how much". In quantum mechanics, it refers to a discrete unit that quantum theory assigns to certain physical quantities, such as the energy of an atom. Let's have some notes:
  1. Quantum entanglement is a quantum mechanical phenomenon in which the quantum states of two or more objects have to be described with reference to each other, even though the individual objects may be spatially separated.
  2. A quantum state is a mathematical object that fully describes a quantum system. Quantum states can be statistically mixed, corresponding to an experiment involving a random change of the parameters. When performing a certain measurement on a quantum state, the result is in general described by a probability distribution.
  3. Quantum superposition is the fundamental law of quantum kinematics. It defines the allowed state space of a quantum mechanical system. For example, if a particle can be in position A and position B, it can also be in a state where it is an amount "3i/5" in position A and an amount "4/5" in position B. To write this, people usually say:
    W) = 3/5 i A) + 4/5 B)
  4. Bits vs. QuBits: Consider first a classical computer that operates on a 3-bit register. At any given time, the bits in the register are in a definite state, such as 101. In a quantum computer, however, the qubits can be in a superposition of all the classically allowed states. In fact, the register is described by a wave function:
    W) = a 000) + b 001) + .........+ h 111)
    Where the coefficients a, b, c... h are complex numbers whose amplitudes squared are the probabilities to measure the qubits in each state. For example, is the probability to measure the register in the state 010.

Power of Quantum Computers

Quantum Computers can solve any problem of these four properties:

1. The only way to solve it is to guess answers repeatedly and check them,

2. There are n possible answers to check,

3. Every possible answer takes the same amount of time to check, and

4. There are no clues about which answers might be better: generating possibilities randomly is just as good as checking them in some special order.

As an example, Integer Factorization is believed to be computationally infeasible with an ordinary computer for large integers that are the product of only a few prime numbers. A quantum computer could solve this problem more efficiently than a classical computer using Shor's algorithm to find its factors. So a lot of military agents provide massive funds for the experiments on that field of science.

For now, it is still a field of research and we don’t yet have a really effective & practical model of a quantum computer.


Saturday, February 16, 2008

Signed Java Applets

Hey, welcome back with a new blog !! today I am talking about both Java and web, more clearly Java Applets

Let us see the problem. Days ago, I was developing a Java Applet that capture a snapshot for Desktop and send it to Flash movie embedded in the same HTML page to provide Desktop Sharing (viewing share not remote access) facility for our web application. I finished developing the applet on Eclipse IDE and it was running well. When embedding it in HTML page, it gave access denied (java.awt.AWTPermission createRobot)
(as I used AWT package to capture the screen). So, what is the problem ?!!

I surfed the net for such problem and it was the first time to deal with Java security policy. This policy resides in java.policy file located at $JAVA_HOME\jre\lib\security. Problem is that Applets, unlike Applications, are not trusted by default by Java security policy. It is restricted for some operations like accessing the local file system, asking for socket connection,... etc. The solution is what called Signed Java Applet.

Before completing with Java Signed Applet, let us see why the applet run on Eclipse IDE the first time. When running the applet in Applet Viewer through Eclipse, Eclipse generates a policy file in the folder contains this applet called java.policy.applet and associate it with the applet. The content of the file (for my applet) was as following:

/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/

grant {

It is clear that it allows the developer applet to do everything assuming that developers (which use Eclipse IDE) are mature enough to take care about disasters may harm their local computers. So everything is running on Applet Viewer.

Java Signed Applet is an applet associated with a digital certificate. Digital certificates are authored by trustworthy authorities. Signing an Applet needs to get a certificate from one of these authorities, which is most of time costs money for sure, so users can trust your applet and give it permission to do its operation. Digital certificate contains the holder party(which is you in this case) besides the certificate authority (e.g. Sun MicroSystems). No specific authorities monopoly giving certificates, but companies have good reputation or something like that can give this certificate. You can create your own certificate for developing and testing issues.

After singing the applet, browser will pop up a dialog to users when the applet is loading displaying the digital certificate associated with the applet and let the user permit the applet to be authorized on his computer or reject the certificate which let the applet behave like unsigned one.

We may talk about digital certificates in details later; but at a glance, it depends on public key encryption algorithms (e.g. RSA algorithm, click here to read more about RSA) that generates a pair of public and private keys and use this to verify the validity of the certificate within its expiration period.

Now, let us see how to sign our applets with our own digital certificate for development purposes:

1. Create your code for the applet as usual.
It is not necessary to set any permissions or use security managers in
the code.

2. Install JDK 1.5
Path for use of the following commands: $JAVA_HOME\bin
(commands are keytool, jarsigner)
Password for the keystore is any password.

3. Generate key:
keytool -genkey -keyalg rsa -alias tstkey
Enter keystore password: ******* (any password)
What is your first and last name?
[Unknown]: Your Name
What is the name of your organizational unit?
[Unknown]: YourUnit
What is the name of your organization?
[Unknown]: YourOrg
What is the name of your City or Locality?
[Unknown]: YourCity
What is the name of your State or Province?
[Unknown]: YS
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=Your Name, OU=YourUnit, O=YourOrg, L=YourCity, ST=YS, C=US
[no]: yes


Enter key password for tstkey
(RETURN if same as keystore password):

(press [enter])

4. Export key: keytool -export -alias tstkey -file tstcert.crt

Enter keystore password: *******
Certificate stored in file tstcert.crt

5. Encapsulate your applet in a JAR file (click here to read how to create JAR files).

6. Sign JAR:
jarsigner signedApplet.jar tstkey
Enter Passphrase for keystore: *******

8. Verifiy Signing: jarsigner -verify -verbose -certs signedApplet.jar

130 Thu Feb 12 13:04:12 GMT+02:00 2008 META-INF/MANIFEST.MF
183 Thu Feb 12 13:04:12 GMT+02:00 2008 META-INF/TSTKEY.SF
920 Thu Feb 12 13:04:12 GMT+02:00 2008 META-INF/TSTKEY.RSA
Thu Feb 12 12:58:28 GMT+02:00 2008 META-INF/
smk 849 Thu Feb 12 12:49:04 GMT+02:00 2008 SignedApplet.class

X.509, CN=Your Name, OU=YourUnit, O=YourOrg, L=YourCity, ST=YS, C=US

s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope

jar verified.

9. Create HTML file for use of the Applet using tag

<"applet" code="SignedApplet.class" width=100 height=140 archive="signedApplet.jar">"</"applet">

where signedApplet.jar reside next to HTML file and SignedApplet.class encapsulated in it.

10. Run HTML page and test your applet.

I tested it on my PC using JDK 1.5 Update 8 to sign the applet and take the applet on my laptop and run well.

I hope this helps.

Wednesday, February 13, 2008

Prallel Multi-Threaded Lock-Free Programming Session

today we had a session by eng.Emad Ali - Software Design Engineer(SDE) at Microsoft Corp. PFX Team, where he first reviewed the multi-threading synchronization objects in C++ and C# and the thread execution model on single-core and multi-core systems,

he then introduced the new synchronization techniques intended to be added to the .Net libraries like SemaphoreLight, Event, Monitor and Parallel.for - which executes independent loop iterations in parallel instead of waiting for each iteration to complete first with support to load balancing between cores too - and showed the advantages of Lock-Free programming in implementing more efficient synchronized data structured like stacks and queue that operate far much better with multiple threads.

he also mentioned the introduction of parallel techniques to LINQ - the Language Integrated Query added to the .Net framework by the end of 2007 that enables you to query any IEnumerable-based information source (arrays, sets...) - which produced PLINQ, in addition to the TPL - Task Parallel Library - which makes it much easier to write managed code that can automatically use multiple processors like Parallel.for, as part of the PFX (Parallel Framework Extensions) development taking place right now.

if you found yourself interested in the subject you can continue with the following links:
Parallel Extensions to the .NET Framework
LINQ: .NET Language-Integrated Query
101 LINQ Samples
Task Parallel Library
Lock-Free Programming (Great)
PFX Team Blog

JavaScript Function Closure

Coming from a C++/JAVA background, it was hard for me to assimilate the concept of Function Closure in JavaScript. Now that I understand it, I'd like to share it here with you. Seriously, it's best explained by example than description. Here's an example.

var thingsToDo = {};

function initializeThingsToDo() {
var food= {
name: "Ramen",
type: "Tokatsu"
}; = function() {
alert("I'm going to eat: " +;


Okay, what did I do here? First, I created an empty (global) Object called "thingsToDo", then I added a global function called "initializeThingsToDo". Inside this function I defined food object. I referenced the global object "thingsToDo" and attached a dynamic function called "eat" in the object.

After the code definitions, I ran the global function initializeThingsToDo, and called the method

I know you would say that this is crazy because when I ran, the method uses the food object but it's already out of scope.

initializeThingsToDo();; // When this is executed,
// the food object is already out of scope!

Na ah?! Not in JavaScript. You see, when you run the code, JavaScript will create a closure to the food object. After that, it saves it in the memory. The interpreter knows that it will be used for later. (It doesn't deallocate the food object in the memory. )

The power of function closure is well executed when you use AJAX. When you define your AJAX callback function, it gets called asynchronously. It creates a closure and call the objects/functions when it's ready.

If you are not familiar with JavaScript Object and Functions, you can read these links:

Java vs. JavaScript object
JavaScript usign Prototype.js
JavaScript Function


Computers and Artificial Intelligence at the Bibliotheca Alexandrina with Dr. Ismail Serageldin

yesterday a bunch of engineering students specially from our departement, attended the Computers and Artificial Intelligence three part series at the Bibliotheca Alexandrina. The department was kind enough to give the day off so all the students are able to attend this big event. It was long and rich with information, a lot of history too but i can say this helped to set the base for the thorough discussion introduced by Dr.Ismail.

The sessions outlined the development of computer systems along side the advancements in communications to the age of the internet and the ICT Revolution. A variety of visions were introduced from purely philosophical to purely technical to show the controversy about the definition of intelligence and the idea of creating intelligent machines and whether it's possible or not.

maybe it's suitable to mention the strongest of both sides of this controversy: the Chinese Room Argument that confines any machine intelligence to a set of predefined rules that can only be enlarged which is not real intelligence, opposed by Raymond Kurzweil who says that computers were able to break any borders that have been set before and predicted that computers will be able to defeat the world champion in chess by 1998 and it happened in 1997, 1 year earlier than predicted. there's more on that in the slides, but without the great presentation given by Dr.Ismail.

I added the links for you here, you can get that and more from Dr. Ismail's website.
Computers and Artificial Intelligence, A three part series - Part 1: Where did our computers come from?
Download Presentation
View Presentation
Computers and Artificial Intelligence, A three part series - Part 2: The Search for Artificial Intelligence
Download Presentation
View Presentation
Computers and Artificial Intelligence, A three part series - Part 3: Humans, Robots And The Future
Download Presentation
View Presentation

Tuesday, February 12, 2008

RTMP: Unrelaible Service on the top of Reliable Service

After completing the networks course in the previous semester; And while working in my the graduation project, I read about RTMP (Real-Time Messaging Protocol); a proprietary protocol developed by Adobe Systems for streaming audio, video and data over the Internet, between a flash player and a server (Usually, Adobe's Flash Media Server).

As you see from the title; RTMP provides Unreliable service by working on the top of a Reliable service. The difference between reliable and unreliable service is the reliable one grantees transferring all sent data correctly and in order to the destination; while the unreliable don't make these grantees.

A reliable service can be built on the top of unreliable service, by the use of ACKs "Acknowledgments" and retransmissions. We already implemented this during the semester to build a file transfer -which is reliable- service on the top of UDP -which is unreliable protocol.

Usually multimedia or interactive real-time application requires an unreliable service, because reliable services adds more overhead due to the use of ACKs and retransmissions. Real-Time multimedia applications can tolerate some data loss and will continue to operate correctly (e.g. while streaming a video over the internet, some video frames can be lost and you still can see the video without sensing any mess).

RTMP approach:

So, Real-Time Multimedia applications usually built on the top of UDP. However, the RTMP which is used for multimedia streaming is built on the top of TCP. TCP is a reliable protocol and ensures that all data are sent correctly and in order. TCP adds overhead and consumes more bandwidth and can cause packets to be sent late, which is unacceptable for real-time multimedia application. So, RTMP requires to implement unreliability for being used with real-time multimedia application.

As we can build a reliable service on the top of unreliable service, RTMP came with the inverse idea. It built its unreliable service on the top of the reliable service provided by the TCP. To support the streaming of media data over TCP, the amount of data being sent must be dynamically adjusted in response to network bandwidth and congestion. RTMP is designed to adjust the amount of video and audio being transmitted by dropping audio messages and video frames in response to inadequate network bandwidth.

RTMP uses buffers to buffer streams for transmission. Data streams are never dropped, because they may contain some control information and dropping them can cause the application to work improperly. Audio and video streams are buffered separately on the server. Audio streams are allowed to accumulate in the buffer until a predefined threshold; when this threshold is reached, the buffer is freed and audio streams are allowed to start accumulating again. For the video streams, only one frame is buffered. If another frame reached before sending the buffered one, the old frame is dropped and the new one is buffered till sending it. This ensures that clients won’t receive partial frames.

Thursday, February 7, 2008

Semantic Web, will the dream become true?

I have a dream for the Web [in which computers] become capable of analyzing all the data on the Web – the content, links, and transactions between people and computers. A ‘Semantic Web’, which should make this possible, has yet to emerge, but when it does, the day-to-day mechanisms of trade, bureaucracy and our daily lives will be handled by machines talking to machines. The ‘intelligent agents’ people have touted for ages will finally materialize.
Tim Berners-Lee, 1999

Imagine the day, when you get a single customized answer to a certain question (e.g. What is the cheapest car in Europe?), when you ask the internet for a suitable clinic by entering the symptoms and your location and the internet responds with the predicted disease, clinic name and reservation times, and when every clinic and hospital all over the world share their data forming a large set of data through the internet, by using some software agents, imagine what can come out of billions of records. This is called the Semantic Web or Web 3.0.

According to Wikipedia, Semantic web is an extension of the World Wide Web in which web content can be expressed not only in natural language, but also in a format that can be read and used by software agents. In other words, Data from different sources should be represented in a common format that is readable by machines to easily integrate and combine them, also using natural languages to describe how data relates to real world objects. Today's WWW is said to be web of documents, that is data is controlled by applications and each application keeps it to itself, those applications interchange documents. Semantic Web is said to be web of data, because using common formats to represent data eases integrating it, and using natural language to relate it data to real world, allows data to be shared and reused across applications, enterprise and community boundaries. The Semantic Web is based on Resource Description Framework (RDF).

RDF is a family of World Wide Web Consortium (W3C) specifications originally designed as a metadata model but which has come to be used as a general method of modeling information, through a variety of syntax formats and notations. These syntax formats includes Notation 3 (N3), RDF/XML and N-Triples, while notations include RDF Schema (RDFS) and the Web Ontology Language (OWL).

Watch this video in which Tim Berners-Lee explains what is the Semantic Web.


Wednesday, February 6, 2008

The Way to Get Money Online Safety!!!!!!

IF u r Freelancer,Programmer,Designer,Writer,Translator
now u can work from home and get paid with dollar $$

About the jobs u not need to pay any money or fee to
open account u just go to this link
And open account now

then click the button “Programmers singup here”
then follow the steps

Saturday, February 2, 2008

Learn about RSS from Common Craft

i've been very amused about these kind of videos, they call it "XYZ in Plain English", which corresponds to our Arabic expression "بالعربى الفصيح", they aim to introduce complex ideas in a very intuitive and story like way guided with pointing fingers and simple sketches, that makes it easy for you to follow up and get the idea, without having to bear with much jargon.

These videos are created by Common Craft and uploaded to YouTube by leelefever, they made many wonderful videos and have some kind of a show too, very creative and inspiring...

one good example that's suitable for our new blog is RSS in Plain English, RSS makes it easy for you to keep track of your favorite blogs and news updates, the video introduces the idea non-technically which isn't enough for you, since it only introduced the illusion of the service,

i prefer you read a little bit more about it on Wikipedia, you can start from here, and to make this discussion more thorough, i have to mention pinging and its implications.

do want to know what an rss feed looks like? click this link to view our blog feed, maybe your browser will suggest registering the feed too, it's a kind of xml that contains some or all the data you need to get, you can view the page source to have a closer look.