Saturday, August 18, 2012
Thursday, August 2, 2012
Using the Facebook Sherer
Facebook provides a nice and easy took to help in using its 'Sherer' utility
http://developers.facebook.com/tools/debug
http://developers.facebook.com/tools/debug
Wednesday, August 1, 2012
Wikisrains moves to Public Beta phase
Months of hard work have finally resulted in airing the WikiBrains machine learning engine.
Having people using it is so exiting, since as more of them do, the smarted it gets.
Although one would need to register to actually use the brainstorm GUI tool, its easy to see the daily increase in vocabulary and context just by going into the search page and checking out 'Apple' (just an example).
Each time a user lines up a couple of words, may they be of his own design or using existing connections from the suggestion list, the brain is enriched by a new synapse.
The wiki engine uses a graph database to store the words as objective points and the subjective links between them are what people have to say about those words.
We still have several usability issues with the GUI, perhaps too cumbersome one may argue. but despite some snags on the way, it works (which makes me really happy). No performance issues so far, and the user base is steadily growing.
Thumbs up for the Wikibrains team!
.
Having people using it is so exiting, since as more of them do, the smarted it gets.
Although one would need to register to actually use the brainstorm GUI tool, its easy to see the daily increase in vocabulary and context just by going into the search page and checking out 'Apple' (just an example).
Each time a user lines up a couple of words, may they be of his own design or using existing connections from the suggestion list, the brain is enriched by a new synapse.
The wiki engine uses a graph database to store the words as objective points and the subjective links between them are what people have to say about those words.
We still have several usability issues with the GUI, perhaps too cumbersome one may argue. but despite some snags on the way, it works (which makes me really happy). No performance issues so far, and the user base is steadily growing.
Thumbs up for the Wikibrains team!
.
Sunday, April 15, 2012
Titanium HTTPClient, Sending a complex object
If you need to send a complex object on a request through the Titanium HTTPClient, an object that has more then a single level of data, for example:
var data_to_send={
user:{name:'Gilad', l_name:'Manor'}
}
Passing this object, as is, to the HTTPClient will result in the server getting the sub object as a string, instead of an object.
To have this properly sent, you will need to wrap the data with JSON.stringify
i.e.
client.setRequestHeader('Content-Type',
'application/json; charset=utf-8');
client.send(JSON.stringify(data));
var data_to_send={
user:{name:'Gilad', l_name:'Manor'}
}
Passing this object, as is, to the HTTPClient will result in the server getting the sub object as a string, instead of an object.
To have this properly sent, you will need to wrap the data with JSON.stringify
i.e.
client.setRequestHeader('Content-Type',
'application/json; charset=utf-8');
client.send(JSON.stringify(data));
Tuesday, April 10, 2012
Titanium for Android and RoR
Lately, I've been playing around with the Titanium IDE for mobile development.
Its pretty nice once you get a hang of it.
My first application (code name Moris) I made to communicate as a mobile front end for the Gizmo server.
It came out rather simple since my API on the server side are aleady set to spit out JSON structures.
I've found that the simplest way is as following:
First I created a generic send function with a global client object:
var SERVER = 'https://YOUR-DOMAIN/api/';
var send = function (action, data, resFunc){
client.open("POST", SERVER+action);
if (resFunc!=null) {
client.setOnload(resFunc);
};
client.send(data);
}
var client = Ti.Network.createHTTPClient({
onload : function(e) {
alert('success '+this.responseText);
},
onerror : function(e) {
alert('error');
},
timeout : 5000 /* in milliseconds */
});
Then I add a specific function for each API I'd like to call on the server:
exports.login = function(user,pwd) {
send("login", {mail:user, password:pwd}, function(e) {
//alert(this.responseData);
Ti.App.fireEvent("gizmo_login_complete", JSON.parse(this.responseText));
});
};
exports.userInfo = function(resultFunction) {
send("user_info", {data:null}, resultFunction);
};
In these two examples, I've Pass a function that would handle the particular case of returned data.
For the login, I fire a Titanium event that is caught on the app.js while for the user info I inject the function each I do the call.
Its pretty nice once you get a hang of it.
My first application (code name Moris) I made to communicate as a mobile front end for the Gizmo server.
It came out rather simple since my API on the server side are aleady set to spit out JSON structures.
I've found that the simplest way is as following:
First I created a generic send function with a global client object:
var SERVER = 'https://YOUR-DOMAIN/api/';
var send = function (action, data, resFunc){
client.open("POST", SERVER+action);
if (resFunc!=null) {
client.setOnload(resFunc);
};
client.send(data);
}
var client = Ti.Network.createHTTPClient({
onload : function(e) {
alert('success '+this.responseText);
},
onerror : function(e) {
alert('error');
},
timeout : 5000 /* in milliseconds */
});
Then I add a specific function for each API I'd like to call on the server:
exports.login = function(user,pwd) {
send("login", {mail:user, password:pwd}, function(e) {
//alert(this.responseData);
Ti.App.fireEvent("gizmo_login_complete", JSON.parse(this.responseText));
});
};
exports.userInfo = function(resultFunction) {
send("user_info", {data:null}, resultFunction);
};
In these two examples, I've Pass a function that would handle the particular case of returned data.
For the login, I fire a Titanium event that is caught on the app.js while for the user info I inject the function each I do the call.
Tuesday, March 20, 2012
Ruby hash to_xml residue
When using the to_xml on a ruby hash object, it leaves a root.
The way to get rid of it is by explicitly specifying the root by the following:
my_hash_object = {:a=>"a", :b=>"b"}
result = my_hash_object.to_xml(:root=>"new_root")
And that's what its all about.
The way to get rid of it is by explicitly specifying the root by the following:
my_hash_object = {:a=>"a", :b=>"b"}
result = my_hash_object.to_xml(:root=>"new_root")
And that's what its all about.
Subscribe to:
Posts (Atom)

