Search Results

Search found 9845 results on 394 pages for 'xbox controller'.

Page 8/394 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Zend framework controller action helper

    - by guptanikhilchandra
    I am getting fatal error after adding the action helper class. I am trying to load layout corresponding to called layout. Following is my code snippet: First of all i added a helper class under application/controller/helpers: class Zend_Controller_Action_Helper_Layout extends Zend_Controller_Action_Helper_Abstract { public $pluginLoader; public function __construct() { // TODO Auto-generated Constructor $this->pluginLoader = new Zend_Loader_PluginLoader (); } public function preDispatch() { $bootstrap = $this->getActionController()->getInvokeArg('bootstrap'); $config = $bootstrap->getOptions(); $module = $this->getRequest()->getModuleName(); if (isset($config[$module]['resources']['layout']['layout'])) { $layoutScript = $config[$module]['resources']['layout']['layout']; $this->getActionController()->getHelper('layout')->setLayout($layoutScript); } } } Then i added a loader in bootstrap.php: protected function _initLayoutHelper() { $this->bootstrap('frontController'); Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH .'/controllers/helpers'); $layout = Zend_Controller_Action_HelperBroker::addHelper(new Zend_Controller_Action_Helper_Layout()); } Following is my application.ini: [production] autoloaderNamespaces.tree = "Tree_" phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.helperDirectory = APPLICATION_PATH "/controllers/helpers" resources.modules[] = "" contact.resources.frontController.defaultControllerName = "index" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.layout.layout = layout admin.resources.layout.layout = admin admin.resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view[] = [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 While running this code i am getting following errors: Warning: include(Zend\Controller\Action\Helper\LayoutLoader.php) [function.include]: failed to open stream: No such file or directory in D:\personal\proj\renovate\library\Zend\Loader.php on line 83 Warning: include() [function.include]: Failed opening 'Zend\Controller\Action\Helper\LayoutLoader.php' for inclusion (include_path='D:\personal\proj\renovate\application/../library;D:\personal\proj\renovate\library;.;C:\php5\pear') in D:\personal\proj\renovate\library\Zend\Loader.php on line 83 Fatal error: Class 'Zend_Controller_Action_Helper_LayoutLoader' not found in D:\personal\proj\renovate\application\Bootstrap.php on line 33 Kindly let me know, how can i come out from this issue. I am beginner in Zend Framework. Thanks Nikhil

    Read the article

  • Sd card bigger than 2gb is not recognized in ubuntu 12.04

    - by dex1
    When I insert a card up to 2gb it is immediately seen by the system but if try it with bigger one it's not seen. I presume the issue is not due to the card reader itself as it reads all cards under windows 7 but due to linux driver. I could see some people having similar issues but no solution. Any help appreciated. GParted doesnt see cards bigger than 2gb. After insertion small card ubuntu@ubuntu:~$ dmesg [10169.384481] mmc0: new SD card at address a95c [10169.384870] mmcblk0: mmc0:a95c SD016 14.0 MiB [10169.386715] mmcblk0: p1 everything worked fine then I removed the small one and put 8gb, waited for 2min [10295.736422] mmc0: card a95c removed [10362.448383] sdhci: Switching to 1.8V signalling voltage failed, retrying with S18R set to 0 [10372.480076] mmc0: Timeout waiting for hardware interrupt. [10382.496146] mmc0: Timeout waiting for hardware interrupt. [10392.512149] mmc0: Timeout waiting for hardware interrupt. [10402.528145] mmc0: Timeout waiting for hardware interrupt. [10402.529267] mmc0: error -110 whilst initialising SD card [10402.748807] sdhci: Switching to 1.8V signalling voltage failed, retrying with S18R set to 0 [10412.768063] mmc0: Timeout waiting for hardware interrupt. [10422.784051] mmc0: Timeout waiting for hardware interrupt. [10432.800076] mmc0: Timeout waiting for hardware interrupt. [10442.816067] mmc0: Timeout waiting for hardware interrupt. [10442.817165] mmc0: error -110 whilst initialising SD card [10443.040805] sdhci: Switching to 1.8V signalling voltage failed, retrying with S18R set to 0 [10453.056145] mmc0: Timeout waiting for hardware interrupt. [10463.072139] mmc0: Timeout waiting for hardware interrupt. [10473.088050] mmc0: Timeout waiting for hardware interrupt. [10483.104046] mmc0: Timeout waiting for hardware interrupt. [10483.104107] mmc0: error -110 whilst initialising SD card [10483.328960] sdhci: Switching to 1.8V signalling voltage failed, retrying with S18R set to 0 [10493.344144] mmc0: Timeout waiting for hardware interrupt. ubuntu@ubuntu:~$ lspci 00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03) 00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 03) 00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 03) 00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03) 00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03) 00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03) 00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03) 00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03) 00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03) 00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03) 00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 03) 00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03) 00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03) 00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03) 00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03) 00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3) 00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 03) 00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03) 00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03) 00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03) 07:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8072 PCI-E Gigabit Ethernet Controller (rev 16) 0a:01.0 FireWire (IEEE 1394): O2 Micro, Inc. Firewire (IEEE 1394) (rev 02) 0a:01.2 SD Host controller: O2 Micro, Inc. Integrated MMC/SD Controller (rev 02) 0a:01.3 Mass storage controller: O2 Micro, Inc. Integrated MS/xD Controller (rev 01) Same cards, same machine (same reader) only different OS(win7) work flawlessly. Some interesting reading I came across but is Chinese for me http://www.mail-archive.com/[email protected]/msg14598.html and another bit http://article.gmane.org/gmane.linux.kernel.mmc/11973/match=sd+card+not+recognized

    Read the article

  • Kinect sera disponible mondialement pour Noël, le module pour Xbox de Microsoft devrait coûter 150$

    Mise à jour du 16.06.2010 par Katleen Kinect sera disponible mondialement pour Noël, le module pour Xbox de Microsoft devrait coûter 150$ Lundi, Microsoft a présenté Kinect (le nouveau nom du projet Natal) lors du salon du jeu vidéo E3 à Los Angeles. Des journaliste ont même pu essayer l'engin. Lors de sa sortie, 15 jeux seront déjà disponibles avec la plateforme. Six ont déjà été présentés sur le salon. Il y Kinectimals, jeu d'interaction avec un bébé tigre qu'il faut caresser et faire jouer ; Kinect Sports (bowling, javelot, etc.) qui rappelle un titre similaire sur Wii ; Dance Central dont le but est de reproduire la chorégraphie à l'écran ; Kinect Your Shape, qui propose des exercices sportifs de...

    Read the article

  • Complete your feedback to win a free registration to the PASS summit or an XBox

    - by simonsabin
    Don’t forget that if you complete you session and conference feedback for SQLBits then you will be entered into a draw for an XBox Super Elite . Not only that, we also have a registration for the PASS Summit in November this year to give away . The survey is essential for us to make SQLBits conference better . If you don’t tell us what doesn’t work then we can’t fix it. We listened this time and gave you better signage and more information in your agenda about sessions and the abstracts. So please...(read more)

    Read the article

  • Microsoft Unveils Xbox SmartGlass

    SmartGlass won't be available to consumers until the fall, and if the reviews of the feature's capability are any indication, it's going to feel like a very long wait. SmartGlass lets you switch from watching something on your TV to watching it on your tablet or smartphone, and vice versa. But that's only the beginning. SmartGlass also lets developers turn smartphones and tablets into Xbox 360 controllers. Thus, if you're playing a sports-based game with your friends, you can enter your strategic plays into your smartphone, so he can't tell what your team is about to do. Or, with a baseball ga...

    Read the article

  • Simulate analogue steering wheel input from third party software like xPadder

    - by David Jensen
    So. I currently have a steering wheel connected to my htpc. Since it wont work / get recognized by all games i play. I use xpadder to play for example Grid 3. As far as i have understood, it simply presses the associated arrow key when i turn the wheel. What i would like, is a software to simulate more and more frequent key presses of the arrow keys the more i turn the wheel. Example: Tilting a little - 100 presses / second Tilting more - 200 presses / second Tilting max - Hold down key Because what i currently do with the wheel is constantly shaking it a bit right, when i just want to turn a little bit right and so on. Os : W8

    Read the article

  • Push/Present Modal View Controller

    - by Yakattak
    I have a table in my view controller (let's call it TVC1). I have rows in TVC1 that are used so the user can input some more data in addition to the data on TVC1. So, when someone taps a specific row in TVC1, it will show another view controller (let's call it TVC2). However, when TVC2 is shown, all of the data in TVC1 is cleared. How can I save the data in TVC1? Should I do it through the app delegate? DescriptionInputViewController *descriptionController = [[DescriptionInputViewController alloc] initWithNibName:@"DescriptionInputView" bundle:nil]; [self presentModalViewController:navController animated:YES]; [self.navigationController pushViewController:descriptionController animated:YES]; [descriptionController release];

    Read the article

  • Codeigniter: Retrieving a variable from Model to use in a Controller

    - by Craig Ward
    Hi, I bet this is easy but been trying for a while and can't seem to get it to work. Basically I am setting up pagination and in the model below I want to pass $total_rows to my controller so I can add it to the config like so '$config['total_rows'] = $total_rows;'. function get_timeline_filter($per_page, $offset, $source) { $this->db->where('source', $source); $this->db->order_by("date", "desc"); $q = $this->db->get('timeline', $per_page, $offset); $total_rows = $this->db->count_all_results(); if($q->num_rows() >0) { foreach ($q->result() as $row) { $data[] = $row; } return $data; } } I understand how to pass things form the Controller to the model using $this->example_model->example($something); but not sure how to get a variable from the model?

    Read the article

  • Design Patterns: What's the antithesis of Front Controller?

    - by Brian Lacy
    I'm familiar with the Front Controller pattern, in which all events/requests are processed through a single centralized controller. But what would you call it when you wish to keep the various parts of an application separate at the presentation layer as well? My first thought was "Facade" but it turns out that's something entirely different. In my particular case, I'm converting an application from a sprawling procedural mess to a clean MVC architecture, but it's a long-term process -- we need to keep things separated as much as possible to facilitate a slow integration with the rest of the system. Our application is web-based, built in PHP, so for instance, we have an "index.php" and an IndexController, a "account.php" and an AccountController, a "dashboard.php" and DashboardController, and so on.

    Read the article

  • My helper methods in controller

    - by FancyDancy
    My app should render html, to answer when a user clicks ajax-link. My controller: def create_user @user = User.new(params) if @user.save status = 'success' link = link_to_profile(@user) #it's my custom helper in Application_Helper.rb else status = 'error' link = nil end render :json => {:status => status, :link => link} end My helper: def link_to_profile(user) link = link_to(user.login, {:controller => "users", :action => "profile", :id => user.login}, :class => "profile-link") return(image_tag("/images/users/profile.png") + " " + link) end I have tried such methods: ApplicationController.helpers.link_to_profile(@user) # It raises: NoMethodError (undefined method `url_for' for nil:NilClass) and: class Helper include Singleton include ApplicationHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::UrlHelper include ApplicationHelper end def help Helper.instance end help.link_to_profile(@user) # It also raises: NoMethodError (undefined method `url_for' for nil:NilClass) In addition, yes, I KNOW about :helper_method, and it works, but i don't want to overload my ApplicationController with a plenty of that methods

    Read the article

  • Reading out all actions in a Grails-Controller

    - by kenan
    Hi, i need to read out all available actions from any controller in my web-app. The reason for this is an authorization system where i need to give users a list of allowed actions. E.g.: User xyz has the authorization for executing the actions show, list, search. User admin has the authorization for executing the actions edit, delete etc. I need to read out all actions from a controller. Does anyone has an idea? Thx for any help! kenan

    Read the article

  • ASP.NET MVC pass information from controller to view WITHOUT ViewData, ViewModel, or Session

    - by josh
    I have a unique scenario where I want a base controller to grab some data and store it in a list. The list should be accessible from my views just as ViewData is. I will be using this list on every page and would like a cleaner solution than just shoving it in the ViewDataDictionary. After attempting to come up with a solution, I thought I would create a custom ViewPage with a property to hold my list. My custom ViewPage would inherit from System.Web.MVC.ViewPage. However, I do not know where MVC passes the viewdata from the controller off to the view. More importantly, how do I get it to pass my list down to the view? Thanks for the help.

    Read the article

  • Returning Json object from controller action to jQuery

    - by PsychoCoder
    I'm attempting to get this working properly (2 days now). I'm working on a log in where I'm calling the controller action from jQuery, passing it a JSON object (utilizing json2.js) and returning a Json object from the controller. I'm able to call the action fine, but instead of being able to put the response where I want it it just opens a new window with this printed on the screen: {"Message":"Invalid username/password combination"} And the URL looks like http://localhost:13719/Account/LogOn so instead of calling the action and not reloading the page it's taking the user to the controller, which isn't good. So now for some code, first the controller code [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl = "") { if (ModelState.IsValid) { var login = ObjectFactory.GetInstance<IRepository<PhotographerLogin>>(); var user = login.FindOne(x => x.Login == model.Username && x.Pwd == model.Password); if (user == null) return Json(new FailedLoginViewModel { Message = "Invalid username/password combination" }); else { if (!string.IsNullOrEmpty(returnUrl)) return Redirect(returnUrl); else return RedirectToAction("Index", "Home"); } } return RedirectToAction("Index", "Home"); } And the jQuery code $("#signin_submit").click(function () { var login = getLogin(); $.ajax({ type: "POST", url: "../Account/LogOn", data: JSON.stringify(login), dataType: 'json', contentType: 'application/json; charset=utf-8', error: function (xhr) { $("#message").text(xhr.statusText); }, success: function (result) { } }); }); function getLogin() { var un = $("#username").val(); var pwd = $("#password").val(); var rememberMe = $("#rememberme").val(); return (un == "") ? null : { Username: un, Password: pwd, RememberMe: rememberMe }; } In case you need to see the actual login form here that is as well <fieldset id="signin_menu"> <div> <span id="message"></span> </div> <% Html.EnableClientValidation(); %> <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @id = "signin" })) {%> <% ViewContext.FormContext.ValidationSummaryId = "valLogOnContainer"; %> <%= Html.LabelFor(m => m.Username) %> <%= Html.TextBoxFor(m => m.Username, new { @class = "inputbox", @tabindex = "4", @id = "username" })%><%= Html.ValidationMessageFor(m => m.Username, "*")%> <p> <%= Html.LabelFor(m=>m.Password) %> <%= Html.PasswordFor(m => m.Password, new { @class = "inputbox", @tabindex = "5", @id = "password" })%><%= Html.ValidationMessageFor(m => m.Password, "*")%> </p> <p class="remember"> <input id="signin_submit" value="Sign in" tabindex="6" type="submit"/> <%= Html.CheckBoxFor(m => m.RememberMe, new { @class = "inputbox", @tabindex = "7", @id = "rememberme" })%> <%= Html.LabelFor(m => m.RememberMe) %> <p class="forgot"> <a href="#" id="forgot_password_link" title="Click here to reset your password.">Forgot your password?</a> </p> <p class="forgot-username"> <a href="#" id="forgot_username_link" title="Fogot your login name? We can help with that">Forgot your username?</a> </p> </p> <%= Html.ValidationSummaryJQuery("Please fix the following errors.", new Dictionary<string, object> { { "id", "valLogOnContainer" } })%> <% } %> </fieldset> The login form is loaded on the main page with <% Html.RenderPartial("LogonControl");%> Not sure if that has any bearing on this or not but thought I'd mention it. EDIT: The login form is loaded similar to the Twitter login, click a link and the form loads with the help of jQuery & CSS

    Read the article

  • Passing Data from Usercontrol to controller

    - by nitinkhanna
    Hi, I am new to MVC, and trying something and got stuck somewhere in between. I have a user control there I have three textbox html type(ID, Lastname, firstname) and a submit buttom. I set the button like <input type="button" value="Search" onclick="location.href='<%= Url.Action("action", "controller") %>'" /> I have called this usercontrol on some view through <%= Html.Partial("ucName") %> Now on pressing that button(on user control) I need to pass the data from these textboxes to controller again to some specific action(Http Post action). By using this data I want to do some database interaction and storing the result in a dataset and pass this data set to same view again to show up in some Grid. I know the first part in conventional Asp.net can be done by raising the event through delegate but don't know how to do that in MVC.

    Read the article

  • Unit testing a controller in ASP.NET MVC 3

    - by Abdullah Al- Mansur
    public Double Invert(Double? id) { return (Double)(id / id); } I have done this for this test but fails please can anyone help with this cos just started with unit testing /* HINT: Remember that you are passing Invert an *integer* so * the value of 1 / input is calculated using integer arithmetic. * */ //Arrange var controller = new UrlParameterController(); int input = 7; Double expected = 0.143d; Double marginOfError = 0.001d; //Act var result = controller.Invert(input); //Assert Assert.AreEqual(expected, result, marginOfError); /* NOTE This time we use a different Assert.AreEqual() method, which * checks whether or not two Double values are within a specified * distance of one another. This is a good way to deal with rounding * errors from floating point arithmetic. Without the marginOfError * parameter the assertion fails. * */

    Read the article

  • CakePHP Auth how to allow specific controller and actions

    - by nolandark
    I have a "Posts" and a "Users" controller. I use the Auth Component and I want that all users can visit "Post.index" but only logged in users can visit "User.index". In my app_controller.php I have this $this->Auth->allow('signup', 'confirm', 'index'); but with that all users can visit post.index and user.index. How can I specify a Controller in the allow-method? This didn't work for me: $this->Auth->allow('signup', 'confirm', 'Post.index');

    Read the article

  • JSF 2 Content Controller (pull in content based on URI)

    - by gerges
    Hey All, I'm new to JSF and am trying to make a content controller. Basically whenever someone makes a request to www.myapp.com/external/** I'd like to forward to a controller that pulls external content into a page template and spits it out to the user. I was able to achive this pretty easily in Spring 3, but I'm a little confused on where to start with JSF. I feel like I'd need to create a custom servlet to handle /external/**? But what would the class of this servlet be? What would it consist of? Any help is appreciated!

    Read the article

  • How to add View Controller with Tab Bar interfaced View Controller

    - by TechFusion
    I have created Window based Tab Bar controller app, One Tab Bar of viewController has been interfaced with WebVIew ..I am looking to create another view once touch event happened in that WebView.. //TabBarViewController.m - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { TabMainView *mainView = [[TabMainView alloc] init]; mainView.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController: mainView animated:YES]; [mainView release]; } I have created MainView, which is UIViewController Subclass. //TabMainView.m - (void)loadView { CGRect frame = CGRectMake(0.0, 0.0, 480, 320); WebView = [[[UIWebView alloc] initWithFrame:frame] autorelease]; WebView.backgroundColor = [UIColor whiteColor]; WebView.scalesPageToFit = YES; WebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin); WebView.autoresizesSubviews = YES; WebView.exclusiveTouch = YES; //self.WebView.UserInteractionEnabled = NO; WebView.clearsContextBeforeDrawing = YES; self.view = WebView; [WebView release]; } - (void)viewWillAppear:(BOOL)animated { [self.WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.apple.com"]]]; } Here when touch event happened then it is not passing control to TabMainView.m 's Viewload function although I am pushing it's view? TabBarView is also UIViewController subclass not a UINavigationController.

    Read the article

  • Codeigniter Controller function in a view [closed]

    - by Y2ok
    I'm using CodeIgniter and I have two controllers: Index controller that loads the website view Personal panel controller that will do all login, registration and personal panel functions. (Functions are loaded from models.) The problem is that I don't have any clue how to insert that controller in a view file or in the other controller file so that it would load when I press submit button for a form or if the session's loggedin is with value true.

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Navigation Controller Views in Landscape

    - by Mahadevan S
    Hi, I have set up a navigation controller ( navController ) in Portrait mode to which I push all the viewcontrollers I have. Now when a user switches to Landscape mode, I need to display all the views as a coverflow. For this I use [navController viewControllers] to get all the view controllers in the stack. In the Landscape view controller NSArray * arr = [navController viewControllers]; self.view = [arr objectAtIndex:0]; [arr objectAtIndex:0]; returns the correct view ( the bottombost viewcontroller's view in the nav stack ). My problem is these views never get displayed ie the views extracted from the navController never gets displayed. If i try to create a new view and insert all the subviews of a view, it gets displayed. eg : UIView * newView = [[UIView alloc] init]; for (UIView *subView in [arr objectAtIndex:0]) [newView addSubView:subView]; self.view = newView; The above piece of code works. But simply adding the view doesnt seem to work.. Can anyone explain the solution? Many thanks

    Read the article

  • Creating foreach loops using Code Igniter controller and view

    - by Tim
    Hello, This is a situation I have found myself in a few times and I just want clear it up once and for all. Best just to show you what I need to do in some example code. My Controller function my_controller() { $id = $this->uri->segment(3); $this->db->from('cue_sheets'); $this->db->where('id', $id); $data['get_cue_sheets'] = $this->db->get(); $this->db->from('clips'); $this->db->where('sheet_id', ' CUE SHEET ID GOES IN HERE ??? '); $data['get_clips'] = $this->db->get(); $this->load->view('show_sheets_and_clips', $data); } My View <?php if($get_cue_sheets->result_array()) { ?> <?php foreach($get_cue_sheets->result_array() as $sheetRow): ?> <h1><?php echo $sheetRow['sheet_name']; ?></h1> <br/> <?php if($get_clips->result_array()) { ?> <ul> <?php foreach($get_clips->result_array() as $clipRow): ?> <li><?php echo $clipRow['clip_name']; ?></li> <?php endforeach; ?> </ul> <?php } else { echo 'No Clips Found'; } ?> <?php endforeach; ?> <?php } ?> The problem I am having is the concept of passing data back to the controller from the view as I am sending the Database Queries off to the view as an array, when I really need to get some more information as to which sheet ID I am looking for to show the relevant clips. I hope this makes sense to someone out there. Thanks, Tim

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >