w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Implement get_serializer in generic list view (generics.ListCreateAPIView) in Django REST Framework
The error you are seeing is because you didn't declare a serializer_class or model attribute on your view. If you don't specify those you must override get_serializer_class() to tell the view which serializer to use. Also you said: but when I try to initialize my PageSerializer in the list view (which inherits from generics.RetrieveUpdateDestroyAPIView) I get the following error: A list view should inherit from one of the generic list views like ListCreateAPIView, not a single object view like RetrieveUpdateDestroyAPIView.

Categories : Django

Fat Free router blocks Backbone router, how/when does Backbone router.js work?
If you are not using pushState, then the backbones routes are easy to differentiate from the server routes: /route1 /route2 /route1#route/a /route1#route/b The part before the hash is the one transmitted to the server (F3 routes). The part after the hash corresponds to the backbone routes. //F3 routing $f3->route('GET /route1',…) $f3->route('GET /route2',…) //Backbone routing routes: { "route/a": "routeA", "route/b": "routeB", } Note that the Backbone router doesn't generate any HTTP request to the server (unless you specifically define it of course). What generates automatically HTTP requests is the Backbone model. A backbone model is mapped to a server resource using urlRoot. The methods fetch(), save() and destroy() are then mapped respectively to the GET, PUT and

Categories : Backbone Js

Meteorite router package installation - Uncaught 'error' event on 'mrt add router'
Node 0.10.9 has a couple of issues. I'm not sure it'll help but try mrt add router --repoPort=80 as suggested here : https://github.com/oortcloud/meteorite/issues/135

Categories : Javascript

KnockOut JS - applying a new binding. Error - Message: ReferenceError: 'router' is undefined; Bindings value: css: { active: router.isNavigating }
Before you execute the problematic code, the Composition lifecycle of Durandal has bound the the shell.jsand subsequently the ViewModel agency.js with the UI. Meanwhile in the addContact function, at the last line you basically change the whole binding applied to the view: ko.applyBindings(objAgency); So your whole UI is now bound to this objAgency which I guess does not contain a router instance as the errors is pointing : ReferenceError: 'router' is undefined; This error comes probably from the binding of the shell because is no longer bound to the UI since your code applied new bindings. SOLUTION: The applyBindings is managed by Durandal in the composition process. If you want to modify some properties of the ViewModel there's no need to update the bindings. I don't know if

Categories : Javascript

How to test Meteor router or Iron router with laika
I had the same problem. I needed to navigate to some page before running my tests. I'm using iron router as well. I figured you can't just execute Router.go('foo') and that's it. You need to wait until the actual routing took place. Fortunately the router exposes a method Router.current() which is a reactive data source that will change as soon as your page is ready. So, in order to navigate to a specific route before running my tests, I firstly run the following code block: // route to /some/path client.evalSync(function() { // react on route change Deps.autorun(function() { if (Router.current().path == '/some/path') { emit('return'); this.stop(); } }); Router.go('/some/path'); }); Since this is within an evalSync()everything that

Categories : Meteor

ARP behind router with NAT?
The X.X.5.7 and X.X.10.1 are likely in different subnets, so you would not be able to get ARP messages from one subnet to another. ARP is sent only in the same subnet. If the destination is in a different subnet, then the host (sitting behind the AP) would simply send it to the gateway (perhaps the AP). You mentioned that you were able to do this without NAT. I am curious without NAT, did you put the clients in the X.X.10.1 subnet or in X.X.5.1 subnet?

Categories : Networking

ASP.NET MVC Router
All the routes defined are generic. http://mydomain.com/pablo will match the first route http://mydomain.com/pablo/cozinha will match the second route http://mydomain.com/ will match the first route (So home page will not be displayed) http://mydomain.com/home/index will match the second route. (So home page will not be displayed) Routes should be defined from specific to generic order. e.g. you can change the routes as, public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Servico", "Func/{funcionario}/{servico}", new { controller = "Funcionario", action = "Servico", funcionario = UrlParameter.Optional, servico = UrlParameter.Optional },

