w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Custom state-enter and state-exit code with routing
$route service has two events $routeChangeStart and $routeChangeSuccess, these can be of some help for you. You can use $routeChangeStart before exiting and $routeChangeSuccess on entering. You can do $scope.$on on any controller to watch for these events.

Categories : Angularjs

Use Angular routing alongside roundtrip routing
I think I may have found a solution. I'm doing a similar thing, a multi-page angular site that uses angular for some of it's pages. Here's what I'm doing var app = angular.module('appname', ['ui.bootstrap', 'ui.autocomplete']) .config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) { $locationProvider.html5Mode(true); $locationProvider.hashPrefix('!'); }]) .run(function($rootScope, $location) { var redirected = false; $rootScope.$on('$locationChangeStart', function(event, nextLocation, currentLocation) { if(!redirected && $location.path() !== '/current-url') { redirected = true; event.preventDefault(); window.location = $location.path(); } }); }); So what I have to work o

Categories : Angularjs

What's the purpose of setting $rootScope.$state = $state; with angular-ui ui-router?
I don't think this is standard code. The only reason i see these being added to you rootScope it to facilitate binding within the html view everywhere. Else if you want to bind to some property of either $state or $stateParams you would have to inject the $tate and $stateParams service into the controller. Ideally this should be injected into controllers that require this service. If you remove it any html binding dependent on it would fail. Search html views for bindings with name $state and $stateParams and you would find where they are used.

Categories : Angularjs

Handling 404 error in asp.net 4.0 with Url routing?
I see, so this question is about having a custom 404 error page, not why the 404 is coming up for a specific route. In order to handle custom errors in MVC, you can override your controller's protected override void OnException(ExceptionContext filterContext) { } method. If you are using webforms, then your best bet is to use the web.config's custom errors element. See msdn documentation for the customErrors web.config element. Example: <customErrors defaultRedirect="/Abhishek_cusstom_error.aspx" mode="RemoteOnly"> </customErrors>

Categories : Asp Net

WCF Routing Service - Dynamic Error Handling
WCF provides error handling (http://msdn.microsoft.com/en-us/library/ee517422.aspx), so you could create a function that activates on a CommunicationException (http://msdn.microsoft.com/en-us/library/system.servicemodel.communicationexception.aspx) and logs the error codes from the data passed to the function. You could the go from there to a mail rooting service and whatever else you need.

Categories : C#

asp mvc friendly url routing problems
Make sure that you have declared this route BEFORE the default one: routes.MapRoute( name: "Noticias", url: "{controller}/{action}/{id}/{urlAmiga}", defaults: new { controller = "Noticias", action = "Noticia", id = "", urlAmiga = "" } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, } );

Categories : Asp Net Mvc

Some Routing problems in laravel 4
If you write Route::controller('users', 'UserController') runs the default function (index of all the objects), but you can write: Route::get('/users', 'userController@function'); or Route::post('/users', 'userController@function'); this route shows to Laravel what controller and function can call when you write this route, the diference is if you pass the parameters with get or post mode. Hope I help you

Categories : PHP

problems in routing in rails 4 app
This match 'auth/:provider/callback' => 'authentications/#create', :via => :post Should be match 'auth/:provider/callback' => 'authentications#create', :via => :post Where authentications is controller & create is method

Categories : Ruby On Rails

Properly handling nested resources in ASP.net MVC 4 WebApi routing
Microsoft is adding Attribute Routing to increase the flexibility of the routing system. Have a look at their documentation on Scenario 3 There is also some answers on Stack Overflow like: How to handle hierarchical routes in ASP.NET Web API?

Categories : Rest

Codeigniter Controller URI routing problems
You will have to add a route for each function in your controller. $route['admin/company/addNew'] ='company/addNew'; $route['admin/company/process'] ='company/process'; It's very annoying. Better, create a folder "admin" inside your "controllers" folder. Put the controller on the folder. Thus you can access your controller with the URL "localhost/admin/company" and all the methods without rerouting. If it doesn't work at first, create a controller inside "admin" folder with the same name you'll find in your routes file (default_controller).

Categories : Codeigniter

Handling complex GET parameters with Slim Framework HTTP routing
So it turns out the above is a bug in the framework which is currently being tested and hopefully fixed and released soon. I solved the problem temporarily by serializing the URI before it reaches the server side.

Categories : PHP

