FAQ Database Discussion Community


Checkboxes array of bools doesnt brings the true value if it's checked by user

asp.net-mvc,controller,asp.net-mvc-5,views
I have a list of Checkboxes in a bool array, I wish I could give the Checked value as a "true" in that specific checkbox if it's checked by user This is my model using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace testnumbers.Models { public class StringNumber...

RSpec 3 - Test controller action that does not have routes

ruby-on-rails,ruby-on-rails-4,rspec,controller,rspec3
I have a controller and there is an action within that controller. That action contains only a few lines of code and this method doesn't have any routes, as follows: class MyController < ApplicationController def action_a # an action does have routes ..some code.. end def action b #(an action...

JavaFX : Button never sets a graphic

java,javafx,controller
EDIT : A MCVE version of my code has been made to help debug it. It reproduces my bug. The purpose of my code is doing a Memory game. Which means that when it is your turn, you "open" a card, then another one. If they form a pair, they...

AngularJS: Making a from invalid based upon contents of an input

angularjs,controller,html-form
When validating my form for a password I did previously just have that the password field was required, but now that I am applying conditions to how many characters the password must have ect, and I can't seem to get this part working. I have this function that displays the...

How to make satellizer use absolute url's?

angularjs,controller,forms-authentication,oauth-provider,satellizer
I'm making a signup form using satellizer. But it does not go to the right urk My console displays the following POST http://localhost:8000/http://104.236.150.55/auth/register 404 (Not Found) view2.js:185 Not found This is my config.js .config(['$routeProvider', '$locationProvider', '$authProvider', function($routeProvider, $locationProvider, $authProvider) { $routeProvider //for Landing page .when('/view2', { templateUrl: 'view2/view2.html', controller: 'View2Ctrl'...

Angularjs $http.get service not returning data to calling controller function