Categories : Asp Net Mvc

Ember.js help for router map
Okay, so first up, you can remove the / from { path: '/:dynamic_id' }. Next, you need to understand that when a dynamic segment is expected within the route you are referencing in your linkTo helper, you need to pass model (or other) objects as additional parameters to the linkTo helper as context for each dynamic segment. This is probably why you're getting the error. Your router should look something like this: Stat.Router.map(function () { this.resource('one', {path: ':one_id'}, function(){ this.resource('two', {path: ':two_id'}, function(){ this.resource('three', {path: ':three_id'}, function () { this.resource('four', {path: ':four_id'}); }); }); }); }); And in your template, you should be pas

Categories : Javascript

C++ Sockets with Router
This has nothing to do with your program, and everything to do with your network configuration. Go learn about NAT (network address translation) and doing port forwarding or DMZ on your router. Usually you want your program to bind to all interfaces - INADDR_ANY - but the important one is the address on the network controlled by your router (often 192.168.0.0/16, but it can be any RFC1918 address block). Once you have your network configured on your router and binding the external interface from your program (don't hard code an address like in your example, just use INADDR_ANY) serv_addr.sin_addr.s_addr = inet_addr(INADDR_ANY);

Categories : C++

Using hashtags with backbone Router
If you haven't defined a callback handler for a particular hash fragment or url(when using the History API), the browser's default behavior is to route you to the home url. The solution is to replace <a href="#"></a> with <a href="#MyFragment"></a> and register a handler for the fragment/url when initializing your router.

Categories : Backbone Js

codeigniter uri (URL) setup using router
To solve the problem, just move $route['products/(:any)/(:num)'] = "products/selbygrp/$2"; above $route['products/(:any)'] = "products/detail/$1";

Categories : Codeigniter

Register annotation router
Information found in the phalcon forum: http://forum.phalconphp.com/discussion/344/multi-module-wildcard-annotation-router One has to register the namespace with the PhalconLoader instead of the throught the modules loader. $loader = new Loader(); $loader->registerNamespaces( array( 'AppsBackendControllers' => __dir__ . '/../apps/backend/controllers/' ) ); $loader->register();

Categories : PHP

Emberjs Router with requirejs
So should I pass an app to my app_router to set the App.Router.map... method or should I return a Ember.Router.map(...)? If the first variant is chosen then for sure, the dependencies change. I'd go with the 2nd variant. In other words, should I create an "empty" Ember.Application and pass it to the router so it can define the App.Route.map(... method, since it has reference to this, like this.route his.resource..., or should I invoke Ember.Router.create() then invoke the map function on it, then return this from the module and set it to App.Router = router. Neither. You should let ember create the router itself. All your code should be doing is calling App.Router's map fx. I'm no require.js expert, but something like this should work: //Define a fx that specifies your applica

Categories : Javascript

ToroPHP Router in nginx
This question really belongs on http://serverfault.com, nonetheless: Use try files Rewriting isn't necessary, the desired results can be achieved more efficiently using try_files: server { ... location /api { # try_files $uri $uri/ index.php$uri; try_files $uri $uri/ index.php; } } } Note that it's not necessary to pass the url as an argument to index.php as it's already available as $_SERVER['REQUEST_URI'] (will require trivial modifications to index.php to work).

Categories : Htaccess

How can I get value in the “post” router using expressJS?
if you want to process GET & POST in the same route, for for app.all just like app.all('/',function(req,res){ //processing code here });

Categories : Javascript

Are there any framework for "Router-Like" cli in Java?
Since you have not got any answer yet I will send you this link: Java command line "shell" with auto-complete Take a look. It can be useful. Additional link is here: What's a good Java, curses-like, library for terminal applications? Follow the discussion. It refers to library Charva that allows you even more: it helps to create fully functional terminal based applications. Remember Norton commander? You can implement one in java.

Categories : Java

Monolithic Backbone Router
Have a look at this example project from Derick Bailey, the creator of Backbone.Marionette. You could see how he organized his app in modules, each of these has a router that takes care of handling the routes. The concept of modules in Marionette is similar to the one used by requirejs to load portions of code with certain dependencies. Even if you're not going to use Marionette and just stick with Backbone you could find some helpful insights in how he divided his code. Though I suggest you to evaluate Marionette.

Categories : Javascript

My backbone js router isn't working
You almost certainly have a Backbone version problem. The 1.0.0 Change Log entry says: The routes in a Router's route map may now be function literals, instead of references to methods, if you like. And you can even find the trivial one line change in the revision history that made this new behavior possible. Older versions of Backbone wanted route method names in routes and didn't know what to do with functions. Upgrade to the most recent Backbone (and Underscore and jQuery) and your code will work. Demo: http://jsfiddle.net/ambiguous/sfeCr/1/

Categories : Javascript

DurandalJS 2.0.0 : where is "settings" in the new router?
I misunderstood the docs, the answer is : router.map([ { route: 'home', moduleId: 'viewmodels/home/home', title: 'Home', nav: true, mySetting: ['mySetting'] }, ... ]);

Categories : Javascript

EmberJS RC6 Router Catch All
It appears to me as if it's still working. Would you mind showing me a jsfiddle with it not working? App.Router.map(function() { this.route('index', {path: '/'}); this.route('catchAll', { path: '*:' }); this.route('place', {path: '/place'}); }); jsfiddle of it working on RC6 Is it possibly failing somewhere else? Is it failing on a programmatic transitionTo instead of a href change? If so, it probably has to do with the new router pushed in by machty and we should probably submit a bug.

Categories : Ember Js

Inject default value in ZF2 Router
Option one: from your indexAction $id = $routeMatch->getParam('id', false); if (!$id) $id = 1; // id was not supplied set default one note this can be added as constant or from db .... Option two: set route in module.config.php 'product-view' => array( 'type' => 'Literal', 'options' => array( 'route' => '/product/view', 'defaults' => array( 'controller' => 'product-view-controller', 'action' => 'index', ), ), 'may_terminate' => true, 'child_routes' => array( 'default' => array( 'type' => 'Segment',

Categories : PHP

How do I connect to router "panel" using C#
Have you tried using this as the address and dropping the post data part of your code : http://username:password@192.168.1.1 Else, you could use basic authentication, as explained in this article

Categories : C#

Router and redirect special
This re-write rule might help you.. This rewrites every request that come to site.com/(anything) to site.com/holiday/(anything): RewriteEngine on RewriteRule ^([a-zA-Z]+)/?$ /holiday/$1 Just put this in your .htaccess and it will do it's job. If you want only the site.com/christmas to be redirected try this: RewriteRule ^christmas/?$ /holiday/christmas

Categories : PHP

Reverse preg_replace - Router
Why don't you simply create : function createUrl($route) { return $route['controller'].'/'.$route['action'].'/'.$route['id'] ; } Then if you display information: createurl(array('controller'=>'home','action'=>'news','id'=>2)); You will have your expected result. You can also add a validator inside the function to check the input parameters.

Categories : PHP

If a class inherits a method does calling that method on that class point to the super class or does it make a local copy within the child class?
It will follow the way you have it currently written: -> New object of class B -> Call method One on this object -> First line calls supermethod, proceed to execute it -> Second line prints out after that Your code doesn't compile at all though, you might want to clear that up. What's keeping you from testing this yourself? Here's the new situation as you described it. Everything still works as expected, you just add a layer. public class C { public void test() { System.out.println("Inside C"); } } public class B extends C { public void test() { super.test(); System.out.println("Inside B"); } } public class A extends B { public static void main(String[] args) { A obj = new A(); obj.test(); } } Out

Categories : Java

Second router or middleware path in express.js
Once you declare a route, Express inserts the router middleware into the middleware stack at that point, so if you were to declare a single route before loading the session middleware, all route requests would skip the session middleware: app.get('/one', ...); // inserts `app.router` into the stack at this point app.use(express.session(...)); app.get('/two', ...); // will skip the session middleware There's two solutions I can think of: create your own middleware to handle the requests which shouldn't be passed through the session middleware, or explicitly set the session middleware for each route you want to run through it. First solution: app.use(function(req, res, next) { if (req.path.indexOf('/avatar/') === 0) { // parse out the `id` and return a response } next(); });

Categories : Node Js

AngularJS UI-Router multiple states with same URL
You're doing inheritance wrong. Parents and children should be dot-separated. Your configuration should look like this: .state('step-3', { abstract: true, url: '/step3', data: { ... }, views: { ... } }) .state('step-3.a', { data: { ... }, views: { ... } }) .state('step-3.b', { data: { ... }, views: { ... } }) This way, both child states will reflect the URL of their parent.

Categories : Javascript

How to make a stable Durandal router URL
Apply the image src via a class defined in a css file. Once you do that, you can use the image location relative to your css location. <div><img class="loading" /></div> the class for "loading" can be defined in your base css. I have it defined in my layout.css .loading { content:url('images/ajax-loader.gif'); } Now, the layout.css mentioned uses its own location to form the relative path to the images folder and it all works. |-[]Images |-ajax-loader.gif |-[]SomeotherFolder |-layout.css hope this helps

Categories : HTML

How to properly use Backbone views and router
Unfortunately with Backbone (especially Backbone Views) there's not really a "proper" way to do things. There's no reference convention. A lot of people who use Backbone only use the Models/Collections and don't use the Views at all. In my opinion I would scrap having a view for a collection unless it's actually doing something important. Use the hierarchy App > ModelCollection+ModelViewCollection. So in your case: ItemsApp (Backbone.View) --ItemCollection (Backbone.Collection) --Item (Backbone.Model) -- SellerCollection (Backbone.Collection) --ItemViewCollection (Array) --ItemView (Backbone.View) -- SellerViewCollection (Array) So your ItemsApp would create and destroy ItemViews as the ItemCollection changes (listen to the events). The ItemView is responsible to know

Categories : Javascript

router still initializing when route called
$.when(window.encoderStream.fetch(), window.recordingLibrary.fetch(), window.scheduleLibrary.fetch() ).done(function(){ this.scheduleLibraryView = new ScheduleLibraryView({ collection: window.scheduleLibrary }); // all data has been fetched, start routing! Backbone.history.start(); }); However, this is actually an anti-pattern. From the docs: Note that fetch should not be used to populate collections on page load — all models needed at load time should already be bootstrapped in to place. fetch is intended for lazily-loading models for interfaces that are not needed immediately: for example, documents with collections of notes that may be toggled open and closed.

Categories : Jquery

Router::parseExtensions() for only a specifc route
If you need request something like this http://localhost/sitemap.xml Then add route: Router::connect('/sitemap.xml', array('controller' => 'sitemaps', 'action' => 'index')); Add beforeFilter() function to SitemapsController.php: public function beforeFilter() { $this->viewClass = 'Xml'; } If you don't want to set extension in route rule and want more complex solution, you have to set correct action: public function beforeFilter() { $this->viewClass = 'Xml'; $action = reset(explode(".", $this->request->params['action'])); $this->setAction($action); }

Categories : Cakephp

Emberjs common router events
You are doing DOM related operations which should go into the didInsertElement of a view. So for your window.scrollTo(0, 0) to work it should be defined in such a hook, assuming you have a todos template than this should work. App.TodosView = Ember.View.extend({ didInsertElement: function() { window.scrollTo(0, 0); } }); In the case you need common code to be executed in different classes one possible way is to create a Mixin and mix it into the classes that need it. For example: App.CommonMixin = Ember.Mixin.create({ myCommonFunction: function() { console.log('this works'); } }); App.ScrollTopRoute = Ember.Route.extend(App.CommonMixin, { ... // myCommonFunction is available here }); App.AnotheScrollTopRoute = Ember.Route.extend(App.CommonMixin, { ... // my

Categories : Javascript

Parameters stored in Ember router
The router map is not designed to store transient data which you later need in your controller. For something like your use case to work you should rather do it like this: App.AboutUsRoute = Ember.Route.extend({ langIndex: '1' ... }); And then inside the route corresponding controller you could get your variable like: App.AboutUsController = Ember.ObjectController.extend({ someMethod: function() { // get here the variable stored in your route // this.get('target') always refers to the controller // corresponding route this.get('target').get('langIndex'); } }); Hope it helps.

Categories : Ember Js

Loading model with EmberJS Router
What happens when you navigate to /#/post-filename/ directly Because you specified a dynamic segment in your post resource (path: 'post_filename'), the route expects a model, which you can specify with the return value of the model hook. By default, for a route named PostRoute, Ember will auto-generate a model hook like this: model: function(params) { return App.Post.find(params.post_id); } which, in this case, I assume is not what you're looking for. Did you define a Post model? If not, you can override the model hook on your PostRoute to whatever you need it to be, e.g.: model: function(params) { //instantiate your model manually (ajax call, load from fixture, whatever) return getMyModel(params.post_filename) } Note that the params argument is an object that has keys equal t

Categories : Javascript

WCF Router raising Exception over RM packets
Figured it out. The endpoint on the router facing the client service was being set up with a WsHttpBinding instead of the CustomBinding that matches the HTTPS binding of the client using reliable messaging. After changing it to use the correct binding the traffic is now passing through the router without issues.

Categories : C#

Get previous router/url in backbone application
You can store your history in some array and do some manipulation with last/previous items. var history = []; this.listenTo(this, 'route', function (name, args) { history.push({ name : name, args : args, fragment : Backbone.history.fragment }); console.log(history); });

Categories : Javascript

Backbone Router -- load data
Backbone.js is a library that doesn't really enforce how you'd like to structure your App (Or the relationship between your Controller, Model, Router, etc.) Below is one of the many ways to do it. Couple highlights: Router kicks off the fetch process. When model has been fetched, Router then asks the View to render data (Instead of having the View listening to change events from the Model.) This assumes that PlayerCardView is a "read only" view, as the View doesn't listen to change events from the Model. Depending on your use case, this might not be desirable, so it ultimately depends on how you'd like to handle it. Here are some sample code: (function (export) { var App = export.App = {}; // Stores state/current views of the App App.state = {}; App.state.currentP

Categories : Backbone Js

Angularjs ui-router with accumulative states
Well I think I made it (misunderstanding the concept of multiple views): (function() { var score_view = { template: '<div>scores!</div>', controller: function() { return console.log("scores!"); } }; var plot_view = { template: '<div>plos!</div>', controller: function() { return console.log("plots!"); } }; this.plotter = angular.module('plotter', ['ui.state']); this.plotter.config([ '$stateProvider', function($stateProvider) { return $stateProvider.state('plotter', { url: '/', template: '<div ui-view="step1"></div><div ui-view="step2"></div>', controller: function() { return console.log("main"); } }).state('plotter.scores', {

Categories : Angularjs

Angular JS ui-router on Internet Explorer 8
Can you try building off of master? There was a pull request merged just after the last release (https://github.com/angular-ui/ui-router/pull/392) that resolved some IE8 issues. Everything else should work fine AFAIK.

Categories : Angularjs

SNMP MIB for finding if Router is busy
Many system administrators use a free tool such as MRTG, Cacti, Cricket, or Zabbix to SNMP poll and graph the traffic flowing through their routers. All these tools should be able to read the standard IF-MIB - in particular the objects ifInOctets and ifOutOctets.

Categories : Linux



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