Azure Web Job writes files in a website's directory - azure-webjobs

I attached a Web Job to my Azure website. The webjob prepares a file and I want to save it on a proper folder in the website.
Environment.CurrentDirectory run on the script returns a path under a Temp directory: Temp\jobs\triggered\WEBJOBNAME\q0uwrohv.x5e
I tried to go down on the directory tree:
string path = Path.Combine(Environment.CurrentDirectory, #"..\..\..\..\..\Data")
But it doesn't work:
C:\DWASFiles\Sites\WEBSITENAME\Temp\jobs\triggered\WEBJOBNAME\q0uwrohv.x5e\..\..\..\..\..\Data
How to make and save files from WebJob to a particular path?
I don't want to use blob store.

The path for the root of your Azure Web Site is (usually) d:\home\site\wwwroot.
d:\home is also stored in an environment setting called %HOME%.
To get more insight on the different paths you can use on your site go to:
https://{sitename}.scm.azurewebsites.net, there' you'll have the Debug Console where you can browse through your site and Environment to see all the environment variables you can use.
Your WebJob will have access to the same paths/environment as your Web Site.
For more information on this administration site go to:
http://azure.microsoft.com/blog/2014/03/28/windows-azure-websites-online-tools-you-should-know-about-2/

try the following instead of putting a file location in the value parameter just put this as I show you here
you can do it in the app.config file
add key="app:TempFolderPath" value="~/temp/"/
add key="app:TempReportDirectory" value="~/temp/"/
the web job will automatically put in this location of
D:\local\Temp\jobs\continuous\ImporterWebJob\yex3ad1c.3wo\~\temp\...your file...
I hope this will not give you any errors.

Related

VuePress build deletes CNAME file in ./docs needed for Github Pages custom domain

I'm trying to get VuePress to work well with GitHub Pages and a custom domain. I have the site working -- https://www.southertonrr.com (repo) -- as long as I manually add a CNAME file to my output folder ('./dest', or in my case, './docs', because that's where GitHub Pages looks for the site) every time after I issue a build command. Otherwise, I assume the build command deletes everything in my output folder and rebuilds the entire site.
Is there a way to get vuepress build to either leave that file alone, or copy a CNAME file from my ./src to my ./docs? Should I be looking at the configureWebpack config to use webpack to do it? (I'm new to webpack.)
Different product completely, but I noticed that Docusaurus for React has a CNAME config setting that does this for you, so I thought I'd check to see if the VuePress community had something similar.
See relative document
Sometimes you may need to provide static assets that are not directly referenced in any of your Markdown or theme components - for example, favicons and PWA icons. In such cases, you can put them inside .vuepress/public and they will be copied to the root of the generated directory.

Why is CreateObject with a dot-notation path to the component not working using CF Administrator Mappings that define the path to the CFC directory?

I am working on a web app already on the production server based on CF code that uses and depends on the CF Administrator Mappings to locate CFCs. I have a directory structure like this:
Webroot/
_TaskDir/
Application.cfm
myFile.cfm
CFC/
component1.cfc
...
app/
Application.cfm
index.cfm
...
My Mappings in CF Administrator has something like:
Logical Path: /myComponents
Directory Path: C:/Projects/Code/.../CFC/
Most of the app is under the app directory and uses calls to create objects all over the place like:
<cfset myCFCojb = CreateObject("component", "myComponents.component1").init()>
There are some scheduled task type scripts in another folder at the webroot (_TaskDir) that calls the CreateObject method in the same way as everywhere else, using the dot notation to specify the path to the components mapped directory. It supposedly has been working fine on production but for some unknown reason I am finding it doesn't work in this directory in my dev environment. The CreateObject works fine in the rest of my app, but when put into scripts in this folder it fails.
By fails, I mean i get a NullPointerException error. If I change the dot-notation path to a physical path (since both paths are within the webroot) such as CreateObject("component", "/CFC/component1").init() then it's fine. It's just the dot notation and mappings that seem to be ignored in just this directory.
Is this because this folder is outside the app directory which has the main Application.cfm and that _TaskDir has it's own Application.cfm? I would think the Mappings would work for either.
The first part of the stackTrace is:
java.lang.NullPointerException at
coldfusion.util.Utils.getDirectoryFromPath(Utils.java:350) at
coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1638)
at
coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:51)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:6354) at
coldfusion.runtime.CFPage.CreateObject(CFPage.java:6373)...
I am using CF2016 in a Tomcat container.
I found the problem. Found out that the version of Tomcat (8.5.20) I am using as the container for my Apache server is now case sensitive. I ran 3 scripts from my _TaskDir directory specifying the URL with the wrong case (_Taskdir), first 2 ran fine. The 3rd was the one that was trying to run CreateObject using Administrator Mappings to find the CFC directory. The URL is apparently being used to comparie with the Mappings paths. With the wrong case being used in the URL is impacting the dot-notation path to the CFC directory. At least I know how to resolve this now.
If you can shed more light on how this case sensitive paths is impacting CF, I'd like to know more. If there is an article on this, please share.

