routing

Symfony2 Use default locale in routing (one URL for one language)

与世无争的帅哥 提交于 2019-11-30 09:03:17
I am currently developing a website with Symfony2 and I need to translate it. With tools provided by Symfony2 it’s very easy. But I encounter a problem: I would like to have specific URL (with prefix) to a language (ie, one URL, a single language), but with a default language. Concretely: Assume that the default language is English, so http://example.com/fr/hello display the page in French http://example.com/it/hello display the page in Italian http://example.com/en/hello redirect to http://example.com/hello (because en is the default language) http://example.com/hello display of course the

Using AngularJS routing and loading controllers on demand using requirejs

南楼画角 提交于 2019-11-30 09:01:24
I'm trying to use AngularJS and RequireJS in combination. I would like to use the $routeProvider service and avoid having to load all the controllers for my views on application startup. For that, I tried the following: define(['require', 'angular', 'appModule'], function (require, angular, app) { app.config(['$routeProvider', function($routeProvider) { $routeProvider .when('/sites', {templateUrl: '/Site/GetSitesView', controller: function() { require(['sitesController'], function(SitesController) { return new SitesController(); }) }}) }]); }); Unfortunately, that did not work for me. There

nodejs hapi single page

戏子无情 提交于 2019-11-30 08:58:49
I have a single app site (NodeJS) and I want to migrate from Express to Hapi, what I normally do is serve static files and route everything else to a single page which contains the angularjs app and the angular routing configuration. // Express routing, first the static files app.use( express.static(__dirname + '/public') ); // Second the api routes app.get('/api', function(req, res){ res.send( {api: 'response' } ) }); // Finally everything else maps to the single page app: app.get('*', function(req, res){ res.sendfile('./public/html/controllers.index.html') }); In HapiJS I dont know how to

Angular 2 - Unexpected Module declared by AppModule

帅比萌擦擦* 提交于 2019-11-30 08:36:21
问题 I am new to angular and trying to separate my modules in Angular2 app having the following directory structure. I have my module and other components declared in the AppModule, but I am getting an error in browser console that Unexpected HomeModule declared by AppModule app --authentication ---- htmls, ts, css --home ----dashboard --------html, ts, css ----representativs --------html, ts, css ----home-routing.module.ts ----home.module.ts --app.routing.ts --app.module.ts app.module.ts import {

Automatically generate lowercase dashed routes in ASP.NET Core

倾然丶 夕夏残阳落幕 提交于 2019-11-30 08:34:33
ASP.NET Core uses CamelCase-Routes like http://localhost:5000/DashboardSettings/Index by default. But I want to use lowercase routes, which are delimitted by dashes: http://localhost:5000/dashboard-settings/index They're more common and consistent, cause my application extends a website running Wordpress, which also has lowercase urls with dashes. I learned that I can change the urls to lowercase using the routing-options: services.ConfigureRouting(setupAction => { setupAction.LowercaseUrls = true; }); This works but gave me urls without any delimiter like http://localhost:5000

Multiple pattern in single symfony routing

Deadly 提交于 2019-11-30 08:24:37
How to make multiple pattern in single Symfony routing? Normally we have a routing as blog: pattern: / defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } Is it possible to have two routing patterns? Something like blog: #Below pattern to match with '/' or '/index' pattern: {/ , /index} defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } Are you using Symfony2? If you are and can use annotations for your routing instead of yml or xml then it's possible to have multiple routes defined along these lines: /** * @Route("/"); * @Route("/home"); */ Then you don't need to

Find distance of route from get.shortest.paths()

有些话、适合烂在心里 提交于 2019-11-30 07:35:55
I'm using the igraph package in R to do something rather simple: Calculate the shortest distance between two nodes in my network. Is there a straightforward way to extract the distance of a path calculated via get.shortest.paths() ? Here is some reproducible code that exemplifies my problem: ## reproducible code: df2 = rbind(c(234,235,21.6), c(234,326,11.0), c(235,241,14.5), c(326,241,8.2), c(241,245,15.3), c(234,245,38.46)) df2 = as.data.frame(df2) names(df2) = c("start_id","end_id","newcost") require(igraph) g2 <- graph.data.frame(df2, directed=FALSE) class(g2) print(g2, e=TRUE, v=TRUE) ##

Routing HTTP Error 404.0 0x80070002

╄→尐↘猪︶ㄣ 提交于 2019-11-30 07:21:11
I have created routing rules in my ASP.NET application and on my Dev machine at IIS7 everything works fine. When I deploy solution to prod server which has also IIS7 I get error 404 (page not found) while accessing URL. Maybe someone could point where is the problem? Actual error HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error InformationModule IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL http://xxx.xxx.xxx.xxx:80/pdf-button Physical Path C:

IgnoreRoute with webservice - Exclude asmx URLs from routing

不问归期 提交于 2019-11-30 06:55:47
Im adding the filevistacontrol to my asp.net MVC web application. I have a media.aspx page that is ignored in the routing with routes.IgnoreRoute("media.aspx"); This works successfully and serves a standard webforms page. Upon adding the filevistacontrol, I can't seem to ignore any calls the control makes to it's webservice. Eg the following ignoreRoute still seems to get picked up by the MvcHandler. routes.IgnoreRoute("FileVistaControl/filevista.asmx/GetLanguageFile/"); The exception thrown is: 'The RouteData must contain an item named 'controller' with a non-empty string value' Thanks in

ASP.NET MVC routing and areas

前提是你 提交于 2019-11-30 06:49:39
I am messing around with ASP.NET MVC 2 Preview 2 and am trying to figure out how routing works with areas and such. In a single project implementation of areas, I want an area named "admin". I am trying to be able to have urls like this: (root)/admin/apples/search (root)/admin/apples/edit/3 (root)/admin/apples/add (root)/admin/oranges/search (root)/admin/oranges/edit/5 (root)/admin/oranges/add (root)/admin I have the area created. I have the controllers created with their respective views, but it is the routing that I can't seem to get. Any advice as to how I would achieve such routing? I am