2011年7月27日星期三

HappyFrog for Harmattan


Can't wait to say finally...finally I got my N950 throught Qt-Ambassador Program.I was waiting impatiently for a long time (two suffering weeks :)) to got it on hand.Unboxing it.........very very fantastic and beautiful design and very 'soft' and fabulous to the touch.The brand-new user interface-Swipe.I feel like the whole view is completely undisciplined unbounded,yet full of the magic and power of the artist view(a image cross my mind,it reminds me of "Steve jobs" in the film "Pirates of Silicon Valley".He was yelling "I need artist!!" and speak to bill "we're artist"..........*(^*&%&^$&^%)Dreams will not remains as a dream.The Next Billion.So Come on,nokia don't let me down : ).
Well,I am prepared to deploy two games on N9.
One is HappyFrog(someone has played it),another....keep you guessing.
So first priority is to make some improvment on Happy Frog. three features on HappyFrog 0.0.3. details as follows
1.parallax scrolling(see the hills) and re-design some levels
2.add tyre fixture(enable Motor in Box2D)
3.add windmill fixture(disanble Motor in Box2D)


you can download HappyFrog for different platform here
2.HappyFrog 0.0.3 For Symbian^1(5800,n97,c6,5230..)

source code is here Happyfrog-Src-0.0.3.tar.bz2 ,you can checkout it also at here 
git://gitorious.org/happyfrog/happyfrog.git
Next game is in-progress,stay tuned.


Br
Gary

2011年7月6日星期三

Making HMAC-SHA1 scriptable in apps

Long time no blog due to busy on project.
It's a funny coincident that I need to do some work based on OAUTH open protocol again.But according to the qoauth libs implementation and the previous blog I mentioned,there is a  need for me to make it with little code change for different platform(on Desktop I need to compile and import QCA libraries in addition to qca-ossl-plugin see below on that page,on Symbian I need to import hash.lib by using related class CSHA1,CMAC).Hum,is there a better solution for me to utilize to make it easier?
So I think it's time to play a small trick.My proposal is that do HMAC-SHA1 in app without any change to fit all platform with Qt(Desktop,embed,mobile device).The main idea is that making HMAC-SHA1 scriptable in apps.
The step as following.
1.Please check http://pajhome.org.uk/crypt/md5/sha1.html and import sha1.js in your project.
2.QtScript module provides powerful embedded scripting environment through the QtScript classes.So we can call a Qt script function from C++ like this.
...
...
QFile file("./sha1.js");
file.open(QIODevice::ReadOnly);
QString jsContent = QString::append(file.readAll());
file.close();
....
....
QScriptEngine engine;
engine.evaluate(jsContent);// very similar with function QWebFrame::evaluateJavaScript ()
QScriptValue value = engine.globalObject();
QScriptValueList paramList;
paramList<<key<<baseString;
QString result = value.property("b64_hmac_sha1").call(QStringValue(),valueList).toString()
//call js function b64_hmac_sha1 from C++ and result is what you want. ;) 

Ps:
special present from Finland before my birthday.
can't wait to test it.
I will be waiting impatiently for the time when I get it.