Angular ng-view/routing not working in PhoneGap

After searching through several questions and forums, I’ve finally got it working reliably. This is what it took me to get it running from a clean PhoneGap project. index.html <!DOCTYPE html> <html ng-app=”App”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> <meta name=”format-detection” content=”telephone=no” /> <meta name=”viewport” content=”user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi” /> <link rel=”stylesheet” … Read more

Next.js Redirect from / to another page

Update: Next.js >= 12 Now you can do redirects using middleware, create a _middleware.js file inside the pages folder (or any sub folder inside pages) import { NextResponse, NextRequest } from ‘next/server’ export async function middleware(req, ev) { const { pathname } = req.nextUrl if (pathname == “https://stackoverflow.com/”) { return NextResponse.redirect(‘/hello-nextjs’) } return NextResponse.next() } … Read more

Rails routing to handle multiple domains on single application

It’s actually simpler in Rails 3, as per http://guides.rubyonrails.org/routing.html#advanced-constraints: 1) define a custom constraint class in lib/domain_constraint.rb: class DomainConstraint def initialize(domain) @domains = [domain].flatten end def matches?(request) @domains.include? request.domain end end 2) use the class in your routes with the new block syntax constraints DomainConstraint.new(‘mydomain.com’) do root :to => ‘mydomain#index’ end root :to => ‘main#index’ … Read more

HttpContext.Current.Session is null when routing requests

Got it. Quite stupid, actually. It worked after I removed & added the SessionStateModule like so: <configuration> … <system.webServer> … <modules> <remove name=”Session” /> <add name=”Session” type=”System.Web.SessionState.SessionStateModule”/> … </modules> </system.webServer> </configuration> Simply adding it won’t work since “Session” should have already been defined in the machine.config. Now, I wonder if that is the usual thing … Read more

Semantic urls with dots in .net

If you are using .NET 4.0 and IIS 7+, you can set this flag in the system.web section of your web.config and it will be allowed: <httpRuntime relaxedUrlToFileSystemMapping=”true” /> I’ve tested it and it works. Haack has an explanation of it.