CreateObject() unable to resolve CFC path in CF2018 - coldfusion

Below is my project folder structure in CF.
root
|---myproject
|-folder1
|-file1.cfc
|-file2.cfc
|- folder2
|-file3.cfc
|-file4.cfc
I have a function in file2.cfc, in which I am using createObject() function to create an object for file3.cfc . Below is the example of code am using.
var fileObj = createObject("component", "folder2.file3").init(argument1, argument2);
I recently upgraded my CF server from CF2016 to CF2018. When my application was running on CF2016, object creation was happening, but on CF2018 no object creation is happening.
Can some one please explain what am I missing here?

Have you tried
var fileObj = new folder2.file3().init(argument1, argument2);
or if the root is / and "myproject" is a folder inside of root
var fileObj = new myproject.folder2.file3().init(argument1, argument2);

Related

how to copy a .db file from assets to FileSystem in expo

Expo SDK Version: 36.0.0
Platform: iOS Simulator
I need to copy a .db file from assets to the FileSystem.documentDirectory but I get an error. Here's the code I'm trying:
await FileSystem.downloadAsync(
Asset.fromModule(require('../assets/databases/data.db')).uri,
`${FileSystem.documentDirectory}SQLite/data.db`
);
Here's the error I get:
Unable to resolve module "../assets/databases/data.db"
None of these files exist:
* assets/databases/data.db(.native|.ios.expo.ts|.native.expo.tx|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
How do i copy a .db file from assets to the FileSystem.documentDirectory folder? I just need to copy a .db file from assets to the FileSystem.documentDirectory folder, but this error makes it look like Asset.fromModule only allows image files.
If I use the exact same code but replace the .db file with a .png file, it works.
Expo SDK Version: 36.0.0
Platform: android expo client sdk-qr code
i am also need this db file and i dont understand how to get it ..
my code here just give me the path ..but no have path like that , i just want to see my db file and i want to save this file in my desktop . how can i do that ?
const { uri } = await FileSystem.getInfoAsync(
`${FileSystem.documentDirectory}SQLite/${'places.db'}`
)
console.log("THIS IS PATH OF THE DB",uri)
I found the answer from a combination of expo forum posts, primarily this one: https://forums.expo.io/t/unable-to-load-obj-file-using-require/15794/3
The problem is that by default, the expo Assets api doesn't recognize .db files, so you have to create a file in the root of your project called metro.config.js and then add the following code to the file:
module.exports = {
resolver: {
assetExts: ["db", "ttf", "png"]
}
};
After that, you can then do this and it will work:
await FileSystem.downloadAsync(
Asset.fromModule(require('../assets/databases/data.db')).uri,
`${FileSystem.documentDirectory}SQLite/data.db`
);

Correct way to import all assets from external library with Ember CLI

I'm working on an Ember.js project and would like to leverage the Slick Carousel library. I've installed the library via Bower in my project folder, and am having difficulty with importing it into my project.
In my ember-cli-build.js, I've added import statements as follows:
app.import('bower_components/slick-carousel/slick/slick.css');
app.import('bower_components/slick-carousel/slick/slick-theme.css');
app.import('bower_components/slick-carousel/slick/slick.js');
The issue I am running into is that the rest of the required assets do not get built and included in the dist folder when I do a build (fonts, assets, etc.), leading to errors with missing fonts and assets that are present in the "bower_components/slick-carousel" folder, but not in the build of my actual Ember application.
Edit: It looks like Broccoli-Funnel was what I needed. The issue was resolved by specifying the source files from the 'bower_components' folder and pointing the relative path to the 'dist' folder in the ember-cli-build.js file.
As a note: The 'broccoli-static-compiler' plugin commonly referenced elsewhere as the solution is deprecated, with the use of 'broccoli-funnel' as the recommended plugin.
Broccoli-funnel ended up being what I was looking for. By placing the following inside of ember-cli-build.js, the needed files would be placed in the correct directory during build:
var Funnel = require('broccoli-funnel');
var requiredAssets = new Funnel('bower_components/slick-carousel/slick/fonts', {
srcDir: '/',
include: ['**/*.*'],
destDir: '/assets/fonts'
});
return app.toTree([requiredAssets]);

Embedded jetty not running outside eclipse ide also jar is not containing webapp or we root folder

I am having a issue when I run jetty in embedded mode after creating my jar file. It works from the same location where jar is created because it can locate src/main/webapp folder but when I copy my jar it's not running. And when I open my jar it doesn't have src/main/webapp everything is at root level.
First of all why is it creating everything at root level any specific reason?
Can I run my jar from Java command line if there is no src/main/webapp, if yes then in that case what shud be my webcontext resource look like in my main class
try this:
String webappDir = this.getClass().getClassLoader().getResource("applicationContext.xml").toExternalForm();
webappDir = webappDir.substring(0, webappDir.lastIndexOf('/') + 1);
String webXmlPath = webappDir + "WEB_INF/web.xml";
WebAppContext context = new WebAppContext(webappDir, contextPath);
context.setDescriptor(webXmlPath);
context.setResourceBase(webappDir);
context.setClassLoader(new WebAppClassLoader(this.getClass().getClassLoader(), context));
Run from IDE or Jar both works.

Deploying a WebJob with a static Content file

A WebJob running on Azure does not seem to drop the <Content> files (Copy if Newer) into the correct directory.
I get the following error:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\local\Temp\jobs\continuous\LongTasks\lprysn1r.tsv\Content\File.cshtml
And I try to access that file as such:
File.ReadAllText("Content/File.cshtml");
When running locally, it works just fine.
Is there a way to get this static file dropped appropriately?
After doing some tests, the convention is they do a shallow copy of the /bin/Release folder to App_Data/jobs/continuous/LongTasks/
Which means, if there are any folders, they are not being copied.
Moving the "File.cshtml" to the root directory fixes this problem.
I know this is not fully related to the Azure WebJobs SDK, but this is happening on 6/22/2015 with version 1.0.0.
You should use WEBJOBS_PATH environment variable for currently running webjob.
var webjobPath = Environment.GetEnvironmentVariable("WEBJOBS_PATH");
if (string.IsNullOrWhiteSpace(webjobPath))
{
// Handle dev environment
webjobPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
This will return some path like D:\local\Temp\jobs\triggered\\xxeeeexxx.qzx\, which contains your content files and folders.

How to copy a django project from one folder location to another?

Am using eclipse+pydev to build my django apps. I created a new workspace, built a new pydev project then created an empty folder in the new pydev project. In that empty folder i imported my old django application. Eclipse copied all the files & folders from my old django location to the new workspace.
I made the necessary changes in the settings.py on my new location, pointed the templates & data location to my new location workspace folder.
But when i run manage.py runserver from the new location workspace folder, django seems to point to my old folder location. All the html templates seems to point to the old location.
How can i make django execute stuff in my new location?
What am i missing?
Edit:
When i run the server inside eclipse, everything seems to be OK! funny.
Gath
There is no reason why you could not move your django folder, except for the presence of some absolute file path that you added. You should never have an absolute path in your project.
You should use the following trick in the settings.py file, as explained in the django wiki:
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# then for each subdirectory:
SOME_DIR = os.path.join(BASE_DIR, 'my_dir')
Then you can move your whole project without ever changing a single character inside.
I agree that something seems odd. Not hardcoding your paths is of course the first place to start. One other possible cause of the error could be that you have added your original project/app to the PYTHONPATH and that it gets imported from there instead of the new place.
If being on a *NIX-system you could symlink your old location to the Eclipse workspace.