[Solved] Program crashing after trying to read a NSString

The problem is probably that that _guideDescription string already is deallocated when you try to access it in -saveIntoExisted. You are now doing _guideDescription = [[NSString alloc] initWithString:[[notification userInfo] valueForKey:@”selected”]]; and that works, but I would recommend: [_guideDescription retain]; That makes sure the system doesn’t deallocate the string. solved Program crashing after trying to read … Read more

[Solved] Draw vector shapes for background of page

This link should get you started with regards to creating rounded corners in a HTML 5 canvas. http://www.html5canvastutorials.com/tutorials/html5-canvas-rounded-corners/ It will also allow you play around and come up with a solution that looks like your image. With regards to then putting this behind other elements, wrap the remainder of your elements in a div and … Read more

[Solved] how do I convert array to JSON

>>> import json >>> url_list = [‘http://www.google.com’, ‘http://www.yahoo.com’] >>> json.dumps({‘entry’: [{‘url’: v} for v in url_list]}) ‘{“entry”: [{“url”: “http://www.google.com”}, {“url”: “http://www.yahoo.com”}]}’ >>> print json.dumps({‘entry’: [{‘url’: v} for v in url_list]}, indent=4) { “entry”: [ { “url”: “http://www.google.com” }, { “url”: “http://www.yahoo.com” } ] } The amount of whitespace isn’t significant in json. If you want … Read more

[Solved] Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character

The first mistake is pushing all the characters on the stack outside of the if statement. Also you should check if stack is empty before removing items from it. Otherwise EmptyStackException is thrown. // stack1.push(S.charAt(i)); <– remove this line if (S.charAt(i)!=’#’) { stack1.push(S.charAt(i)); }else if (!stack1.isEmpty()) { // <– add this check stack1.pop(); } The … Read more

[Solved] Elasticsearch CreateIndex() not enough arguments

The IndicesCreateService.Do() function expects a context.Context to be passed. So, you need to import “golang.org/x/net/context” and then change your call to this: import ( … your other imports… “golang.org/x/net/context” ) … _, err := client.CreateIndex(“events”).Do(context.TODO()) ^ | add this You can also check the indices_create_test.go test case in order to see how it’s done. 2 … Read more

[Solved] JavaScript object search and get all possible nodes

You could try and solve this with recursive function calls function parse(string, key, before) { return before+key+”:”+string; } function findString(string, json, before) { var results = []; for (var key in json) { if (typeof(json[key]) === “string”) { // it is a string if (json[key].contains(string)) { // it contains what it needs to results.push(parse(string, key, … Read more

[Solved] Why my if…else statement doesnt work where is my mistake and how to fix it?

Please try this code: $number = 0; $result = mysqli_query($con, $sql); if (!$result) exit(mysqli_error($con)); else $number = mysqli_num_rows($result); if ($number==0) { echo “No rented cars for this period !”; } else { while ($number){ $row = mysqli_fetch_row($result); $brand = $row[‘brand’]; $model = $row[‘model’]; $reg_num = $row[‘reg_num’]; $horse_powers = $row[‘horse_powers’]; $color = $row[‘color’]; echo $brand; $number–; … Read more

[Solved] How to use autoresize on 2 UIViewControllers? [closed]

Well, part of the problem is that this is illegal: [UIViewControllers1.view addSubview:UIViewControllers2.view]; You must never just wantonly add one view controller’s view to another view controller’s view. There is only one way in which that is allowed outside of a built-in parent-child structure that does it for you (UINavigationController, UITabBafController, UIPageViewController), and that is when … Read more