Friday 14 June 2013

E3: Xbox One VS PS4 opinion

The ultimate console wars! Has Xbox made a bad move? I was hoping to give my overview on the whole situation. I strongly believe that it is a draw. Here are my reasons:

  • Even though the internet are all against Xbox because people tend to follow the bandwagon of hate phenomenon and yes the Xbox did not make it any less easier for themselves with their announcements. People will still buy the new console, it is just how it always is. Same situation happened with EA, people threatened to boycott it, but they still buy every single new game released. 
  • Considering the way Xbox completely eliminated second hand retailers from their systems, people will have no options but to buy the full game if they want to play it. This will result with the full price going to the Xbox and developers and no third party retailer. Even though they might lose a large part of the Xbox audience, it will mostly lose the people who only bought second hand games, thus this does not make a difference.
  • Sony on the other hand are openly admitting the freedom for their customers. Want to buy used game? We don't care, just buy our console please. Their overall gain from getting all of these new Xbox fans to buy their system will increase revenue but they will actually lose money to the developers. 
No matter what, true die hard fans will fight you for their console. 

Personally, I am a PC girl :D

GWT project experience


Recently I had to create a full working ground up project using the Google Web Toolkit Framework, so I thought I would give my feedback on the experience I had working with it. Take note, that I have previously worked with ASP .NET, Django, Spring Framework thus I will mostly compare it to these.

As you may have noticed GWT is an open source development toolkit. The setup process of your very first working application is no longer than 5-10 minutes which is what I love about it. All you have to do is download the GWT plugin from the Eclipse Marketplace, restart Eclipse, right-click create new GWT project and check to generate sample code. The most basic application will be set up for you. Right click your project to run in DevMode and open a browser for you application. How great is that?

When you get over the fact of how easy it is to test your application and that all the things you need are already set up for you and you do not have to fiddle with web.xml or GWT libraries. Next step is to play around with some of the amazing features GWT offers by going to their Showcase web page where they offer a preview of how the certain widget looks like but also the code to get it to work.

One of the things that struck me as abnormal to the original way of developing web pages is the fact that GWT only needs 1 .html page. Everything inside this page is assigned dynamically using pure java code. In case you have a page full of buttons and you do not want to spend millions of lines of code declaring every single “Button button1 = new Button();” all you have to do is look up UiBinder where all of these widgets will be declared using a well structured xml document. Great huh?

I outlined how pretty and simple GWT makes dynamic web page creation, but with every view there is always a rant, so lets begin. GWT YOU ARE SO LIMITED! Sure all the widgets are great and all, but the amount of time I had to spend customising handlers and @Overriding these widgets to get them to do what I wanted is ridiculous. It was a constant battle of the wits. TextArea, a box for text, does NOT have a set for the maximum number of characters it accept. I had to create a javascript native method for pasting and a keyboard press handler to limit character input. Don’t even get me started on CellTable. I will make a tutorial at some point for the customisation of CellTable to your needs, mostly because I spent so much time at it that I do not want to waste it.

You might start asking me, “well, if you think GWT is so limited why not just download something like smartgwt or gxt which have many more features?” well sir, my answer to you is: did you see the size of the libraries for those things? I do not want to use all the features... Why can’t I make several simple parameter setups for the current GWT widgets instead?

Don’t get me wrong, GWT is fun and great, but it doesn’t teach you much about proper web development setup. If you are new and want to try something quick I would suggest GWT, if you have a more serious project and you want GWT go with GXT even though I see a lot of people complaining about its features breaking peoples applications.

TL;DR : With great power (like GWT), comes great programmability.




Friday 25 January 2013

Weave Silk, interactive generative art

My Cat

  Here is a little something I made using this interesting little tool for creating interactive art. The silk like art tools of multiple colors allow creating ambient designs while you listen to very relaxing music. Options exist for creating symmetric or non-symmetric art.
     I personally spent about an hour playing with this website. Every stroke along the canvas creates a work of art within itself. You don't have to be an artist to enjoy it. Link to the website new.weavesilk.com


'Whirled Worlds' the spinning plate interface

     This has to be one of the most ridiculous applications I have seen for a phone/tablet. It is in fact so ridiculous that the only thing they could come up with to use it for is spinning it like a disc. Who in their right mind would use an expensive device as a phone/tablet and mindlessly spins it around their house while attempting to play a pizzeria game. What's next? Skeet shooting?
     To read more about it - Abstract

Sunday 6 January 2013