angularjs,service,controller
Hi Everyone I'm sure there is a simple solution to this problem but I can't seem to find it myself... I have a controller that assigns data to the $scope.items variable by calling a service defined as GetDataService $scope.items = GetDataService.getData('/getBroadcastSourceList/1'); The service is set up as follows: angular.module('appName') .service('GetDataService',...

Angular is giving me an injection unresolved error, but my controller isn't asking for any injections

javascript,angularjs,controller,modal-dialog,inject
I have a modal controller that is buggy, so I've been commenting out code to try to figure out the bug. Currently, my modal HTML partial is an empty div tag and my controller is a single console.log, with no arguments or parameters. The $modal.open call only specifies the controller...

redirect to action of different controller not retaining variable

c#,asp.net-mvc,controller,actionmethod
I'm redirecting from one controller to another, and sending over an object in the route values but the object is coming back as null: class Person { string Name {get; set;} } FirstController { ActionResult something() { Person p = new Person() { Name = "name" }; return redirectToAction("AddPerson", "Second",...

AngularJS - controller doesn't get data from service when using $http

angularjs,http,service,controller,is-empty
I have simple web app where I like to load some data from json. At the moment the data is hardcoded within my service and everything is working. When I change my service to load the same data from an external json file the controller renders the view before it...

Move some code from controller to factory in angular

angularjs,controller,factory
I must upload some file to server... I have some code in my controller, but the code is reusable.. So I would like to move it in a factory and then use the factory everytime I need it... I am not able to move this code to the factory.. If...

How can I pass data between GSP and controller in Grails without storing in the database?

grails,controller,gsp
Is it possible to enter data in the GSP view and use this data in the controller inside the program to do some operations without storing this data in the domain. For example I have a g:textField and I enter my name. I want to be able to use the...

Is bootstrap file a controller?

php,oop,model-view-controller,controller
Sometimes, there are things that should be done at the very beginning of execution. And, I called it 'bootstrap' or 'initialization'. In bootstrap file, I usually disable the magic quotes at the runtime, set up the database adapter,defining paths, registering the autoloader, etc. Is it right to put that bootstrap...

Silex can't find Controller Class

php,controller,silex
project directory structure /composer.json /web/index.php /app/controller/IndexController.php composer.json { "require" : { "silex/silex": "*" }, "autoload": { "psr-0": { "": "./" } } } index.php require_once __DIR__.'/../vendor/autoload.php'; use Silex\Application; $app = new Application(); $app['debug'] = true; $app->get('/', 'App\\Controller\\IndexController::getIndex'); $app->run(); IndexController.php namespace App\Controller; use Silex\Application; class IndexController { public function getIndex(Application $app)...

AngularJS factory inside ng-class on body tag not working

angularjs,controller,factory,angular-services,ng-class
Was told to create service/factory and use it on global controller. It's my first time hearing global controller. Anyways, I created a factory called Scroll and injected it on our main.controller.js. The function in the factory is isScrollingEnabled which returns true or false. The other function is setScrolling which will...

How to call this function for every controller in codeigniter

php,codeigniter,controller,autoloader
My situation is that, I have 20 controllers in my website, where I have a function like this. $this->lang->load("main", $this->session->userdata("lang_code")); How can I load this function in all the 20 controllers without adding it individually to the __constructor of every controller?...

How to make a variable set in controller, available in other class?

ruby-on-rails,ruby,ruby-on-rails-4,controller
In my controller I have: def index @grid = UsersGrid.new(params[:users_grid]) do |scope| scope.where(admin: false).page(params[:page]).per_page(30) end @grid.assets if (current_user && current_users.admin?) @show_column = true else @show_column = false end end In my grid class: class UsersGrid include Datagrid scope do User.order("users.created_at desc") end column(:abc, :header => "abc?", :html => true, :if...

Rails 4 routing issue, or something else; I am not sure at this point

ruby-on-rails,ruby-on-rails-4,controller,routes
Okay, these dashboard pages originally worked when I was trying to render them within the main controller generated with scaffold. I opted to try and split them off into their own controller. I am copying much of this from another app, but it is rails 3 and I am using...

More than one controller in one Bundle (Symfony)

php,symfony2,controller
Is it possible to do more than one controller in Symfony? And if yes, how can I do it? (Controller, routing etc) Because now I have: Directory "Controller" and inside "DefaultController.php" (It has 1000 lines of code like now.) Directory Resources->Config->Routing.yml (Here I have all routings). Directory Resources->views->Default (In this...

No Route Matches [POST] Bloc

ruby-on-rails,controller,routes
Alright I know there's a million posts on this but I can't seem to find a way to fix mine. I'm new to rails, just starting on my first solo-project after going through a guided one over at bloc. I'm hitting this error: No route matches [POST] "/registered_applications/new" Here are...

Upload picture NO plugin NO activerecord

ruby-on-rails,ruby-on-rails-4,upload,controller
i want to create a function into my controller to save a picture uploaded by an admin. I don't want to use plugin or Activerecord, just a function to write the bytes of the picture into the directory app/assets/images/ . So , when the admin create a new product he...

Controller method #show getting called

ruby-on-rails,ruby,controller
I have a link on my #index view: <%= link_to 'Export Calendar (ICS)', { controller: :tickets, action: :ics_export, format: :ics }, class: "class-needed right" %> routes.rb that pertains to this: resources :tickets get 'tickets/calendar' => 'tickets#ics_export' post 'tickets' => 'tickets#index' patch 'tickets/:id/close' => 'tickets#close', as: 'close_ticket' post 'tickets/:id' => 'ticket_comments#create'...

Cakephp3 redirect in beforeFilter is not working

redirect,controller,cakephp-3.0,before-filter
When I add the $this->redirect statement inside a beforeFilter of a controller and return afterwards, the redirection is being ignored. When I move the redirect statement inside an action of the controller, it works fine. Does someone has an idea what I am doing wrong? public function beforeFilter(Event $event) {...

MVC controller returns JSON. But to where?

json,asp.net-mvc,controller
i'm new to MVC. So a MVC controller mainly returns a viewresult. i understand it will be the view has the same action name. Let's say "DoSomething" action goes to "DoSomething" view. But if the controller returns a JSON, to where is it returned to? Is it going to the...

How can i access scope in angular service

javascript,angularjs,controller
I have two controllers app.controller('TestCtrl1', ['$scope', function ($scope) { $scope.save = function () { console.log("TestCtrl1 - myMethod"); } }]); app.controller('TestCtrl2', ['$scope', function ($scope) { $scope.var1 = 'test1' $scope.save = function () { console.log("TestCtrl1 - myMethod"); } }]); Then i have two services .service('Service1', function($q) { return { save: function(obj) {...

How can I stub a controller instance variable using RSpec?

ruby-on-rails-3,rspec,controller
new_controller_spec.rb require 'spec_helper' describe NewController do describe 'actions' do describe 'POST /franchise_opportunities' do it 'renders v3/franchise_opportunities when domain id 5' do domain = double(Domain, mrdeliverycom?: true) controller.instance_variable_set(:@domain, domain) post :franchise_opportunities, name: 'v' response.should render_template('v3/franchise_opportunities') end end end end new_controller.rb # -*- encoding : utf-8 -*- class NewController < ApplicationController before_filter...

Rails category (or filter) links in same controller?

ruby-on-rails,ruby,hyperlink,model,controller
Having trouble understanding how using links_to filter content within the same controller in the rails view works. My code is below: # index.html.erb (link nav area) <nav> <%= link_to 'Daily Monitoring', root_path(:category => "dailymonitoring") %> <%= link_to 'Smoke Tests', root_path(:category => "smoketests") %> </nav> # index.html.erb (cont.) <ul id="results"> <%...

How to get the value from model to controller

php,codeigniter,model,controller
model This is my model.using last query I get value in the model,but I don't get the value in the controller class Login_model extends CI_Model { function __construct() { parent::__construct(); } public function email() { $this->db->select('email'); $this->db->from('change_password'); $result=$this->db->get(); return $result; } } controller class Login extends CI_Controller { function __construct()...

Activeadmin where to place this variable code from my view

variables,ruby-on-rails-4,controller,activeadmin
I have created a nice little view but it has some code in it that I would normally place in a controller. I have tried making a controller for the model but Active Admin ignores it. I have tried a small controller do block inside the Active Admin resource file...

Yii: Redirect in controller to external site in new tab

php,browser,yii,controller
Is it possible to redirect to an external url inside a Yii controller and open the new page in a new tab? $this->redirect("http://www.google.com"); This works fine, but opens in the same tab. Is there a way to open the url in a different tab? Thanks...

Controller method: Contact form should render different page depending on where the form is used

ruby-on-rails,ruby,forms,ruby-on-rails-4,controller
I have a contact form on a special page dedicated to this form. The dedicated controller includes: def new @message = Message.new end def create @message = Message.new(message_params) if @message.valid? MessageMailer.new_message(@message).deliver_now flash[:success] = "Thank you!" redirect_to contact_path else render 'new' end end Now I would also like to include this...

rails controller test failing non-deterministicly wrt state leak (I think)

ruby-on-rails,testing,controller,strong-parameters
I have a standard rest controller (with load_and_authorize_resource) for which I have the following strong params allowed: def subscription_params params.require(:subscription).permit(:email,:confirmed) end update action: def update respond_to do |format| if @subscription.update(subscription_params) format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' } format.json { render :show, status: :ok, location: @subscription } else...

calling the parent controller function in Ext.Ajax.request

extjs,view,controller,scope
I have a login Page which authenticates the user.On correct username and password it should hide the loginview and display the next view.When I call the function to do the same it gives an error saying "Uncaught TypeError: this.functionname is not a function.Here is my code for the same: startMain...

Signout from a controller in rails 4

ruby-on-rails,devise,controller
I want to signout from a controller. My controller looks like def update if @attendance.update_attribute(:logout_at, Time.now.localtime) redirect_to signout_path and return end end And my routes looks like devise_scope :employees do get "signout" => "devise/sessions#destroy" end devise_for :employees, :controllers => { registrations: 'registrations' } But It gives error Unknown action Could...

Click actionlink on view, controller checks condition, returns JSON, jQuery Ajax doesn't work

ajax,json,controller,asp.net-mvc-5,actionlink
Click ActionLink on view, controller checks condition, returns JSON, JQuery Ajax doesn't work. Click the "Delete" ActionLink, "Delete" controller if customer's "Orders" property is null, if not null, a message will be popped up. If null, process to "Delete" view. Here are the codes: 1, on the view, the @Html...

Open in same view controller as closed on (swift)

swift,view,controller,save,nsuserdefaults
I am making a simple fact app (In swift) and all the facts are in separate view controllers and when the user closes the app, it all goes to the main page and you have to start from fact 1 again. I want to know how to save what view...

rspec controller empty session

ruby-on-rails-3,testing,rspec,controller
app/controllers/new_controller.rb: class NewController < ApplicationController def enter_time session[:dr] = 'dr' if !params[:time].nil? then Time.zone = @franchise.time_zone inanhour = 1.hour.since(Time.zone.now) delivery_time = delivery_time_format(params[:time]) delivery_time = delivery_time.change(offset: (Time.zone.now.utc_offset / 3600).to_s) session[:target_time] = [delivery_time, inanhour].max.to_s end end end spec/controllers/new_controller_spec.rb: require 'spec_helper' describe NewController, :type => :controller do...

Where is the syntax error in my rails app?

ruby-on-rails,controller
The following is my webhooks_controller.rb: class WebhooksController < ApplicationController before_action :auth_anybody! skip_before_filter :verify_authenticity_token def tx if params[:type] == "transaction" && params[:hash].present? AMQPQueue.enqueue(:deposit_coin, txid: params[:hash], channel_key: "satoshi") render :json => { :status => "queued" } end end And I'm getting the following error: webhooks_controller.rb:10: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)...

Resolve promise in service without callback in controller

angularjs,callback,controller,promise,angular-promise
I would like to ask/discuss wether this is good or bad practise - what are the pros and cons of making a service call insde a controller as clean and short as possible. In other words: not having a callback anymore but make use of the Angular binding principles of...

ParameterMissing param is missing or the value is empty

ruby-on-rails,ruby-on-rails-4,view,controller,parameter-passing
i have the following situation: I have a controller for admins , that i use to manage the users (model generated by Devise). So, i use the actions of another controller to manage the resources "users". Here my files: admins_controller.rb before_action :set_user, only: [:show, :edit, :update, :destroy] def update respond_to...

Rails extended “show” function

ruby-on-rails,ruby-on-rails-4,model-view-controller,controller,routes
I'm beginner and can't figure out where to start with this problem. I have fully functional Entities Controller where I can make new Entity and add all info I need. Now I would like to have simple button on Show page that will direct me from Example/entities/12 to Example.com/entities/12/custom_view page...

Using controller inside another controller in AngularJS

angularjs,binding,controller
Why I can't bind to controller's variable inside second controller? <div ng-app="ManagerApp"> <div ng-controller="MainCtrl"> Main: <div ng-repeat="state in states"> {{state}} </div> <div ng-controller="InsideCtrl as inside"> Inside: <div ng-repeat="state in inside.states2"> {{state}} </div> </div> </div> </div> var angularApp = angular.module('ManagerApp', []); angularApp.controller('MainCtrl', ['$scope', function ($scope) { $scope.states = ["NY", "CA", "WA"];...

Override one attribute in Rails strong params

ruby-on-rails,ruby,controller
Is there a way I can override one attribute yet still use strong parameters in Rails? Such as in the following example, if I wanted to override the person's name every time, but also use the person_params method. There has to be a better way than manually setting @person.name, right?...

Passing params to an angular service from a controller?

javascript,angularjs,service,controller,params
I'm an angular newby. I'm hoping to pass params to a service that fetches data form a server depending on those params. for example, if I want to pass a book name string and then use it in the service to concatenate with the request url. The documentation does not...

Can not reach to associated models from Jquery

javascript,jquery,ruby-on-rails,controller,models
I have associated models. Boat & Location Model. I am trying to reach to Boat Model from Jquery code but I could not do it. The thing; I return all the locations to Jquery as listing and it contains address, boat_id etc. So listing.address works, listing.boat_id works but listing.boat.year (for...

refactoring Rails 4 before_action for code speed with reused controller methods

ruby-on-rails,ruby-on-rails-4,controller,refactoring
I’ve been learning Rails for a while now and I’d like to know what the best way to include reusable methods in other methods is. I use before_action for some, but I’m wondering if I should convert my code which looks like ‘Fig.A’ to utilize more before actions (Fig. B)....

Pass an id and get it from actionLink to view page

asp.net-mvc,view,controller,html.actionlink
I have this ActionLink into view named catalog @Html.ActionLink("Formations", "Index", "Formation", new { id = item.Id },null) and I want to get the list of formations of this catalog id. How can I do this ? In my database I have two tables : Catalog:idC (PK),NameC,Date Formation:idF(PK),idC(FK),NameF. ...

Ionic update Checkbox value

angularjs,controller,ionic-framework,alert,ionic
I'm trying to update the Toggle/Checkbox value back to default/Off when the user selects the cancel option. Currently it sticks to Red/On. Any suggestions to figuring this out would be great, Before Alert After Controller // Default Value $scope.turnClearAppData = 'Off'; // Ionic OK Alert $scope.showConfirm = function(val) { if...

Geb testing: How to click the link of a controller action?

jquery,grails,controller,geb
I am working through a segment of a Geb test for a Grails app, and can't find this in the docs (though I might be overlooking something). How do you select and click on the link of a controller action? Here's the form element with that has a controller action...

AngularJS directive: scope with named controller

angularjs,controller,directive
I have the example below. HTML: <body ng-controller="MainCtrl as MgtCtrl"> <p>Hello {{MgtCtrl.name}}!</p> <p>Result is {{MgtCtrl.result}}!</p> <output-content data="MgtCtrl.name" result="MgtCtrl.result"></output-content> </body> JavaScript: var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope) { var MgtCtrl = this; MgtCtrl.name = 'World'; MgtCtrl.result = "no"; MgtCtrl.changeLabel = function() { alert('changeLabel'); MgtCtrl.result = 'yes'; } });...

Switching an app from displaying one quote at random to all in a grid

ruby-on-rails,controller
I previously built an app (my first rails app) designed to display a single quote from the db at random on screen (and a different one on each refresh). I'm now aiming to refactor that app to display all of the quotes (paginated, I guess) in a grid format. The...

Call rendering from another controller

ruby-on-rails,ruby,controller,render
I have a rails application with 3 controllers : categories, subcategories, all The two firsts fetch data from the db and render it via render "list" The last one should get the result of the first controller, the result of the second one and render them. Simplified example : #...

How Do I call and pass data to a Directive from a Controller Angular

angularjs,laravel,angularjs-directive,controller
I have a QueueController.js which handles AJAX query. How do I pass the data from my CONTROLLER to my DIRECTIVE and show it to the Modal. Thanks. QueueController.js app.controller('QueueController', function($scope, $http, $interval, $modal) { $scope.Call = function(trans_id){ $http({ url: $locationProvider + 'query_stransaction', method: "GET", params: { trans_id: trans_id } }).success(function...

computed property that changes its value with action in Ember.js

javascript,ember.js,controller
I do have a controller that has an action {{loadRight}} that passes the current model to the controller when I click a button. When I first load the app, I also use firstElement computed property which pulls the first element from my model array. Basically what I want to do...

Configuring inputs for a Multiple Input Fuzzy Controller in Labview?

input,controller,logic,labview,fuzzy
I'm building a fuzzy controller in Labview using the MIMO (Multiple Input, Multiple Output) FL Fuzzy Controller.vi. I designed the fuzzy system using the Fuzzy System Designer, and the .fs file is connected as the "fuzzy system in" of the MIMO Fuzzy Controller VI. The input values are where I'm...

View from custom controller overriding default view

model-view-controller,controller,routes,orchardcms
I'm using orchardcms 1.9 (no tag created jet). I am writing a custom module that implements its own controller that calles a service wich check some information and based on the service response I either redirect or let the user stay on the page. The module is on the default...

Assign one of values in controller

ruby-on-rails,controller
Post model has two fields: title and category_id. In simple_form I'd like to assign name and it's ok, but category I'd like to assign in controller (value will be different dependends on action). But I have problem, because every time category_id is null. I just do: def fun @post=Post.new @post.category_id=1...

Reading from database in Laravel 4

laravel,model-view-controller,controller,blade
How can I get the image url stored in my database and render it on the page in laravel 4?

zend2 adding another controller to application

controller,routing,zend-framework2
I'm working on a ZendFramework2.4-project. I just got started an filled the IndexController of a standard skeleton application with some code and thought of another controller in the same application. No new modul, just a second Controller to keep code seperated. Of course I read the documentation at Zend2: Routing...

respond_to and service objects

ruby-on-rails,ruby-on-rails-4,controller,respond-to,service-object
I'm currently using the docx_replace gem to automate the insertion of data into a set of documents. The gem is pretty straightforward; basically it runs in a special method within your rails controller like so (quoting from the documentation): def user_report @user = User.find(params[:user_id]) respond_to do |format| format.docx do #...

Cannot implicity List into IEnumerable

c#,asp.net-mvc,controller,viewmodel
My ViewModel public class ViewModelCT { public IEnumerable<SelectListItem> Tests { get; set; } public IEnumerable<string> SelectedTests { get; set; } public Course course { get; set; } } Controller public ActionResult Details(int id) { Course course = functionality.toCourse(functionality.GetCourseById(id)); List<SelectListItem> lsli = new List<SelectListItem>(); ViewModelCT vm = new ViewModelCT(); foreach (SchoolService.Test...

controller logic for two different type of users

ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,model-view-controller,controller
In my project i have three different categories of users: Guest Registered Admin If a Registered user is logged , i want to show him (if he clicks on a button) his orders. The admin , instead , can see the orders of the other users. I can use OrderController...

How to get variables from another controller

c#,asp.net-mvc,asp.net-mvc-4,controller
I have two controllers: job and home now job counts the number of stopped jobs and at which location like below public void Stopped() { int HBAStop = db.Jobs.Where(x => x.Status == "Stopped" && x.LocationID == 1).Count(); int CRStop = db.Jobs.Where(x => x.Status == "Stopped" && x.LocationID == 2).Count(); int...

JSON response from SpringMVC controller is not working

java,json,spring-mvc,controller
I want to response JSON object or array from Spring MVC controller. From these two beingjavaguys and mkyoung tutorial, i tried. I could success only in when the response is string. But when the response is in object or in list, it doesn't work for me. //It works @RequestMapping(value =...

Make a required field if the other field has value

javascript,c#,jquery,controller,asp.net-mvc-5.2
I have these variables: public int? BossId { get; set; } public DateTime? HeadShipDate { get; set; } My view: <div class="form-group"> @Html.LabelFor(model => model.BossId, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.DropDownList("BossId", null, "-- Select --", htmlAttributes: new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.BossId,...

Return Error and view in ajax

jquery,ajax,asp.net-mvc,controller
Hello everyone I want to know something is there possible. Using ajax send error message if occurred else send view. you can see my code. please help me what should I do. need some suggestions here is my example public ActionResult Test() { string ErrorText = string.Empty; if(true) return View("PagedList");...

insert variable value to database from another function in codeigniter?

php,codeigniter,controller
I need some help in here. This is my controller: function result_selected_abc_data(){ $this->auth->restrict(); $this->load->model('usermodel'); $this->load->model('productmodel'); $level=$this->session->userdata('level'); $this->load->library('form_validation'); $this->form_validation->set_rules('date1','Tanggal Di Masukkan','trim|required'); $this->form_validation->set_rules('date2','Tanggal Belum Di Masukkan','trim|required');...

JavaFX TabPane selection wont work properly

javafx,controller,selectionmodel
I have two *.fxml forms with controllers. First is Window, second - ProductPane. Simplified Window.fxml is: <BorderPane prefWidth="650.0" prefHeight="450.0" fx:controller="package.WindowController"> <center> <TabPane fx:id="tabsPane"> <tabs> <Tab fx:id="productsTab" text="Products"/> <Tab fx:id="warehouseTab" text="Warehouse"/> <Tab fx:id="saleTab" text="Sale"/> </tabs> </TabPane> </center> </BorderPane> Controller for Window.fxml: public class WindowController { @FXML...

Rails form: A field showing the value of one variable but saving it to another variable

ruby-on-rails,ruby,forms,ruby-on-rails-4,controller
I have an edit form with the profile data for a user. Two variables in the User table are email and new_email. I would like for one of the fields in the edit form to show a user's email but if a new value is entered in that field, I...

Null pointer exception on passing a value between 2 controllers

java,binding,javafx,controller,fxml
Introduction I am learning Java and JavaFX and in order to do that I am working on a little project which objective is to behave as password generator. Basically, I have 2 windows, the first one allows the user to chose what kind of password he wants. Once he is...

How to get temperature value from DS18B20 voltage

controller,arduino,hardware,sensor,temperature
I just connected DS18B20 temperature sensor to ADC of a device. But that device only shows voltage reading from ADC likve 1033 mV. But I want to get an actual temperature value from the voltage value. Is there any way to calculate or get the temperature value from voltage reading?...

Grails: Carry forward params on hyperlink is clicked

grails,redirect,controller
How to carry forward the parameters when hyperlink is clicked? Here is my gsp code: <g:link class="grid_link" controller="user" action="delete" id="${userInstance.id}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure, want to delete?')}');">Delete</g:link> Here is my controller code: def delete() { try { def userInstance = User.get(params.id) //deleting the user //successful. redirect(action: "list",...

MVC inquiry, controller checks condition, stay on current page

asp.net-mvc,controller
so a controller has to return a view. I'm wondering what would be a professional approach in this scenario? controller checks condition, if true, proceeds, if false, pops up a message, stays on current page? Thanks. So it is a "delete" action link on the "index" view, when I click...

JAVAFX LISTVIEW REFRESH TAB

listview,javafx,controller,reload
I'm stuck in school projet. I have javafx project, with a Controller A and Controller B. The A controller is associated with Tab A, and B conrtoller with Tab B. In both controller, I have a listview listing the same object (@FXML Listview moviesList for example). In Tab A, I...

JQuery AJAX Success With Multiple MVC Controller Methods

jquery,ajax,asp.net-mvc,controller
Let's say I post a form to an MVC controller and action like this function ajaxFunction() { $.ajax({ type: "POST", url: "ControllerName/FirstMethod", data: $('#form').serialize(), success: function () { //I'm wondering if this gets run after the FirstMethod or SecondMethod } }); ) The controller action does something, then redirects to...

Using the same DbContext object across different controllers

c#,controller,asp.net-mvc-5,entity-framework-6,dbcontext
I am coding a MVC 5 internet application & have a question in regards to using the same instantiated DbContext object across different controllers. I am wanting to do this because i am retrieving some of the same data in different controllers, & the inbuilt caching feature of the DbContext...

AngularJs: programmatically filter by either of 2 columns

javascript,angularjs,controller,filtering
I have the following code in my controller: $scope.filteredTransactions = $scope.invoiceTransactionsObject.transactions.concat(); // make a copy of the initial array if ($scope.searchTerm.message) { var search = $scope.searchTerm.message; $scope.filteredTransactions = $filter('filter')($scope.filteredTransactions, ({ message: search } || { item: search })); } I want to be able to filter by typing some value...

Controller issue: undefined local variable

ruby-on-rails,ruby,ruby-on-rails-4,controller
A controller method includes: @organization = Organization.find(params[:description]) check_expiration_date(@organization) if @organization.update_attributes(subscription: true, actioncode: session[:actioncode_id], subs_exp_date: expiration_date) ... private def check_expiration_date(org) expiration_date = Time.zone.now + 366.days end On the development server this generates the error below, referring to the line subs_exp_date: expiration_date: undefined local variable or method `expiration_date' for...

php function to check when an uploaded image has been in the directory for longer than a day

php,file-upload,controller,cron,unlink
I have a cron controller class that basically handles all cron job related work. I'm trying to add a function to the controller that deletes images that have been in the directory longer than a day. Here is what I have so far, and it makes sense to me I...

Using the controller to manage render logic rather than view

html,ruby-on-rails,controller
I'm not asking for code as an answer, rather, a resource or some general guidance. I have an index page of users. For each user, I check the "friend status" of each user in respect to the current user. As you can imagine, it is a pretty lengthy if and...

USB3 Controller & Kinect 2

controller,usb,driver,kinect,fresco
I recently updated a PC to Windows 8.1 in order to make it compatible to Kinect v2. It's an ASUS N53S with the following specs: CPU: Intel Core i7 - 2670QM (2.2GHz) RAM: 16 GB GPU: GEForce GT 550M USB3 Controller: Fresco Logic xHCI When running Kinect v2 Configuration Verifier...

How to delete functions of previous instances of controller?

javascript,angularjs,controller,state,reload
I have a simple angularjs controller referenced as someCtrl and it contains the following code: function testing() { console.log("Hello there."); } $document.on('click', function(e) { testing(); }); this.getView = function(value) { return viewService.getView(value); }; this.setView = function(value) { viewService.setView (value); }; this.destroy = function() { $state.reload('default_state'); }; When click event happens,...

Computed Property not working

ember.js,controller,ember-data,computed-properties
I'm writing the todo app and I can't get computed properties working. I want to implement computed properties in the todos/index controller so that the template can appropiately display the amount of todos undone remaining (based on the isCompleted attribute of the models). This is the code: todos/index.hbs {{input type="text"...

AngularJS Passing changing values from Controller to a Directive Controller

javascript,angularjs,controller,directive
I'm pretty new with angular and I've read a lot of threads here and googled this topic but I cannot get a clear answer. What I'm trying to do is pass a value that is not set until the user makes a selection, at which point my controller will make...

Laravel 5 form submit creates an error MethodNotAllowedHttpException

php,forms,controller,routes,laravel-5
I'm using Laravel 5. When editing a form a get this error MethodNotAllowedHttpException There are a few posts but I think it may be code specific. I'd rather not use the resource route methods if possible. Route: Route::get('profile/edit', array('as' => 'admin.profile.edit', 'uses' => [email protected]')); Route::post('profile/edit', array('as' => 'admin.profile.update', 'uses' =>...

AngularJS: Failed to instantiate module error

javascript,angularjs,module,controller,dependencies
i know this question has already been asked, but i could not find the answer to my personal case. I'm sure it's a stupid thing i didn't notice but i'm not getting out of it. I'll post all the code i have (it's not that much) because i can not...

Sort a LINQ with another LINQ in MVC

sql-server,linq,entity-framework,controller
Using SQL Server Management Using MVC VS 2013 for Web Being in a Controller Here materialnumb it's a LINQ query that always return only one value. Being the following... var materialnumb = (from r in db.MaterialNumber where r.MaterialNumber == 80254842 select r.MaterialNumber); I have another LINQ query from a...

Why do I keep getting 'undefined method' when it's worked fine before?

ruby-on-rails,ruby,ruby-on-rails-4,controller
My OrdersController is as follows below, but I keep getting this message: undefined method `listing_id=' for # Extracted source (around line #31): 29 30 31 @order.listing_id = @listing.id Is there something I am doing incorrectly? Am following a tutorial so followed the instructions, then when it wasn't working decided to...

How to add .php extension to Codeigniter 2.x controller URL's

php,.htaccess,codeigniter,url,controller
I am using Codeigniter 2.x for a project and have limited knowledge on .htaccess etc. I've created an RESTful api which can be accessed via "api" controller's "getfeedback" function and was able to remove the index.php from the URL using .htaccess rules. Example That currently works (without .php extension): www.example.com/api/getfeedback?param=abc&param2=defghi...

Laravel Authentification fails

authentication,laravel,login,controller
I got a problem, my Authentifications keeps getting to the else statement, while I put in the correct email and password into the login form. With the else statement I mean the last line of my SessionController else { return Redirect::to('login') } Here are my routes.php // ~ Root Route::get('/',...

Displaying a table's row in a div element using AngularJS

javascript,angularjs,service,view,controller
I have a database table with many rows, each with 5 fields each. I then have a <div> element that I'd like to display one row's fields in. What is the best way to retrieve a row from my table and have a div display the row's fields? Currently I...

Opencart module controller index function data source

model-view-controller,controller,opencart
Some module controllers on a website I work with have data passed to their index function. How is it done? I can't find the source file that sends data to controller.

AngularJS centralized data with restful services

javascript,angularjs,rest,service,controller
I need help with the design of my AngularJS application. I have a factory, which provides a resource object for me, to a restful web service. product.factory("productResource", function ($resource) { var resource = $resource("/fooo/rest/products/:id", {}, { query: { method: "GET", isArray: true } }); return resource; }); I have a...

Rspec test public controller method passing params to private controller method

ruby-on-rails,ruby-on-rails-4,rspec,controller,rspec-rails
This is my controller: class PlansController def use_new_card @user = User.find_by_id(new_card_params[:user_id]) if new_stripe_card ... end private def new_card_params params.permit(:user_id, :stripeToken) end def new_stripe_card StripeService.new({user_id: @user.id, customer_id: @user.stripe_customer_id, source: new_card_params[:stripeToken]}).new_card end end I'm trying to write a controller spec that tests that when the proper parameters are POST to the use_new_card...

Targeting $index from ng-repeat

angularjs,controller,angularjs-scope
How would I go about targeting this model in the controller? formData[$index].ID This is not working - $scope.getJob = function() { Employee.get({id: "" + $scope.formData[$index].ID}, function (data) { console.log(data); }) } ...

Accessing child functions/properties with arranged content in Ember.js

javascript,ember.js,controller
I'm having some trouble figuring out what to do. Basically I have a 'post' controller that has a function 'imageURL'. This function just takes a string (ex image_1.jpg), and prepends the root path to it (ex images/image_1.png). The problem I'm having is in a parent controller, I only want to...

file_get_contents() expects parameter 1 to be a valid path

image,codeigniter,model-view-controller,controller,file-get-contents
My image is uploading to images/news successfully. I want to now save that image in the database. but it keeps giving me the above error. My model query is correct because i use it to insert other data and it works. How can i save the image into the database...

How to access properties inside an array and push them to a List Angularjs

json,angularjs,http,controller
I am working on an angularJS application, where i am accessing a service and getting a JSON data as follows. { "repositoryFileDto":[ { "aclNode":"false", "createdDate":"1433166794593", "fileSize":"16208", "folder":"false", "hidden":"false", "id":"d4850a7e-17f7-4ee6-a3c5-125c26077da8", "lastModifiedDate":"1433166794593", "locale":"en", "localePropertiesMapEntries":[ ], "locked":"false", "name":"accountInfo.prpt", "ownerType":"-1", "path":"/home/admin/accountInfo.prpt", "title":"accountInfo", "versionId":"1.0", "versioned":"true" }, { }, {...

Rails - Create and update two models in one controller - SOLVED

ruby-on-rails,model,controller
I would like to create a model and update one part of an other at the same time. I have two models Order and Listing. Order belongs_to :listing and Listing has_many :orders When a user fills up the order form, an order is created. In the URL there is a...

The best (or the proper) way to reuse action at any route? [Laravel 4.2]

php,laravel,view,laravel-4,controller
I'm just learning some Laravel 4.2 with a book I got recently (mainly the reason I learn 4.2 first, not 5). But now I'm kinda unsure. Let's say I have a Blog application. There will always be a sidebar with list of categories (all in DB). What is the best...

Pass parameter from controller to service in Angular

angularjs,service,controller
I'm trying to pass a parameter from a controller to service in Angular. Here is the controller: angular.module('CityCtrl', []).controller('CityController',['$scope', '$http', function($scope,$http,CityService){ $scope.data = "unknown"; $http.jsonp('http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&callback=JSON_CALLBACK').success(function(data){ $scope.data=data; }); console.log($scope.name); if($scope.name){ $scope.weather = CityService.get($scope.name); } $scope.update = function (zip) { $scope.zip = zip;...