This blog is subject the DISCLAIMER below.

Wednesday, December 23, 2009

Quantum Computing's potential: impossible to ignore

What's the average time you need to find a certain item in an unsorted list of N=1,000,000 items ? O(N/2) = 500,000. That means on average you have to look at half of them before finding your desired item.

What's the minimum number of steps you need to solve a N-by-N system of linear equations ? at least N steps.

What's the minimum time you need to factor an integer of N bits ? 2^N steps. Cryptographic security relies on this fact.

However all these answers are wrong in quantum computing !
In quantum computing to find an item in an unsorted list of 1,000,000 items you need only Sqrt(1,000,000) = 1000 steps! [1,4]

In quantum computing to solve a system of N linear equations you need Log(N) steps ! [2]

In quantum computing to factor a N-bits integer you need only N steps (logarithmic to the number) ! So if a quantum computer with enough bits (called qubits in quantum computers) all today's encryptions are totally useless !! Your bank account can be stolen in one day. [3,5,6]

Several quantum computes of 5 and 7 qubits have been made to prove it is possible[7]. However not yet practical because they don't have enough qubits yet.

Some quantum cryptography networks have been deployed [8]. Ordinary cryptographic systems promises you that your encrypted text will not be decrypted in less than 1 million years for example. However these quantum cryptography methods are totally unbreakable no matter how much time given (personal opinion of the author, that can be wrong).

Even google is considering using quantum search algorithms and have already bought a quantum computer[1].

They are becoming less and less ignorable nowadays. One day we will wake up to find a complete revolution in computing. They are exponentially faster than ordinary computers in general.

To find a good and easy (and more complete) starting point refer to [9]. However I am going to write a small introduction here.

A quantum bit is the building block of quantum computers as much as the ordinary bit is the basic block of ordinary computers. Although it can not deliver or carry more than 1 bit of data in normal cases[11] (1), but in the intermediate calculation steps it can carry zero and one at the same time.

Basically what that means is that using an array of n qubits, you can deliver or carry any number between 0 and 2^(n-1) just like ordinary computers, but also means that in intermediate steps ur quantum register can carry ALL these numbers at the same time, and you can do calculations on ALL of them simultaneously. That's the concepts used in all quantum algorithms.

For more details I redirect the interested reader to the references mentioned below.

--------FOTENOTES------
(1) Other cases like superdense coding as in [10] uses more advanced techniques and tricks.

-------REFERENCES------

[1] http://www.popsci.com/technology/article/2009-12/google-algorithm-uses-quantum-computing-sort-images-faster-ever
[2] Davide Castelvecchi, _Warp-Speed Algebra_, Scientific American January 2010 Issue, Pages 22-23.
[3] http://spectrum.ieee.org/computing/networks/mother-of-all-quantum-networks-unveiled-in-vienna
[4] http://en.wikipedia.org/wiki/Grover's_algorithm
[5] http://en.wikipedia.org/wiki/Shor's_algorithm
[6] http://alumni.imsa.edu/~matth/quant/299/paper/node19.html
[7] http://en.wikipedia.org/wiki/Timeline_of_quantum_computing
[8] http://spectrum.ieee.org/computing/networks/mother-of-all-quantum-networks-unveiled-in-vienna
[9] http://alumni.imsa.edu/~matth/quant/299/paper/paper.html
[10] http://en.wikipedia.org/wiki/Superdense_coding
[11] http://en.wikipedia.org/wiki/Quantum_information_theory; last modified on 13 November 2009 at 06:53; Quote: "However, despite this, the amount of information that can be retrieved in a single qubit is equal to one bit. It is in the processing of information (quantum computation) that a difference occurs"

.. more.

Monday, December 14, 2009

WSCF.blue v1.0

WSCF.blue is a Visual Studio .NET 2008 add-in that provides the following features:

· A WSDL Wizard that allows the developer to step through the creation of a WSDL from one or more XSDs.

