Cordova httpd local assets path - ios

I have an app that downloads html pages, css, js and images to its cordova.file.dataDirectory.
I have installed the httpd and the server is starting and running. But I do not seem to able to correctly target the files to display them.
How do I set the default directory to point to cordova.file.dataDirectory?
This does not work:
httpd.startServer({
'www_root' : cordova.file.dataDirectory,
'port' : 8080
}
Once I have started the server my goal is to display content like so:
<img src="http://path/named_folder/resource.jpg">
Or create a link like so:
Link to resource
But I cant seem to set the correct root path.
Currently the issue is in iOS but I will need to do the android path too

Related

Why isn't Drupal recognizing my new twig files?

I want Drupal to recognize my new twig files. Trying to clear the cache with the
drush cr
command gives me a success message. So does manually clicking on "Flush all caches" from the menu. But my new twig files are not being recognized. I was able to clear caches for weeks perfectly fine and it recognized twig files until now. I am using ddev to run my server. I have stopped and restarted the server. Restarted docker. I am using development.services.yml, not services.yml, which from my research I believe is correct. I am also exporting my settings.local.php from my settings.php.
I would like for Drupal to recognize my twig files. Neither clearing the cache by command line with
or manually works. No part of the configuration was changed it just stopped working suddenly.
Most probably, it’s related with permissions.
Resetting permissions, perhaps like described in
After drupal update site throws HTTP ERROR 500
might work,

Assets folder resolution: Running an application within a project not picking up assets

I created an application within an Angular workspace. When running
ng serve [application-name]
Picks up images and files in asset folder fine. Now I want to run the workspace with just
ng serve
I would expect through having the application lazy loaded the path would resolve but instead I get
zone.js:3243 GET http://localhost:4200/assets/terms.txt 404 (Not Found)
What is the proper setup to access assets of an application within a workspace?
EDIT After talking offline I think we've found a solution. I'll post it here and leave the below for reference even though the original answer I posted doesn't really apply to the problem.
You're trying to run multiple Angular apps and route between them via something like Firebase where you can direct different routes to different apps.
To get this to work locally for development you will need to run each Angular app separately on it's own port. I suggest you control the destination of the route in the environment files. This way when you are running locally you can point to the port the app is running on and then point to the endpoint Firebase uses in production.
Example environment.ts file in your root app
{
...,
OTHER_APP_URL: 'localhost:4201'
}
prod.environment.ts
{
...,
OTHER_APP_URL: '/otherApp'
}
Then in your component
....
import {environment} from '<path to environments file>';
#Component({
selector: 'my-component',
template: '<a [href]="otherAppUrl"></a>'
})
export class MyComponent implements OnInit {
otherAppUrl: string;
ngOnInit() {
this.otherAppUrl = environment.OTHER_APP_URL;
}
}
You will probably need to do something similar in the other apps so you can route from them to the root app or other child apps. You will probably also need to build the other apps with the --baseHref flag when you build for production so their assets are available. See here for more info from the docs: https://angular.io/cli/build
Old answer - doesn't really apply to the question
Looking at your repo I don't see the terms.txt in your root project's assets folder. I checked to see if it was in one of the other libraries in the repo but wasn't able to find it there either.
If this is an asset that is included or referenced by a component or service in one of your libraries you will need to copy that over to the library's output folder as part of your build process since that functionality isn't currently supported by the Angular CLI.
An example of a build script that might do this for you is:
ng build my-lib-with-assets --prod && cp -r projects/my-lib-with-assets/src/assets dist/my-lib-with-assets && ng build --prod
Don't forget that you need to build your libraries before you build your main project.

How to reference embedded Docker resource files using file path URL

I have created a Docker image and embedded some static resource files within it, using the following command in the Dockerfile:
COPY resources /resources
I have a java web application running within the Docker container which requires access to these static files. File paths must be provided using a URL, E.g.:
file://c:/resources/myresourcefile.css
I am able to construct the URL programmatically but am unsure if embedded files can be referenced this way. Any guidance would be appreciated!
Note: I am specifically using the pdfreactor web service, and my Dockerfile is thus:
FROM realobjects/pdfreactor:9.1
EXPOSE 9423
COPY resources /resources
I am trying to set the "BaseURL" of the PDFreactor wrapper client to the root resource folder.
If it’s a Linux container, and the requestor is specifically your Java process running inside the container, then file:///resources will point at the directory you added (a subdirectory of the image root directory). If the URL is being served to something outside the container (like an HTML link or image reference) then a file: URL won’t be able to access files inside the container; you’d have to come up with something else to serve up the files and provide an HTTP URL to them.
As per the official doc on https://www.pdfreactor.com/product/doc_html/index.html#resourceLoading
It is also possible to specify file URLs:
Java: config.setBaseURL("file:///directory/")
PHP: $config["baseURL"] = "file:///directory/";
.NET: config.BaseURL = "file:///directory/";
CLI: --baseURL "file:///directory/"

Change /home/opencart/public_html/opencart to localhost URL (Change Server URL to Localhost URL)

I am trying to move Hosted Opencart to XAMPP.
I have changed domain name to localhost/opencart but don't know how to change these URLs to localhost URL
/home/opencart/public_html/opencart
I tried searching in google but didn't found any solution.
It depends on which folder you want to install OpenCart.
You need to find absolute path to your directory. For example if you want to install OpenCart in a directory called opencart, create a find_path.php file in that folder with this content:
<?php
echo __DIR__;
Then run it in your browser:
http://localhost/opencart/find_path.php
You should see something like this on the screen:
C:\xampp\htdocs\opencart
Another way is to install a fresh OpenCart in your localhost, and then look at the config.php file that is filled in by OpenCart.

How can I execute cocos2d-js html file?

I made a cocos2d-js project on OSX.
And I debuged it on WebStorm.
It worked well.
So I just clicked index.html file. but it didn't work. just black screen.
I put all files on the web server and tried again.
Web brower console said http://localhost:8080/html5/project.json 404 not found.
but the file was in same folder.
I want to execute it on local server and just click.
What should I do?
Go to the project directory, start new terminal.
Then: cocos run -p web
This will run your game for Web, as -p stands for platform
Also note, that sometimes you will need to clear the browser's cached images and files after changes that affect files or images.

Resources