Where do you store your misc project settings? - configuration

Some projects have properties have miscellaneous settings such as: "AllowPayments", "ShowSideBar", "SectionTitle". Really things that don't necessarily fit in to other objects.
How do you guys store these kinds of values? ApplicationSettings? Flat File? Database table?
How do you access them? Static object with properties? DB call?
Would either of these change if you were in a load balanced environment where you would have to synchronize the files across multiple servers?
Environment
ASP.NET 2.0

For me it depends on the context the setting is. If it relates to the data and the domain, i store in the database, if it relates the the application i store in the web.config.

App.Config, or a custom xml configuration file and config service. Key value pair mappings keeps things very simple.

Since you didn't tell which environment you use:
In .NET applications, I use the ApplicationSettings system from Visual Studio. This way you can configure the settings with default values in the designer, and a strongly-typed class to access the values is generated. I usually add a second ApplicationSettings element with the name Persistent in addition to the default Settings, with anything the user configures to go in the Settings object and anything I just save (i.e. window position) to the Persistent object.
This goes for desktop applications.

Related

Can I Create config files with namespaces in Yii2 or do I just create a model from my settings table?

This is a question about using config files for my configuration or rather saving the configurations on my settings table on the database. The configurations change as they include usernames and passwords for APIs I am using. I have thought of saving sensitive information to config file and other settings to database. Is it really possible for me to create a config file in #app\config folder and declare global variable $cfg[] which I can call from all controllers and views? Another question withing this same question is, is it a security risk to use the database for configuration settings like API username and password?
If you are using advanced templates you can use param.php or local-param.phpcper management of global parameters that can be used any place you want. If these parameters are common to both the frontend backend it is appropriate indicate in the \ common.
For storing passwords in the database, or for their conservation in the configuration file param is purely a personal choice. I'm running through the files param very comfortable. The fact of creating a database table its model, controller, and CRUD is very easy with Yii2 especially using the automatic generator gii. Over the years I found the tables of database configurations rather awkward unless you use as structures and key value persistent and also why I found the facilities configuration Yii2 very practical

SSIS - 2008 - Use a single config table for multiple copies of the same package

I am somewhat new to SSIS.
I have to deliver a 'generic' SSIS package, that the client will make multiple copies of, deploy and schedule each copy for different source databases. I have a single SSIS Configuration table in a separate common database. I would like to use this single configuration table for all connections. However the challenge is with the configuration filter. When client makes a copy of my package, it will have the same configuration filter just like others. I would like to give an option to the client to change the configuration filter before deploying, because for this new copy, the source database can be different. I do not find an option to control this.
Is there a way to change the configuration filter from outside the package (without editing the executable .dtsx file)? Or is there a better approach that I can follow? I do not prefer XML configuration files, the primary reason being my packages are deployed onto SQL server.
Any help would be greatly appreciated.
-Shahul
Your preferred solution does not align well with the way that SSIS package configurations are typically used. See Jamie Thomson's answer to a similar question on the MSDN forums.
I have created a package with the same requirements for my company. It loads data from different sources and loads them into different destinations based on individual configurations for the instances. It is used as an internal ETL.
We have adapters that connect to different sources and pass data to a common staging table in XML format and the IETL Package loads this data into different tables depending on a number of different settings etc.
i.e. Multiple SSIS package instances can be executed with different configurations. You are on the right track. It can be achieved using SQL Server to hold configurations and XML Config file to hold the database info that has this configurations. When an instance of the package executes it will load the default values configured with the package, but needs to update all variables to reflect the purpose of the new instance.
I have created a Windows app to configure these instances and they settings in the database to make it really easy for the client or consultant to configure them without actually opening the package.

C# Application Saving

I have created an application in C# using visual studio 2010. The application uses a database and a ton of data bound controls.
I need to save a copy of the running application with what changes the user has made to a file they can double click and get their saved state back in the application.
I know I need to use a SaveFileDialog but other than I have no idea.
If all the controls are bound to data through datasets you could perhaps serialize and deserialize the underlying datasets to/from XML files in order to create some kind of "offline data file storage" feature.
Before introducing such a feature into your application you should, however, consider all the potential database synchronization issues that are potentially created though preservation of such a saved state within your application clients.
If you really only want to preserve window layout properties (such as window size, grid column width, sorted column, splitter positions etc) you have to focus on those properties only.
Here is a thread with a similar discussion

Mysql adapter for Zend_Translate

I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, wont have FTP access to the site.
Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own translations of the interface. There is however still no mysql adapater for Zend_Translate.
So, does anybody now of an adapter script for Zend_Translate so it can work with a mysql table? Or any arguments against using mysql and possible other solutions for this problem?
You could solve this problem on different ways:
Extend Zend_Translate_Adapter to create your own. All new adapters are only responsible from getting the translations out from the source. That is, you would need only to fetch the translations from the database. Look at other adapters and see how they are implemented.
Fetch the data from the database and pass it to Zend_Translate_Adapter_Array
Use Zend_Translate_Adapter_Csv or Ini. As there would be more reading the writing on the translations, this solution would cut down the number of queries to the database. When the client adds a new language or changes an existing one, simply write it to a file, not the database.
If you decide to go with the database adapter, maybe you could "tag" somehow the translations, so that on the home page you fetch only the translations for the home page, on the contact page only the translations for the contact page...
HTH!
Default Zend adapters handle caching well, so I'd stick to them, unless you really need database.
Instead storing the translation data in the database, you may directly operate on the translation files (e.g. po templates). This would be the best choice if you just needed to add (append to file) new translation strings.
You may use Zend_Translate's option to log untranslated messages (to file or any log adapter, including database),
and then handle the logs, or even create listener translating the saved strings.
Here's how: http://cloetensbrecht.be/zend_translate_mysql.html

How to dynamically configure an application?

When I say "configure" I mean where to save those values that could change very often (constants values like taxes rates or something similar) and then when you need to change them you don't want to re-compile your application.
Where to save those values? Database? XML File? Flat File?
It depends on how often these change and who or what changes them. For some application specific settings, it's best to use an XML or config file, where the developers are the ones responsible for updating it. For other "businessy" values (like exchange rates, tax rates, etc), it's best to keep them in the database and provide a UI for users (not developers) to update.
It also depends on how many apps depend on this value, for example, if several applications depend on some setting (such as email server addres), it's best to put it in a database since it'll be easily accessible from any machine where the app is running.
I use INI files for potentially user-configurable files, and BIN files for data that save session state between runs.
But, it is very dependent upon what type of application you are developing.
it depends on how your app is architecture. you could design your app in such way that you could change the location of you configuration. by just injecting the provider.
Normally I use Ini files or XML if the data is structured.
For applications that already use a database and you don't want to have the user to change the data easily, you can use the database.
I almost never use binary data unless you want to obfuscate the data for the user.
Regardless of app, you're probably going to have at least 3 sources of configuration data:
Command line flags, usually for bootstrapping your run-time environment, e.g, finding config files, setting debug flags, include paths, class paths, etc
Config files, potentially more than one that may override each other. These usually boot strap your application: connection strings, cache settings, build-specific settings, etc
Control data in a database. Things like timezones, conversion rates, stable display values, etc. This data should also be versioned in the database (as in, a "Data Version" field, not living in a version control system). Versioning it will save a lot of headaches when you find you need to change a setting for a new release, but the old release will break if you change it.
Generally, anything that changes at run-time should go in the database. Anything that is sensitive and rarely changing should go into the config files, and any hacks should go on the command line (--[no]enable-bug-287438-hack can be very handy when you need it).
I prefer the simplicity of a flat ini file. Here's an example Setting class that you might find useful.