Go IRIS http frameowrk, I can't get routing right - http

Ok, so first of let me start off by saying I know that with go I should really go for the net/http framework unless I have the knowledge to write my own or I explicitly tried that and it didn't work. However, I'm an idiot, and I thought I could save some time and headache by using a framework and I thought choosing one maintained by only 1 guy is a good idea. The framework is here:
https://github.com/kataras/iris
But I don't expect you to read through all of it. However, it is based on top of fasthttp which some of you might have experience with (hopefully).
The problem I'v meet with this framework is with configuration of static content serving. For example, I have my index page being served:
iris.Get("/", serveHome)
which serves and html template over at ip:port.
I have static ressources listed as such:
iris.Static("/css", "./client/css")
Which basically serves the dir css over at ip:port/css
However, when I put this all up on a server and redirected mydomain.example and www.mydomain.example to ip:port using nginx (with an ssl&tls cert), this worked:
iris.Get("/", serveHome)
and served the index.html at mydomain.example. This didn't:
iris.Static("/css", "./client/css")
And now my website can't access any static resources, because its trying to access mydomain.example/css, which, for some reason, isn't pointing to ip:port/css.
Any clue why this might be happening, have you seen this behavior on any other http server before and if so do you have any pointers that might help me figure out this thing ? I'm at a loss and any advice, even if its just speculation, would be useful.

I know you're already porting this, but if i have to guess, i'd say the problem is the relative path you're using for ./client/css.
If you're compiling this and running it form your development environment, this pretty much will run under $GOPATH/bin and i guess your CSS files are in $GOPATH/src/path/to/project/client/css... then when the compiled server tries to find ./client/css from $GOPATH/bin... well, i guess you got it, it looks up in $GOPATH/bin/client/css. But that's just a guess, i'd need more info from your project to debug that.
Good luck with porting your project!

Related

Error when calling createDefaultLayers() in HERE API

EDIT: Is there anywhere to get an un-minified version of the Here-api to use when debugging? It's impossible for me to figure out what 'v' is and why it may be undefined.
We're using the HERE API both from our website where it works flawlessly and our old RDP C++ application which runs a similar webpage in an embedded IE window. It should be using a stripped version of IE11 I believe.
We recently upgraded to the new HERE API after routing stopped working in the old one, and it worked for a while but a while ago it suddenly didn't. And no one can recall making any changes that could affect this.
I have narrowed it down to a single line of code where it crashes. (platform is already defined in the scope through our geo-service script, the same one being used for the web that works)
var defaultLayers = platform.createDefaultLayers();
This is an initialization of the map layers that is required for the maps to work, but we simply can't perform this action through this embedded browser window even though we run almost identical code on the web.
We receive two error messages of:
'v' is undefined
With a reference to some dynamically generated eval code.
This is the only lead I've managed to dig up, it's not much but I'm hoping someone else has encountered a similar issue and can point me in the right direction what to look for.
I found the issue, it was totally self inflicted...
When we implemented the solution there was an issue in the core js file from Here which made it not work in our servers due to some path being wrong. To fix this we had changed the path so it worked and then hosted our own version of the core file.
This worked great, until Here put up a new minor release which is automatically distributed through the same content link as before. This meant the minified files were no longer in sync with the variable names, thus causing v to never be defined where it should, since in our file it was probably named something else.
It was only by chance I noticed that the core js was side-loaded like that, I was looking in the completely opposite direction the entire time and didn't even consider the loading might've been tinkered with.

MVC4: List of all urls available on the site?

We have quite a large MVC4 application and we would like to have Selenium go through every page and make sure it loads - some sort of smoke test.
I can use reflection to go through the assembly, find all controllers and all actions, check if actions are not post, come up with parameters for actions that require parameters.
Then I'll feed this list to Selenium and check that everything I need on the pages is done appropriately.
But before I start playing with reflection, I'd like to check if this has already been done, so I don't reinvent the bicycle. I have googled for such thing, but could not find anything.
p.s. Writing the reflection code is not an issue. Selenium is covered as well. Just checking if this has already been done.
The AttributeRouting project has a route debugger in place, which does work even if you don't use attribute routing inside your project.
You can see the class that handles displaying the routes over on Github but I'm not sure it will display the routing information when the project isn't run locally. You may need to adapt that code so you can access it safely from your Selenium instance (and make it machine readable using JSON or something).