Use of window.location.href in crosswalk

I use crosswalk 5.34.104.5 to build Android app.
After executing
location.href = '/another_page.html'
in index.html, which is a entry point defined by manifest.json,
empty alert pops up and blank page appears.
another_page.html is located in the same directory as index.html
(i.e. it is in apk file whose path is assets/www/another_page.html relative to apk's root)
and is not served over network.
How can I achieve intended location transition?
It is a typo in "asserts/www/another_page.html", it should be assets, right? I can do the same thing with changing location.href to load another page.
EDIT: If you are using make_apk.py to package your app, you can pass "--enable-remote-debugging" to turn on remote debugging for your app. Once the app is launched on your device, open 'chrome://inspect' in Chrome browser running on the host machine, and inspect the page to directly execute "window.location.href=xxx" in console, and try to fix your problem. See https://crosswalk-project.org/#wiki/Remote-Debugging-on-Android for details.

Set default location after cflogin

I have a couple web applications written in ColdFusion. The applications have their own folder inside the CF root folder. When I do a successful <cflogin> I am returned to the index page of the root folder. I want the user to stay within that apps folder I know it can be done, I just can't remember how to start. Something where you set the root page for the application withing that App's Application.cfc page. Any insight?
If you delete an Application.cfc from your local drive, that doesn't mean it was deleted from the server. So you might have some hidden Application.cfc's thoughout the App.

Django: how to open local html files directly in the browser with links like href="file:///C:/path/file.html"

I'm making a django app to index my collection of local files (html, text, pdf, ... ) that I keep in diferent partitions and directories so I can search easily based on the name, date, title, etc of the files. It's like a advance locate, the unix utility. It generates a dynamic page with links for the files and in the case of the html files I should click and load the local file in the brower. The generated page contains links like:
Title of local file</li>
The problem is that when I click it does nothing, not even error messages. If I save this generated html page and open it in the brower directly it works fine. I think it doesn't work for security issues but I do not pretend to use it as a web app over the internet but as a local app. I am using the django development server. I know that django can serve static files putting them in a specific directory but this isn't what I need (the files are in multiple locations); I want to load the files in the browser as local files, not through the server. Can this be done?
Is there a way in django to make the "file:///C:/path/file.html" scheme work in the generated dynamic pages?
The problem had nothing to do with django but the browser (in my case firefox 4). Firefox doesn't allow to link to local files from remote sites for security reasons. I have to disable this security check for http://localhost:8000 and it worked. As the change only affects localhost it shouldn't be a security issue.This link explain how to do it:
http://kb.mozillazine.org/Links_to_local_pages_don%27t_work
Basically all you need to do is create a user.js file in your firefox profile folder with this:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://localhost:8000");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
If you use noscript you also have to change some configuration: NoScript Options ("Advanced -> Trusted -> "Allow local links").
Other browsers may have this security checks so you will have to do diferent changes accoding to the operating system and browser you use.
: is wrong. Use | instead.
Title of local file