Box2DWeb Destroy body and fixture - box2dweb

I have created a list of the bodies and fixtures, everything works fine, but cannot delete objects by some reason, here is my code ("id" is the id of the div that is linked to a body and fixture, that info is being holding in the body and fixture data): HEEEELLPPPPP!!!
var bodyItem;
for(var j=0; j < bodieList.length; j++){
if (bodieList[j].userData.id == id) bodyItem = bodieList[j];
};
//world.DestroyBody (bodyItem);
var fixItem;
for(var i=0; i < fixtureList.length; i++){
//console.log (fixtureList[i].userData.id);
if (fixtureList[i].userData.id == id) fixItem = fixtureList[i];
};
bodyItem.DestroyFixture(fixItem);
world.DestroyBody(bodyItem);

Related

Using Jenkinsfile to Modify an existing text file during build process

I'm very new to modifying jenkinsfiles and would appreciate some pointers.
I want to be able to modify an existing txt file in my repository with the detail of the changes made as part of that checkin. I've got the list of changes by using the below:
def getChangeLog() {
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
echo "${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}"
def files = new ArrayList(entry.affectedFiles)
for (int k = 0; k < files.size(); k++) {
def file = files[k]
echo " ${file.editType.name} ${file.path}"
}
}
}
}
But then need to somehow be able to write this to an existing txt file before the build triggers. I also need to be able to read in the file, and confirm that the changes do exist there as well as to not insert duplicate entries.
All of this needs to be done in the Jenkinsfile somehow.
I've been able to find a lot of addons which do something like this but nothing that points to how to implement it in the Jenkinsfile itself.

How to check if Sqflite DB contains a specific id or not? -FLUTTER

I want to check the DB if IDs Column contains a specific ID or not?
I wrote something like this but this is WRONG as h:
dbHelper.ColID is a String
posts is a list ; the post model has an int ID ;
for(int i = 0 ; i<pageCount ; i++) {
for(int j=0 ; j<i; j++) {
if (dbHelper.ColID != posts[i].id){
dbHelper.insertPost(posts[0]) ;
}
}
Simply I used SQL query to get IDs from DB then put 2 loops together:
for (int i = 0; i < cachedPostsIDs.length; i++) {
for (int j = 0; j < postsIDs.length; j++) {
if (cachedPostsIDs.contains(postsIDs[j])) {
debugPrint("FOUND ${postsIDs[j]} post in the database");
} else {
foundPost = false;
debugPrint("COULDNT FIND ${postsIDs[j]} in cachedPostsIDs");
break;
}
}

Zapier Javascript Issue

Zapier splits out my JSON arrays to two separate variables when it runs in a code action, any idea why? If I include the array in the code action, it works - but if I pull it from another step it splits it out.
Code:
var jsonOrg = JSON.parse(inputData.data);
var orgList = inputData.origin;
var orgArray = orgList.split(",");
var out =[];
for (var i = 0; i<jsonOrg.rows.length; i++){
for (var j = 0; j<orgArray.length; j++){
if (jsonOrg.rows[i].product === orgArray[j]){
out += jsonOrg.rows.id[i] + ",";
}
}
}
output = [{id: 123, hello:out }];

GetElementById and A tags

Getting error on this:
for (i = 1; i <= 18; i++) {
oAllKits = myNode.getElementById('node' + i).getElementsByTagName('a');
}
I have a series of IDs on the html document called: node1, node2,... node18. I am trying to target the A tags on these IDs since these A tags are the only elements inside these ids. The console is giving me this message: # has no method 'getElementById'.
I am doing a for loop because I want the variable oAllKits to hold an all those A tags inside the Ids. Thank you advance for your help.
That can be done easily. Find it here
or you can see the code
var avar = document.getElementById('div');
var bvar = div.getElementsByTagName('a');
var cvar = children.length;
for (var i=0;i < len;i++) {
document.getElementById('aclass').innerHTML +='<br> ' + children[i].href;
}
getElementById exists on the document. There should be only 1 of any particular ID so the selector is fast.
var div = document.getElementById('id1');
var children = div.getElementsByTagName('a');
var len = children.length;
for (var i=0;i < len;i++) {
document.getElementById('found').innerHTML += '<br> ' + children[i].href;
}
http://jsfiddle.net/UhT2W/1/

Get resultSet keys in phonegap?

With say 5 fields in the DB, I know the columns that can be queried and use:
function getDetails_success (tx, results) {
var len = results.rows.length;
for (var i=0; i<len; i++) {
var content = results.rows.item(i);
buf += '<tr '+ content.key1+'>';
buf += '<tr '+ content.key2+'>';
}
}
and so on.
What if I have 50 fields, of which 5 random fields has to be displayed. Do I get the keys from the resultset? What are the various ways I can approach this?
If 5 random fields are selected by the user to be displayed, put all of them in an array.
var randomFieldsSelected = new Array();
randomFieldsSelected.push(selection1);
randomFieldsSelected.push(selection2); //and so on
Instead of the above for loop, put,
for (var i=0; i<len; i++) {
var content = results.rows.item(i);
buf += '<tr '+ content[randomFieldsSelected[i]]+'>';
}
(The above works,provided, the database column names match with 'selection1' and 'selection2' etc)

Resources