I've been playing with Sublime Text 2 the last few days and was wondering if anyone out there has had any success getting Cocos2d-x method completions working yet? I've install Sublimeclang,but it doesn't work well.
There is my setting of Sublimeclang
{
"options":
[
"-m32",
"-w",
"-fgnu-runtime",
"-fms-extensions",
"-nostdinc",
"-D__GNUC__=4",
"-D__GNUC_MINOR__=2",
"-D__GNUC_PATCHLEVEL__=1",
"-D__GXX_ABI_VERSION__=1002",
"-Di386=1",
"-D__i386=1",
"-D__i386__=1",
"-DWIN32=1",
"-D_WIN32=1",
"-D__WIN32=1",
"-D__WIN32__=1",
"-DWINNT=1",
"-D__WINNT=1",
"-D__WINNT__=1",
"-D_X86_=1",
"-D__MSVCRT__=1",
"-D__MINGW32__=1",
"-D__STDC_VERSION__=201112L",
//"-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/",
//"-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1",
"-isystem", "D:\\Developer\\mingw\\lib\\gcc\\mingw32\\4.6.2\\include",
"-isystem", "D:\\Developer\\mingw\\lib\\gcc\\mingw32\\4.6.2\\include\\c++",
"-isystem", "D:\\Developer\\mingw\\lib\\gcc\\mingw32\\4.6.2\\include\\c++\\mingw32",
"-isystem", "D:\\Developer\\mingw\\include\\",
"-DANDROID",
"-isystem", "D:\\Developer\\android-ndk-r8e\\toolchains\\x86-4.6\\prebuilt\\windows-x86_64\\lib\\gcc\\i686-linux-android\\4.6\\include",
"-isystem", "D:\\Developer\\android-ndk-r8e",
"-isystem", "D:\\Developer\\android-ndk-r8e\\sources\\cxx-stl\\gnu-libstdc++\\4.6\\include",
"-isystem", "D:\\Developer\\android-ndk-r8e\\sources\\cxx-stl\\gnu-libstdc++\\4.6\\libs\\x86\\include",
"-isystem", "D:/Developer/Cocos2d-2.0-x-2.0.4/cocos2dx",
"-isystem", "D:/Developer/Cocos2d-2.0-x-2.0.4/cocos2dx/include",
"-isystem", "D:/Developer/Cocos2d-2.0-x-2.0.4/cocos2dx/platform/android",
"-isystem", "D:/Developer/Cocos2d-2.0-x-2.0.4/cocos2dx/platform/third_party/android",
"-Wall",
"-ferror-limit=0"
]
}
Unfortunately, the autocompletion only lists macro, no class and method.
Related
I have an array and I need to generate many components as the array lengh:
I tried this but it didn't worked:
let items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"];
let itemList = [];
items.forEach((item, index) => {
itemList.push(<li key={index}>{item}</li>);
});
export default function TaskList(props) {
return (
<div className="task-list-container">
<Task id="" nombre={itemList} />
</div>
);
}
So I need one component from TaskList that contains Item1 and other Item2 and so one
That's not very clear what you're trying to do...
But I think you should try to loop in the render part instead of stacking components in variables ...
let items=['Item 1','Item 2','Item 3','Item 4','Item 5'];
export default function TaskList(props) {
return (
<div className="task-list-container">
{
items.map((item, index) => <Task key={index} value={item} />)
}
</div>
)
}
It will render as many <Task> components as string in the items array
I have a json object called blogData with json data. Inside the json obj the tags key may have multiple tag values. I would like to display the tags values separately in span tag while iterating using map function.
Now multiple tags are displaying in a single span tag ( please see below) How can I fix this ?
const blogData = [
{
"id" : 1,
"title":"Cypress tests",
"images":"/images/image1.jpg",
"description": "Add the E2E cypress UI tests",
"tags": "cypress"
},
{
"id" : 2,
"title":"Jmeter tests",
"images":"/images/image2.jpg",
"description": "Performance test using Jmeter tool",
"tags": ["jmeter", "performance"]
},
{
"id" : 3,
"title":"Basic Unix commands",
"images":"/images/image3.jpg",
"description": "Learn basic unix commands in git bash",
"tags": "unix"
},
{
"id" : 4,
"title":"Postman",
"images":"/images/image4.jpg",
"description": "Api testing using postman",
"tags": ["postman", "api"]
},
]
Home.js
const [searchResults, setSearchResults] = useState([]);
<div className="container">
{
searchResults.map(({ id, title, images, description, tags }) => (
<div key={id} className="column-center">
{/* <img className="blogImage" key={images} src={images} alt="image"></img> */}
<div className="blogtitle">
<span key={title}>{title}</span>
</div>
<section>
<p className="blogdescription" key={description}>{description}</p>
</section>
<section className="col1">
<span key={tags}>{tags}</span>
</section>
<section className="col2">
<a>Read more {'>'}{'>'}</a>
</section>
</div>
))
}
</div>
I think this what you are after.
Sandbox
<section className="col1">
{Array.isArray(tags) ? (
tags.map((tag) => (
<span style={{ marginRight: "10px" }}>{tag}</span>
))
) : (
<span>{tags}</span>
)}
</section>
You could make this code much simpler be having the tags field always be an array even if there is a single element.
my recieving json array looks something like this
questions = [
{
q_name="question 1",
op_1="op 1",
op_2="op 2",
answer=1
},
{
q_name="question 2",
op_1="op 1",
op_2="op 2",
answer=2
}
];
i want to display this data in a form with radio buttons to choose options
how to achieve this, im new to angular 2
You have to update your Question collection object in component as below.
//Define private variable
questions: any;
//List of questions
this.questions = [
{
"q_name":"question 1",
"op_1":"op 1",
"op_2":"op 2",
"answer":"op 1"
},
{
"q_name":"question 2",
"op_1":"op 3",
"op_2":"op 4",
"answer":"op 4"
}
];
Now, In HTML render radio button as below:
<div *ngFor="let question of questions;let i=index">
<div>
Question : {{question.q_name}}
</div>
<div>
<input type="radio" [(ngModel)]="question.answer" name="{{i}}" value="question.op_1">{{question.op_1}}<br />
<input type="radio" [(ngModel)]="question.answer" name="{{i}}" value="question.op_2">{{question.op_2}}<br />
</div>
I face a problem now that I am not able to fetch key and value from nested JSON data.Please help me I am doing any wrong.
<ion-item class="item item-thumbnail-left item-text-wrap" type="item-text-wrap" nav-transition="android" ng-repeat="data in hrINPROCandidateList | filter:search">
<p class="small-text blue-text ">{{data.cfname}}</p>
<div class="row" ng-repeat="(key,value) in data.note_detail_fields track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
</ion-item>
JSON Data
{
"responseToken": 1,
"list": [
{
"candidate_id": "4",
"note_detail_fields": "{\"link\":\"View Interview Details\",\"job_title\":\"Sopra Executive\",\"Candidate\":\"Mark Ashton\",\"Interview_Type\":\"First Interview\",\"\":\"\",\"Duration\":\"30 minutes\",\"Date\":\"Wednesday, 23<sup>rd<\\/sup> November 2016\",\"Time\":\"09:00 to 09:30\",\"Location\":\"london\"}",
"cfname": "Idris",
"clname": "Alba"
},
{
"candidate_id": "506",
"note_detail_fields": null,
"cfname": null,
"clname": null
},
{
"candidate_id": "32",
"note_detail_fields": "{\"link\":\"View Shared Job\",\"job_title\":\"Manager\",\"Location\":\"London, United Kingdom\",\"Package\":\"800 - 850 per day GBP\"}",
"cfname": "Sajal",
"clname": "Agarwal"
}
],
"totalCount": "4",
"success": 1,
"status": null
}
View data in app
You re trying to loop through a string instead of an array, create a filter that parse the json contained in data.note_detail_fields
<div class="row" ng-repeat="(key,value) in data.note_detail_fields | fromJson track by $index">
<div class="col field">{{key}}</div>
<div class="col field-info">{{value}}</div>
</div>
app.filter('fromJson',function(){
return function(input){ return angular.fromJson(input); }
})
I am new to angular js. I have a json value based on which i will be populating my html. I need to populate a select dropdown with two options and make one auto selected based on the flag mentioned in the json.
Below is my json
$scope.alertdata=[{"Action": "1", "Name":"Peter"},{"Action": "2", "Name":"Steve"},{"Action": "3", "Name":"Khan"}]
My HTML
<tr ng-repeat="data in alertdata">
<td>
<select ng-model="data.Action">
<option ng-selected="data.Action == '1' " id="data.Action">Option1</option>
<option ng-selected="data.Action == '2' " id="data.Action">Option2</option>
<option ng-selected="data.Action == '3' " id="data.Action">Option3</option>
<option ng-selected="data.Action == '4' " id="data.Action">Option4</option>
</select>
</td>
</tr>
In the above HTML whenever i change my option in the dropdown my model is changed with the value of the option selected. Instead I want the id of the option to be updated in my model, since i require to process the updated model based on the new selection of option.
Thanks In Advance
You can use angular's ng-options, which automatically selects the correct one when the ng-model is pre-filled:
$scope.availableOptions = [
{ id: "1", name: "Option1" },
{ id: "2", name: "Option2" },
{ id: "3", name: "Option3" },
{ id: "4", name: "Option4" }
];
Then in your html:
<tr ng-repeat="data in alertdata">
<td>
<select ng-model="data.Action"
ng-options="option.id as option.name for option in availableOptions">
</select>
</td>
</tr>
See this working jsfiddle