add and tag to collections in applicationHost.config or web.config using Powershell webadministration module |
Without resorting to xml manipulation, the following answer may help you
get started with this problem:
Add a 'clear' element to WebDAV authoringRules using powershell
|
Passing config file as argument to config parse module |
start.py
...
options.ConfigFile = args.filename
...
options.py
from ConfigReader import getConfigValue as getVal, ConfigFile
def getTest():
Test = getVal('main', 'test')
return Test
ConfigReader.py
import os
import ConfigParser
ConfigFile='default.cfg'
def config():
cfg = ConfigParser.ConfigParser()
for f in set(['default.cfg',ConfigFile]):
|
How do I determine if a required module came from a gem, or was a core module? |
Once require has found an loaded a library file it adds the full path to
that file to the $LOADED_FEATURES array. So you could look in that array to
see where it found blah
$LOADED_FEATURES.find_all { |path| puts path if /blah/ =~ path }
|
Binding extension required in app.config |
This is required for WCF to be able to load this binding from the correct
dll. There are cases where you can add this to other config files like
machine.config and WCF will pick it from there and hence the app will work
without having it in the app.config file.
|
Magento Module config.xml |
I found this quite useful as a starting point
http://coding.smashingmagazine.com/2012/03/01/basics-creating-magento-module/
I'm still learning module development but the module works
|
Release required module from Node.js |
It sounds like you're creating some sort of plugin system. I would have a
look at Node VM's:
http://nodejs.org/docs/latest/api/vm.html
It allows you to load and run code in a sandbox which means when it's
finished all it's internal allocations should be freed again.
It is marked as unstable, but that doesn't mean it doesn't work. It means
the API might change in future versions of Node.
As an example, Haraka, a node based smtp server, uses the VM module to
(re)load plugins.
|
Inject module dynamically, only if required |
I haven't tried it as we have avoided large dependencies (thus far), but
this article appears to show how to accomplish what you are wanting.
http://weblogs.asp.net/dwahlin/archive/2013/05/22/dynamically-loading-controllers-and-views-with-angularjs-and-requirejs.aspx
Good luck!
-T
|
NodeJS required module not available in other modules |
Each file has to include references to modules
index.js
var fs = require("fs"),
other = require("./otherfile");
// you can now use `fs`
otherfile.js
var fs = require("fs");
// you can now use `fs` here
One of the best parts about this is you're not locked into naming the
variable a certain way in any given file. Every file is pretty much
isolated from all the other files in your lib, and that's a very good
thing.
Also know that you can include just parts a module if you'd like
var read = require("fs").readFile;
read("myfile.txt", function(err, data) {
if (error) {
return throw error;
}
console.log(data);
};
Explanation:
Node.js does not encourage the use of globals; and as such, you should not
try to implement things that depend on global variables.
Whe
|
Injecting a provider into a module config |
From official docs:
provider(name, provider)
Register a provider for a service. The providers can be retrieved and can
have additional configuration methods.
Parameters
name – {string} – The name of the instance. NOTE: the provider will be
available under name + 'Provider' key.
You should name your provider without "Provider" word.
This code works fine:
myApp.provider('test', function () {
});
myApp.config(function (testProvider) {
});
|
AngularJS: Provider after Module.config? |
You might want to consider creating separate modules. This will not only
allow give you the flexibility you are looking for, it will help to make
your code easier to test and maintain.
angular.module('myModule', ['myModule.controllers',
'myModule.services']).config(function (myServiceProvider) {
myServiceProvider.setName('Sam');
});
angular.module('myModule.controllers', []).controller('myController',
function ($scope, myService) {
$scope.name = myService.getName();
});
angular.module('myModule.services', []).provider('myService', function () {
var name = 'John';
this.setName = function (newName) {
name = newName;
};
this.$get = function () {
return {
getName: function () {
return name;
}
};
};
});
|
requirejs - construct a module when it is defined, not when it is required |
script is successfully loaded, but constructor is not called. Is it a
normal behaviour?
Yes. They are only executed when needed, the define might be renamed as
register. Also it might need to wait for its dependencies anyway.
Is there some workaround to fix this?
If you want to execute it, just place a require() call for it (not in the
same file though).
I have some legacy code which knows nothing about modules and depends on
file attachment instead.
While the script attachment does successfully load them (synchronously!),
they will be executed asynchronously. You better would wrap the legacy code
in requires as well (which shouldn't break anything).
|
Why I cannot call a module's function after required or used successfully? |
You haven't provided enough information to be entirely certain of the
problem, but the most likely cause is that the new sub is in a package
other than genbank.
When you attempt to call genbank::new (or genbank->new), Perl looks for
a sub named new in the package genbank, not in the file genbank.pm. By
convention, the file genbank.pm will contain a package named genbank, but
this is purely a matter of convention and convenience. It is not enforced
by the language and there is absolutely no automatic connection between
file names and package names.
To find out what package your subs are being placed in, look in genbank.pm
for any lines saying package xxxx;. The last one to appear before the sub
new line will tell you the package that new belongs to. If there isn't a
package stateme
|
How do I access a factory inside my module config? |
Please give us code ! In this example instead of factory provider is
used,to configure value of salutation variable.
provide.provider('greeter2', function() {
var salutation = 'Hello';
this.setSalutation = function(s) {
salutation = s;
}
function Greeter(a) {
this.greet = function() {
return salutation + ' ' + a;
}
}
this.$get = function(a) {
return new Greeter(a);
};
});
angular.module('abc', []).configure(function(greeter2Provider) {
greeter2Provider.setSalutation('Halo');
});
your question is not clear,i cant even fully understand it,but maybe that
code somehow can help you...
|
AttributeError: 'module' object has no attribute 'config' |
I'm also a newbie. I had the same problem. I deleted the crud in my
directory (build and dist folders etc), then rebuilt it all. Bingo! I
suspect that, as Alain suggested, PyCharm has cached something undesirable.
|
Magento - Add node and save module config |
If is more easy to you, you could try with custom variables.
Hope it helps. The official Doc
Greetings.
|
Why am I getting "ImportError: No module named pyramid.config" |
I found the answer to my problem. My virtual environment was correctly set
up, I just needed to run my code through the version of python found in the
scripts folder of my virtual environment.
The python file you are trying to run can be found anywhere on your local
machine as long as it uses python from that environment, for example
C:anypathonlocalmachine> C:envScriptspython.exe helloworld.py
I was making the mistake of putting my python file in the virtual
environment and attempting to run the following WRONG code
C:env> helloworld.py
I thought that I was supposed to be working entirely within the virtual
environment
Thanks for the help in the comments rebelious
|
angular: Error: Unknown provider during module.config() |
A call to
module.provider("test", ...);
is really a call to
module.config(function($provide) {
$provide.provider("test", ...);
});
(See my wiki article on dependency injection for more details.)
And since config blocks run in the order they were declared, you just need
to move the declaration of your provider to above the point where it's
used. You'll often see it written something like this:
angular.module('myApp', [])
.provider ("test", function () {
var prefix;
this.setPrefix = function(p) {
prefix = p;
}
this.$get = function () {
return {
log: function(msg) {
console.log (prefix + msg);
}
}
}
})
.config(function (testProvider) {
testProvider.setPrefix("works: ");
})
.controller ("myCtrl", function(
|
Tor's stem module (python) loading but not unloading config |
That's certainly odd. I'd expect set_options() to behave the way you expect
but tor's HiddenServiceOptions is certainly unconventional so I wouldn't be
surprised if there's a bug here. If you determine the root cause of this
then please let us know!
Out of curiosity, does issuing a RESETCONF rather than SETCONF do the
trick? You can do this via...
>>> controller.reset_conf('HiddenServiceOptions')
|
Accessing .config file inside a DotNetNuke Module |
If you add keys to the appsettings section of the DNN site's web.config,
you can retrieve them using:
DotNetNuke.Common.Utilities.Config.GetSetting("settingname");
However, it is a better practice, and makes sense in this case to create a
Settings control in your module and to store the information there.
You do this by creating an ascx control that inherits from
DotNetNuke.Entities.Modules.ModuleSettingsBase and stores settings in the
base Settings Dictionary for you module.
Your other module view controls can access the settings via a similar
Dictionary object called Settings that is part of the ModuleUserControlBase
class.
For an example of how to use module settings, check out this DNN7 tutorial
video and article. A sample project with all the code is in the Related
Files sectio
|
How to get my module to work globally? Is there any config in package.json? |
Use npm install . -g in the root of a module to install it globally. See
the docs.
The bin property in you package.json is used to specify which executables
should be added to the PATH. See the docs.
For example:
{
"name": "my-module",
"bin": "./bin/script.js"
}
|
Module.exports vs plain json for config files |
Thanks @jonathan-ong, looks like config.js (NOT JSON file) works as
expected and I could put some comments.
module.exports = {
// Development Environment
development: {
database: {
host: '127.0.0.1',
login: 'dev',
password: 'dev'
}
},
// Production Environment
production: {
database: {
host: '127.0.0.1',
login: 'prod',
password: 'prod'
}
}
};
|
AngularJS - How to use $routeProvider and custom module in config function? |
As I commented you can create a provider instead of a factory and put the
URLs in that as the central place:
angular.module('urls', []).
provider('urls', function (){
this.$get = function(){
var obj = {}
obj.login = function(){ return '/login';}
//more urls here, you don't really need function though
return obj;
}
});
angular.module('app', ['urls']).
config(function ($routeProvider, urlsProvider) {
$routeProvider.
when(urlsProvider.login(), { controller: PageCtrl,
templateUrl: 'tem.html' }).
otherwise({ redirectTo: urlsProvider.login() });
});
However, you can not inject the $location service to the urls
|
Python setup does not find correctly installed module using pkg-config |
To guide Python to the right place, you may need to tinker with PYTHONPATH:
PYTHONPATH and imports
|
How to write new rules from code behined in web.config |
can you please be more specific which type of rule you want to add or
modify?
for changing web .config through application please go through following
article.
http://www.dotnetcurry.com/ShowArticle.aspx?ID=102
|
How to write to trace listeners defined in config file |
You can use Trace.TraceError() to write to the trace listeners:
try
{
}
catch(Exception ex)
{
Trace.TraceError(ex.Message);
}
Notice that this will write to all listeners defined in your web.config
file. Read more on MSDN: How to: Create and Initialize Trace Listeners
|
What ObjectMapper config / annotations required for successful JSON / JSON array exhange using Jackson 2.2 |
On stackOverflow are more than many answered questions like yours.
This is a solution:
objectMapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
You can see similar questions:
Use class name as root key for JSON Jackson serialization
Enable Jackson to not output the class name when serializing (using Spring
MVC)
|
Issue with installing Postgres on Vagrant VM using Chef: undefined method `ruby' for Config:Module |
There appears to be a problem installing the "pg" gem:
================================================================================
Error executing action `install` on resource 'chef_gem[pg]'
================================================================================
Gem::Installer::ExtensionBuildError
-----------------------------------
ERROR: Failed to build gem native extension.
/opt/vagrant_ruby/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
|
I don't see the Web.Debug.config and Web.Release.config files on my web.config after upgrading my project to VS2012 |
I found the answer in a post here: how to add files in web.config
transformation process?
In your "App Data" folder you'll find your publish profiles you created and
can right click on them to add a config transform file.
|
How do you write wrapper module? |
Here is some example, how i did it:
How it works? It checks for some condition, and creates object depends on
this condition. And subroutine also checks for reference type and calls the
right method
file /tmp/Adapt/Base.pm (base module):
#!/usr/bin/perl
package Adapt::Base;
use strict;
use warnings;
sub new {
my $class = shift;
my $self;
if ( time % 3 ) {
require "/tmp/Adapt/First.pm";
$self = Adapt::First->new(@_);
}
elsif ( time % 2 ){
require "/tmp/Adapt/Second.pm";
$self = Adapt::Second->new(@_);
}
else {
require "/tmp/Adapt/Default.pm";
$self = Adapt::Default->new(@_);
}
bless( $self, $class );
}
sub somesub {
my $s = shift;
my $self = $$s;
if ( ref( $self ) eq 'Adapt::First
|
Is lock or volatile required when worker threads write non-competitively to local or class variables? |
Writes to reference types (i.e. Object) and word-sized value types (i.e.
int in a 32 bit system) are atomic. This means that when you peek at the
values (position 6) you can be sure that you either get the old value or
the new value, but not something else (if you had a type such as a large
struct it could be spliced, and you could read the value when it was half
way through being written). You don't need a lock or volatile, so long as
you're willing to accept the potential risk of reading stale values.
Note that because there is no memory barrier introduced at this point (a
lock or use of volatile both add one) it's possible that the variable has
been updated in the other thread, but the current thread isn't observing
that change; it can be reading a "stale" value for (potentially) q
|
VBA MS Excel: Can I Write UserForm Code in a Module? |
An approach is outlined here that involves defining a Class and adding
controls to the form dynamically, which are then associated with Events of
the Class.
From you description, though, it sounds like your UserForm is doing too
much. I suggest that you consider creating other forms, rather than trying
to do everything from a single form. You could, perhaps, create a Class to
store properties (and behaviours) that are common to the two or three forms
that you might create. Instantiate the Class when the first (main) form is
opened.
|
How to write register from linux kernel module (cpu: ARM) |
I'm guessing that REGBASE is a physical address and not a virtual one. You
need to ask the kernel to map it into the address space before you can use
it. Most of the time you'd use ioremap to map it in.
For example:
void __iomem *io = ioremap(REGBASE, SZ_4K);
writel(0x00000002, io + 0x0004);
|
Apache and Japanase website re-write module |
Try in Hex:
RewriteRule
^xE5xADxA6xE6xA0xA1-xE8xA9xB3xE7xB4xB0xE3x81xAAxE8xA9x95xE4xBExA1-(.+)$
/statistics.php?n=$1 [L]
For example with having this rule:
RewriteRule ^xE5xADxA6-(.+)$ /statistics.php [L]
this url http://domain.com/学-t will redirect to
http://domain.com/statistics.php
For testing you can use online htaccess tester:
http://htaccess.madewithlove.be/ and remember to change the page encoding
to UTF-8 before testing.
|
Linux module to deny write permissions to BIOS? |
Flashing the BIOS is typcially done not by using some driver but by
accessing the SPI or I²C controller hardware directly.
Some mainboards have hardware write protection switches/jumpers.
Neither the kernel nor a rootkit could do anything about that.
Some flash chips have a write protection that can only be enabled, but
cannot be disabled without a reset, i.e., only the BIOS can do or allow
flashing.
Neither the kernel nor a rootkit could do anything about that.
On most mainboards, the flash hardware has no write protection.
There is nothing the kernel can do about that; any rootkit that has the
capability to access the hardware is already in complete control and is
also able to reverse any software protection measures attempted by the
kernel.
|
How do you write tests for the argparse portion of a python module? |
Populate your arg list by using sys.argv.append() and then call
parse(), check the results and repeat.
Call from a batch/bash file with your flags and a dump args flag.
Put all your argument parsing in a separate file and in the if __name__ ==
"__main__": call parse and dump/evaluate the results then test this from a
batch/bash file.
|
how to use create and write function in openerp module development? |
So if I understand you, you have a child form/model with fields and you
want to save the value of a couple of fields onto the parent model?
In this case, you would override the create and write methods like this:
def write(self, cr, uid, ids, values, context = None):
res = super(MyChildClass, self).write(cr, uid, ids, values, context =
context)
if 'child_field' in values:
for child_item in self.browse(cr, uid, ids, context = context):
self.pool.get('my.parent.model').write(cr, uid,
[child_item.parent_id.id], {'parent_field': values['child_field'],},
context = context)
return res
Going from memory here but I think this is right. Note you only want to do
the write to the parent if they are changing the child field. The create
is much the same except you don't
|
Python module needs to write files to a directory but permission is blocked |
Application data should be stored under either %APPDATA%, $XDG_CONFIG_HOME,
or ~/.config, depending on the platform. Create a directory for the module
within one of those locations. Or better yet, have the application tell you
where your data should be located.
|
How to set paths for template files in one config like file in requireJs so that I do not have to pass template path url to my module? |
You can, just use the text! plugin in the require function, so in your
config file write this:
paths: {
Thome_a: '../tmp/home/a.htm',
Tsearch_b: '../tmp/search/b.htm'
},
and require the templates like this:
require(['text!Thome_a'], function(thome_a){...});
|
How to use Angular.js service instance inside module config and keep the same instance |
From the doc - Services as singletons
All Angular services are application singletons. This means that there
is only one instance of a given service per injector. Since
Angular is lethally allergic to global state, it is possible to create
multiple injectors, each with its own instance of a given service, but
that is rarely needed, except in tests where this property is
crucially important.
It mean if you do injector.get for a single injector, it will always
returns the singleton like this
var injector = angular.injector(['app.services']);
var singletonService1 = injector.get('singletonService');
var singletonService2 = injector.get('singletonService');
console.log(singletonService1 === singletonService2) // prints true
However if you inject it to another the controller
|
Which module should contain logging.config.dictConfig(my_dictionary)? What about my_dictionary? |
For dictConfig:
import logging.config
logging.config.dictConfig() #Your method.
In terms of what you need to do, it might be easier if you posted some of
your code.
Some documentation
An Example
|