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

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.

Related

Meteor unwatch folder

I am trying to make a folder to be not watched. Is there a way to make one of the folders not watched in Meteor? I don't want my project to reload if I change a content in that folder.
Not exactly. Meteor assumes that if the folder content changes, it also needs to reload/restart the server, because the business logic of the application might have changed. Therefore it reloads these files and restarts the server
However, you might be able to "abuse" the tests/ directory or any of the directories/files mentioned below for that purpose. As explained in the Meteor guide on Application Structure, paragraph "Special directories":
Any directory named tests/ is not loaded anywhere. Use this for any test code you want to run using a test runner outside of Meteor’s built-in test tools.
The following directories are also not loaded as part of your app code:
Files/directories whose names start with a dot, like .meteor and .git
packages/: Used for local packages
cordova-build-override/: Used for advanced mobile build customizations
programs: For legacy reasons
So the reasonable choice would be to create a dot directory, e.g. .myStuff, and place anything that you might need to update but do not want to trigger a server restart there.
Just build your app in a package so you can decide which files you want to make available or not :)

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.

How to populate Isolated Storage for Windows Phone application

Is there a recommended way to initialize the data in Isolated Storage for Windows Phone 7 application before it is run for the first time? Right now the best solution I can think of is putting a flag in IsolatedStorageSettings and checking for its presence on in the application Launching event. If the flag is not present I initialize several objects in code and save them to Isolated Storage and set the flag so they are not set the next time the application is run. Is there a better way to do this? Should I add the objects in serialized state as some kind of resource or it is acceptable to initialize them in code? I expect that they would require like a thousand lines of code.
Well if you can create your files and add them to the project. And if you are sure that you will not be editing your files than just keep them like that. The files will go into your installation folder.
Or if you think that you are going to edit them and want to keep the changes saved, than copy them from the installation folder to the application storage folder.
Here is a link in which a database which was added as a reference to the project is copied from installation folder to storage folder of the app.
http://msdn.microsoft.com/en-us/library/hh286411(v=vs.92).aspx
Do the same for your files and everything will be fine.
The second part of your question. Well after this just check for one file/folder in the app storage folder and if it says yes it is there than do not copy your files from installation folder to application storage folder.
And if you are trying to make the files when the application launches than just add a check before the creation code is run. Where you will search for a file/folder existence. And if it exists do not run the file creation code.

Add deep zoom folder to VS2010 silverlight applciation

I have copied the deepzoom data created folder "Generated Images" into
a folder named "temp" in my VS2010 web project, but I am unable to see
the "Build" property of this ("temp") folder.
While compilation, VS2010 shows an error "'Build Action' not set to 'Resource'"
The build actions are only applied to files, not folders. You need to set the files to "Content", but why are they not under ClientBin where they would normally reside (and no such settings are required)?
You are basically adding a large number of data files to a website, for the DeepZoom component to download as required. This needs to be relative to the location of the XAP Silverlight application.
As you need to point your MultiScale image control at something it can reference, either put GeneratedImages (back) under ClientBin or change it to a full URL pointing at the location of the dcz_output.xml file (the controlling DeepZoom file).
I just put a deepZoom on my blog here to confirm the parameters needed. In that instance I dropped the whole generated image folder into DeepZoom/GeneratedImages on the site and reference it with path=DeepZoom/GeneratedImages/dzc_output.xml and it worked a treat. So you can put the deep zoom anywhere on a site, but make sure the URL reference matches.
I strongly recommend you never call a folder "temp" unless you are deleting it 5 minutes later :)

Resources