Inconsistency in WPF command routing behavior depending on the UI focus state
Okay, I'll try to describe the issue, as I understand it. Let's start with a quote from the MSDN section with FAQ (Why are WPF commands not used?): Additionally, the command handler that the routed event is delivered to is determined by the current focus in the UI. This works fine if the command handler is at the window level, because the window is always in the focus tree of the currently focused element, so it gets called for command messages. However, it does not work for child views who have their own command handlers unless they have the focus at the time. Finally, only one command handler is ever consulted with routed commands. Please pay attention to the line: who have their own command handlers unless they have the focus at the time. It is clear that when the focus is

Categories : C#

Controller filenames starting with P cause Routing problems
Do not use double quotes in your yaml file for string delimiters. It would appear that, with double quotes, characters get converted in to their escaped values. No real need to use any quotes at all for class names. If you do want to quote things like @service to avoid warnings that some broken yaml processor issue then use single quotes.

Categories : Symfony2

Problems Using routing-filter beta version 0.4.0.pre
It looks like the problem has been corrected the problem with the locale not appearing in the URL. However I ended up using the native Rails code for routing since I had two applications in production that I had already rewritten in Rails 4.

Categories : Ruby On Rails

Auth on create resource causing routing problems
I would suggest you use controller filters instead. This simplifies the routing to this: Route::resource('posts', 'PostsController'); And in your post controller's constructor, you can configure the filter: public function __construct() { $this->beforeFilter('auth', array('except' => array('index', 'show'))); }

Categories : Laravel

Symfony: Problems Importing the bundle routing resource
As I suspected, the problem was between the screen and the keyboard. While each bundle in Symfony may have its own routing.yml file, there's a master file at app/config/routing.yml This file points at each individual bundle's routing file. When you "Importing the bundle routing resource", you're adding a configuration entry to this file. #app/config/routing.yml pulsestorm_helloworld: resource: "@PulsestormHelloworldBundle/Resources/config/routing.yml" prefix: / Because I didn't know about this app/config/routing.yml file, I failed to remove the configuration that had been previously added. That's what the console application had been complaining about. When I remove the above from the master routing.yml file, I could get a a clean run of the Bundle generation.

Categories : PHP

Routing with Angular and Node
Are you forwarding the proper requests from your node server to angular? If using express this may look something like this: router.all('/*', function(req, res) { res.sendfile('index.html'); });

Categories : Javascript

Angular js trigger routing
I have been using the so-called AngularJS way like this, at least the routing is handled by AngularJS rather than browser directly. function Ctrl($scope, $location) { $scope.resetApp = function(){ ... $location.url('/'); } } The path is what is defined in the Route Provider like this: app.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'Ctrl' }). ...

Categories : Javascript

State Machine Problems
It looks like you're checking to see that Serial.available() is not zero and then reading a bunch of data. It could be that you are not done recieving the data when you begin your receiveMsg function. You should: Check to make sure that the bytes you need are available Wait if They are not available, but you expect them to be coming soon Just as an example: void receiveMsg(MESSAGE_STRUCT* message) { // receive bytes and put them back as integers intByte code_word, checksum; // receive byte by byte, wait for it if need be while( Serial.available() < 1 ) {delay(10);} message->start_byte = Serial.read(); while( Serial.available() < 1 ) {delay(10);} message->length = Serial.read(); There are better, more robust ways to do it, but this is pretty simple and ea

Categories : C++

How to structure routing in an Angular js and Lithium app?
This presentation should be helpful: http://li3-angular.lithium-framework.com/ What you're planning is the way to go: Li3 expose a json api, and Angular handles your routes and views. Your URL scheme should follow REST principles. li3_resources will help you to build a RESTful api: https://github.com/nateabele/li3_resources Angular UI router should help you with your routes: https://github.com/angular-ui/ui-router

Categories : Angularjs

Routing error with angular.js and express
You're serving your JS/CSS via /parent as well: ... http://localhost:3000/parent/javascripts/jquery.js ^^^^^^^ So if you declare your routes before you declare the express.static middleware, your catch-all route will handle all JS/CSS requests. You should use a setup similar to this: // express.static() first... app.use('/parent', express.static(__dirname + '/public')); // ...followed by your catch-all route (only one needed) app.get('/parent*', function(req, res) { res.render('main') });

Categories : Javascript

Angular.js ng-view ignoring routing
The problem is that you're creating the module two times, in both controller.js and routes.js: angular.module('todoApp', [])// creates the module 'todoApp' // vs angular.module('todoApp')// fetches the existing module 'todoApp'

