Credentials in pip.conf for private PyPI

You could store credentials for Pip to use in ~/.netrc like this: machine pypi.example.com login johndoe password changeme Pip will use these credentials when accessing https://pypi.example.com but won’t log them. You must specify the index server separately (such as in pip.conf as in the question). Note that ~/.netrc must be owned by the user pip … Read more

How to write to the main exe’s .config userSettings section?

After some research I came up with this solution. It is a bit low level, but still goes through the .NET configuration API without having to manually parse the .config file. static void SaveUserSettingDefault(string clientSectionName, string settingName, object settingValue) { System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); // find section group ConfigurationSectionGroup group = config.SectionGroups[@”userSettings”]; if (group == … Read more

Spring boot: configure it to find the webapp folder

See the docs: http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-web-applications.html#boot-features-spring-mvc-static-content The static resources are loaded from /static, /public, /resources, /META-INF/resources If you are packaging your application as a JAR (deploying a .jar), using src/main/webapp is not recommended. You can customize that by overriding the addResourceHandlers method in WebMvcConfigurerAdapter @Configuration public class MvcConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry){ registry.addResourceHandler(“/**”) … Read more

How to change memory per node for apache spark worker

When using 1.0.0+ and using spark-shell or spark-submit, use the –executor-memory option. E.g. spark-shell –executor-memory 8G … 0.9.0 and under: When you start a job or start the shell change the memory. We had to modify the spark-shell script so that it would carry command line arguments through as arguments for the underlying java application. … Read more

Most Pythonic way to provide global configuration variables in config.py? [closed]

How about just using the built-in types like this: config = { “mysql”: { “user”: “root”, “pass”: “secret”, “tables”: { “users”: “tb_users” } # etc } } You’d access the values as follows: config[“mysql”][“tables”][“users”] If you are willing to sacrifice the potential to compute expressions inside your config tree, you could use YAML and end … Read more

global results across different packages defined in struts configuration file

Define global result in the package that other packages extend. For example <package name=”default” extends=”struts-default”> … <global-results> <result name=”error”>/pages/error_page.jsp</result> </global-results> … </package> This result could be used across actions that forward to error page and as exception handling result. If you are using conventions plugin with annotations you could define @Results annotation on the class … Read more

Edit installed XML file according to user preferences in Inno Setup

You probably just need to edit the file after the installation completes. procedure CurStepChanged(CurStep: TSetupStep); begin if CurStep = ssPostInstall then begin SaveValueToXML( ‘C:\AutoScan.exe.config’, ‘//configuration/system.serviceModel/client/endpoint/address’, CustomEdit.Text); end; end; Also you should not load the value every time you get to the custom page, because you reset user preference, every time user returns back to the … Read more

How to Load Config File Programmatically

You’ll have to adapt it for your requirements, but here’s the code I use in one of my projects to do just that: var fileMap = new ConfigurationFileMap(“pathtoconfigfile”); var configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap); var sectionGroup = configuration.GetSectionGroup(“applicationSettings”); // This is the section group name, change to your needs var section = (ClientSettingsSection)sectionGroup.Sections.Get(“MyTarget.Namespace.Properties.Settings”); // This is the … Read more