Maintaining a common set of Eclipse preferences

You could of course export/import those settings. The other approach is to enable project specific settings for some settings. We have a very small Git repository with those kind of files: .settings/org.eclipse.jdt.core.prefs (compiler problem settings and formatter rules) .settings/org.eclipse.jdt.ui.pref (cleanup rules, common code templates) The common settings are just copied/merged in each projects .settings directory, … Read more

How to configure “Shorten command line” method for whole project in IntelliJ

Inside your .idea folder, change workspace.xml file Add <property name=”dynamic.classpath” value=”true” /> to <component name=”PropertiesComponent”> . . . </component> Example <component name=”PropertiesComponent”> <property name=”project.structure.last.edited” value=”Project” /> <property name=”project.structure.proportion” value=”0.0″ /> <property name=”project.structure.side.proportion” value=”0.0″ /> <property name=”settings.editor.selected.configurable” value=”preferences.pluginManager” /> <property name=”dynamic.classpath” value=”true” /> </component> If you don’t see one, feel free to add it yourself <component … Read more

Reading dll.config (not app.config!) from a plugin module

You will need to load the x.dll.config (with the Configuration API) yourself. All the automatic file handling (including the .Settings) is all about machine.config/y.exe.config/user-settings. To open a named config file: Reference System.Configuration.dll assembly. Using System.Configuration Create code like: Configuration GetDllConfiguration(Assembly targetAsm) { var configFile = targetAsm.Location + “.config”; var map = new ExeConfigurationFileMap { ExeConfigFilename … Read more

Get font scaling factor to calculate the fontsize

I just found in the source code of Settings.System this function: /** @hide */ public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig, int userHandle) { outConfig.fontScale = Settings.System.getFloatForUser( cr, FONT_SCALE, outConfig.fontScale, userHandle); if (outConfig.fontScale < 0) { outConfig.fontScale = 1; } } There is however the FONT_SCALE in usage so I checked for that Configuration class … Read more

Android: Changing NFC settings (on/off) programmatically

It’s not possible programatically without rooting device. But you can start NFC Settings Activity by intent action Settings.ACTION_NFC_SETTINGS for api level 16 and above. For api < 16 use Settings.ACTION_WIRELESS_SETTINGS Previous selected answer suggests to use WIFI_SETTINGS but we can directly move to NFC_SETTINGS Here’s the example : android.nfc.NfcAdapter mNfcAdapter= android.nfc.NfcAdapter.getDefaultAdapter(v.getContext()); if (!mNfcAdapter.isEnabled()) { AlertDialog.Builder … Read more

VSCode Integrated Terminal Doesn’t Load .bashrc or .bash_profile

Simply add shell arguments to the VsCode settings.json file. Paths to the settings.json file are as follows: Windows: C:\Users\<username>\AppData\Roaming\Code\User\settings.json` Linux: $HOME/.config/Code/User/settings.json Mac: $HOME/Library/Application\ Support/Code/User/settings.json Add one of the following: “terminal.integrated.shellArgs.windows”: [“-l”], “terminal.integrated.shellArgs.linux”: [“-l”], “terminal.integrated.shellArgs.osx”: [“-l”], This will launch your shell of choice with the login argument. This will thus execute any user profile that is … Read more

Java Swing save and load workspace/settings

In this case, the obvious solution, java.util.prefs.Preferences, is probably the correct one. RCPrefs from this game is a simple example that demonstrates saving a variety of data types, including enum. The exact implementation is highly dependent on the application. While tedious, it needn’t be especially complex. For expedience, the example uses static methods; frame and … Read more

Can’t apply system screen brightness programmatically in Android

OK, found the answer here: Refreshing the display from a widget? Basically, have to make a transparent activity that processes the brightness change. What’s not mentioned in the post is that you have to do: Settings.System.putInt(y.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS_MODE, 0); Settings.System.putInt(y.getContentResolver(),Settings.System.SCREEN_BRIGHTNESS, brightnessLevel); then do WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = brightness; getWindow().setAttributes(lp); And if you call finish() right … Read more