Categories : Javascript

angular routing without webserver to load templates
I'm ignoring the "no web server" part of the question. Here's an example on how you can put a template directly in a script tag and use it with a directive. <body ng-app="myApp"> <script type="text/ng-template" id="templateTemplate.html"> <div> I am the <span ng-transclude>{{templateAdjective}}</span> template result. </div> </script> <div> <test>best</test> <test>optimal</test> </div> <script> var app = angular.module('myApp',[]); app.directive('test', function() { return { restrict: 'E', templateUrl: 'templateTemplate.html', transclude: true, replace: true }; }); </script> </body>

Categories : Javascript

Mixing Angular routing with MVC Partial Views?
Looks like there are ways to use the $location service to accomplish what you are requesting: Conditionally have anchor links send user to a different page, rather than load to ng-view

Categories : Asp Net Mvc

Handling AJAX concurrency problems in the database
Therefore, I have the idea of running every update query in a way so that they supply the previous value of the fields You are describing a trick known as "optimistic concurrency control" or "optimistic locking". It's well-established and proven. See: http://en.wikipedia.org/wiki/Optimistic_concurrency_control http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/transactions.html#transactions-optimistic (for Hibernate, a Java ORM, but the principles apply to many systems) Even ODBC back in the year dot did this, though the original approach used by ODBC has some ... issues. It's generally much better to have a dedicated revision column, which should be an integer that's incremented with every update. Don't use a timestamp. You can do something like: SELECT col1, version F

Categories : Ajax

python - problems handling exception and continuing
The traceback you pasted says that the error is in the c = wmi.WMI(asset) line. You need to put that line inside the try block. Like so: import wmi list = open("ips.txt") bad_assets = [] for line in list.readlines(): asset = line.strip(' ') try: c = wmi.WMI(asset) for process in c.Win32_Process (name="SbClientManager.exe"): print asset, process.ProcessId, process.Name except Exception: bad_assets.append(asset) Also, trying to catch the right exception is recommended.

Categories : Python

Problems handling HTTP 302 in Java with HttpURLConnection
Seems that the site you are scraping does multiple redirections, using cookies to identify the actual step. In your code, you are intercepting only the Set-Cookie header, but you are discarding previously set cookies (i.e the cookies set by response n-2). Also, the site does a http/https switch, which you might need to consider in order to send the appropriate cookie set.

Categories : Java

