ios6 EXC_BAD_ACCESS(code=1, address=0x0) error - ios6

I am getting a EXC_BAD_ACCESS(code=1, address=0x0) error (the address equals is another not 0x0 but I assume a number related to my project).
This error occurs when going "back" to the main VC in a Navigation Controller system. The set up is as follows:
View Controller - MyConnection is the main ViewController. There are tableviewcells and a tab bar on this VC. The tableviewcells will take you to either the Choose Server VC or the Choose Test Type VC. The one button on the tab bar takes you to Preferences VC.
This all works fine, you can go to and back with no issues.
The Preferences VC also has tablecells which also take the user to the Choose Server and Choose Test Type VCs. My error occurs when going from either Choose Server or Choose Test Type, back to Preferences and then back to the main VC. It crashes upon going back to the main VC and gives the error described above. Sadly the debugger doesn't give much more information. I have deduced that the viewWillAppear code in the main VC is being called and when reloading the table data it crashes.
Any idea what may be going wrong?
UPDATE:
Using the debugger some more it appears the cellForRowAtIndexPath isn't being called when returning. Any idea why this might be?

After reading a few other posts related to cellForRowAtIndexPath not being called I tried adding:
self.navigationController.delegate= self;
self.tableView.delegate = self;
to my viewWillAppear in the main ViewController. This solved the problem.

Related

how to get rid of namespace errors caused by including custom control in wpf application?

I am working on a wpf-project that used a ScrollViewer to show a range of items.
In order to create a more advanced look and feel for the application, I replaced the Scrollviewer with a Carousel-control.
The code for the Carousel-control I downloaded from here:
https://www.codeproject.com/Articles/181835/WPF-Carousel-Control
Conceptually, the carousel control (as part of my wider application) consists of a large black box (which one does not need to touch) plus just a few lines of code for plugging in the carousel control. The black box is the Carousel project, highlighted in the following screenshot:
In order to plug the carousel-control in the application, just a couple of lines had to be commented out and a couple of other lines had to be added. The comments in the following two screenshots mark off the lines of code that had to be commented out and the lines of code that had to be added (in order for the scrollviewer-control to be replaced by the carousel-control):
... and (at the end of the file):
Furthermore, at the beginning of the xaml-file that contains the carousel, the following line was included:
xmlns:Carousel="clr-namespace:Carousel;assembly=Carousel"
as can be seen in the following screenshot:
As you can see, at the moment, the code for the scrollviewer is commented out. Hence, the application is using the Carousel at the moment.
This carousel works fine. However, the error list shows a bunch of errors, mostly of the following type:
the name "XYZ" does not exist in the namespace "bla".
The following screenshot shows some of the error messages:
As already mentioned, the carousel-control works despite those error messages. However, I still need to get rid of the error messages before leaving this project.
Regarding the error messages, the following points might be of interest:
No error messages are shown, when the scrollviewer-control is used.
As you can see from screenshot 5, most error messages refer to line 1 of the file CarouselControl.xaml. This file is located inside the "black box":
The beginning of file CarouselControl.xaml contains the following lines of code:
As you can see from screenshot 5, most of the error messages say that some name or property does not exist in namespace xyz, whereby namespace xyz is one of the namespaces listed at the beginning of file CarouselControl.xaml (see screenshot 7).
********************************UPDATE*****************************************
(Right-click on) Solution -> Properties -> Configuration Properties, I noticed that it was apparently not possible to change the configuration of the Carousel-project to anything other than platform x86:
No matter which platform I selected (from the drop down menu at the top of the screenshot), the platform for the Carousel-project stubbornly remained at value "x86".
Might this have something to do with the error messages?
I'm not sure how useful this may be, but I believe I have found the code that was the source of my problem:
var variables = values[0] as ObservableCollection<variable>;
var identifier = values[1] as string;
var variable = variables.SingleOrDefault(x => x.identifier == identifier);
if (variable == null) return "";
This is code of my converter to access a variable in a collection and return its value as a string, it was used on a TextBox control.
Looking back over my branches, it seems that I made this change:
var variable = variables?.SingleOrDefault(x => x.identifier == identifier);
Resharper suggested adding a Null-conditional Operator at this point, which solved my issue. It would seem that the designer was returning errors due to the LINQ expression, since the collection at this point was uninitialized.
I would look through your code to see if you have a similar instance of uninitialized collections.

"save this stack" doesn't work in livecode

