w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to leave my general "Routes" intact when operating code in a specific "Area" with its own "Routes"?
When you have areas in your app you will need to be specific about which controllers and actions you want to point to. If you are inside your SubApp area, then any link you need to create pointing to the root, should include an empty area. @Url.Action("index", "home", new { area = "" } Using the same concept, any url from the root controllers to the SubApp area should include the area in the link: @Url.Action("index", "home", new { area = "SubApp" } If you are not crossing any boundaries, then not specifying the area will default to the area you are in.

Categories : Asp Net Mvc

Iteration Through Routes Mapped to RouteTable.Routes via MapHttpRoute - MVC4 Web API
If you are looking to iterate only through Web API route collection, you could do something like GlobalConfiguration.Configuration.Routes to get HttpRouteCollection. This collection would have all your api routes.

Categories : Asp Net

Rails Routes. Multiple nested routes with member actions
Delete the comma between resources :milestones and resources :comments. Your code should be resources :projects do resources :milestones resources :comments do member {post :hide} end end

Categories : Ruby On Rails

How to enable format in routes with ServiceStack in tandem with custom routes?
See the wiki page on Routing for documentation on how Routing works, e.g. if you wanted to use pre-defined routes the correct urls would be: /api/json/reply/Things /api/json/reply/things?Id=1 /api/xml/reply/Things /api/xml/reply/things?Id=1 Note: the pre-defined only uses the name of the Request DTO, i.e. it does not use all your custom routes. The Content Negotiation section on Routing wiki shows the different ways to request different Content-Types. In ServiceStack (v3.9.54+) you can now use a format .ext e.g: /api/things.json /api/things/1.json /api/things.xml /api/things/1.xml Which is an alternative to using the ?format=ext parameter: /api/things?format=json /api/things/1?format=json /api/things?format=xml /api/things/1?format=xml

Categories : Rest

acts_as_votable gem routes error
The path name like_question_path is incorrect. It should contain at least "comment", something like "like_comment_question_path". Please consult your $rake routes for accurate name. By the way, is there any reason you need to use put? In my opinion this action is not to change existing data but add a new one, so 'POST' should be more appropriate.

Categories : Ruby On Rails

Rails 4 routes error
Found the solution though didn't expect it would be the issue. Above route with following change worked for me. match '/moon-signs' => 'promotions#moon_portal', :as => :moon_portal_promotions, :via => [:get, :post] Only with addition of / in match has fixed the issue.

Categories : Ruby

Rails 2 + Spree 0.11.0: How do routes work when there are so many routes files?
Routes should be specified in config/routes.rb Here's where they're specified in Spree 0.11.0: https://github.com/spree/spree/blob/v0.11.0/config/routes.rb Modern versions of Spree are mountable Rails engines which will mount some of its own routes underneath your applications routes. However, you're dealing with the rails 2 version which injects its routes a little differently. You're dealing with a very old version of Spree, so many of the resources you find on the internet will pertain to more modern versions of Spree (Rails 3.0+). Your easiest bet will be to figure out where 'gourmet-specialties' is coming from and remove it. If it's coming from the taxonomy tree, try recategorizing it under the root taxon.

Categories : Ruby On Rails

autocomplete generating routes error
Autocomplete_field_tag expects you to pass arguments like this: autocomplete_field_tag 'hotel_name', '', autocomplete_hotel_hotel_name_hotels_path The third argument should not be a hash. You also need to specify in your HotelsController that you want autocomplete: class HotelsController < ApplicationController autocomplete :hotel, :hotel_name, :full => true

Categories : Ruby On Rails

Error opening `routes` file in Scala IDE
As mentioned in your comment, you had installed the play plugin for Eclipse Indigo, running on Eclipse Juno. To avoid that kind of problem, select very carefully the correct update-site on the Scala-IDE download page, and then only compatible plugins will be suggested for you.

Categories : Scala

AbstractController::ActionNotFound error, even though routes.rb is configured
I accidentally made my UserController#test_add_realtime_code and #add_realtime_code methods private: class UserController < ApplicationController # snip private # snip def test_add_realtime_code end def add_realtime_code if request.post? # snip end end end When I moved them out of the private methods for the controller, everything worked as I expected: class UserController < ApplicationController # snip def test_add_realtime_code end def add_realtime_code if request.post? # snip end end private # snip end

Categories : Ruby On Rails

How to build specific resource routes in routes.rb
You can specify which of the standard routes to include when you use the resources command, with the except and only options: resources :foo, :except => [:destroy] do end or resources :foo, :only => [:index, :create, :show] do end

Categories : Ruby On Rails

Matching routes in config/routes.rb to a controller
You should use a named route, it would be easier: routes.rb: post 'polls/toggle_live' => 'polls#toggle_live', :as => 'toggle_live' In the view: = link_to "Start", toggle_live_path, {:method => :post, :remote=>true}, {:class=> 'btn btn-success btn-small start-poll'}

Categories : Ruby On Rails

Controller & Routes error - Couldn't find User without an ID
You've got your root page going to static_pages#home, but there is no id parameter in that case, so params[:id] is returning nil, so that's what's being passed to find. Assuming you want to access the id of the currently logged in user, you need to get at it some other way, as discussed in http://ruby.railstutorial.org/book/ruby-on-rails-tutorial. Search for current_user in that tutorial.

Categories : Ruby On Rails

Error creating user in Express routes file
User is not defined. why you are sticking User to app is anyone's guess, but what you need to do is is have app available in your route's js file. You can require it there. edit: Looked at the example. In my option its not very good. They could have a better separation of routes from controllers and mongoose models are imported in a very weird way where you basically have to define them twice. Its more confusing then it needs to be. Their example will be a pain in the ass to extend. I would find yourself some other example. (yeah I know im not much help here, but its 230am and the best advice i can give you is to stay away from this crap if you are just starting out with node/mongoose/express)

Categories : Node Js

How to set routes for a controller in MVC. Always returns "HTTP Error 404.0 - Not Found"
I'm not sure your route is working beyond the default, as you're explicitly providing the parameters. Try registering your route in RouteConfig.cs http://www.jondavis.net/techblog/post/2012/06/23/ASPNET-MVC-4-Where-Have-All-The-Globalasax-Routes-Gone.aspx

Categories : Asp Net Mvc

500 error when binding index and other routes to a single callback in Bottle
It can be tricky to debug 500 errors, but if you can get other scripts to work, then my guess is that the problem is because you didn't define a default value for the name argument in your index function. When you access the route, the function is called. But if you access /, there's no value for the name argument, so an error is raised when the function is called. This is why the example you pasted has def greet(name='Stranger'):. The name='Stranger' sets a default name that will be used if no name is passed in. Try adding that to your function and see if it fixes it. You might want to turn on debug mode when debugging your bottle script, as it makes the error messages more helpful.

Categories : Python

Code igniter routes making internal server error
It might be .htaccess issue. Try putting this code in your .htaccess and give it a try? RewriteRule ^(.*)$ index.php/$1 [L] And also try setting this option in your config file config['log_threshold'] to 4 and check exactly where the issue is coming from?

Categories : PHP

Unit testing AngularJS routes throwing Error: Unexpected request
This means that there is an AJAX call that goes to fetch the template. $httpBackend.expectGET('app/html/listTodos.html').respond(200) can be put before calling path(): describe("Todo Routes", function(){ var route; var rootScope; var location; var httpBackend; beforeEach(function(){ module('todoApp'); inject(function($route, $location, $rootScope, $httpBackend){ route = $route; location = $location; rootScope = $rootScope; httpBackend = $httpBackend; }); }); it("should navigate to todo list", function(){ httpBackend.expectGET('app/html/listTodos.html').respond(200);//mimicking the AJAX call expect(route.current).toBeUndefined(); location.path('/todos');

Categories : Unit Testing

Rails.application.routes.recognize_path error with undefined method authenticate
This issue may be due to route path which is written in routes by default as and when the application loads first, so join the string to the url you get from request.referrer. ie, url = request.referrer + "controller_name" previousPath = Rails.application.routes.recognize_path(url)

Categories : Ruby On Rails

Ember Routes and Rails Routes
How does the browser know to look for an Ember route when the route does not exist in rails? It doesn't. When you enter a url in browser, it will make request to the server, then rails should respond with some content. So in this case when the "/newslinks" url is requested you want rails to respond with an HTML page that includes your ember application. When that page is loaded, the ember app will boot up and from there the ember-router will be used to handle links within the context of your ember app. Make sense?

Categories : Ruby On Rails

Rails routes: same controller different routes
You can use route with constraints. Define a class that executes matches with customized conditions. You can search the API with match to see details. I assume that your tag has two columns named "category" and "name". route.rb match ':category/:name' => 'tags#show', via: 'get', constraints: TagRouteWhiteList.new, as: 'tag' app/models/tag_route_white_list.rb class TagRouteWhiteList def matches(request) Tag.distinct('category').include?(request.params[:category]) && Tag.distinct('name').include?(request.params[:name]) end end In your view, you can use tag_path(category: @tag.category, name: @tag.name)

Categories : Ruby On Rails

Routes inside Routes EmberJS
Why not use a nested resource? this.resource('project', { path: '/project/:project_id' }, function(){ this.resource('manage', function(){ this.route('settings'); this.route('team'); this.route('notifications'); /* etc */ }); }); This is not so different from the post/comments resources described in the ember guides: http://emberjs.com/guides/routing/defining-your-routes/#toc_nested-resources I'd like to have a "manage" section with subsections for the things you can manage, all of which referencing my "project" instance. Ok. So using nested-resources approach you will have a manage.hbs template. To reference the project instance from the manage section or any of the subsections just use needs like this: App.ManageController = Ember.Controller.extend({

Categories : Ember Js

Rails 4 Include Rails.application.routes.url_helper undefined method routes for nil:NilClass
One way to do it, though probably not the best way is to use included and method_missing. This is of course assuming that you are in ActionView or ActionController Something like this should do OK: module DynamicMenu def included(base) @parent = base end def method_missing method, *args super unless @parent.methods.index method @parent.send(method,args) end end

Categories : Ruby On Rails

While returning a DataContract from a WCF function, I'm getting this error: "An error occurred while receiving the HTTP response"
That's a pretty generic exception in WCF so you'll need to enable WCF tracing to get more detailed info. Just guessing but look at this MSDN forum thread where the list contained complex objects that exceeded the default internal object limits in WCF. Once you enable WCF tracing, you should have a better idea of what's going on.

Categories : C#

Error in Play on Get: java.lang.UnsupportedClassVersionError: controllers/routes : Unsupported major.minor >version
I failed to recompile my Play/Scala app under the JDK1.6 environment which I had backed down to, from JDK 1.7. Down-versioning to JDK1.6 and blowing away / recreating my Play/Scala project in JDK 1.6 environment solved the errors.

Categories : Java

Nested routes: handling failed child find in error action loses parent context
Your right that the parent context is getting lost. The trick is to extract that context from the transition and pass it as an argument when calling transitionTo. So: App.ArticlesArticleRoute = Em.Route.extend({ actions: { error: function(reason, transition) { console.log('in error handler'); this.transitionTo('articles.notFound', transition.resolvedModels.authors); } } }); With this change, visiting the url: http://jsbin.com/iVOYEvA/2#/authors/schneier/articles/my-fake-article will redirect to: http://jsbin.com/iVOYEvA/2#/authors/schneier/articles/not_found

Categories : Ember Js

Karaf works with spring camel routes but not with java DSL camel routes
See this page http://camel.apache.org/spring at the section Using Java Code how to from the spring xml file to refer to a < bean > which is the Java RouteBuilder class. That is the way to have it work in OSGi.

Categories : Spring

Its returning a error, but its in try-catch. Whats the error?
Your code is only catching ParseException, so a NullPointerException won't be handled by the catch clause. My guess would be that either sdf is null when this code executes, or dataUltima is null when it is passed into the parse method (I don't exactly remember how parse() responds to null arguments). You can solve this in a number of ways. Check to see if the variable causing the exception is null before executing the try block, add a catch for NullPointerException to your try/catch, or make the ParseException block catch a more generic exception (like Exception) to handle both cases (although I personally would not recommend it).

Categories : Android

Error when returning a pointer
That code compiles and runs just fine in gcc in both c90 and c99 mode, so there's a couple of things you can do. First and foremost, you should show us the actual error (that should have come with the original question). Second, get a hex dump of the file to make sure there's no funny characters in it, such as with the command od -xcb myprog.c. Thirdly, it's also good practice to return values from functions where you specify a non-void return type. Later iterations of C make this unnecessary for main but earlier iterations could result in random values being passed back to the environment. I still return zero from main even though I no longer have to (it's hard to break a thirty-year habit). That last point may be what's happening here, depending on which compiler and version you're u

Categories : C

Error in Returning Value of Function
Use a callback function : db_Save(req.session.user,function(x){ console.log('x is ' + x); }); var db_Save= function (user,callback) { userProfile.find({Email: profileInstance.Email}, function(err, doc){ callback(2); }); };

Categories : Javascript

SQL line returning an syntax error
As soon ScheduledDateTime is a datetime field you should compare it with a for example a string constant so you should add ' around this constant. And also change => to >= SqlCommand cmd = new SqlCommand("SELECT * FROM HomeCareVisit WHERE MedicalStaffID=" + IDBox1.Text+" AND ScheduledDateTime>='"+txtdate+"'" , conn);

Categories : SQL

PHP and rrd : rrd_xport function returning error
Solved the issue! For future reference, the rrd_xport functions expects an array in the following format: $options = Array( "--step", "1", "--start", "-1 year", "--end", "now", "DEF:out=<filename>:<name of your DS>:AVERAGE", 'XPORT:out:"<legend>"', );

Categories : PHP

Expression returning syntax error
There seems to be a missing parenthesis: '@'.join map(... should be '@'.join(map(... And .upper should be .upper() So your final piece of code is: ''.join(re.findall("@(.{1})",'@'.join(map(lambda x: x[::-1], ['where are you a@', 'cruise queen mary on', 'morgtage ninjitsu', 'maritimes', 'professional analyst', 'blue ma', 'therapist or', 'forget-me-not'])))).upper()

Categories : Python

How do I fix this preparedStatement error when returning a decimal value?
How about treating it as an appropriate number? String.valueOf(resultSet.getDouble(i)) If the value is returned as a String, then the trailing "0" never has a chance to be treated in a numeric context and "fall off". When treated as a number the trailing 0 is insignificant and "falls off": 204.40 == 204.4 // -> true String.valueOf(204.40) // -> "204.4" Of course, it might be more appropriate to use the number instead of turning it [back] into a String ..

Categories : Java

locationManager returning 0.0000, where is the error?
You are not updating your labels. You should move the following to another method and invoke it in locationManager:didUpdateLocations:. _Breddegrad.text = [NSString stringWithFormat:@"%1.6f", Breddegrad]; _Lengdegrad.text = [NSString stringWithFormat:@"%1.6f", Lengdegrad];

Categories : IOS

TextField.setText() returning an odd error
You're seeing the result of TextField#toString here ans.setText(ans.toString()); You want ans.setText(Integer.toString(numA)); You also probably want to use Swing's JTextField for consistency.

Categories : Java

why is this method always returning false even when no error
the false at the end of cancel_subscription causes an implicit return. Basically, in Ruby, if no return statement is present a method will return whatever the final statement evaluates to. In this case it is equivalent to return false. You could try adding a return true in an appropriate place like this, since you want to return true any time a delete was successful. def cancel_subscription(customer_id) unless customer_id.nil? customer = Stripe::Customer.retrieve(customer_id) unless customer.nil? or customer.respond_to?('deleted') if customer.subscription.status == 'active' customer.cancel_subscription user.remove_role :pro if user.practices.size > 1 user.practices.delete(user.prac

Categories : Ruby On Rails

Why is DBAL returning a SQL Syntax Error?
The reason why this particular query is failing is because 'key' is a reserved word in mysql. FROM keys t0 WHERE t0.key = ? LIMIT 1' http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html So I'm guessing you didn't have this working before you did your orm change? Rename the property to something like value. $key->value reads better than $key->key anyways.

Categories : PHP

String.Format returning an error
You've got some extra curly-brackets in there, which confuses the parser. Escape them like {{: string.Format("{{ "id": "{0}", "label": "{1}", "value": "{1}" }},", ... (Related)

Categories : C#

android blob pdf error not returning
You have to convert the Blob into a byte array to be able to use the put function with a byte[] parameter: Blob blob = row.get_pdf(); values.put(KEY_pdf, blob.getBytes(0, blob.length()));

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.