Most likely is because of the half-boiled eclipse auto-compile resource implementation, your XML files and the compiled resources are not sync. to solve it goto project->clean...
another tips: getDafaultSensor() should pass in Sensor.TYPE_SENSOR_xxxxx not SensorManager.SENSOR_xxxxx. the latter is for the deprecated registerListener(listener, sensor, delay)
Sunday, May 29, 2011
Friday, May 6, 2011
How to setup ejabberd clustering
- change /etc/ejabberd/ejabberd.cfg hosts
- sudo ejabberdctl register NEW_ADMIN 192.168.2.xxx P@55w0rd
- change /etc/ejabberd/ejabberd.cfg admin user
- use web admin, make sure you could access the admin panel
- copy /var/lib/ejabberd/.erlang.cookie to all seondary node // might need to restart secondary nodes
- add all node name to /etc/hosts
- stop all secondary nodes
- copy .erlang.cookie to /root/ // use su bash to change to root user or a fresh restart to solve the problem?
- run sudo erl -sname ejabberd -mnesia dir '"/var/lib/ejabberd"' -mnesia extra_db_nodes "['ejabberd@HOSTNAME']" -s mnesia
// crash if ejabberd instance is running and
// /var/lib/ejabberd/ has something in it. BUT .erlang.cookie must maintain in the folder
- mnesia:change_table_copy_type(schema, node(), disc_copies). in the console
- after quitting from console make sure all the new files in /var/lib/ejabberd own by ejabberd.ejabberd
- if hav doubt remove /dev/null from /etc/init.d/ejabberd
Failed to merge schema: Incompatible schema cookies. Please, restart from old backup.'ejabberd@HOSTNAME'
- remove /var/lib/ejabberd/ content ** except .erlang.cookie
USEFUL PATH
================
/var/lib/ejabberd/ - database and .erlang.cookie. ejabberd home directory
/etc/ejabberd/ejabberd.cfg - ejabber configuration file
/usr/sbin/ejabberdctl - controller
/var/log/ejabberd/ - log folder
/usr/lib/ejabberd/ebin/ - plugin folder
USEFUL LINKS
=================
- http://www.process-one.net/docs/ejabberd/guide_en.html#ejabberdctl
- http://jabber.nes.ru/logs/ejabberd@conference.jabber.ru/2006/01/09.html // ejabberd must stop and db must clean before running erl -sname ejabberd
- http://tdewolf.blogspot.com/2009/07/clustering-ejabberd-nodes-using-mnesia.html // point 8, ejabberdctl.cfg modification is obsolete
Monday, May 2, 2011
Simple JSON parser
I have written a simple json parser in actionscript. i re-create a wheel because the one in as3corelib is too complicated for me. this is pretty straight forward, it does single pass parsing, convert JSON text into ActionScript Object. currently it supported string, object and array only. i think it is good enough for configuration purposes. so enjoy :)
/**
* Simple JSON parser. this parser does a single pass translation of JSON to
* Actionscript string, array and object. no int and float support yet and no error checking
* as well. but this parser does support nested object and array
* @param content JSON text
* @param stack parser
* @param parent Parent Object or Array depends on context
* @return Object Actionscript object that represent the JSON (content)
*/
private function parse(content:String, stack:Vector., parent:Object):Object {
var ret:Object;
var curr:uint = stack[CFG_POS];
var type:String = content.charAt(curr);
++curr;
stack[CFG_POS] = curr;
switch(type) {
case OPEN_BRACKET_OBJECT:
// push the new stack
stack.unshift(TYPE_OBJECT);
stack.unshift(PART_KEY);
stack.unshift(curr);
ret = new Object;
while(stack[CFG_TYPE] == TYPE_OBJECT){
ret = parse(content, stack, ret);
}
// pop the old stack
curr = stack.shift();
stack.shift();
stack.shift();
stack[CFG_POS] = curr;
break;
case CLOSE_BRACKET_OBJECT:
stack[CFG_TYPE] = NA; // stop the object's while loop
ret = parent;
break;
case OPEN_BRACKET_ARRAY:
// push the new stack
stack.unshift(TYPE_ARRAY);
stack.unshift(PART_VALUE);
stack.unshift(curr);
ret = new Array;
while(stack[CFG_TYPE] == TYPE_ARRAY){
ret.push(parse(content, stack, ret));
}
ret.pop(); // pop out the unwanted last null set by CLOSE_BRACKET_ARRAY
// pop the old stack
curr = stack.shift();
stack.shift();
stack.shift();
stack[CFG_POS] = curr;
break;
case CLOSE_BRACKET_ARRAY:
stack[CFG_TYPE] = NA; // stop the array's while loop
ret = null;
break;
case BRACKET_ITEM:
stack[CFG_POS] = content.indexOf(BRACKET_ITEM, curr) + 1;
if (stack[CFG_PART] == PART_KEY){
parent[content.substring(curr, stack[CFG_POS]-1)] = parse(content, stack, parent);
ret = parent;
}else{
ret = content.substring(curr, stack[CFG_POS]-1);
}
break;
case SEPARATOR_KEY_VALUE:
stack[CFG_PART] = PART_VALUE;
ret = parse(content, stack, parent);
break;
case SEPARATOR_STATEMENT:
if (stack[CFG_TYPE] == TYPE_OBJECT)
stack[CFG_PART] = PART_KEY;
else
stack[CFG_PART] = PART_VALUE;
ret = parse(content, stack, parent);
break;
}
return ret;
}
Friday, March 18, 2011
8 Steps to keep R&D type game company afloat
R&D is a time consuming and risking process, too keep a company afloat is not an easy task. let's said your company is to produce a revolutionary mmo gameplay, how do you keep your company survive for more than 4 years? here is a rough idea. build your product by phases, just like Runic did to their torchlight mmo, do it by phases, single player -> multiplayer -> mmo.
What if your company is very shaky, can't burn moneys more than 1 year? my idea is break down your production schedule to even smaller phases, for example:
- 3D Model viewer, and sell it as cheap model viewer software -> work on rendering engine, UI, simple editor
- 3D architecture walk-through, and sell it as cheap architecture visualization tool -> scene graph, building shaders
- 3D model viewer and 3D architecture walk-through, sell as online store and visualization software -> player walking in 3d environment, physics, collision detection
- Advertisement software, -> better UI and better interaction
- 3D online chat software -> networking and server side programming
- 3D virtual world -> big terrain system, whether, day and night, water shaders, database programming
- 3D simulation -> AI, NPC, quest programming, editors to balancing and fine tuning
- 3D games -> combine all your stuff, you should have very good foundation and game engine, and you should have enough networking and experience in your field.
Friday, February 25, 2011
New Year New Mission
Lunar new year is over, my last day with my current employer is approaching, and my plan for my "Independence life" has not finalized yet. (!!!)
I was planing to create a facebook sci-fi 3d virtual world where player are surrogates stay at alien planet but after discussing with my friends, i decided to change it to fantasy 2d virtual world instead and this world support offline game play. i really likes the idea but they were few things keep bugging me. 1) the alchemist crafting system is overly complicated and adobe stratus technology is not commercially supported. today when i discuss with the same friend, he exposed a new game idea to me, and i decided to change my project again, this time will be simple facebook flash 3d game, player able to play as programmable golem or robot. i really like this idea, but i also wish i never talk to that guy again before i completed this project :D
Friday, January 28, 2011
Begin with zabuza, end with zabuza
Naruto become my favorite anime after mission against zabuza, I like the story so much. naruto anime basically created a new magical world that chakra as mana. the author has put in so much emotion and detail into the mission. i was so sad and sorry for the ending of Haku and Zabuza. zabuza story should end when he is first die, should not resurrect them in part II. the resurrection is badly done, so many great shinobi have been summoned at the same time, that really mess up the whole story. i guess i'll stop following this anime for few months until this arc is over
Saturday, January 1, 2011
Day 1 with Blender Game Engine
Making a simple minigame, a bulleye shooting game. my first step is to model the bulleye.
simple task but many problems.
1) blender doesn't show transparent texture
2) after fixing problem, blender render the object to black
3) gamekit doesn't show the bulleye correctly.
the solutions:
1) http://blender.bencrowder.net/transparent-textures/ and set texture->image->stencil to true to remove black outline
2) bulleye only getting light source from point light, don't know why
3) gamekit has problem with transparent texture
Happy New Year 2011!
Happy new year 2011. I finally decided to make a bold move to reach my goal. wish me best luck 2011
Subscribe to:
Comments (Atom)