How to pass NSManagedObject into ECSliding - nsmanagedobject

I don't know if anyone has asked this question or perhaps I have overlooked. Please accept my apologies.
I have a LoginViewController in front of InitialSlidingView. How can I pass NSManagedObjectContext into InitialSlidingView and subsequently to any NavigationTopView? I have NSManagedObjectContext and NSManagedObjectModel in AppDelegate.
Thanks.
Adrian

You can expose a NSManagedObject property on your view controllers. Then you can set this property on the view controllers the need it or end up passing it along.

Related

Methods implementation for future grails project

i just want to ask for any of your ideas on what method to be created, i mean a useful method that can be implement to any grails project. Thanks!
Here is my example method
String.metaClass.htmlEscape {
return org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(delegate)
}
and here's how you call it in the controller
def kups = ([['name':'<marquee direction="up">"Sample 1"</marquee>'.htmlEscape()],['name':'<b>Sample 2</b>'.htmlEscape()]])
render kups as JSON
and the output is
<marquee direction="up">"Sample 1"</marquee> <b>Sample 2</b>
So guys please me for any method ideas Thanks :)

Call a controller inside a template and another controller in Fatfree framework

i'd like to know if i can call a controller action inside a template, and inside another controller in fatFree framework (F3).
I'm not sure if i understand you corrently, but calling a Class method in Template would go like this:
{{ MyConroller->doSomething() }}
Of cause you could call one controller within another too... just use raw php
$obj = new MyController();
$obj->foo();
or use the F3 call method $f3->call('MyController->doSomething');
Also check out the new API docs.
http://fatfreeframework.com/base#call
It's still under construction, but hopefully you'll find more information about this or any other framework part very soon.
Many MVC purists would balk at the idea of a View (template) calling methods on the Controller. They would say that the controller needs to provide the data that the view needs, or at least give it the Model, so that it can retrieve data from there.
Furthermore, the View probably shouldn't be doing anything (or asking another component to do anything), other than generating the display. But can query the Model for data. But maybe by doSomething() you do mean getSomeData().
While I'm not an MVC purist I do agree with the idea of keeping logic and functionality out of the view if at all possible.

Fluently choosing which component to inject

I have some components implementing the same interface and I would like to chose which one gets injected to my Repository.
Component.For<IRepository>().ImplementedBy<Repository>().<whatShouldGoHere>()
I thought I had this working with DependsOn but now I saw that DependsOn are for static dependecies such as strings. Is the IHandlerSelector the only way forward? I would rather have the declaration inline with the component registration. Maybe a factory method? Are there any recommendations?
Edit
Example Constructor
public PersitentRepository(Func<ISession,string> sessionFactory)
Digging around I realize that the delegate is an artifact from the TypedFactoryFacility. There seems to have been some change so it now resolves by type only. In older Castle versions the string argument was used to select component by name.
A factory would to the trick.
You need to add the FactorySupportFacility to your container for this to work.
For much more detail, see the Castle Windsor documentation at http://docs.castleproject.org/Default.aspx?Page=Factory-Support-Facility&NS=Windsor&AspxAutoDetectCookieSupport=1.
See also http://www.mail-archive.com/castle-project-users#googlegroups.com/msg04463.html.
DependsOn does work for other things than statics, the problem is that the injected delegate does not resolve the way it used to. I ended up registering my own component for handling this specific delegate
container.Register(Component.for<Func<ISession,string>>().ImplementedBy(sessionName => container.resolve<ISession>(sessionName));
(I typed the above from memory so please excuse any typos)

Create an array for several UIViewControllers

So I want to create an array that would contain my App's UNViewControllers. I'm using a navigationcontroller to switch between views. What my overall aim is to use this Array so that I can load the views using this array. My only problem is I don't have an idea how I would utilise this function. Do I need to create the array in my Projects AppDelegate file so I can apply the Array to all my sub ViewControllers? Any advice would be really helpful. Thanks in advance!
You have a navigation controller right? So you don't need an array of viewcontrollers, the navigation controller will handle it. Just give each view controller an identifier in interface builder (storyboard) and then use:
MyViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:#"MyVCIdentifier"];
[self.navigationController pushViewController:vc animated:YES];

Call a Method in a Collection

I've got a collection of custom objects with a method, Update(), in each of them. I need a way to iterate over the collection and call that method. This is easy to do in C# with a List, but I'm not sure how to do it in ActionScript. Any help that you could provide would be greatly appreciated. Thanks!
have a look at Array.foreach()
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html#forEach%28%29
So, after some experimentation, I found that you can type the iteration variable in the look to the object that the list is composed of, and it opens up all the methods and properties in that object:
for each(var ship:Ship in ships)
{
ship.Update();
}
Not too sure if this is GOOD to do or not, but it works...