How To Change The Default Circuit - coldfusion

I am new to a company that is using fusebox. We need to run two versions of the application on the same box, so we duplicated all of the ColdFusion mappings from, say, "mapping" to "mappingD" in order to indicate these are the ones on the D drive.
All well and good.
In the D drive version of the app, though, while most of the settings have been changed to point to "mappedD", Fusebox keeps rewriting the parsed files to use "mapped" and I cannot for the life of me figure out where the heck to change the setting in Fusebox so it uses "mappedD" from now on!
We are using Fusebox with ColdSpring (which also has a new mapping of coldspringD) if that helps.

Related

Is there an update/change flag in the current version (v4) of gspread?

Is there an indicator or flag in gspread that indicates whether or not a change has been made to a sheet or worksheet? This appears to have been present as an attribute called updated before version 2.0, or maybe that served a different purpose?
You're looking for Detect Changes guide in Drive API.
For Google Drive apps that need to keep track of changes to files, the
Changes collection provides an efficient way to detect changes to all
files, including those that have been shared with a user. The
collection works by providing the current state of each file, if and
only if the file has changed since a given point in time.
There's a github code demo for testing purposes.

Conflicting mapping for two ColdFusion Applications

I've spent over a day now trying to resolve an issue where two applications use the same relative paths but are under a different "root", and this causes the wrong code base to be accessed for one of the applications.
These are my roots to the two Applications:
\www\Clients\
\www\Other\Clients\
Structure
..www
....Clients
......Application.cfc
....Other
......Clients
........Application.cfc
In both Applications there is code that references the relative path (e.g., /clients/content/login.cfm)
I noticed that the ColdFusion Administrator has a Mappings section where the first mapping has a logical path / mapped to the directory path D:/www/.
This works well for the first application since the clients folder is found directly under the www folder, however the second application doesn't work correctly as it too adheres to the same mapping. Therefore instead of searching for /clients/content/login.cfm under the Others folder, it searches yet again under the www folder.
Note: Both applications have a different Application.Name so they are indeed segregated.
The biggest red flag is that we don't experience this issue on our older ColdFusion 9 server, however we are experiencing this on the newer ColdFusion 2016 server.
Sifting through ColdFusion Administrator, I can't seem to find any other settings which could affect the underlying root per Application which could take precedence over the Mappings.
Is there a setting I missed? Was there a drastic change regarding relative paths or mappings between ColdFusion 9 and ColdFusion 2016?
Sifting through ColdFusion Administrator, I can't seem to find any
other settings which could affect the underlying root per Application
which could take precedence over the Mappings.
Solution: Use application specific mappings.
<cfset this.mappings["/Clients"] = GetDirectoryFromPath(GetCurrentTemplatePath())>
Source

Design approaches to read/write different version of same config file

In our project we got an application that uses an external configuration file (say server.xml). Now we need to design a setup tool GUI in C++/QT to read/edit such configuration file and it should be able to handle all the different versions of such file. The user will choose the file version and then proceed with the editing. From one version to another doesn't change too much, maybe there is a new xml tag, a tag with a different name or in a different position.
What's the best design approach to do so? We are planning to go for a standard MVC design pattern but how to deal with all the different configuration versions without rewriting the same GUI code again n again?
Here the sample config file:
<?xml version="1.0" encoding="utf-8"?>
<Server_configuration ver="11">
<core>
<enable-tms>true</enable-tms>
<enable-gui-messages>true</enable-gui-messages>
<waiting-for-config-timeout>10000</waiting-for-config-timeout>
<remoting>
<port>50000</port>
<join-timeout>5000</join-timeout>
<ismultithread>true</ismultithread>
<maxconcurrentrequests>20</maxconcurrentrequests>
</remoting>
</core>
<content>
<ftp>
<ip>192.168.0.227</ip>
<port>21</port>
<userid>******</userid>
<passwd>******</passwd>
</ftp>
<library>
<ip>192.168.0.227</ip>
<port>50023</port>
</library>
<local>
<asset-root>/assetroot</asset-root>
<kdm-expiration-warning>172800000</kdm-expiration-warning>
</local>
<hula-store-daemon>
<ip>127.0.0.1</ip>
<port>5567</port>
</hula-store-daemon>
</content>
</Server_configuration>
This is no means a drop in solution but I here are some things to do/consider. Every situation will differ.
Have an explicit version identifier in your config files. Fingerprinting them is a real (error prone) pain.
Consider having a tool that will update from version to version. It will be easier than reading old versions and trying to apply them.
I may be easier to do every version step individually but this can make the conversions less "lossless". A happy hybrid is to do minor updates from version to version but have "checkpoint" major upgrades that will jump right to the latest (or the latest "checkpoint"). This is kinda like incremental backups with full backup snapshots every once and a while.
Keep the user informed. A sysadmin won't be happy if you are changing his settings. You might want to make the process interactive or put comments into the file of every added/moved/removed setting. I would also recommend keeping removed settings in some section of the file for user reference. (Put a note why they are there as well).
Backup the old file. Your script will crash and it will eat data. Do something like naming the current file ${oldname}.old-${ver}~. Saving the settings in a different section of the file won't always be enough and this will save your users a lot of heartache.
Versioning should always be designed as robust and as simple as possible. It is crucial for you to determine whether each version of your application must be compatible with each version of the setup tool (which is rare), or whether you can, for example, meet your needs if any newer setup tool works with any same or older application, but not vice versa.
One way compatibility
One possibility to design for the latter is to add a version attribute to the XML file but try to keep it at the same fixed value forever by always only changing the structure and semantics of the XML file in backward compatible ways. For example, adding an element is backward compatible as long as the setup tool can interpret its absence the same way both the old setup tool and the application would behave. It does not hurt that the new setup tool always writes an (equivalent) value to the new element, because two-way compatibility with the old application is not required.
Once the day comes when you cannot maintain backward compatibility on input, you just change the value of the version attribute and start special casing it in the setup tool.
If you validate the XML against an XSD, notice that XSD can actually do one frequently useful thing for you: assign default attribute values. This way, your setup tool's source code may not even actually notice that the underlying document was missing a recently added attribute!
Two way compatibility
Strict versioning is needed. A schema definition (XSD, RelayNG,...) should be defined for each version of the XML file and the file should be validated against it both when it is read by the setup tool, written by the setup tool, or read by the application. The schema definition may be identical for several consecutive versions, if the interpretation of the same XML has changed, so when in doubt, always increase the version number.
Do what you can educating everyone that they cannot just edit the latest schema and do away with that. Unreliable versioning is worse than no versioning.

