w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Web API Routing - multiple actions were found that match the request
I got this Route: What you have shown is a route for MVC controllers. I hope you realize that Web API controllers are an entirely different thing. They have their own routes defined in the ~/App_Start/WebApiConfig.cs. So make sure tat you have included the {action} token in your Web API route definition (which I repeat once again has nothing to do with your MVC route definitions): config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}" );

Categories : C#

Multiple actions were found that match the request with multiple PUT webapi actions
You could try and restrict the first routing definition to accept just this one action since it doesn't seem to be used for any other route anyway: config.Routes.MapHttpRoute("DefaultApiWithIdAndAction", "{controller}/{id}/{action}", null, new { id = @"d+", action="assignrole" });

Categories : Asp Net Mvc

ASP.NET MVC different routing for different actions
Routeconfig is checked top down. Update: You should specify the controller name in the route otherwise the way your routeconfig was in your question, Default2 would never have been fired.Having 2 routes start with {something} means the second one won't be fired. I'm guessing you want your URL to be localhost/movies/create/id. For that, do this: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "MoviesDefault", url: "Movies/{action}/{id}", defaults: new { controller = "Movies", action = "Index", id = UrlParameter.Optional } ); /* not sure about this route without testing - /* i think it would conflict with the above route routes.MapRoute(

Categories : C#

ASP.Net MVC Routing/Using Dynamic Actions
You can use root Action and them use reflection like that: {controller}/{action}/{step} public ActionResult ExecuteStep(string step){ try { Type thisType = this.GetType(); MethodInfo theMethod = thisType.GetMethod("ExecuteStep_" + step); return theMethod.Invoke(this, null); } catch {} } But there is some speed limitation, if you using Reflection.

Categories : Asp Net Mvc

Rails routing URL folders for product categories on show actions
What about defining your routes like this: get ':controller/:action/:id/:user_id' Here, Anything other than :controller or :action will be available to the action as part of params.

Categories : Ruby On Rails

Symfony Routes without app/config/routing.yaml
Is there any way to skip the "add this extra configuration to the app/config/routing.yml file? No, this is the way SonataAdminBundle, FOSUserBundle and a bunch of others handle it. Why? Routing belongs to the application, not each and every bundle. If every bundle started including their own routing files and Symfony2 autoloaded them, you would quickly have a mess of routes you may or may not want to enable in your application. What if SonataAdminBundle wanted you to use /admin, but you already had a route there and wanted Sonata to use /sonata/admin instead? You'd need a file to override those routes and then you're back to square one! Additionally, although caching mitigates this part, looking up files is expensive and would significantly slow down the development environment. This

Categories : PHP

web.config azure websites friendly url-rewriting routing with manual code writing
try looking these answers url: http://stackoverflow.com/questions/15012893/iis-url-rewrite-how-to-remove-directory-and-extension http://stackoverflow.com/questions/10210936/url-rewrite-remove-html-extension Update: Its works fine for static files: <rules> <rule name="Rewrite Rule"> <match url=".*" /> <conditions> <add input="{StaticRewrites:{REQUEST_URI}}" pattern="(.+)" /> </conditions> <action type="Rewrite" url="{C:1}" /> </rule> <rule name="Remove html Extension" stopProcessing="true"> <match url="^(.+).html$" /> <action type="Redirect" url="{R:1}" redirectTy

Categories : Azure

How to call multiple actions of multiple modules from different controller and combine the output?
Action View Helper will help you to accomplish this in modules/default/views/scripts/index/index.phtml <?php echo $this->action('index', 'index', 'module1')); ?> <?php echo $this->action('index', 'index', 'module2'); ?> But action view helper have several performance and debugging issues please see these links before deciding to use it How can I speed up calls to the action() view helper? Action View Helper in Zend - Work around? Using Action Helpers To Implement Re-Usable Widgets

Categories : PHP

How should I route CMS urls alongside optional paramters / actions in route config?
Eventually I stumbled across the answer here: Dynamic Routes from database for ASP.NET MVC CMS The answer is to provide a custom route constraint that checks the DB for existence of the CMS url.

Categories : C#

Having multiple validation functions in a class with multiple actions
Create validateXxx methods where Xxx is the name of the related action method. (Whether or not this is the best option depends on the particular validations you need.)

Categories : Validation

How do you use one thread to do multiple timed actions rather than multiple timers
A thread executes code then exits, it doesn't loop unless your code loops. In the sample you posted the thread waits for 5 seconds, changes the button's visibility, then exits. So... since you have a defined sequence of actions, you could write it like this: Thread Tutorial_Thread = new Thread(() => { Thread.Sleep(1000); this.Dispatcher.BeginInvoke(() => do_step_d()); Thread.Sleep(500); this.Dispatcher.BeginInvoke(() => do_step_f()); Thread.Sleep(1200); this.Dispatcher.BeginInvoke(() => do_step_h()); }); Tutorial_Thread.Start(); The thread will proceed through the statements, pausing at the Sleep calls, executing the various step methods, then exit. This is a simplistic example of course. Rather than writing a stat

Categories : C#

Multiple GET actions
What you're asking for is n-depth sub-resources and the only real solution to this is the attribute routing provided in v2 of the Web API. Until it is released (which I believe will be soon), you can use RPC like approach: routes.MapHttpRoute("RPC", "rpc/{controller}/{id}/{action}"); You'll need to register this as the very first HTTP route, and use a prefix other than 'api' so it won't clash with the actual api/ routes.

Categories : Asp Net Web Api

SQL Query which helps me to get me no of "y"s in a column
SELECT concat("no. of presents on ",date," are", if(pt17='y',1,0)+ if(pt18='y',1,0)+ if(pt19='y',1,0)+ if(pt20='y',1,0)+ if(pt21='y',1,0)+ if(pt22='y',1,0)+ if(pt23='y',1,0)+ if(pt24='y',1,0) ) FROM attendance WHERE date = '2013.01.01'

Categories : PHP

Will static keyword helps here
In static function you can use only static members of class. Like this (_a is static): class A { static int _a; public: static void setfunc(int a) { _a=a; } static int getValue(){return _a}; }; Otherwise, you can't do anything with non-static members: class A { int _a; public: static void setfunc(int a) { _a=a; // Error! } static int getValue(){return _a}; // Error! };

Categories : C++

One drop down box helps populates the other
For this you will have to get into AJAX, and I highly recommend using jQuery's implementation. You will also need to get a good grip on JSON string coding and decoding. The basic Idea of your code will be like so: // listen for user to change the <select> item $('select#park').on('change', function(){ $.ajax({ url: 'getrides.php' // send a park id to this script ,cache: false // do not cache results in browser ,type: 'POST' // send POST to getrides.php ,data: {'park_id': $('select#park').val()} // getrides.php will receive $_POST['park_id'] ,dataType: 'json' // this AJAX call expects a JSON string as a return value ,success: function(data){ // the data variable will be converted to an array from JSON // check out al

Categories : PHP

Multiple actions in asp.net controller api
You should add Custom route like below public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "ApiByName", routeTemplate: "api/{controller}/{action}/{name}", defaults: null, constraints: new { name = @"^[a-z]+$" } ); config.Routes.MapHttpRoute( name: "ApiByAction", routeTemplate: "api/{controller}/{action}", defaults: new { action = "Get" } ); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } Hope this helps

Categories : C#

Setting Up Multiple Actions
You could do this multiple ways, here's just one: Set up a route to handle this: routes.MapRoute("UserEditsThings", "user/{id}/edit/{thingToEdit}", new { controller = "UserController", action="Edit" }, new { thingToEdit = ValidThingsToEditConstraint() } ); Then your action in the User Controller should look like this: public ActionResult Edit(ThingToEdit thingToEdit) { ThingToEditViewModel viewModel = new ThingToEditViewModel(thingToEdit); return View(viewModel); } The RouteConstraint is what would take their input (the thingToEdit) and make sure it was valid (you could do this in a few places - like in a Custom ModelBinder): public class ValidThingsToEditConstraint : IRouteConstraint { public bool Match(HttpContextBase httpContext, Route route, string param

Categories : Asp Net

Multiple actions within a controller
"Is it possible for there to be multiple actions functions that was within other actions?" How would that work? Action methods are just regular .NET methods - actions within actions don't really make sense. If you want it all in one controller, you will have to have something like this: public ActionResult UserSettings(int userid) { /*...*/ } public ActionResult UserName(int userid) { /*...*/ } public ActionResult UserDescription(int userid) { /*...*/ } public ActionResult PageSettings(int userid) { /*...*/ } public ActionResult PageName(int userid) { /*...*/ } public ActionResult PageDescription(int userid) { /*...*/ } You could wire up routing like this: routes.MapRoute( name: "Default", url: "Manage/Users/{userid}/Settings", defaults

Categories : Asp Net

How synchronization helps in variable visibility?
There are no guarantees that by changing a variable in one thread, other threads will see the results of those changes. Technically there is no happens-before relation between them and thus no guarantees (whilst in practice you'll see the changes almost all the time). That's why the thread may run forever. Secondly, why sometimes 0 ? Well the JLS says that Writes in one thread that are in a data race with reads in another thread may, for example, appear to occur out of order to those reads. Which means that your number = 42; ready = true; Can occur in any order. Now it's more likely they'll appear in order, but again there's no guarantees. You could fix it by changing the variables to be volatile, in which case the writes will always be visible to the readers or by making t

Categories : Java

ASP.NET WebApi - Multiple GET actions in one controller
You can either: just define one Get method, and have an optional Id Parameter like this: public IEnumerable<User> GetUsers(int? id){ if (id.HasValue) { //return collection of one item here } //return collection of all items here } Or you can have multiple Gets decorated with the ActionName Attribute // GET api/Users [ActionName("GetAll")] public IEnumerable<User> GetUsers() // GET api/Users/5 [ActionName("Get")] public User GetUser(int id) // THIS IS NO LONGER IN CONFLICT And then define the routes on your RouteConfig like so: routes.MapHttpRoute( name: "DefaultApiWithAction", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional } );

Categories : C#

Handle multiple actions with one button
You do not need a second listener. Just use the one you have to check, if the menu is visible or not: document.getElementById('menubutton').addEventListener("click", function() { menu = document.getElementById("mainmenu"); if (menu.style.display == "none") { document.getElementById("mainmenu").style.display="block"; } else { document.getElementById("mainmenu").style.display="none"; } }, false); See this jsfiddle. You could also use jquery, which makes live a bit easier. Then you would have: $('#mainmenu').click(function() { $('#mainmenu').toggle() });

Categories : Javascript

iOS Button that performs multiple actions
You can put all code in a single -(IBAction) and use a boolean value that changes it's value after executing facebook action. Something like this, - (IBAction)PostToFacebook:(id)sender { if(valueOfBoolean==TRUE){ mySLComposerSheet = [[SLComposeViewController alloc] init]; mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [mySLComposerSheet setInitialText:@"I just followed a guide on this App - Get it on the App Store http://"]; [self presentViewController:mySLComposerSheet animated:YES completion:nil]; valueOfBoolean=FALSE; } else{ [self performSegueWithIdentifier:@"next" sender:self]; } } Set default value for valueOfBoolean as TRUE in viewDidLoad method.

Categories : IOS

I don't see the Web.Debug.config and Web.Release.config files on my web.config after upgrading my project to VS2012
I found the answer in a post here: how to add files in web.config transformation process? In your "App Data" folder you'll find your publish profiles you created and can right click on them to add a config transform file.

Categories : Visual Studio 2012

SKProductResponse invalid product identifiers. Nothing helps
Few days Ago I have also implemented inApp purchase and I have also face this issue. In my case reason was tax information. You need to make sure you have an iOS Paid Applications Contract setup which is located under the "Contracts, Tax, and Banking" section of iTunes connect. First you have to click on the request button, then you have to click on the 3 Set Up buttons (Contact Info, Bank Info, Tax Info) Here is a small check list that I have copied from one website. Have you enabled In-App Purchases for your App ID? Have you checked Cleared for Sale for your product? Does your project’s .plist Bundle ID match your App ID? Have you generated and installed a new provisioning profile for the new App ID? Are you using the full product ID when when making an SKProductRequest? Are your ba

Categories : IOS

WebAPI OData Actions Sample - Differentianting between CheckOut and CheckOutMany actions
Your observation about CheckOutMany is correct. It doesn't make sense for CheckOutMany to bind to a an entity collection as it is already taking the movie id's it has to check out as an input.

Categories : C#

Even after putting actions handlers in 'actions' object, I still keep getting a deprecation message in Emberjs
Why do you have filteredContent in a actions hash anyway? It's a Computed Property and thus should not be inside the actions hash. Try a moving filteredContent outside the actions hash. Hope it helps.

Categories : Javascript

HTML action="" attribute >> multiple actions
No. Any redirect would have to be initiated by the resource the action points to. (Using header() to return a Location response header). (You could do something crazy like adding a dependancy on JavaScript, submitting the data using Ajax, then setting location if the request was successful, but that would be much more complex and much less reliable then having send.php issue a redirect response).

Categories : PHP

PHP Multiple actions in true clause in shorthand IF
This is ternary: $variable = condition ? true : false; So basically: $value = isset($var) ? "var is set!" : "var is NOT set!"; echo $value;

Categories : PHP

web api route error - multiple actions were found
I've thrown up a quick project in order to test your configuration, even though I was quite sure that you've implemented it correctly. Everything works as it should be in my project, I can POST to the controller and get the correct responses etc. Are you sure you are sending the request properly? Because http://<host>:<port>/api/<controller> should be the address to which you are sending the POST. No additional action is necessary in the URI, since there is only one POST method. The framework should pick up on the method and use that one automatically. Obviously, a 'multiple actions' error only occurs when there are actually two or more POST methods. One last resort you could try is to explicitly mention what type of request a method belongs to. This can be done by addi

Categories : Asp Net Web Api

How to set multiple click actions on ListView's item
I have already asked this question. You need to implement a view holder: See this post: Android GridView clickable ImageView You just need to re-structure your adapter. See the accepted answer in the above link.

Categories : Android

multiple actions need to be perform in single selector
How to avoid to call the click function when I click on the other links (for example 'edit' above)? In your handler for the "edit" link, use event.stopPropagation() to prevent it bubbling to the li. Since you're using delegation, you can do that like this: Live Example | Live Source $(document).on('click', '.edit', function(event) { $("<p>Do the edit...</p>").appendTo(document.body); event.stopPropagation(); // <=== The important bit }).on('click', 'li', function (){ $('li').removeClass('selected'); $(this).addClass('selected'); return false; }); (I also added return false to the second one because the links in the lis were causing the page to jump.)

Categories : Jquery

WEB API. Multiple actions were found that match the request
You could define the action that should be executed in this case: defaults: new { id = RouteParameter.Optional, action = "AddSMS" } But with only the following url localhost:25856/api/sms and not including the action name, I hope you realize that the routing engine has no way of disambiguate which action to execute. The routing engine could use the HTTP verb but in your case both actions are POST.

Categories : Asp Net Web Api

handling multiple button actions in one action in C#
Use same handler for all buttons. Sender of event will be the button which raised event. You can get it's name and extract text to say: private void button_Click(object sender, EventArgs e) { Button button = (Button)sender; string text = button.Name.Substring("button".Length); synthesizer.Speak(text); }

Categories : C#

How to execute multiple key actions using webdriver with java
Not clear what all actions you want perform but following working for me. Try this out: driver.get("http://www.google.com"); WebElement element = driver.findElement(By.name("q")); Actions action = new Actions(driver); element.sendKeys("result"); action.sendKeys(element,Keys.ENTER).perform(); action.sendKeys(Keys.TAB); Thread.sleep(2000); action.sendKeys(Keys.ENTER).perform(); Thread.sleep(2000); System.out.println("Page title is: " + driver.getTitle()); (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.getTitle().toLowerCase().startsWith("R"); } }); System.out.println("Page title is: " + driver.getTitle()); }

Categories : Java

Multiple threads submitting actions to be done in order
This is a reasonable approach. Use an unbounded BlockingQueue (e.g. a LinkedBlockingQueue) - the thread performing IO on the XML file calls take on the queue to remove the next message (blocking if the queue is empty) then processing the message to modify the XML file, while the threads submitting changes to the XML file will call offer on the queue in order to add their messages to it. The BlockingQueue is thread-safe, so there's no need for your threads to perform synchronization on it.

Categories : Java

Custom Actions with multiple implicit arguments
@senia was right, currying needs to be used to do this. This is actually addressed in the Play docs but it's a recent addition I missed. For future reference for people looking for this, my custom action now looks like this: def DBAction(action: Request[AnyContent] => Session => Result) = { Action { request => database.withSession { session => action(request)(session) } } } Which I can then use in the following way: def someAction = DBAction { implicit request => implicit session => /* body */ }

Categories : Scala

cancan for actions involving multiple objects
You should only authorize the objects that are actually involved with your app. In doing so, you're keeping it DRY (Don't Repeat Yourself). If more than 3 objects are involved in an action, then you need to work out what those are, because if you don't, then you might experience some problems in the future. Can you list the actions that you've got please

Categories : Ruby On Rails

invalid byte sequence in US-ASCII (ArgumentError), nothing helps
try adding, as first line of the files touched by this task, the string: #encoding: utf-8 These files may be all your custom initializers, your database.yml, etc

Categories : Ruby On Rails

Is there a tool that helps me understand why a certain row was included in a the result of an SQL query?
Move your where condition to a case statement. Break up each 'OR' into it's own column and the result will show you which returned true and false. I haven't heard of a tool that would do this for you.

Categories : Mysql

Generic class for multiple actions with different member variables
What you describe sounds a lot like the combined functionality of using std::function and std::bind. Using these creates a callable function object that stores all of the arguments that need to be passed while allowing you to execute the call without knowing any specific details. It works with both member functions and free functions. You could change your Command class into a simple wrapper that describes the requirements. The example below does this using free functions. The Command class does not care about the arguments or their types. All it cares about is how the command itself is dispatched. #include <iostream> #include <functional> #include <string> class Command { public: Command(const std::string& name, const std::function<void()>& func)

Categories : C++



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