My favourite inventions of 2012

 
   I want to wish everyone a Happy 2013! Heres to hope this year will be full of fantastic inventions and research! I wanted to highlight a couple of my most favorite from 2012.

   DARPA's robot navigating an obstacle course. It is amazing what people can make out of algorithms, sensors and machine parts. This has to be my favorite artificial intelligence creation so far. The only concern with the high increase of robotic inventions in the world, is putting them for good use. Unlike ASIMO robot who is currently being used to deliver coffee at the Honda offices, robots like these could actually be utilized in dangerous environments where human involvement would prove fatal.

    Another one of my favorite inventions is the Corning Willow Glass. With the current market highly invested in making applications smaller and lighter yet still maintaining their usefulness, this thin, light and cost efficient glass can greatly improve mobile devices.

Monday 8 October 2012

Build Your Skeletons Correctly

I was working with character models that where using motion captured movements. Here are some results of incorrectly created character skeletons and why it is important to build them correctly!


Friday 23 March 2012

M2Crypto for Python X509 certificates and RSA encryption

Don't you hate it when you cannot find a proper guide to use a certain programming language? I had this problem over the last week when I was trying to use encryption in python.

My task was to simulate 2 players playing a game of tic tac toe over a secure connection. By secure connection I mean, they had to get a certificate from a Certificate Authority, check its authenticity and extract a public key, with which they encoded data and sent to the other player. So If a certain nosy person decided to listen into the conversation he will not be able to decrypt the messages with a private key.

I coded a tic tac toe game using sockets and threads no problem. The main issue came in when I wanted to encode data and create a X509 certificate. A very commonly used library for certificate creation is called OpenSSL. Since I rather code on my windows machine, I was having a lot of trouble trying to install it. The alternative I looked at is called pyOpenSSL, it is python wrapper to call certain methods in OpenSSL using a few commands. This library was very limited and did not provide encryption and decryption. Which means I would have to import other libraries such as RSA. After looking helplessly I found a lovely thing called M2Crypto. The only problem with it is that It has very little documentation or sample code online on how to exactly execute certain things. I was mostly looking at Stack Overflow questions people made about problems. After a couple of days of struggling and messing around with code, I have done it.

I decided to create an easy readable manual on M2Crypto for people who decide to work on it. This will provide a set of commands which you might require to implement a secure connection.


M2Crypto

M2Crypto download:
http://chandlerproject.org/Projects/MeTooCrypto#Downloads

To import M2Crypto into code:
import M2Crypto


Importing certain libraries:
from M2Crypto import RSA, EVP

Generating a Random RSA key pair (public and private):
key= RSA.gen_key(512, 65537)
512 is the size of the key
65537 encryption standard use it as a default


Saving the generated public and private key:
key.save_key ('Alice-private.pem', None)
key.save_pub_key ('Alice-public.pem')
None is a specified password for testing purposes there is none
The file can be created in a specific directory ‘/local/temp/Alice-private.pem’


Converting the RSA key into a PKey() which is stored in a certificate:
pkey = EVP.PKey()
pkey.assign_rsa(key)

To create a X509 certificate using M2Crypto:
# time for certificate to stay valid
cur_time = M2Crypto.ASN1.ASN1_UTCTIME()
cur_time.set_time(int(time.time()) - 60*60*24)
expire_time = M2Crypto.ASN1.ASN1_UTCTIME()
# Expire certs in 1 hour.
expire_time.set_time(int(time.time()) + 60 * 60 * 24)
# creating a certificate
cert = M2Crypto.X509.X509()
cert.set_pubkey(pkey)
cs_name = M2Crypto.X509.X509_Name()
cs_name.C = "US"
cs_name.CN = “8080”
cs_name.Email = "fake@foo.com"
cert.set_subject(cs_name)
cert.set_issuer_name(cs_name)
cert.set_not_before(cur_time)
cert.set_not_after(expire_time)
# self signing a certificate
cert.sign(pkey, md="sha256")
cert.save_pem("cert")

This will create a “cert” file in your directory which can be loaded later on. Or you can use the cert object to convert into a string to send it through a socket EG:
message = cert.as_pem()
print message