· A Data Contract Generator (similar to XSD.exe, XSDObjectGen.exe and SvcUtil.exe) that generates the .NET equivalent classes of the XSD types.

· A Service/Endpoint Stub (support for self-hosted and web-hosted) Generator and

· A Client Proxy Generator.

· A Generate Data Contract Code feature that supports the selection of multiple XSD/WSDL source files.

· A Paste XML as Schema option that generates a schema for a block of XML in the clipboard.

· Support for C# and VB.NET code generation.

· You can choose if operation methods on your service class will throw a NotImplementedException, call an implementation method in a partial class, or will be defined as abstract methods.

· Force the SOAP actions (Action and ReplyAction) applied to each operation contract follow the standard WCF format

· Errors found while processing the WSDL are reported in a WSCF.blue pane in the Visual Studio Output window.

.. more.

Monday, December 07, 2009

How to Get User Friends\Followers on Twitter

Twitter became very popular social network, all use it for different purposes i.e to expand your network, to market for your products, to be up-to-date with specific technology, or to know what people talking about is.
Developers are users but on Twitter and Facebook they are not regular users, Twitter for example gives you some APIs to develop you own application and extend Twitter with features, it's time for everybody to extend without waiting for creators to do.
I was developing Twitter application two days ago, and I faced a problem to get all user's friends\followers, I used some APIs but unfortunately, they got first 100 friends\followers!! I knew that you can browse user friends\followers for user called "RamyMahrous" like that http://twitter.com/statuses/friends/ramymahrous.xml?
http://twitter.com/statuses/followers/ramymahrous.xml?
But it gets just first 100 friends\followers I browsed some sites but no information, unless I went to Twitter API Wiki and I knew about XML cursor they use every cursor has limited 100 friends\followes means... if "RamyMahrous" has 204 friends so it will be iterated through 3 cursors.
Let's code...
string FriendsXMLFileURL = "http://twitter.com/statuses/friends/{0}.xml?cursor={1}";
string FollowersXMLFileURL = "http://twitter.com/statuses/followers/{0}.xml?cursor={1}";
List < users_list > listUserList = new List < users_list > ();
int index=0;
XmlSerializer Serializer = new XmlSerializer(typeof(users_list));
List < users_list > listUserList = new List < users_list > ();
List < users_listusersuser > users = new List < users_listusersuser > ();
users_list usersList = new users_list();
int index = 0;
string nextCursor = "-1";
while (nextCursor != "0")
{
usersList = (users_list)Serializer.Deserialize(
XmlReader.Create(string.Format(FollowersXMLFileURL, "RamyMahrous", nextCursor)));
listUserList.Add(usersList);
nextCursor = usersList.next_cursor;
}
//user_list class generated based on the xml structure you can save the xml file and generate it
//using XSD please take alook on this post by Shady
http://fci-h.blogspot.com/2009/12/how-to-create-c-class-from-xml-file-via.html
foreach (users_list userlist in listUserList)
{
users.InsertRange(index, userlist.users[0].user);
index += 100;
}
//so now you've list of users you can iterate and do anything with them!
//take a look this brings user friends\followers without providing user password!
Your comments are welcome :)

.. more.

Saturday, December 05, 2009

How to create a C# Class from XML file (via xsd.exe)

A friend asked me a couple of times about how to I created the class I used in “twitter common friends” to handle xml as objects (includes reading & writing back). Actually the tool (xsd.exe) is pretty simple & takes no more than a couple of commands to create the class for me.

It’s just that I usually forget the keywords/parameters & their order (you can create a dataset or class that can be C# or VB, & there’s a couple of other option I never used before). I usually refer to its MSDN page when asked..

So I thought a post would be easier to remember. First you should create the xsd file out of the xml, using the VS command prompt:

xsd myFile.xml

That will create “myFile.xsd”, now to create “myFile.cs”, write the below line:

xsd myFile.xsd /c

Now you can add the cs file to your project & use it as illustrated in my previous post.

.. more.