Regarding ColdFusion Mapping - coldfusion

I am rebuilding my directory structure. The old way had CFC folders in each sub-directory that was a nightmare. I went into ColdFusion administrator and set a mapping (which is actually outside my root). Now here is the confusing part.
My original structure looks similar to this.
\appRoot
\appRoot\cfc
\appRoot\modules
\appRoot\modules\cfc
I moved the files from the CFC directory inside of modules to the mapped location and all works great. Next I went to move the files from appRoot directory (which is one up from modules) and no matter what I do it will not find those in the mapped directory. It keeps insisting I put the files back in the CFC directory under appRoot.
So why would pages further down the directory structure see the new CFC mappings and not the pages above them?

Related

How can I point a folder in Documents folder?

How can I point a folder or file which stored in Documents folder?
So in my case that would be C:/Users/Vanya/Documents/ATFolder (AT Folder is folder I need)
What should I put instead "Vanya" to get into Documents folder, on any PC not just mine
In case it matters I'm trying to do this:
QDir().mkdir("C:/Users/%USERPROFILE%/Documents/ATFolder");
It responds as false and doesn't create folder.
Qt solution - QStandardPaths
Use QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); to get Documents directory.
Try to use std::getenv to get the value of the environment variable "USERPROFILE".
It worked for me.

How to NOT delete a war directory on Jetty server stop()

I am trying to create a "warless" (exploded war, war directory only) deployment of embedded Jetty. I have been able to make it run by passing the path to the war folder to the WebAppContext(...) constructor and making sure that extractWAR, copyWebDir and CopyWebInf are set to false. I do not set a temp directory.
This runs fine. However, after stopping this, the content of the war folder is deleted and replaced with just one empty subfolder - jsp. So, next time this runs there is nothing there to run... and that is the problem.
I would ideally also like to keep any JSP compilation artifacts in place (for various reasons I am not doing build-time precompiled JSPs .... yet).
Does anyone know what causes this? I am assuming Jetty believes that this is a temp folder and that it should be removed... but it isn't.
Found the cause. Something else was setting the temp folder to the same path as the exploded war. Once I changed that to a different folder the deletion no longer happened.
That still leaves my other question though... but I'll live with it.

Where to put Java library in ColdFusion?

I have to put my Java Library in Coldfusion and my Coldfusion's Java Virtual Machine Path is C:/ColdFusion9/runtime/jre
In which location I should consider placing my Java Library ?
Coldfusion9/wwwroot/WEB-INF/lib
Coldfusion9/runtime/jre/lib
I can see .jar files at both of the above locations. Hence I'm wondering where should I put my downloaded .jar? I will be restarting CF9 after doing this.
More Info: The documentation here says that it should always be in the JVM's classpath as a rule. Could anyone tell me where, or what, is the rule ?
(This does sound like a duplicate, but my remarks are too long for comments)
Short answer:
The simple option is to place the .jar file in {web_root}/WEB-INF/lib and restart.
Longer answer:
The thread you referenced says that .jar files must be placed somewhere within the CF class path. In loose terms, "class path" just means a collection of paths that CF is going to search for jars/classes when the server starts.
Technically - you are free to place a jar file just about anywhere you want. As long as it is accessible to the CF Server and that path is included in the jvm.config file. However, there are certain locations which CF checks automatically. So you can just place a jar file in one of those directories and restart. No other changes are needed.
Two of the locations CF checks automatically are:
{web_root}/WEB-INF/lib/
{web_root}/WEB-INF/classes/
The comment about the "rule" refers to a convention for the /WEB-INF/ folder that specifies .jar files should be placed in WEB-INF/lib/ while individual *.class files (less common) should be placed in WEB-INF/classes/. Since you are using a jar, it would go in WEB-INF/lib/.
For more details about how and where CF searches for jars, see also
About ColdFusion and Java objects
The Definitive Guide to the ColdFusion Classpath (A bit dated, but most of it is still relevant).

Installing OpenCart extensions locally

When installing OpenCart extensions, you´re generally given a bunch of folders that should be copied to the root directory and the extension files will find their way to the right subfolders. This works great in FTP software, but on a local installation (Mac OSX) using Finder, this operation makes Finder want to overwrite the folders completely, deleting the actual site and just keep the extension.
I can hold Alt when dragging the folders and it will give me the option to not overwrite, the problem is I have hidden files visible, which means there's now a .DS_STORE file in each folder and the ”Hold ALT”-approach doesn’t work in case there are ANY duplicate files in any of the folders.
I’m sure someone out there has stumbled upon the same problem, any ideas for how to solve such a simple but annoying problem? I do not wish to use FTP software for local file management.
I have the same problem, and i found 3 different ways to solve this:
a - use another file manager, i personally use "Transmit" to do this sort of things;
b - use terminal, like: ditto <source> <destination>. Or easier way just type ditto, and drag the source folder, then drag the destination folder, all inside source will merge inside destination;
c - unzip the plugin, inside the OC folder using the terminal, like: tar -zxvf plugin.zip;

SetCurrentDirectory in multi-threaded application

I understand SetCurrentDirectory shouldn't be used in a multithreaded application since the current directory is shared between all threads in the process.
What is the best approach to setting the directory with this in mind.
It can mostly be avoided setting the directory by including the full pathname when opening files instead of first navigating to them with SetCurrentDirectory, but is this the only solution?
I've encountered this problem before.
Any object that needs the concept of a current directory to support relative paths or searching (e.g. a build tool) has a member property that it maintains with its "current" path, then build the full path to open/create/search.
The initial value for CurrentPath can be retrieved once during the application's load phase, e.g. main(), WinMain(), DllInit(), etc. via GetCurrentDirectory and stored in a global. After that the Win32 version is ignored.
The OPENFILENAME structure has an initial directory member, so file open/save dialogs don't have to use the Win32 current directory.
Each process has a single current directory, so if you want each thread in your process use different current directory I think you should specify the full path in each.
A advice to use full paths in general and local paths only as a exception (and very carefully), when needed. I.e. the OpenFile Dialog may or may not change the current directory (depending on attributes) etc. Using filenames or local paths is a potential cause of trouble.
By my experience full paths do not slow down file access significantly. I wrote a app that opens thousands of files every minute and writes sorted data to other thousands of files - all using full paths and all on a windows mounted network drive. The bottleneck there was closing the files. Not opening them.