I've successuflly created a custom prefpane for my application (in thunderbird) and defined some preferences.
At the moment, the values in my prefpane are empty by default. However, when I do enter/select and save them, everything is good and they get written into the default database.
<preferences>
<preference id="myextension.settings.autosync_time"
name="myextension.settings.autosync_time"
type="int"/>
<preference id="myextension.settings.autosync_server"
name="myextension.settings.autosync_server"
type="string"/>
</preferences>
How can I predefine values to my preferences (eg. autosync_time = int(60) and autosync_server = string(dlc://mydlc.com) for my application ?
If you are packaging an extension, you put a JavaScript file with default preferences into the defaults/preferences directory:
pref("myextension.settings.autosync_time", 60);
pref("myextension.settings.autosync_server", "dlc://mydlc.com");
If you are packaging a XULRunner application or changing Thunderbird the same file goes into the defaults/prefs directory of the application.
Related
I am working an aosp project. For this project, I want to set the captive portal check off by default in the aosp build. I figured and tested that I can set the setting via:
settings put global captive_portal_detection_enabled 0
see also https://www.kuketz-blog.de/android-captive-portal-check-aenderung/
So usually I will set this by using the overlay mechanism for the resources in the device, for example in overlay/frameworks/base/core/packages/settingsprovider/res/value:
<resources>
<!-- disable lockscreen by default to avoid showing of user switcher -->
<bool name="def_lockscreen_disabled">true</bool>
</resources>
I figured, that the default value for the captive portal is in the aosp ConnectivityService defined like
private int getCaptivePortalMode() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.CAPTIVE_PORTAL_MODE,
Settings.Global.CAPTIVE_PORTAL_MODE_PROMPT);
}
I tried several ways to override it but prepending config_ or _def does not work, adding the entry by
<resources>
<!-- disable captive portal checking -->
<add-resource type="integer" name="config_captive_portal_mode"/>
<integer name="config_captive_portal_mode">0</integer>
</resources>
now I only have 2 options left, but I do not like any of them:
a) patch aosp -> have troubles with updates
b) run a script on the first startup -> ugly
Did I miss something?
Alains answer is what I was looking for.
You'd need to add some logic to check whether the device is booting
for the first time or not, through a file in userdata for example.
To add a default value for CAPTIVE_PORTAL_MODE make the below changes in
DatabaseHelper under framework/base/packages/SettingsProvider/src
loadIntegerSetting(stmt, Settings.Global.CAPTIVE_PORTAL_MODE,
R.integer.def_captive_portal_detection_enabled);
Default.xml under framework/base/packages/SettingsProvider/res
<integer name="def_captive_portal_detection_enabled" translatable="false">0</integer>
I am new to Intellij Idea plugin development. So I am developing a simple plugin to print a string value in a tool window(similar to console window)! There are less examples when I searched the web! I have a slight understanding about the Intellij action system but is unable to figure out how to register the necessary action in the plugin.xml to print the string in a tool window!
Following is my code
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
public class A extends AnAction {
#Override
public void actionPerformed(AnActionEvent e) {
String x="Hello how are you?";
}
}
How can I print String x in a tool window?
Console windows can't just exist on their own, they have to be tied to a tool window. Here's a quick example.
First create a ToolWindow for your plugin in XML:
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<toolWindow id="MyPlugin"
anchor="bottom"
icon="iconfile.png"
factoryClass="com.intellij.execution.dashboard.RunDashboardToolWindowFactory"></toolWindow>
</extensions>
Then in your action, you can grab a handle to that tool window and lazily create a console view, then add your text there:
ToolWindow toolWindow = ToolWindowManager.getInstance(e.getProject()).getToolWindow("MyPlugin");
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(e.getProject()).getConsole();
Content content = toolWindow.getContentManager().getFactory().createContent(consoleView.getComponent(), "MyPlugin Output", false);
toolWindow.getContentManager().addContent(content);
consoleView.print("Hello from MyPlugin!", ConsoleViewContentType.NORMAL_OUTPUT);
A couple of notes:
Your new tool window may not be visible by default so you may need to activate it from the View -> Tool Windows menu.
We used RunDashboardToolWindowFactory to create our new tool window, so it will take on the layout of a run window. You can use any implementation of ToolWindowFactory (including your own custom class) in its place.
RunDashboardToolWindowFactory no longer exists in the lastest intellij-community codebase. The only reference I have is https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/tool_window
Actions should be registered this way (inside in plugin.xml) :
<actions>
<group id="MyPlugin.TopMenu"
text="_MyPlugin"
description="MyPlugin Toolbar Menu">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="MyAction"
class="actions.MyAction"
text="_MyAction"
description="MyAction"/>
</group>
</actions>
Also, make sure your action is inside a package, otherwise it might not be found/called.
I am starting in WP development but I already got the following situation.
I have my app and I need other apps to call it passing data/parameters that I will specify.
For example:
App X will call and open my app, passing parameters like id, name and age.
Is there any way to do it?
Define a URI association for your app.
To do so add content like this to the app's manifest file:
<Extensions>
<Protocol Name="myapp" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions>
Define a class that derives from UriMapperBase to handle incoming URIs and register right after the call to RootFrame.Navigated + = /*...*/ by doing this:
RootFrame.UriMapper = new MyPersonalUriMapper();
Other apps can open your app by doing something like this:
Windows.System.Launcher.LaunchUriAsync(new System.Uri("myapp:4711/Luciano/24"));
You can parse this URI in your UriMapper to open the page you wanted with ID=4711, Name=Luciano and Age=24.
I successfully deploy my custom Action to the list of Actions available for use in my SharePoint Designer, but when opening an existing workflow, or creating a new one in the Designer, I get the message (and of course my custom action is not on the list of actions)
The list of workflow actions on the server references an assembly that
does not exist. Some actions will not be available. The assembly
strong name is {Actual Assembly strong name}. Contact your server
administrator for more information.
I checked the Strong Assembly name, Global Assembly Cache, package options, .ACTIONS file, web.config... Everything seems ok. Any new Ideas?
I am assuming the custom action is a farm deployed activity, which inherits from System.Workflow.ComponentModel.Activity (perhaps using subclass SequenceActivity, but really that doesn't matter)
I'm guessing that you haven't created the required ACTIONS file, which gets deployed to TEMPLATE\1033\Workflow
<?xml version="1.0" encoding="utf-8" ?>
<WorkflowInfo>
<Actions Sequential="then" Parallel="and">
<Action Name="Description for SP Designer"
Assembly="$SharePoint.Project.AssemblyFullName$"
ClassName="AssemblyName.ClassName"
AppliesTo="all"
Category="SPD category"
UsesCurrentItem="true"
>
<RuleDesigner Sentence="Line as it appears in SPD workflow" />
<Parameters>
<Parameter Name="__ActivationProperties" Type="Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties, Microsoft.SharePoint" Direction="In" />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>
SPD reads the list of activities from the ACTIONS files. Adding the file will get it into the menu. To actually add it to the workflow, you also need to authorize the custom workflow activity by class name.
To add the authorized type, I use a feature receiver with the following spwebmodification:
private SPWebConfigModification CreateWebConfigModification(string assembly, string assemblyNamespace)
{
return new SPWebConfigModification()
{
Type = (SPWebConfigModification.SPWebConfigModificationType)0,
Name = String.Format("authorizedType[#Assembly='{0}'][#Namespace='{1}'][#TypeName='*'][#Authorized='True']", (object)assembly, (object)assemblyNamespace),
Path = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes",
Owner = assemblyNamespace,
Sequence = 0U,
Value = String.Format("<authorizedType Assembly='{0}' Namespace='{1}' TypeName='*' Authorized='True' />", (object)assembly, (object)assemblyNamespace)
};
}
this will generate an SPWebConfigModification which can be used during install/uninstall.
Check you local admin privleges. This error comes up if you don't have local priveleges
create a new web and site collection and create a new a new workflow for the new site. you'll get the error message. don't save the work flow. and close the SPD.
reopen the designer and create a new work flow it'll solve the problem.
I'm playing with this Azure web role sample. It contains a class derived from RoleEntryPoint and a .aspx page that contains a button click handler.
I test it in Azure Emulator. I put the following code (taken from here)
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
in both role OnStart() and the button click handler. When role OnStart() is invoked it happens to run in WaIISHost.exe under MachineName\\MyLogin account and when button handler code is invoked it happens to run in w3wp.exe under MachineName\\NETWORK SERVICE account. That's surprising.
Why are these pieces of code from the same role project run inside different processes and under different accounts? Can I change that?
David is correct. In addition to that, you can turn off this behavior and run everything in the hostable web core (as it worked before SDK 1.4). You just need to comment out the "Sites" section in the services definition like in the example below:
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="aExpense.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="aExpense" vmsize="Medium">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="HttpsIn" endpointName="HttpsIn" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="DiagnosticsConnectionString" />
<Setting name="DataConnectionString" />
<Setting name="allowInsecureRemoteEndpoints" />
</ConfigurationSettings>
With Windows Azure v1.3 and beyond, a Web Role takes advantage of the full IIS, rather than Hosted Web Core. IIS runs in a separate appdomain.
See this blog post from the Windows Azure team for the gory details.