Significance of : xmlns:mx="http://www.adobe.com/2006/mxml"

I want to know a bit more about 'xmlns:mx="http://www.adobe.com/2006/mxml". Generally namespaces acts as the pointers to the component location, but I've always seen them directing resources within local directory structure. When 'xmlns:mx="http://www.adobe.com/2006/mxml"' is used than is a new connection is set with adobe server or is it just a convention?
If an actual connection is set then the application should not get compiled without internet connection but in reality we can compile and run our application without internet connection as well !! Plz correct me if I am wring somewhere.
Please help me understanding its significance,
Thanks in advance.
Ashine.
It's just an identifier that with the use of flex-config.xml file (you can find it in your $SDK_HOME/frameworks folder) points to mxml-manifest.xml file which contains definitions of classes that you can use by "importing" specific namespace.
It's just a convention. Try actually following the URI, the page doesn't exist!
Namespaces aren't the same as directory structures btw... The actionscript compiler cheats a lot to make it look that way.
The URL is known as a namespace URL. Not all namespaces are directory structures. But, it takes quite a bit more work to create a namespace URL; whereas directory namespaces are almost automatic.
To create a namespace URL, you need to use a library project and add a manifest.xml file.
The documentation is really light on this topic. But, I demo about this in the last episode of The Flex Show's screencast series on creating custom components and in an episode of the Flextras Friday Lunch.

Flex - Passing request data with URL fragments

I'm passing the following parameter as an url fragment to flex. (#groupID=2385)
This works great on the development box, but when I put it on the production server.. nothing.
Do you think this is a server configuration issue. I presume that flex is talking to the javascript file 'AC_OETags.js' to make this all happen.
Any pointers much appreciated.
Thanks
Do you have access to "history.js", "history.css", and "historyFRame.html" on release? They should be packed into your release folder as well as the AC_OETags.js if you're using the browser history in flex.

silverlight error - the opreation is not supported for a relative uri

I've just started developing silverlight applications. I've created a webserivce in my asp.net project. Now, when I try to connect to it through my silverlight project I receive the following error:
"the opreation is not supported for a relative uri"
I am using the following url -->
http://192.168.1.2/MyWebsite/SubVersionedHistory.svc
I can find the class and its methods, but I receive this horrific error when I add it.
Thank you for your help and advice,
Vondiplo
I don't think you're alone in hitting this problem. I hit it today with VS2008SP1 + SL2 trying to create a Service Reference for an ADO.NET Data Service. First time I've hit the error.
Others have detailed similar experiences to reach this error:
http://silverlight.net/forums/t/87535.aspx
http://silverlight.net/forums/t/56629.aspx
It's not entirely clear at this point if the issue is with the IDE "Add Service Reference" dialog or something specific in the services causing this error. In my case, however, my code still worked despite the error message. I simply passed the URL to my service in the constructor of my DataService proxy client, like this:
var context = new DataServiceContext(new Uri("NorthwindDataService.svc", UriKind.Relative));
Summary point: Just because you hit this error in the IDE, your service reference may still work. Give it a try and let us know if you're seeing errors at run time.
Hope that helps.
[UPDATE] Based on some other advice I've found and tested, you can also try:
deleting your Service Reference
deleting your ServiceReferences.ClientConfig file
saving your solution
and then closing and reopening it in VS.
The simple act of closing and reopening your project has been shown to fix several problems with the Add Service wizard. Re-run the Add Service Ref wizard and you may have better luck. I personally tested this solution on a project today and can confirm it works. Hope that adds extra help to finding your solution.
You should be more specific about your problem. For example, are you having this problem when adding the reference or when you actually try to consume the service?
It sounds like you need to be using a full path, including the "http://" but that is just a shot in the dark based on the error message you provide.
[edit]If you are using the built in ASP.NET server instead of IIS then be sure you set a specific port number and use it in your path. For example, I have used http://localhost:4940/MyService.svc for testing[/edit]
Maybe this response can help you
You cannot use AbsolutePath, You need to use AbsoluteURL. Build your URL this way:
Uri url = new Uri(App.Current.Host.Source, "../settings.xml");client.DownloadStringAsync(url);
http://silverlight.net/forums/p/28912/95541.aspx
HTH
Braulio
Check the ServiceReferences.ClientConfig
if there are multiple endpoints there you will get this exception. one thing that can cause this is referencing a service using casini, later switiching to IIS express and rereferencing the service.

Resources