Best practices for storing settings

I have a fairly large C++ application (on Windows, no other platforms planned), which currently stores all settings (even some kind of addresses) in the Windows registry.
Sometimes this is inconvenient, because the users have difficulties changing entries in the registry. I would like to have settings versioned, so settings always match the current code. At the moment we version reg-files, but you are never sure, if all reg-files have been added on the target machines. With C# you can define default values in app.config, but don't overwrite existing settings. I don't know, if such a mechanism or library exists for C++.
I would like to have the following "features":
Settings can be versioned
Simple update on target machines (can be done by user)
Ensure that on update only new settings are added and no existing settings are overwritten with default values
Simple change of settings for user
Same workflow under Win XP and Win 7
As far as I see it, there are 3 possibilities to store settings on Windows:
Registry
Ini file
XML file
Only one application of our suite uses Qt at the moment, but Boost would be available.
For addresses, we will put them in some kind of XML address book, but for the other settings we are not sure, what's the best practise.
As comments mention, tree-based key/value structures are a common solution and libraries are easy to find.
Boost's property_tree is an excellent choice, as it is well-tested and can easily be exported as XML or JSON
Regarding your requirements:
Settings can be versioned
Yes! Make "version" a top-level key. Make it easily comparable with other versions.
You can also categorize your settings into various tree nodes and give each node a version.
Simple update on target machines (can be done by user)
Have your application do that when it runs. See below.
Ensure that on update only new settings are added and no existing settings are overwritten with default values
Simple change of settings for user
Same workflow under Win XP and Win 7
As settings change from one version to another, usually these changes fall into three categories. New properties are needed, old settings are abandoned, and some settings change their expected format. E.g. "32 Fahrenheit" becomes "0 Celsius"
When your application initializes:
Load the existing configuration file, regardless of its version.
If the version does not match what's current for the application:
Create a new blank property tree for the new configuration
For each node in the tree, have a set of expected property names, and a function pointer or similar to get this setting if it's absent in the old file's tree. If a setting changes its format, give it a new name.
Search for each setting in the old tree, copying it if it's found, and using the result of the supplied function if it's not.
Save your new settings file.
Your "missing setting" functions can:
Return a constant default value.
Query the tree for a different setting and convert it (with a default value if the old setting isn't found either)
Ask the user

Fusebox 5 issues when replacing files

Today, no matter what I did, my application just would not recognise a change I did to a file I uploaded. I even put a cfabort at the top of the page and it just ignored it.
Now, this is a production server, so there were some things I normally have to do for the fusebox framework to load the new pages. However, all the usual processes failed and I even tried numerous others. Let me list them:
Normal Process:
&fusebox.parseAll=1&fusebox.password=whatever <- Did not work
&fusebox.load=1&fusebox.password=whatever <- Did not work
Other things I tried:
* changed mode from production to development-full-load <- Did not work
* called onApplicationStart to reset app <- Did not work
* changed the application name to reset app <- Did not work
* deleted parsed folder and regenerated <- Did not work
No matter what I did (they may have been more that I just don't recall at present) nothing would refresh the page. The only thing that worked after I was at my wits end, was to stop the Railo server, restart it and then run the thing I tried first again, being:
&fusebox.parseAll=1&fusebox.password=whatever
That worked. So my only assumption can be that somehow, somewhere in the one of the applications, the cached code was being used to regenerate the parsed files instead of the actual updated file.
Has anyone experienced this before and do you have any solutions to avoid this. I can not keep restarting my production application just to update a changed file.
Thanks
From what you've said it sounds like Trusted Caching may be turned on, which is an odd name but basically means "I trust that these files will not change, so don't bother checking" or something like that. The main thing is it doesn't look at your cfm/cfc files for changes, which is faster, but of course very annoying when you make changes.
On Railo, that can happen at the per-mapping level, so first thing is to check all your mappings to see if the "Trusted" option is enabled - unless your site is high enough traffic that it's beneficial, for a Fusebox app it's probably more hassle than it's worth - so for any relevant mappings, unless you specifically need it, go ahead and disable it.
There is also a similar global caching option - in Railo Web Admin, go to Settings>Performance/Caching and most likely you want to have "Inspect Templates" set to "Once". If it is set to "Never", this is same as Trusted cache, which again is faster but not best for a changing site.
However, you may have noticed there is a "Clear template cache" button below - if you prefer to keep it on "Never" you can press this button each time the code changes, and it will rebuild the cache with the latest files.