Problems with handling arrays gotten from php by using jquery ajax
The result is a local variable, you need to create a reference outside your ajax call, this way you can reference it without problems. Try this: var myResult; $.ajax({ type: 'POST', url: '/ws/languagesForJs', dataType: 'json'}) .done(function(result) { myResult = result; // save a reference langs = result; }) .always(function() { console.log(myResult); }); I should also mention that success is deprecated and you should go for done instead. The always callback is called as the names say's always so you can put there code that needs to be executed when the async call is done. Hope it helps.

Categories : Arrays

Exception handling in Laravel 4 - Problems understanding flow
Exception handling can be seen as a reversed waterfall. The last handler that is defined, is checked first. Take this example: // Custom Exception class CustomException extends Exception {} // Error handler in global.php App::error(function(Exception $exception, $code) { echo 'Debug: Exception<br/>'; }); App::error(function(CustomException $exception, $code) { echo 'Debug: CustomException<br/>'; }); // Exception in routes.php (or any other place) throw new CustomException(); Both types match the Exception type, so this outputs: Debug: CustomException Debug: Exception However, if you return something from within your handler, ONLY the first matching handler is triggered. To return a JSON response with a HTTP 401 response code, do something like: App::error(funct

Categories : Laravel

jquery ajax - multiple checkbox state problems
jQuery's .prop() method will return a boolean value for "checked". This is the benefit of .prop() over .attr(), that .prop() returns the type of value that fits the input while .attr() returns what's stored via HTML. .prop() was added to jQuery in 1.6.

Categories : Jquery

Express + Angular routing causing infinite loop + crash
The routing rule that you have specified for partials will not match any requests to subdirectories within the partials folder e.g. /partials/folder/file. The routing path matcher treats / as a delimiter between variables. Therefore in order to support having sub folders within your partials directory you will have to add another rule to your app and define a function to handle rendering this template. This is shown below: app.js app.get('/partials/:directory/:file', routes.subpartials); routes/index.js exports.subpartials = function (req, res) { var file = req.params.file, directory = req.params.directory; res.render('partials/' + directory + '/' + file); };

Categories : Node Js

#! causing routing issues using Angular/Rails with multiple layouts
Alright, so after testing lots of tweaks on both the client and server side, I ended up using the following solution. Basically, I just stopped exposing Angular to multiple layouts and dealt with that in Rails. Of course, this does put a limitation on users. The app is divided into two main sections: dashboard and authentication. So in the backend, we restrict the users from accessing any authentication pages if they're logged in, and obviously dashboard pages can only be accessed if the user is authenticated. The root of the problem was that Rails had no way of knowing which layout to serve, if a layout should be served at all. We used the cookies to differentiate the authenticated and unauthenticated users. If the cookie is set, and it passes the authenticity testing, then the dashboa

Categories : Ruby On Rails

Problems in windows application with error handling and textbox display
When you append "+", the num2 is equal to value1+"+"+value2 or something so try to use this code private void button4_Click(object sender, EventArgs e) { double result; if (c == "+") { num2 = double.Parse(textBox1.Text.Split('+')[1]);//bad idea but will work result = num1 + num2; textBox1.Text = result.ToString(); } } also try private void button4_Click(object sender, EventArgs e) { double result; if (c == "+") { num2 = double.Parse(textBox1.Text.SubString(textBox1.Text.LastIndexOf('+')+1)); result = num1 + num2; textBox1.Text = result.ToString(); } } PS: try catch needed!

Categories : C#

Error handling for encoding problems in File.listFiles() in android
Not really the answer to my question, but it does allow me to do what I intended. I am now using the JCIFS library to handle all the mounting and so forth. This library then handles the encoding internally and with good results. It seems to skip those file/directory names that it doesn't recognize and thus provides some form of error handling on the file/directory names.

Categories : Java

Problems handling response.status in auth.authResponseChange event
I have the same problem, but for what it's worth if you subscribe to the event 'auth.statusChange' instead of 'authResponseChange' you can know if he is 'connected' to facebook and authorized your app or if he's connected to fb but not authorized. Also if you use the FB.getLoginStatus, which facebook advise not to, you can know in what of the three states (connected, not_autorized or not_connected) the user is in.

Categories : Facebook

SOAP/MTOM: Problems with VS-generated proxy class and handling PDF attachments
Found the answer on my own, finally. In order to get the proxy class set up properly (i.e. in WCF-compliant form), I had to use svcutil via command line to convert the WSDL to the proxy class. After I did that, I was able to set the message binding to MTOM. I'm still having trouble getting it to authenticate with the certificate, but that's a smaller issue.

Categories : C#

Handling event handlers in angular
You should probably not be handling Angular events along with jQuery event in the first place. But if you must, try using event.stopPropagation() If that doesn't cut it, you can check whether the event was stopped in your jQuery: event.isPropagationStopped() which returns a boolean. http://api.jquery.com/event.isPropagationStopped/ Worst case scenario, you hold a shared flag (variable visible in scope to both the angular event handler and the jQuery event handler), always be sure to delay the jQuery handler for a couple of ms, and then in your angular handler raise the isHandled flag. When it comes to your jQuery event handler: if flag is false handle event. if flag is true lower flag and return without handling. But your best bet is to handle events only in Angular and lose the jQue

Categories : Javascript

Preserve state with Angular UI-Router
I have found Angular-Multi-View to be a godsend for this scenario. It lets you preserve state in one view while other views are handling the route. It also lets multiple views handle the same route. You can do this with UI-Router but you'll need to nest the views which IMHO can get ugly.

Categories : Angularjs

Express Routing HTML5 Style CatchAll Conundrum no HASHBangs - Angular JS, Yeoman
Put your API routes (get, post, delete, etc.) before the catch. There's no need to redirect. app.get('*', function(req, res){ res.sendfile('public/index.html'); }); There's nothing else to it.

Categories : Node Js

Angular JS / data handling / overview page
If you want to persist data between actual HTML pages and not routes within a single page, you could use LocalStorage. Here is a service that will make that a little easier. Another approach would be to use cookies. You can read more about using cookies in Angular here. If you are wanting to persist the data across different routes, you will need to create a shared service. Here is an example of such an approach: <div ng-app="myApp"> <a href="#one">one</a> | <a href="#two">two</a> <div ng-view></div> <script id="one.html" type="text/ng-template"><div><h1>Template One</h1>foo = {{shared.foo}}</div></script> <script id="two.html" type="text/ng-template"><div><h1>Template Two<

Categories : Angularjs



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