Archive for the ‘mobile’ Category

found solution here: http://stackoverflow.com/questions/10480858/how-to-define-same-macro-function-based-on-different-parameters

Add the select menu to the html code

<select name=”timeOfWorkoutPlanMinutes” id=”timeOfWorkoutPlanMinutes” data-native-menu=”true”>
<option value=”0″>00</option>
<option value=”5″>05</option>
<option value=”10″>10</option>
<option value=”15″>15</option>
<option value=”20″>20</option>
<option value=”25″>25</option>
<option value=”30″>30</option>
<option value=”35″>35</option>
<option value=”40″>40</option>
<option value=”45″>45</option>
<option value=”50″>50</option>
<option value=”55″>55</option>
</select>

and it can be changed by javascript

$(‘#timeOfWorkoutPlanMinutesoption[value=’+val+’]’).attr(‘selected’, ‘selected’);
$(‘#timeOfWorkoutPlanMinutes’).selectmenu(‘refresh’);

Google Android development team – you’re a bunch of whores!

Why std is so fu**ing old??????

need to write your own to_string function

string to_string (int num)
{
ostringstream convert; // stream used for the conversion

convert << num; // insert the textual representation of ‘Number’ in the characters    in the stream

return convert.str();
}

I needed to parse JSON response from a server.

I did my research and the most important thing i looked for was SIMPLICITY of API and small number of files to integrate to my existing project.

Finally, I found what I was looking for. Not something fancy JSON library but rather a very simple one that does the trick very nicely without any obvious bugs.

 

https://github.com/udp/json-parser

 

The code to print every Json response:

http://pastebin.com/i201FsEE

found this nice question and great answer

http://stackoverflow.com/questions/4967799/how-to-know-the-calling-activity-in-android

works great

I needed to secure my jquery mobile pages. Because it depends on user authentication to the server first.

I use this code for example to prevent the page from loading until user is logged in and redirect it to a login/register page:

$(document).bind(“pagebeforechange”, function (event, data) {

//alert (“trying”);
if (typeof data.toPage == ‘object’ && data.toPage.attr(‘data-needs-auth’) == ‘true’) {
//alert (“token= ” + sessionStorage.getItem(“token”));
if (!sessionStorage.getItem(“token”)) {
pageVars.returnAfterLogin = data;
event.preventDefault();
//alert (“going to login page”);
$.mobile.changePage(“#login”, { changeHash: false });
}
else {
//alert (“going to normal page”);
//sessionStorage.setItem(‘token’, localStorage.getItem(“token”));
}
}
});

and mark the page like this

<div id=”workoutspage” data-role=”page”  data-needs-auth=”true”>

I had the original page init code in the devicereadyevent and I had to move it to the pageshow event. like so:

$(‘#workoutspage’).live(‘pageshow’, function (event) {

… init page stuff …

});

i had to do it like this becuase the devicereadyevent happens anyways no matter what. And i wanted to load the secured page content only if the actual page is loading…  (took it from here http://stackoverflow.com/questions/6126493/jquery-mobile-after-page-is-shown-event)

i’m looking for a UI menu for my ndk app.

found this nice project http://gameplay3d.org/

from this q&a http://stackoverflow.com/questions/15859521/ui-using-opengl-es-in-bb10

also, this looks nice: http://blogs.gnome.org/clutter/

and this http://www.cegui.org.uk/wiki/index.php/Main_Page

 

many shit here http://gamedev.stackexchange.com/questions/3617/good-gui-for-opengl