NancyFx won't serve static content (images) from a folder called '16x16' - nancy

I have a NancyFx (v0.21.1) web site where some of my images are held in a subfolder of the content folder, e.g.: /content/img/16x16/image.png
However, Nancy won't serve this image (yields a 404). If I change the folder name to something else (/content/img/size16/image.png), Nancy will serve the image.
Not the end of the world (clearly), but interested to know why this is?

What hosting are you using? I just tried this using Nancy.Hosting.Aspnet for the latest build (1.4.3) and it works fine
0.21.1 is over 2 years old and a lot has changed during that time. I wouldn't be surprised if there used to be an encoding issue that has been resolved since
If you really want to figure it out, then I recommend you grab the PDB files and step into the static content convention and see what is happening

Related

Why are images inside my assets folder only displayed when the folder is outside the src-folder?

In two different ReactJS projects, I am working with images which are stored inside of an "assets"-folder. For some reason though, they are only found/displayed as long as the folder containing them is outside the source folder. Why is that?
Without knowing more details about both projects it's not possible to say which specific part of the project is causing this. However, if the issue is that moving the assets folder around does not break things until you move it into the source folder, this will most likely be due to whichever deployment system you use not making raw source files available as assets.
If the issue is just that moving or renaming the assets folder prevents you from being able to access it, then that will be down to the configuration of your deployment process.

Reading data organised in folders with Codename one

I've got data generated by a desktop application. These data are organized in a 2-levels folders system : each folder is a physical representation of one object, with an image file, a property file and different text files. There is no way I can change this structure.
I'm willing to show these data with a mobile application. I started something with Intel XDK, but I feel more comfortable with java. So I'm building a POC with Codename One. The final goal is to get these data on the mobile device with a DropBox integration. But for now (in dev phase), I'm going to manually download the data in a user folder on the device.
In netbeans, I put a sample of these data in the src/ folder, but when I try to read them, I've got an error telling me that nested directories are not allowed:
ERROR: resources cannont be nested in directories in Codename One! Invalid resource: /00002/page.properties
Any suggestion on how I can move on with the development, using with static folders ?
Resource files must be placed in the root of the src directory to be packaged and can't be deeper. The reasoning is that we don't generate a JAR but rather a native package where hierarchies are pretty different.
If you need this exact structure just extract them into the FileSystemStorage on the first activation then you can use the hierarchy that's available there.

Dart: Accessing a resource out side the project|web/ directory

I have a web-app(browser based) which needs to access a folder full of icons that resides outside the web folder.
This folder MUST be outside the web folder, and would ideally exist outside the project folder all together
however, when specifying the path to the folder neither "../" or making use of a symlink will work
when the page attempts to load the image I always get
"[web] GET /Project|web/icons/img.png => Could not find asset Project|web/icons/img.png."
however I set the image source to "../icons/img.png"
how can i get dart to access this file properly
PS: I attempted a symlink to another part of the filesystem (where the images would be kept ideally) however this did not work either.
The web server integrated into DartEditor or pub serve only serves directories that are added as folders to the files view. When you add the folder to DartEditor you should be able to access the files. This is just for development.
You have also to find a solution for when you deploy your server app. It would be a hazardous security issue when you could access files outside the project directory. Where should the server draw the line? If this would be possible your entire server would be accessible to the world.
Like #Robert asked, I also have a hard time imaging why the files must not be in the project folder.
If you want to reuse the icons/images between different projects you could create a resource package that contains only those images and add them as a dependency to your project.
If you want a better answer you need to provide more information about your requirements.
If you wrote your own server (by using the HttpServer class) it may be possible to use the VirtualDirectory to server your external files.
Looking at look the dartiverse_search example may give you some ideas.
You could put them in the lib directory and refer to them via /packages/Project/...
Or in another package, in which case they would be in a different place in the file system. But as other people have said, your requirement seems odd.

Stubborn Silverlight Caching Issue?

Bear with a bit me before jumping straight to the normal caching fix solutions. Here's what happening:
I have a project, a single project out of dozens in our solution that appears to be refusing to update its code when I build and run. It's not part of the xap, but a dll sitting along side the xap.
Things I've already determined not a solution:
I've checked the output of its dll and it has been built, and its contents updated to match my code, verified with dotPeek. But it refuses to display the updated code.
I clean, rebuild the solution, and restart the dev server but it refuses to display the updated code.
I switch to a different browser, no dice.
I clear browser cache's to no avail.
I completely delete my local code and do a fresh fetch from our repository, again, no love from silverlight.
I have not been without a little success though. The ONE bone I've been thrown was over the weekend. Not touching it for a couple days, I came back to work on Monday and, without having done anything to it, it just updated. Now, however, it's cached again, or something, because it's stuck in the last set of changes I made to it.
So my question is this: What am I missing?
Most likely your files may be read only and MS Build fails to display error message and it does not update files. In case if you have mistakenly checked in your .xap files, then this is possible, you will have to remove it from your source control and also make .xap file writable by removing readonly checkbox.
Visual Studio checks in your .xap files by mistake and silverlight build does not report any error.
Second, do you have any other file backup service installed like Shadow copy or Dropbox kind of online backup service, something is probably making xap files readonly and that is causing this problem.
Here there are couple answers: Prevent Silverlight 3 from caching while debugging
Code below helped me(add this to Page_Load of page that hosted the app ):
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-100));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
UPDATE:
Prevent Silverlight xap from being cached by proxy server
"So my question is this: What am I missing?"
An internal caching mechanism that our application uses. So, none of you could really have helped me as it was an architectural feature of our software.

cakephp disable routing for specific URLs

I have a CakePHP 1.3.10 app which I'm trying to make it do the following:
I want to embed a mp3 file in some views, using Google's reader flash audio player. If I put the mp3 file in the webroot directory of my app, there's no problem. However, I would like to have those files in a directory called AUDIO at the same level of my app directory. Like:
[public_html]
[app]
[cake]
[AUDIO]
...
The problem is that if I put my mp3 files there, when I link to them from my view, Cake looks for the controller audio, which doesn't exist, instead of just linking my file. I believe this has something to do with routing, so I was wondering if I can disable automatic routing for a specific folder (**audio in this case).
I want to do this in this way because in the future I might have to access those mp3 from other websites, so I don't want to put them deep into cake's directory system.
Thanks so much in advance for any tips!
Files that should be directly served by the web server without going through Cake should be put in the /app/webroot directory. You can create such a /webroot directory in plugins as well (see here), which technically will use routing, but behaves the same as the general webroot directory.
If you place them anywhere else you're going against Cake conventions, which I wouldn't recommend. Not because it's not possible, you're just making your life harder than it needs to be. You can edit the /app/webroot/.htaccess file to rewrite certain URLs to wherever you stored your files or use Media Views (as pointed out by #Ivo) if you really want to do this.
CakePHP won't be able to automatically find files in folders that it doesn't know about.
I'd suggest using Media Views to serve files from a custom directory.
If you want them to be freely downloadable, you can do this using MediaView also, or put them in a custom folder inside webroot. You'll need to include that folder in paths etc, though.

Resources