Printing the certificate as a pem will look something like this, which is stored in a cert file if you open it with notepad:
-----BEGIN CERTIFICATE-----
MIIBYzCCAQ0CADANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQGEwJVUzENMAsGA1UE
AxMEODA4MTEfMB0GCSqGSIb3DQEJARYQZmFrZUBob3RtYWlsLmNvbTAeFw0xMjAz
MjEyMTU0MTJaFw0xMjAzMjMyMTU0MTJaMD0xCzAJBgNVBAYTAlVTMQ0wCwYDVQQD
EwQ4MDgxMR8wHQYJKoZIhvcNAQkBFhBmYWtlQGhvdG1haWwuY29tMFwwDQYJKoZI
hvcNAQEBBQADSwAwSAJBANFx5xZ/4k5Rx2XeAHrFLkaswFa8DIak1JnEMB+epKei
KNKrGliibUYp74YDAMw9CpA1QPzFqYKz7/zTivteSSkCAwEAATANBgkqhkiG9w0B
AQsFAANBALFh3S7rNMN/mYcmJzQQfe/FEEpVc0esRbeL/hvwWZs1C4yj+MwpCgBi
P/zSzkglB3WHe2VZk5i7kKv1pN+qvdU=
-----END CERTIFICATE-----

Once you receive the certificate as a string the way to convert it to a certificate object is:
m2cert = M2Crypto.X509.load_cert_string(message)

you can print the certificate object as a more readable string with this line:
print m2cert.as_text()
Certificate:
   Data:
       Version: 1 (0x0)
       Serial Number: 0 (0x0)
       Signature Algorithm: sha256WithRSAEncryption
       Issuer: C=US, CN=8081/emailAddress=fake@hotmail.com
       Validity
           Not Before: Mar 21 22:16:06 2012 GMT
           Not After : Mar 23 22:16:06 2012 GMT
       Subject: C=US, CN=8081/emailAddress=fake@hotmail.com
       Subject Public Key Info:
           Public Key Algorithm: rsaEncryption
           RSA Public Key: (512 bit)
               Modulus (512 bit):
                   00:c6:02:10:81:5d:c5:a4:30:83:24:91:ce:78:86:
                   7b:47:ea:20:02:ab:07:bc:91:39:7d:c1:5b:2c:3a:
                   e3:9c:b6:6a:96:86:9c:7e:e4:c8:6c:a9:8c:b1:33:
                   c6:1c:20:8c:cd:05:3e:b1:4b:69:49:9a:6c:0b:14:
                   a9:52:25:8d:47
               Exponent: 65537 (0x10001)
   Signature Algorithm: sha256WithRSAEncryption
       67:59:f6:04:a4:21:8b:8e:ff:f9:6a:79:56:13:b9:cb:84:24:
       9e:cd:b0:d7:c0:76:4f:99:bc:0f:14:f5:76:2a:07:04:c6:dc:
       be:56:c1:68:5b:35:4e:f2:c7:b4:5b:ac:c9:c3:d9:a1:c1:d5:
       73:52:9b:e2:36:45:ba:9b:a4:02

To extract an RSA key which can be used for encoding you use this:
pkey= m2cert.get_pubkey()
rsa_key_pub = pkey.get_rsa()

to encrypt a message using the public key above:
crypto = rsa_key_pub.public_encrypt(message, M2Crypto.RSA.pkcs1_oaep_padding)
M2Crypto.RSA.pkcs1_oaep_padding this is a RSA encryption type, there are different ones, but you should stick to one if you do not want to bother having to extract the type from the RSA key.

to decrypt a message using the private key, which you saved earlier, you need to load it first:
rsa_key_pri= M2Crypto.RSA.load_key(‘Alice-public.pem’)

once loaded use the command to decrypt:
decyphered = rsa_key.private_decrypt(message, M2Crypto.RSA.pkcs1_oaep_padding)

If you have any of the following errors:

RSAError: data too large for modulus

Check to make sure the data you are encrypting does not exceed the formula:
(sizeofkey/8) - 11 bytes
If it is then you will have to cut the message into slices and encrypt it OR encrease the size of the RSAKey
512 - moderate secure
1024 - really secure
2048 - military security
The bigger size of the key, the longer it will take to generate it.

RSAError: no start line

You are using the wrong file name or format for example if you open the .pem file for one of your private or public keys the header will say something like this:
-----BEGIN RSA PRIVATE KEY-----
or
-----BEGIN PUBLIC KEY-----
you need to make sure the file you are using is correct and you are not trying to encrypt using a private key or vice versa

RSAError: oaep decoding error

This means that during the method decrypt, you have used the wrong private key. The error means that the decryption that you get from decrypting the message is not the same as original one.
Make sure you are using correct keys it is easy to mix them up