Once I could save an existing state in the application using the "save this stack" command, both on a computer and on a mobile device.
Today I found out, it no longer works.
For example: there is a field that is incremented by 1, and I reach 10.
If I leave the app and reopen it, it's not saved and will start from 0.
Why? How can this be fixed?
Code:
on mouseDown
add 1 to field "counter"
save this stack
end mouseDown
Make a new stack with a field and a button, and place this in the button script:
on mouseUp
add 1 to fld 1
save this stack
end mouseUp
If you click on the button, the field increments. If you then close the stack, it will shut down at once, not asking if you want to save it. If you then re-open, the last state of the field is displayed.
The reason you are not asked to save is because the stack was just saved, and no changes were made. The field holds the latest value. In other words, all is right with the world. The question then becomes this: what is different about your stack?
Mac os 10.9. LC 8.1.8. (But none of any of that should matter)
That's exactly what I did But it is not saved! I pressed and pressed And I got to 10. Then I closed the app and reopened it The field presented the first value (0 for this purpose) and not the value 10 * Not working on mobile
Desktop: I tried it on my IDE and it works! But only if you use is as livecode stack and not as standalone, see next section.
Mobile: You can not save changes in the main stack on mobile devices because it is always a standalone. Mainstacks in standalones cannot be chanched because they are part of the binary. If you want to have a stack on a mobile device (or desktop) which can save itself you have to create it as a substack.
To be correct, a substack, if also part of the executable file, cannot be saved.
The usual method is to attach one or more stack files to a "Splash" stack.
The Splash stack generally has limited functionality, such as to navigate to the working stack or stacks, and all their substacks. Those all can be saved. The splash stack is simply a vehicle to open the standalone, and then let its associated stacks do the real work.
Use
command saveThisStack
put fld "score" of cd "mainCard" into tTempList
put the base64Encode of tTempList into tTempList
set the defaultFolder to specialFolderPath("documents")
put tTempList into URL ("file:score.txt")
end saveThisStack

Smoothstate : Get $(document) in onReady

How to get to $(document) in the onReady method ?
I've tried with smoothState.cache[smoothState.href] but couldn't make it works.
(fantastic plugin)
Thanks
I'm assuming you want to get at the document for the new page that's being loaded. Technically, $(document) exists in onReady, and it's the first document you visited on the site. After that, smoothState just dynamically updates it by swapping out content. So whatever existed on the previous page you were viewing is there as normal. Once the line $container.html( $newContent ); runs in your onReady method (assuming your code follows all the smoothState examples), you new content should be available.
However, if you want to get at the actual, full document for the new page that got loaded up, not just what's contained in your wrapper div that gets swapped out, it's contained in smoothState.cache[smoothState.href].doc. It's got the header, the body, everything.
A little reading of the smoothState source code shows that you can pull it into a useful format this way:
var $newDoc = $("<html></html>").append( $(smoothState.cache[smoothState.href].doc) );
At this point, you can run find queries or whatever you need to go look through things.

adding controller later

I'm trying to create an NG app where parts can be enabled/disabled dynamically. The idea is to have an "admin" page, where parts of the app can be enabled or disabled, and then see new functionality appear, in the form of an adjusted menu at the top of the page, and matching routes, controllers, etc loaded into the app (I'm using SocketStream w/ NG).
The first step was to add / remove routes dynamically, for which I found a solution at https://stackoverflow.com/a/13173667 - working well, as far as I can tell.
Next, adding items to the menu bar - easy with ng-repeat on ul/li items.
So the app adjusts its menu and recognizes the corresponding route. So far so good.
The problem comes with registering a controller. I'm calling myApp.controller('SandboxCtrl',[...]) with proper args (same as what worked when initialising statically on startup), but the controller does not appear to get loaded or inited properly. Navigating to the newly added route generates errors such as:
Error: Argument 'SandboxCtrl' is not a function, got undefined
assertArg#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:973
assertArgFn#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:984
#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:4638
update#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:14007
$broadcast#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:8098
#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:7258
wrappedCallback#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:6658
wrappedCallback#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:6658
#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:6695
$eval#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:7848
$digest#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:7713
$apply#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:7934
#http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.1/angular.js:5433
I'm currently at a loss on how to proceed. I've not been able to find a solution on the web. The app is too large to put in a jsFiddle, but I can commit the last changes on GitHub if needed.
Questions: is this feasible? what can I do to debug this? any examples I could look at?
EDIT: The code is now at https://github.com/jcw/housemon (needs node/npm/redis). It's easy to reproduce the problem: launch with "npm start", browse to localhost:3333, go to admin tab, click on "jcw-sandbox" and then "Install". Top menu will update with new a "Sandbox" entry. Clicking on that entry generates the error shown above.
Oh, almost forgot: relevant code is in client/code/app/main.coffee and client/code/modules/routes.coffee ...
The answer turns out to be two-fold:
the NG calls were made from SocketStream RPC callbacks, and had to be wrapped in $scope.$apply calls - my bad, didn't know about this SS/NG interaction
the rest of the solution was outlined by #matys84pl - pick up $controllerProvider (and $filterProvider) early on, so they can be called at a later time instead of the normal "app.controller" and "app.filter" members, which don't seem to work anymore later on
Example code in GitHub, I'll link to a specific commit so this answer stays valid:
https://github.com/jcw/housemon/commit/f199ff70e3000dbf57836f0cbcbb3306c31279de

module block view only prints if it is on a certain page

In Drupal 7 Is there a way for me to insert my block into a region only on certain pages inside of a module code? Or do I have to do that in the gui block list?
I've created a banner module, but want to be able to give the ability to choose the pages it appears on. For starts, it could appear only on the front page. I tried a $is_front check, but I am getting an error that $is_front or $variables are undefined.
This doens't work inside of my block_view() function in my module.
if ($is_front){
$block['content'] = theme('mydata', $banner_node_list);
}
I think your best bet is to use the block GUI to select where it appears. I can't see any benefits to doing it in the code when it's already built in to be honest.

Resources