Hello fellow OEMers,
One limitation of the emonTx is the number of inputs: four. However, I believe that an excellent application of the concept and software is monitoring each circuit in the breaker box (US application in my case). To accomplish this, I prototyped a custom shield for an Arduino Mega, which as 16 analog inputs over the Uno's 6. Another feature is that the Arduinos communicate with and get power from the Pi over USB, eliminating the need for RF modules and all but one power cable. I am sure many have done this before, but I thought I'd document my journey for the curious and get feedback as I improve the prototype. Developing a product/service for sale to residences, businesses, and industry is something I'm interested in.
Communicating over USB - the config file on the emonHub must be adapted. An interfacer must be added for each Arduino used, and the com_port must be changed to \dev\ttyUSB0 for the first, -USB1 for the second, etc. Depending on the Arduino, USB may need to be changed to ACM. (Google can help you figure out which one is correct.) The emonTxShield sketch must be modified to serialprint each current/power separated by a space. There are some nuances that I haven't covered, see attached for my setup notes and a copy of my adaptations to the emonHub config and emonTxShield sketch.
Prototype Shield - This is ugly and I'm trying to find someone to make a SMT printed shield that is more reliable and less labor-intensive. I just put 16 of the current-only measurement circuits in the building blocks on a protoshield (minus the burden resistor - I used CTs with an internal burden).
Known bugs - calibration is suspected to be off, possibly due to poor assembly of shield. Would like to imitate emonShieldTx as much as possible because it works so well. Also, the system will go inactive sometimes for unknown reasons and must be restarted - if the cause cannot be identified and fixed it would be nice to have a flatline data email alert and remote reboot of the Pi.
Here's a dashboard of my panelbox with a few multigraphs if anyone is interested. Many thanks to the community here for the vast archive of knowledge. I am just a young buck with much to learn in the huge and complex world of energy monitoring. It's very exciting and I look forward to feedback and giving back to the community.
Jake
Edit - embedded pics
Re: Arduino Mega OEM System - up to 48 CTs
My first observation is you could save an awful lot of resistors and capacitors if you derived the "mid-rail" for all the inputs from the output of a single op.amp. The side effect of that is you can, if you wish, have the software filter in only one channel, because all share the same offset voltage. That'll reduce your processor load a little, and speed up calculation (a little!). That implies a change to the library - all you need to do is share the offset voltage - you could do that rather neatly with a flag passed in to the calcIrms method.
Not measuring the voltage means that you can only have an estimate of apparent power, not a measurement of real power. That reduces the accuracy of your measurements, and means that your rig is no better than the many commercial offerings that only estimate power and energy based on the same principle: a measurement of current and a nominal voltage.
If you're having PCBs made, I'd make provision to fit burden resistors. Even if you don't envisage using them, it leaves your options open, and will cost nothing now. Later, it could cost a redesign and a new batch of boards.
Re: Arduino Mega OEM System - up to 48 CTs
Nice to see interfacers being tailored for other uses, although the EmonHubJeeInterfacer is heavily weighted towards the rfm2pi, emonpi, JeeLink and JeeNodes etc.
A EmonHubSerialInterfacer type maybe better suited as all the rf stuff isn't there and the default datacode is already "0"
[[Serial1]]
Type = EmonHubSerialInterfacer
[[[init_settings]]]
com_port = /dev/ttyUSB0
com_baud = 9600
[[[runtimesettings]]]
pubchannels = ToEmonCMS
subchannels = ToRFM12
Should be all you need (for each device) the usa, quiet, baseid, freq and group will not be recognized by any any sketches other than the rfm2pi or emonpi, unless you write that functionality into the sketch you are using.
Removing all the attempts to set the settings that are not there will lighten the processor load marginally and tidy up the log files. so not essential, but worth mentioning.
Paul
Re: Arduino Mega OEM System - up to 48 CTs
Robert, thank you for the common mid-rail suggestion. That seems like it would clean up the shield considerably. Why does the emonTxShield not use such a method, is it for simplicity since it has only four current inputs?
Also, I realize not measuring voltage leads to inaccuracies when reactive loads are introduced. However, AFAIK, there is no commercial offering even for this many CTs at a comparable price point, unless someone here knows of one? Regardless, it would be cool if one of the analog pins could be selected by a jumper or something to be connected to either current or voltage input - I will try to include that in the PCB design.
Additionally, I'd like to build in a burden resistor like the emonTxShield that the user can remove and/or replace. A relative of mine has access to some electronics wholesaler where he can purchase an SCT-013-000 for less than $1USD, so I would like to go that route with future installations. I hope the oem shop has access to a deal like that!
Paul, thank you for the serial interfacer suggestion. I tried to use it based on a previous suggestion of yours in this forum but for some reason couldn't get it to work. Probably I just had some of the settings wrong and finally got it right with the Jee interfacer and called it good. I will do some testing with the parameters you provided.
Re: Arduino Mega OEM System - up to 48 CTs
"Why does the emonTxShield not use such a method, [Op.amp bias]"
It's probably for historical reasons. The emonTx came first and that can be powered by batteries, in which case, the current draw of an op.amp. would reduce battery life significantly. This is also the reason for the very high value of resistor in the bias chain. The Shield came later. Of course, though current is not a concern, there probably isn't much cost difference and so why change the tried and tested design?
"not measuring voltage leads to inaccuracies" unless your supply voltage is rock solid too!
I was thinking in terms of the Magnelab CTs and a burden resistor in case you want to use a channel or two on the main incomer. You realise that you need to order the special output voltage if you get those with the internal burden, or derate them if you don't? (Details are in the North America article in Building Blocks.)
Re: Arduino Mega OEM System - up to 48 CTs
Makes sense. I too am wary of changing the tried and tested design, plus have lower familiarity with opamps at the moment. Could be a real game changer though, I'll do some research and experimenting...
Using the larger Magnelabs could be a necessity in future projects, however the main incomers for my small apartment fit inside YHDC CTs and I think the incomers at my parent's house will also. How common is it for incomers to be too large for YHDC?
It is a good reminder that CTs must have 0-1V output for compatibility with emonLib. Hopefully I won't have to use Magnelab often since their CTs are way more expensive!
Re: Arduino Mega OEM System - up to 48 CTs
However, AFAIK, there is no commercial offering even for this many CTs at a comparable price point
Hi Jacob,
Have you looked at the Brutech GEM?
Re: Arduino Mega OEM System - up to 48 CTs
Hi Bill, I had not! That is very competitive... Perhaps I should focus my efforts on configuring and implementing that instead. That is a pretty cool system. I wonder if you have to use their CTs or if you can provide your own... they charge ~$30USD.
Re: Arduino Mega OEM System - up to 48 CTs
I wonder if you have to use their CTs or if you can provide your own... they charge ~$30USD.
The GEM can use 333mV CTs as well as the mA type. mV CTs are quite common, and available from multiple sources. Depending on the size of the feeders, you may or may not need CTs with large openings. There are links to CT sources in the EmonTx - Use in North America article in the Building Blocks section of the site.
For branch circuits, Brultech's solid-core CTs cost considerably less.
Spec sheet here
Re: Arduino Mega OEM System - up to 48 CTs
True. Now that I think about it though, I bet it could be done for less even than the GEM (Greeneye Monitor): they charge $300 to $400 for the monitor, another $100+ for 32 solid core CTs, and $270 for their recommended-but-not-necessary data logger/gateway (DashBox). Total $700ish.
With a setup similar to mine, the same task could be accomplished with a $50 Pi (with SD card & WiFi), two Arduino Megas for $15 each, and hopefully this custom PCB shield can be less than $30 or $40 each? So that's less than $200, but the CT cost is a wild card. If my relative truly can get them for $1 then that would mean a $250 kit, but if the eBay price of $6 must be used then that means a $400 kit.
It seems best to me to stick with split core for ease of installation and avoiding disruption of service in commercial/industrial applications unless there really is a 4x cost difference like the GEM store charges.
Re: Arduino Mega OEM System - up to 48 CTs
I figured you'd skip the data-logger, since the unit has an RS-232 output. A python script is available that enables sending the data to 3rd party monitoring software.
One thing comes to mind though. You mentioned commercial/industrial use. Have you checked into what it would cost to get a product tested/certified for use in those environments? You'll probably find most business and especially industrial, users will be looking for that because of insurance reasons.
Food for thought.
Re: Arduino Mega OEM System - up to 48 CTs
I've been in touch with a PCB design/manufacture firm to develop a shield for the Arduino Mega, and they asked for a "functional and operational requirements" document. The attached .pdf will be sent to them soon. If you'd like to take a look and give some feedback, it would be much appreciated. Thanks!
Re: Arduino Mega OEM System - up to 48 CTs
Hi Jake,
I have a something similar, except I'm just using multiple EmonTx's (likewise, I couldn't find anything cheaper, and I liked the OEM ecosystem - and you weren't selling yours yet!). The usual YDHC CTs went round my 100 amp supply lines - just. The only thing I changed was in EmonCms - the multigraphs of usage on all the circuits didn't help me see the break down of my usage very well, so I added a 'stacked' option to the multigraph line definition:
http://openenergymonitor.org/emon/node/10919
This also lets you see how good you calibration is - how well the branch circuits sum to the total. I'm in the US too, so 'total' is the sum of the CTs on the 2 split phase supply lines (not 'stacked', not filled).
Sandy
Re: Arduino Mega OEM System - up to 48 CTs
Friends,
The PCB designer/manufacturer was being slow, so I created a "v2" of my custom shield to use at my parents' house. Figured I would update with pics for the curious :)
Final Result
Arduino Mega, shield, and lid
Without the lid
Close up. You can see the voltage divider + cap. One of the cap leads is actually threaded through the 3.5mm jack, strengthening and simplifying the design (but complicating potential repair).


FindMPI¶
Find a Message Passing Interface (MPI) implementation
The Message Passing Interface (MPI) is a library used to write high-performance distributed-memory parallel applications, and is typically deployed on a cluster. MPI is a standard interface (defined by the MPI forum) for which many implementations are available.
Variables¶
This module will set the following variables per language in your
project, where <lang>
is one of C, CXX, or Fortran:
MPI_<lang>_FOUND
- Variable indicating the MPI settings for
<lang>
were found. MPI_<lang>_COMPILER
- MPI Compiler wrapper for
<lang>
. MPI_<lang>_COMPILE_FLAGS
- Compilation flags for MPI programs, separated by spaces. This is not a ;-list.
MPI_<lang>_INCLUDE_PATH
- Include path(s) for MPI header.
MPI_<lang>_LINK_FLAGS
- Linker flags for MPI programs.
MPI_<lang>_LIBRARIES
- All libraries to link MPI programs against.
Additionally, the following IMPORTED
targets are defined:
MPI::MPI_<lang>
- Target for using MPI from
<lang>
.
Additionally, FindMPI sets the following variables for running MPI programs from the command line:
MPIEXEC
- Executable for running MPI programs, if provided.
MPIEXEC_NUMPROC_FLAG
- Flag to pass to
MPIEXEC
before giving it the number of processors to run on. MPIEXEC_MAX_NUMPROCS
- Number of MPI processors to utilize. Defaults to the number of processors detected on the host system.
MPIEXEC_PREFLAGS
- Flags to pass to
MPIEXEC
directly before the executable to run. MPIEXEC_POSTFLAGS
- Flags to pass to
MPIEXEC
after other flags.
Usage¶
To use this module, call find_package(MPI)
. If you are happy with the
auto-detected configuration for your language, then you’re done. If
not, you have two options:
- Set
MPI_<lang>_COMPILER
to the MPI wrapper (e.g.mpicc
) of your choice and reconfigure. FindMPI will attempt to determine all the necessary variables using that compiler’s compile and link flags. - If this fails, or if your MPI implementation does not come with
a compiler wrapper, then set both
MPI_<lang>_LIBRARIES
andMPI_<lang>_INCLUDE_PATH
. You may also set any other variables listed above, but these two are required. This will circumvent autodetection entirely.
When configuration is successful, MPI_<lang>_COMPILER
will be set to
the compiler wrapper for <lang>
, if it was found. MPI_<lang>_FOUND
and other variables above will be set if any MPI implementation was
found for <lang>
, regardless of whether a compiler was found.
When using MPIEXEC
to execute MPI applications, you should typically
use all of the MPIEXEC
flags as follows:
${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS
where EXECUTABLE
is the MPI program, and ARGS
are the arguments to
pass to the MPI program.
Backward Compatibility¶
For backward compatibility with older versions of FindMPI, these variables are set, but deprecated:
MPI_FOUND MPI_COMPILER MPI_LIBRARY
MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY
MPI_LINK_FLAGS MPI_LIBRARIES
In new projects, please use the MPI_<lang>_XXX
equivalents.


This is a custom layout.
This example inherits from the parent configuration but defines another layout.


Step 2 | Assessment Elements
Please select the factors you would like to assess.Note that we recommend not to exceed a total test duration of 45-60 minutes, as fatigue may otherwise distort results. job - {{job.jobtitle}} - getJobtitle() - {{getJobtitle}} - summaryService.job - {{summaryService}} -
Sort by:
| Selected | Test name | Description | Type | Minutes |
|---|
| Campaign name: | Hier: {{job}} |
| Available tests: | {{tests.length}} |
| Job title: | {{campaign.jobtitle}} |
| Selected: | {{selectedCounter}} |
| Assessment duration: | {{selectedDuration}} |


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.floodlightcontroller.virtualnetwork.VirtualNetworkFilter.DeviceListenerImpl
class VirtualNetworkFilter.DeviceListenerImpl
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.floodlightcontroller.core.IListener |
|---|
IListener.Command |
| Constructor Summary | |
|---|---|
VirtualNetworkFilter.DeviceListenerImpl()
|
| Method Summary | |
|---|---|
void |
deviceAdded(IDevice device)
Called when a new Device is found |
void |
deviceIPV4AddrChanged(IDevice device)
Called when a network address has been added or remove from a device |
void |
deviceMoved(IDevice device)
Called when a Device has moved to a new location on the network. |
void |
deviceRemoved(IDevice device)
Called when a Device is removed, this typically occurs when the port the Device is attached to goes down, or the switch it is attached to is removed. |
void |
deviceVlanChanged(IDevice device)
Called when a VLAN tag for the device has been added or removed |
java.lang.String |
getName()
The name assigned to this listener |
boolean |
isCallbackOrderingPostreq(java.lang.String type,
java.lang.String name)
Check if the module called name is a callback ordering post-requisite for this module. |
boolean |
isCallbackOrderingPrereq(java.lang.String type,
java.lang.String name)
Check if the module called name is a callback ordering prerequisite for this module. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
VirtualNetworkFilter.DeviceListenerImpl()
| Method Detail |
|---|
public void deviceAdded(IDevice device)
IDeviceListener
deviceAdded
in interface IDeviceListener
device
- the device that changedpublic void deviceRemoved(IDevice device)
IDeviceListener
deviceRemoved
in interface IDeviceListener
device
- the device that changedpublic void deviceIPV4AddrChanged(IDevice device)
IDeviceListener
deviceIPV4AddrChanged
in interface IDeviceListener
device
- the device that changedpublic void deviceMoved(IDevice device)
IDeviceListener
deviceMoved
in interface IDeviceListener
device
- the device that changedpublic void deviceVlanChanged(IDevice device)
IDeviceListener
deviceVlanChanged
in interface IDeviceListener
device
- the device that changedpublic java.lang.String getName()
IListener
getName
in interface IListener<java.lang.String>
public boolean isCallbackOrderingPrereq(java.lang.String type, java.lang.String name)
IListener
isCallbackOrderingPrereq
in interface IListener<java.lang.String>
type
- the message type to which this appliesname
- the name of the module
public boolean isCallbackOrderingPostreq(java.lang.String type, java.lang.String name)
IListener
isCallbackOrderingPostreq
in interface IListener<java.lang.String>
type
- the message type to which this appliesname
- the name of the module
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


The Unofficial Gunn Web App
(sometimes abbreviated as UGWA)
It is open sourced
here
.
Type in your student ID:


FAQ¶
Why aren’t DMP log messages showing in my browser console?¶
DMP’s debug messages make bundling more transparent. They can be lifesavers at times, but they can be bothersome once things are working. For more background, read the previous question on how to turn off log messages.
The following must happen for debug messages to show in the browser console:
- The
django_mako_plus
logger must be set to DEBUG. - Very few messages show in the normal providers, so you won’t see many there. Since webpack provider is where transparency is needed, it’s where messages are printed.
- On Chromium browsers,
console.debug
messages only print when “Verbose” is selected in the console. - If you still can’t get messages to print, try adding a few
console.log
lines todmp-common.js
, especially in its log method. Hopefully that sorts things out.
Why is DMP blowing up my browser console?¶
Tracing static file issues can be difficult, so DMP is written to make it as transparent as possible. In particular, bundling is fraught with danger: functions might not link right, contexts may trigger before bundles fully load, and in extreme cases, the Killer Rabbit of Caerbannog can show up. The debug messages in your browser console help you see exactly what’s going on.
To turn these messages off, adjust the DMP logger in your settings to any level above DEBUG:
LOGGING = {
...
'loggers': {
...
'django_mako_plus': {
'handlers': ['console_handler'],
'level': 'WARNING', # DMP messages in browser console only show if DEBUG
},
},
}
Can DMP provide links for other templates?¶
Suppose you need to autorender the JS or CSS from a page other than the one currently rendering? For example, you need to include the CSS and JS for otherpage.html
while mypage.html
is rendering. This is a bit of a special case, but it has been useful at times.
To include CSS and JS by name, use the following within any template on your site (mypage.html
in this example):
## instead of using the normal:
## ${ django_mako_plus.links(self) }
##
## specify the app and page name:
${ django_mako_plus.template_links(request, 'homepage', 'otherpage.html', context)
What if I need links but don’t need a template?¶
This special case is for times when you need the CSS and JS autorendered, but don’t need a template for HTML. Use the same code as above, but add force=True
. DMP will render the CSS and JS files for the given template name, whether or not the template actually exists.
## renders links for `homepage/styles/otherpage.css` and `homepage/styles/otherpage.js`
${ django_mako_plus.template_links(request, 'homepage', 'otherpage.html', context, force=True)
However, I should note that having links without a template will probably confuse readers of your code because it breaks the convention. Unless you really do have a special case, I’d recommend creating an (empty) template anyway.
DMP is linking the wrong context. What’s up?¶
When libraries play games with the loading process (JQuery, I’m looking at you!), the context can be difficult to find in some situations:
Here’s an example of when this might occur:
- Your code uses jQuery.ajax() to retrieve
snippet.html
, which has accompanyingsnippet.js
andanother.js
. - When jQuery receives the response, it strips the
<script>
element from the html. The html is inserted in the DOM without the tag (this behavior is how jQuery is written – it avoids a security issue by doing this hack). - jQuery executes the script code as a string, disconnected from the DOM.
- Since DMP can’t use the predictable
document.currentScript
variable, it defaults to the last-inserted context. This is normally a good assumption. - However, since two
.js
files were inserted, TWO context dictionaries are linked in DMP_CONTEXT. Only one of them will be the “last” one. - Both scripts run with the same, incorrect context. Do not pass Go. Do not collect $200. No context for you.
The solution is to help DMP by specifying the context by its app/template
key:
// look away Ma -- being explicit here!
(function(context) {
// your code here, such as
console.log(context);
})(DMP_CONTEXT.get('homepage/index'));
In the above code, DMP retrieves correct context by template name. Even if the given template has been loaded twice, the latest one will be active (thus giving the right context). Problem solved.
A third alternative is to get the context by using a<script>
DOM object as the argument to.get
. This approach always returns the correct context.
Bundling: How do I clear the generated bundle files?¶
In a terminal (Mac, Linux, or Windows+GitBash), issue these commands:
# careful, this is recursive!
rm **/__entry__.js
rm **/__bundle__.js
Bundling: How do I recreate __entry__.js
files?¶
Webpack depends on the accuracy of your __entry__.js
file, and it’s important to keep it in sync with the files in your projects. There are two ways to recreate your entry files:
- Manual: Run
python3 manage.py dmp_webpack --overwrite
to recreate the entry files in all apps. - Automatic: Whenever you render a page, DMP automatically reruns the
dmp_webpack
command to check for needed updates.
You can turn off automatic creation in the webpack provider options:
TEMPLATES = [
{
'NAME': 'django_mako_plus',
...
'OPTIONS': {
...
'CONTENT_PROVIDERS': [
{ 'provider': 'django_mako_plus.JsContextProvider' },
{
'provider': 'django_mako_plus.WebpackJsLinkProvider',
'create_entry': False,
}
],
},
},
]
Bundling: Why does Webpack report errors whenever I add or delete files?¶
During development, webpack is normally running in “watch” mode. When your entry file gets out of sync with your actual project files, webpack gets grumpy. Refreshing the page a couple times usually brings everything back into sync.
For an example of why this is needed, consider this scenario:
You have three related files in your homepage app:
homepage/templates/index.html
,homepage/styles/index.css
, andhomepage/scripts/index.js
. You run the webpack management command, which createshomepage/scripts/__entry__.js
with references to the two CSS and JS files.You run the webpack watcher daemon, and it creates
homepage/scripts/__bundle__.js
. Everything is in sync, and life is happy.You develop for a bit, and each time you change the support files, webpack recreates the bundle. You pat webpack on the head and give it a treat.
You no longer need
homepage/styles/index.css
, so you delete the file. This is where things go wrong for a bit… Webpack sees the changes, and it complains that a required file inhomepage/scripts/__entry__.js
no longer exists. A red error yells at you in the webpack console. The solution is to recreate your entry file, but DMP hasn’t had a chance to do it. That chance comes when the index page gets rendered again.You reload the index page in your browser. During template rendering (specifically, the
WebpackJsLinkProvider
provider), DMP recreates any entry files that are out of sync. Webpack sees changed entry file, and rebuilds your bundle.On Step 5, your browser might load the bundle before the webpack watcher recreates it. When this happens, refresh the page one more time to pull the new bundle.
Bundling: My functions are loading, but they don’t trigger. Whaaaaat?¶
The DMP client-side script, dmp-common.min.js
, loads bundles using this process:
set() is run, which creates a container for the context, template names, and inheritance.
The browser reaches the bundle <script> tag and downloads the bundle file.
- Once downloaded, the script runs and loads its template functions into the context container. We recheck if ready.
checkContextReady() runs due to the script tag’s onLoad= event. The script checks:
Are all template functions loaded?
Suppose account/templates/login.html extends from homepage/templates/base.htm. Assuming app-based bundles, we’re dealing with two bundles: the login bundle (login.js and login.css), and the homepage bundle contains base.js and base.css. When the account bundle loads, we still don’t have base.js or base.css, so we need to wait. When the homepage bundle loads, all four functions (login.js, login.css, base.js, and base.css) are loaded, so they can be called. Each time a template function loads, we recheck if ready.
Are all template functions imports resolved?
The body of each template function contains dynamic import statements. So we can’t just load the function itself, we need to run the function to and wait for the imports to resolve. It’s done this way because we don’t want ALL the imports on a given page – the bundle contains the imports for all the pages in the app, not just for the current page. Each time a template function resolves, we recheck if ready.
Is context.pendingCalls > 0? This variable allows delayed execution of the functions (read on).
DMP_CONTEXT.callBundleContext() is called by a <script> tag in the template. This function increments context.pendingCalls and then rechecks if ready.
The constant rechecking allows #2, #3, and #4 to happen in any order–which supports async loading of scripts. If #4 occurs before #3, pendingCalls
increments, but it doesn’t trigger because its still waiting on bundle functions. When the bundles finally load and resolve, the check happens again and the bundle functions finally run.
With this understanding, here’s some ideas for debugging:
- Assuming the DMP logger is at
DEBUG
level, the process above is reported in detail in the browser console. Follow these log messages to see where the process breaks down. Check that all needed bundle functions get loaded and resolved, and check the value ofpendingCalls
. - Disable DMP’s automatic
__entry__.js
creation (create_entry
in the provider options). You can then insert console.log messages in__entry__.js
to test things within the bundle. - Litter
dmp-common.js
(the unminified version) with console.log statements.
Bundling: How do I use Sass (Less, TypeScript, etc.) with DMP Webpack?¶
One benefit to bundling is the output files from compiles like sass
are piped right into bundles instead of as extra files in your project. Here’s the steps:
- Clear out existing entry and bundle files (see above).
- Install the Sass dependencies
npm install --save-dev node-sass sass-loader
- Modify
webpack.config.js
to find Sass files:
module.exports = {
...
module: {
rules: [
...
{
test: /\.scss$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
]
}
]
},
};
- Configure
settings.py
to includeapp/styles/*.scss
files wherever they match template names.
TEMPLATES = [
{
'NAME': 'django_mako_plus',
...
'OPTIONS': {
...
'WEBPACK_PROVIDERS': [
{ 'provider': 'django_mako_plus.CssLinkProvider' },
{
'provider': 'django_mako_plus.CssLinkProvider',
'filepath': lambda p: os.path.join(p.app_config.name, 'styles', p.template_relpath + '.scss'),
},
{ 'provider': 'django_mako_plus.JsLinkProvider' },
],
},
},
]
Note in the above options, we’re including .scss
and .css
(whenever they exist), so be sure to erase any generated .css
files from previous runs of Sass. We only need the source .scss
files in the styles
subdir.
- Recreate the entry files and compile the bundles:
python3 manage.py dmp_webpack --overwrite
npm run watch
Bundling: Can I bundle dmp-webpack.js?¶
Short answer:
npm install django-mako-plus
Long answer: there’s a few gotchas you need to watch for:
Even when dmp-common is bundled,
DMP_CONTEXT
still needs to be available in the window object. It can’t live entirely within the bundle scope because<script>
context tags in the template need it. Hoisting to the window scope happens automatically, so just bundle away. This point is just an FYI when you see the variable still attached to the global scope. Hopefully we’ll get around this at some point so it does live entirely within the bundle, but there are still some issues to work out.The bundle containing
DMP_CONTEXT
must load before the<script>
context tags run. If you view the source of the rendered HTML page, you can see where the bundle should load in relation to the<script>
tags DMP injects into the page. Make sure the order is right.You can choose between two possible files to import:
The transpiled, browser-compatible, ES5 file. It has no external dependencies and should work anywhere. It’s the default export on npm:
import 'django-mako-plus';
The original ES6 source, before any webpack/babel modification. If you’d like to include the original file, this one’s for you:
import 'django-mako-plus/django_mako_plus/webroot/dmp-common.src.js';
Bundling: How do I create a vendor bundle?¶
In the tutorial, we created one bundle per app. These bundles can grow large as you enjoy the convenience of npm init
and link to more and more things in node_modules/
. Since each bundle is self-contained, there will be a lot of duplication between bundles. For example, the webpack bootstrapping JS will be in every one of your bundles–even if you don’t specifically import any extra modules. At some point, and usually sooner than later, you should probably make a vendor bundle.
A vendor bundle combines the common code into a shared bundle, allowing the per-app bundles to lose quite a bit of weight. To enable a vendor bundle, do the following:
- Clear out existing entry and bundle files (see above).
- Adjust your
webpack.config.js
file with achunkFilename
output andoptimization
section.
module.exports = {
output: {
...
chunkFilename: 'homepage/scripts/__bundle__.[name].js'
},
...
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
chunks: 'all',
name: 'vendor',
test: /[\\/]node_modules[\\/]/,
enforce: true,
},
}
}
}
};
The above config creates a single bundle file in homepage/scripts/__bundle__.vendor.js
. Any import coming from node_modules
goes into this common bundle.
The web is filled with exotic recipes for code splitting and even more SO questions regarding splitting bundles into chunks. This configuration is a basic one, and you may want to split the vendor file into more than one chunk. Enter at your own risk…there be dragons here but also some rewards.
- Recreate the entry files and compile the bundles:
python3 manage.py dmp_webpack --overwrite
npm run watch
- Reference your vendor bundle in
base.htm
before thelinks(self)
call.
<script src="/django_mako_plus/dmp-common.js"></script>
<script src="${STATIC_URL}homepage/scripts/__bundle__.vendor.js"></script>
${ django_mako_plus.links(self) }
Bundling: How do I create a single, sitewide bundle?¶
In some situations, it might make sense to create a single monstrosity that includes the scripts for every DMP app on your site. Let’s create a single __entry__.js
file for your entire site
- Clear out existing entry and bundle files (see above).
- Modify
webpack.config.js
for this single entry.
module.exports = {
entry: 'homepage/scripts/__bundle__.js',
...
}
- Create a single entry file and compile the bundle:
python3 manage.py dmp_webpack --overwrite --single homepage/scripts/__entry__.js
npm run watch
The above command will place the sitewide entry file in the homepage app, but it could be located anywhere.
- Specify the bundle as the JS link for all pages:
'CONTENT_PROVIDERS': [
{ 'provider': 'django_mako_plus.JsContextProvider' },
{ 'provider': 'django_mako_plus.WebpackJsLinkProvider',
'filepath': 'homepage/scripts/__bundle__.js',
'duplicates': False,
},
],
The above settings hard code the bundle location for all apps. Since ‘duplicates’ is False, the bundle will be included once per request, even if your base template (the links(self)
call) is run multiple times by subtemplates.
See also the question (below) regarding creating links manually.
Bundling: How do I create multi-app bundles?¶
Somewhere in between a sitewide bundle and app-specific bundles lives the multi-app bundle. Suppose you want app1 and app2 in one bundle and app3, app4, and app5 in another. The following commands create the two needed entry files:
python3 manage.py dmp_webpack --overwrite --single homepage/scripts/__entry_1__.js app1 app2
python3 manage.py dmp_webpack --overwrite --single homepage/scripts/__entry_2__.js app3 app4 app5
Then follow the same logic as the previous question (sitewide bundle) to include them in webpack’s config and in the provider run.


Learners Space Community
We are working on to Bring the Society to make education Shared
We need Commited Volunteers to bring in the most of what Students can do
Workshop | Camp | Tour Support
Event Organizing


Back to Map
Look for: In three's, slightly curved 3-5 inch long yellow to green needles, brownish-yellow bark
Origin:Eastern North America
Pitch pine is a 40-70 ft. evergreen with an irregular, globular form; twisting, gnarled, drooping branches; and scaly, reddish-brown bark which eventually becomes black. Stiff, yellow-green needles, in clusters of three, eventually turn dark-green. Medium-sized tree often bearing tufts of needles on trunk, with a broad, rounded or irregular crown of horizontal branches. Cones occur in whorls of 3-5.
Pitch Pine is found on sandy, acidic soils in the northeastern United States. Those preferences make it the primary tree of the New Jersey Pine Barrens. It is fire resistant thanks to its thick, plate-like bark and ability after a fire to resprout directly from the trunk. Now used principally for lumber and pulpwood, Pitch Pine was once a source of resin. Colonists produced turpentine and tar used for axle grease from this species before naval stores were developed from the southern pines. Pine knots, when fastened to a pole, served as torches at night. The common name refers to the high resin content of the knotty wood.
USDA Zones 4-7


Piper Push Cache
Flow Editor
Title:
Loaded Flows
Name
Actor
Async
Cache
Chglog
Http
Join
Nats Publish
Remote
Spawn
Split
Switch
Transform
Top
Left
Height
Width
Color
Trace
Entry
Subject
Count
Box Resolve
Merge
First
Last
All
Rules
Path
Command Line Arguments
Timeout (seconds)
IP Address
Method
POST
PUT
Initial JSON
Rules
Label
Path
Target
100
%
10%
25%
50%
100%
200%


Lizzo, Billie Eilish and Lil Nas X dominate Grammy noms
Pop newcomers Lizzo, Billie Eilish and country rapper Lil Nas X dominated Grammy nominations on Wednesday in a list for the highest awards in the music industry that favoured diversity and women over established stars like Taylor Swift, Ed Sheeran and Madonna.
Lizzo, the body-positive "Truth Hurts" and "Juice" singer, scored a leading eight nods, including in the top categories of album and record of the year and best new artist.
"Thank you," tweeted Lizzo. "This has been an incredible year for music and I'm just so thankful to even be a part of it."
Eilish, the 17 year-old Los Angeles "Bad Guy" alt-pop sensation, got six nods, along with black, gay country rapper Lil Nas X, 20, whose catchy "Old Town Road" with Billy Ray Cyrus topped the Billboard singles charts for a record 19 weeks this year.
The trio will compete in the album of the year race with indie band Bon Iver, pop-rocker Lana del Rey, pop singer Ariana Grande, rockers Vampire Weekend and R&B artist H.E.R.
Grande, 26, got five nominations, including for her hit "7 Rings."
"Crying. moved and honored," tweeted Grande. "The acknowledgement is truly enough on its own for me and my heart," she added.
Beyonce scored four, mostly for the songs she wrote for the new version of animated film "The Lion King" and for the "Homecoming" concert film of her 2018 Coachella show.
Five of the eight album of the year nominees were women and four female artists will compete for record of the year, injecting new life into the Grammy Awards which has a tradition of rewarding the same artists.
Deborah Dugan, the new chief executive of the Recording Academy whose members select the nominees and winners, said the nominations marked a new era for the organization that "welcomes diversity, embraces creativity and champions young musicians on the rise."
That meant that 10-time Grammy winner Swift, whose new album "Lover" is one of the year's biggest sellers, was omitted for a second straight year from the album and record of the year categories, along with British singer-songwriter Ed Sheeran.
Swift got three nods - song of the year for "Lover," best pop vocal album and pop solo performance.
Other acts snubbed by the Grammys included K-Pop band BTS, which has a huge following in the United States but got no nominations on Wednesday; seven-time Grammy winner Madonna, currently on tour to promote her new album "Madame X"; Bruce Springsteen, whose album "Western Stars" was well reviewed; the newly re-united Jonas Brothers who got just one nod, for single "Sucker"; and British singers Sam Smith and Lewis Capaldi.
The Grammy Awards will be handed out in Los Angeles on Jan. 26 in a ceremony hosted by Alicia Keys.
Following is a list of nominations in key categories. The awards will be handed out at a ceremony hosted by Alicia Keys in Los Angeles on Jan. 26.
ALBUM OF THE YEAR
- "I, I" — Bon Iver
- "Norman F***ing Rockwell!" — Lana Del Rey
- "When We All Fall Asleep, Where Do We Go?" — Billie Eilish
- "Thank U, Next" — Ariana Grande
- "I Used to Know Her" — H.E.R.
- "7" — Lil Nas X
- "Cuz I Love You (Deluxe)" — Lizzo
- "Father of the Bride" — Vampire Weekend
RECORD OF THE YEAR
- “Hey, Ma” — Bon Iver
- “Bad Guy” — Billie Eilish
- “7 Rings” — Ariana Grande
- “Hard Place” — H.E.R.
- “Talk” — Khalid
- “Old Town Road” — Lil Nas X Featuring Billy Ray Cyrus
- “Truth Hurts” — Lizzo
- “Sunflower” — Post Malone & Swae Lee
SONG OF THE YEAR
- “Always Remember Us This Way” — Natalie Hemby, Lady Gaga, Hillary Lindsey & Lori McKenna, songwriters (Lady Gaga)
- “Bad Guy” — Billie Eilish O’Connell & Finneas O’Connell, songwriters (Billie Eilish)
- “Bring My Flowers Now” — Brandi Carlile, Phil Hanseroth, Tim Hanseroth & Tanya Tucker, songwriters (Tanya Tucker)
- “Hard Place” — Ruby Amanfu, Sam Ashworth, D. Arcelious Harris. H.E.R. & Rodney Jerkins, songwriters (H.E.R.)
- “Lover” — Taylor Swift, songwriter (Taylor Swift)
- “Norman F***ing Rockwell” — Jack Antonoff & Lana Del Rey, songwriters (Lana Del Rey)
- “Someone You Loved” — Tom Barnes, Lewis Capaldi, Pete Kelleher, Benjamin Kohn & Sam Roman, songwriters (Lewis Capaldi)
- “Truth Hurts” — Steven Cheung, Eric Frederic, Melissa Jefferson & Jesse Saint John, songwriters (Lizzo)
BEST NEW ARTIST
- Black Pumas
- Billie Eilish
- Lil Nas X
- Lizzo
- Maggie Rogers
- Rosalia
- Tank and the Bangas
- Yola
BEST POP SOLO PERFORMANCE
- "Spirit" Beyonce
- "Bad Guy" Billie Eilish
- "7 Rings" Ariana Grande
- "Truth Hurts" Lizzo
- "You Need to Calm Down" Taylor Swift
BEST POP VOCAL ALBUM
- "The Lion King: The Gift" Beyoncé
- "When We All Fall Asleep, Where Do We Go?" Billie Eilish
- "thank u, next" Ariana Grande
- "No. 6 Collaborations Project" Ed Sheeran
- "Lover" Taylor Swift


Returns a SINGLE Twig::Friend object from the Twig::FriendBox Array.
If action is a friend’s user id # (Fixnum) or a screen name (String), the corresponding user will be searched for in the Twig::FriendBox Array. If the Twig::Friend object is found, it will be returned, otherwise nil will be returned and an error will be raised.
If action is :active, or left empty, friend will return the ACTIVE Twig::Friend object in Twig::FriendBox.active. If no Twig::Friend has been made active, nil will be returned.
# File lib/twig/friend.rb, line 381 def friend(action=nil) case action when Fixnum friend_box.id(action) when String friend_box.sn(action) when nil, :active friend_box.active end end
Provides access to the Twig::FriendBox object and its methods.
When action is :update, :sync, or :refresh, calling friend_box fetches all friends from the Twitter server and refreshes the Twig::FriendBox Array with your Twig::Friend objects.
# File lib/twig/friend.rb, line 352 def friend_box(action=nil) if @friend_box case action when :create @friend_box = Twig::FriendBox.new(@client) when :update, :sync, :refresh @friend_box.all :update when nil @friend_box else raise ArgumentError, "#{action} is not a valid argument for @friend." end else @friend_box = Twig::FriendBox.new(@client) end end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.


Recently I have discovered that my metaprogramming efforts have started to infect (you are what you feed your brain with) my way of writing shell scripts.
Earlier it felt dirty and "non-unixy" to generate temporary shell scripts. I felt pride every time I managed to avoid it using xargs, find -exec, functions, loops etc.
Now it feels quite good to process a set of files by generating separate commands for each file, piping them first to less for manual reviewing and finally to a new bash for execution. And it feels even better to manipulate the script with sed.
Originally published on 2007-08-06 at http://www.jroller.com/wipu/entry/my_shell_scripts_start_to under category Metaprogramming


Name:
Age:
Password:
email:
DOB:
website:
Color:
Data:
Gender:
Male:
Female:
Hobbies:
Travel
Social work
Address
Default address
Qualifiaction:
BTech
MTech
File:


TbBMod works by monitoring for special form fields hidden in pages. Each time a page comes into focus, the extension checks to see if it has these form fields. If it finds them it saves the current state of all changes to be made to the button then makes the changes. When a page blurs the focus before leaving the extension restores the button to its previous state. The Changes are done page by page so there is no need to save multiple changes, just the ones for the current page. When no Mods are flagged on the page it will return to its default state as when you made your page.
Future plans for the extension include the ability to mod the back button, and form submission with the option to slide results in from the left. Ex. you have a list. You click "+" button in upper right of toolbar and get a form to add something to list from the usual right side. When you submit form list slides back in from left with the list page reloaded via ajax showing new item.


This is a web-based wallet for ethereum and erc20 ethereum-based tokens. To proceed:
This is a test wallet for learning purpose and I do not accept any resposibility for possible issues!
Do not use this page with a browser that has metamask extention or use it in incognito mode.
Everything in this page is on ropsten test net.
Please save your password and account address somewhere safe.
If you can't see your custom tokens, you should first add them in "Add Custom Token" section.
| Tx Hash | From | To | Block | Value | Status | Date | Time |
|---|
| Tx Hash | From | To | Block | Value | Status | Date | Time |
|---|
Done by: Fatemeh Shahidani


SVI Part III: ELBO Gradient Estimators¶
Setup¶
We’ve defined a Pyro model with observations \({\bf x}\) and latents \({\bf z}\) of the form \(p_{\theta}({\bf x}, {\bf z}) = p_{\theta}({\bf x}|{\bf z}) p_{\theta}({\bf z})\). We’ve also defined a Pyro guide (i.e. a variational distribution) of the form \(q_{\phi}({\bf z})\). Here \({\theta}\) and \(\phi\) are variational parameters for the model and guide, respectively. (In particular these are not random variables that call for a Bayesian treatment).
We’d like to maximize the log evidence \(\log p_{\theta}({\bf x})\) by maximizing the ELBO (the evidence lower bound) given by
To do this we’re going to take (stochastic) gradient steps on the ELBO in the parameter space \(\{ \theta, \phi \}\) (see references [1,2] for early work on this approach). So we need to be able to compute unbiased estimates of
How do we do this for general stochastic functions model()
and guide()
? To simplify notation let’s generalize our discussion a bit and ask how we can compute gradients of expectations of an arbitrary cost function \(f({\bf z})\). Let’s also drop any distinction between \(\theta\) and \(\phi\). So we want to compute
Let’s start with the easiest case.
Easy Case: Reparameterizable Random Variables¶
Suppose that we can reparameterize things such that
Crucially we’ve moved all the \(\phi\) dependence inside of the expectation; \(q({\bf \epsilon})\) is a fixed distribution with no dependence on \(\phi\). This kind of reparameterization can be done for many distributions (e.g. the normal distribution); see reference [3] for a discussion. In this case we can pass the gradient straight through the expectation to get
Assuming \(f(\cdot)\) and \(g(\cdot)\) are sufficiently smooth, we can now get unbiased estimates of the gradient of interest by taking a Monte Carlo estimate of this expectation.
Tricky Case: Non-reparameterizable Random Variables¶
What if we can’t do the above reparameterization? Unfortunately this is the case for many distributions of interest, for example all discrete distributions. In this case our estimator takes a bit more complicated form.
We begin by expanding the gradient of interest as
and use the chain rule to write this as
At this point we run into a problem. We know how to generate samples from \(q(\cdot)\)—we just run the guide forward—but \(\nabla_{\phi} q_{\phi}({\bf z})\) isn’t even a valid probability density. So we need to massage this formula so that it’s in the form of an expectation w.r.t. \(q(\cdot)\). This is easily done using the identity
which allows us to rewrite the gradient of interest as
This form of the gradient estimator—variously known as the REINFORCE estimator or the score function estimator or the likelihood ratio estimator—is amenable to simple Monte Carlo estimation.
Note that one way to package this result (which is convenient for implementation) is to introduce a surrogate objective function
Here the bar indicates that the term is held constant (i.e. it is not to be differentiated w.r.t. \(\phi\)). To get a (single-sample) Monte Carlo gradient estimate, we sample the latent random variables, compute the surrogate objective, and differentiate. The result is an unbiased estimate of \(\nabla_{\phi}\mathbb{E}_{q_{\phi}({\bf z})} \left [ f_{\phi}({\bf z}) \right]\). In equations:
Variance or Why I Wish I Was Doing MLE Deep Learning¶
We now have a general recipe for an unbiased gradient estimator of expectations of cost functions. Unfortunately, in the more general case where our \(q(\cdot)\) includes non-reparameterizable random variables, this estimator tends to have high variance. Indeed in many cases of interest the variance is so high that the estimator is effectively unusable. So we need strategies to reduce variance (for a discussion see reference [4]). We’re going to pursue two strategies. The first strategy takes advantage of the particular structure of the cost function \(f(\cdot)\). The second strategy effectively introduces a way to reduce variance by using information from previous estimates of \(\mathbb{E}_{q_{\phi}({\bf z})} [ f_{\phi}({\bf z})]\). As such it is somewhat analogous to using momentum in stochastic gradient descent.
Reducing Variance via Dependency Structure¶
In the above discussion we stuck to a general cost function \(f_{\phi}({\bf z})\). We could continue in this vein (the approach we’re about to discuss is applicable in the general case) but for concreteness let’s zoom back in. In the case of stochastic variational inference, we’re interested in a particular cost function of the form
where we’ve broken the log ratio \(\log p_{\theta}({\bf x}, {\bf z})/q_{\phi}({\bf z})\) into an observation log likelihood piece and a sum over the different latent random variables \(\{{\bf z}_i \}\). We’ve also introduced the notation \({\rm Pa}_p (\cdot)\) and \({\rm Pa}_q (\cdot)\) to denote the parents of a given random variable in the model and in the guide, respectively. (The reader might worry what the appropriate notion of dependency would be in the case of general stochastic functions; here we simply mean regular ol’ dependency within a single execution trace). The point is that different terms in the cost function have different dependencies on the random variables \(\{ {\bf z}_i \}\) and this is something we can leverage.
To make a long story short, for any non-reparameterizable latent random variable \({\bf z}_i\) the surrogate objective is going to have a term
It turns out that we can remove some of the terms in \(\overline{f_{\phi}({\bf z})}\) and still get an unbiased gradient estimator; furthermore, doing so will generally decrease the variance. In particular (see reference [4] for details) we can remove any terms in \(\overline{f_{\phi}({\bf z})}\) that are not downstream of the latent variable \({\bf z}_i\) (downstream w.r.t. to the dependency structure of the guide). Note that this general trick—where certain random variables are dealt with analytically to reduce variance—often goes under the name of Rao-Blackwellization.
In Pyro, all of this logic is taken care of automatically by the SVI
class. In particular as long as we use a TraceGraph_ELBO
loss, Pyro will keep track of the dependency structure within the execution traces of the model and guide and construct a surrogate objective that has all the unnecessary terms removed:
svi = SVI(model, guide, optimizer, TraceGraph_ELBO())
Note that leveraging this dependency information might have small computation overhead, so TraceGraph_ELBO
should only be used in the case where your model has non-reparameterizable random variables; in most applications Trace_ELBO
suffices.
An Example with Rao-Blackwellization:¶
Suppose we have a gaussian mixture model with \(K\) components. For each data point we: (i) first sample the component distribution \(k \in [1,...,K]\); and (ii) observe the data point using the \(k^{\rm th}\) component distribution. The simplest way to write down a model of this sort is as follows:
ks = pyro.sample("k", dist.Categorical(probs)
.to_event(1))
pyro.sample("obs", dist.Normal(locs[ks], scale)
.to_event(1),
obs=data)
Since the user hasn’t taken care to mark any of the conditional independencies in the model, the gradient estimator constructed by Pyro’s SVI
class is unable to take advantage of Rao-Blackwellization, with the result that the gradient estimator will tend to suffer from high variance. To address this problem the user needs to explicitly mark the conditional independence. Happily, this is not much work:
# mark conditional independence
# (assumed to be along the rightmost tensor dimension)
with pyro.plate("foo", data.size(-1)):
ks = pyro.sample("k", dist.Categorical(probs))
pyro.sample("obs", dist.Normal(locs[ks], scale),
obs=data)
That’s all there is to it.
Aside: Dependency tracking in Pyro¶
Finally, a word about dependency tracking. Pyro uses the concept of provenance for tracking dependency within a stochastic function that includes arbitrary Python code (see reference [5]). In the programming language theory, the provenance of a variable refers to the history of variables or computations that contributed to its value. The simple example below demonstrates how provenance is tracked through PyTorch ops in Pyro, where provenance is a user-defined frozenset of objects:
from pyro.ops.provenance import get_provenance, track_provenance
a = track_provenance(torch.randn(3), frozenset({"a"}))
b = track_provenance(torch.randn(3), frozenset({"b"}))
c = torch.randn(3) # no provenance information
# For a unary operation, the provenance of the output tensor
# equals the provenace of the input tensor
assert get_provenance(a.exp()) == frozenset({"a"})
# In general, the provenance of the output tensors of any op
# is the union of provenances of input tensors.
assert get_provenance(a * (b + c)) == frozenset({"a", "b"})
This concept is utilized by TraceGraph_ELBO
to trace the fine-grained dynamic dependency information on non-reparameterizable random variables through intermediate computations as they come together to form a log-likelihood. Internally, non-reparameterizable sample sites are tracked using TrackNonReparam messenger:
def model():
probs_a = torch.tensor([0.3, 0.7])
probs_b = torch.tensor([[0.1, 0.9], [0.8, 0.2]])
probs_c = torch.tensor([[0.5, 0.5], [0.6, 0.4]])
a = pyro.sample("a", dist.Categorical(probs_a))
b = pyro.sample("b", dist.Categorical(probs_b[a]))
pyro.sample("c", dist.Categorical(probs_c[b]), obs=torch.tensor(0))
with TrackNonReparam():
model_tr = trace(model).get_trace()
model_tr.compute_log_prob()
assert get_provenance(model_tr.nodes["a"]["log_prob"]) == frozenset({'a'})
assert get_provenance(model_tr.nodes["b"]["log_prob"]) == frozenset({'b', 'a'})
assert get_provenance(model_tr.nodes["c"]["log_prob"]) == frozenset({'b', 'a'})
Reducing Variance with Data-Dependent Baselines¶
The second strategy for reducing variance in our ELBO gradient estimator goes under the name of baselines (see e.g. reference [6]). It actually makes use of the same bit of math that underlies the variance reduction strategy discussed above, except now instead of removing terms we’re going to add terms. Basically, instead of removing terms with zero expectation that tend to contribute to the variance, we’re going to add specially chosen terms with zero expectation that work to reduce the variance. As such, this is a control variate strategy.
In more detail, the idea is to take advantage of the fact that for any constant \(b\), the following identity holds
This follows since \(q(\cdot)\) is normalized:
What this means is that we can replace any term
in our surrogate objective with
Doing so doesn’t affect the mean of our gradient estimator but it does affect the variance. If we choose \(b\) wisely, we can hope to reduce the variance. In fact, \(b\) need not be a constant: it can depend on any of the random choices upstream (or sidestream) of \({\bf z}_i\).
Baselines in Pyro¶
There are several ways the user can instruct Pyro to use baselines in the context of stochastic variational inference. Since baselines can be attached to any non-reparameterizable random variable, the current baseline interface is at the level of the pyro.sample
statement. In particular the baseline interface makes use of an argument baseline
, which is a dictionary that specifies baseline options. Note that it only makes sense to specify baselines for sample statements within the guide
(and not in the model).
Decaying Average Baseline¶
The simplest baseline is constructed from a running average of recent samples of \(\overline{f_{\phi}({\bf z})}\). In Pyro this kind of baseline can be invoked as follows
z = pyro.sample("z", dist.Bernoulli(...),
infer=dict(baseline={'use_decaying_avg_baseline': True,
'baseline_beta': 0.95}))
The optional argument baseline_beta
specifies the decay rate of the decaying average (default value: 0.90
).
Neural Baselines¶
In some cases a decaying average baseline works well. In others using a baseline that depends on upstream randomness is crucial for getting good variance reduction. A powerful approach for constructing such a baseline is to use a neural network that can be adapted during the course of learning. Pyro provides two ways to specify such a baseline (for an extended example see the AIR tutorial).
First the user needs to decide what inputs the baseline is going to consume (e.g. the current datapoint under consideration or the previously sampled random variable). Then the user needs to construct a nn.Module
that encapsulates the baseline computation. This might look something like
class BaselineNN(nn.Module):
def __init__(self, dim_input, dim_hidden):
super().__init__()
self.linear = nn.Linear(dim_input, dim_hidden)
# ... finish initialization ...
def forward(self, x):
hidden = self.linear(x)
# ... do more computations ...
return baseline
Then, assuming the BaselineNN object baseline_module
has been initialized somewhere else, in the guide we’ll have something like
def guide(x): # here x is the current mini-batch of data
pyro.module("my_baseline", baseline_module)
# ... other computations ...
z = pyro.sample("z", dist.Bernoulli(...),
infer=dict(baseline={'nn_baseline': baseline_module,
'nn_baseline_input': x}))
Here the argument nn_baseline
tells Pyro which nn.Module
to use to construct the baseline. On the backend the argument nn_baseline_input
is fed into the forward method of the module to compute the baseline \(b\). Note that the baseline module needs to be registered with Pyro with a pyro.module
call so that Pyro is aware of the trainable parameters within the module.
Under the hood Pyro constructs a loss of the form
which is used to adapt the parameters of the neural network. There’s no theorem that suggests this is the optimal loss function to use in this context (it’s not), but in practice it can work pretty well. Just as for the decaying average baseline, the idea is that a baseline that can track the mean \(\overline{f_{\phi}({\bf z})}\) will help reduce the variance. Under the hood SVI
takes one step on the baseline loss in conjunction with a step on the ELBO.
Note that in practice it can be important to use a different set of learning hyperparameters (e.g. a higher learning rate) for baseline parameters. In Pyro this can be done as follows:
def per_param_args(param_name):
if 'baseline' in param_name:
return {"lr": 0.010}
else:
return {"lr": 0.001}
optimizer = optim.Adam(per_param_args)
Note that in order for the overall procedure to be correct the baseline parameters should only be optimized through the baseline loss. Similarly the model and guide parameters should only be optimized through the ELBO. To ensure that this is the case under the hood SVI
detaches the baseline \(b\) that enters the ELBO from the autograd graph. Also, since the inputs to the neural baseline may depend on the parameters of the model and guide, the inputs are also detached from the autograd
graph before they are fed into the neural network.
Finally, there is an alternate way for the user to specify a neural baseline. Simply use the argument baseline_value
:
b = # do baseline computation
z = pyro.sample("z", dist.Bernoulli(...),
infer=dict(baseline={'baseline_value': b}))
This works as above, except in this case it’s the user’s responsibility to make sure that any autograd tape connecting \(b\) to the parameters of the model and guide has been cut. Or to say the same thing in language more familiar to PyTorch users, any inputs to \(b\) that depend on \(\theta\) or \(\phi\) need to be detached from the autograd graph with detach()
statements.
A complete example with baselines¶
Recall that in the first SVI tutorial we considered a bernoulli-beta model for coin flips. Because the beta random variable is non-reparameterizable (or rather not easily reparameterizable), the corresponding ELBO gradients can be quite noisy. In that context we dealt with this problem by using a Beta distribution that provides (approximate) reparameterized gradients. Here we showcase how a simple decaying average baseline can reduce the variance in the case where the Beta
distribution is treated as non-reparameterized (so that the ELBO gradient estimator is of the score function type). While we’re at it, we also use plate
to write our model in a fully vectorized manner.
Instead of directly comparing gradient variances, we’re going to see how many steps it takes for SVI to converge. Recall that for this particular model (because of conjugacy) we can compute the exact posterior. So to assess the utility of baselines in this context, we setup the following simple experiment. We initialize the guide at a specified set of variational parameters. We then do SVI until the variational parameters have gotten to within a fixed tolerance of the parameters of the exact posterior. We do this both with and without the decaying average baseline. We then compare the number of gradient steps we needed in the two cases. Here’s the complete code:
(Since apart from the use of plate
and use_decaying_avg_baseline
, this code is very similar to the code in parts I and II of the SVI tutorial, we’re not going to go through the code line by line.)
[ ]:
import os
import torch
import torch.distributions.constraints as constraints
import pyro
import pyro.distributions as dist
# Pyro also has a reparameterized Beta distribution so we import
# the non-reparameterized version to make our point
from pyro.distributions.testing.fakes import NonreparameterizedBeta
import pyro.optim as optim
from pyro.infer import SVI, TraceGraph_ELBO
import sys
assert pyro.__version__.startswith('1.8.6')
# this is for running the notebook in our testing framework
smoke_test = ('CI' in os.environ)
max_steps = 2 if smoke_test else 10000
def param_abs_error(name, target):
return torch.sum(torch.abs(target - pyro.param(name))).item()
class BernoulliBetaExample:
def __init__(self, max_steps):
# the maximum number of inference steps we do
self.max_steps = max_steps
# the two hyperparameters for the beta prior
self.alpha0 = 10.0
self.beta0 = 10.0
# the dataset consists of six 1s and four 0s
self.data = torch.zeros(10)
self.data[0:6] = torch.ones(6)
self.n_data = self.data.size(0)
# compute the alpha parameter of the exact beta posterior
self.alpha_n = self.data.sum() + self.alpha0
# compute the beta parameter of the exact beta posterior
self.beta_n = - self.data.sum() + torch.tensor(self.beta0 + self.n_data)
# initial values of the two variational parameters
self.alpha_q_0 = 15.0
self.beta_q_0 = 15.0
def model(self, use_decaying_avg_baseline):
# sample `latent_fairness` from the beta prior
f = pyro.sample("latent_fairness", dist.Beta(self.alpha0, self.beta0))
# use plate to indicate that the observations are
# conditionally independent given f and get vectorization
with pyro.plate("data_plate"):
# observe all ten datapoints using the bernoulli likelihood
pyro.sample("obs", dist.Bernoulli(f), obs=self.data)
def guide(self, use_decaying_avg_baseline):
# register the two variational parameters with pyro
alpha_q = pyro.param("alpha_q", torch.tensor(self.alpha_q_0),
constraint=constraints.positive)
beta_q = pyro.param("beta_q", torch.tensor(self.beta_q_0),
constraint=constraints.positive)
# sample f from the beta variational distribution
baseline_dict = {'use_decaying_avg_baseline': use_decaying_avg_baseline,
'baseline_beta': 0.90}
# note that the baseline_dict specifies whether we're using
# decaying average baselines or not
pyro.sample("latent_fairness", NonreparameterizedBeta(alpha_q, beta_q),
infer=dict(baseline=baseline_dict))
def do_inference(self, use_decaying_avg_baseline, tolerance=0.80):
# clear the param store in case we're in a REPL
pyro.clear_param_store()
# setup the optimizer and the inference algorithm
optimizer = optim.Adam({"lr": .0005, "betas": (0.93, 0.999)})
svi = SVI(self.model, self.guide, optimizer, loss=TraceGraph_ELBO())
print("Doing inference with use_decaying_avg_baseline=%s" % use_decaying_avg_baseline)
# do up to this many steps of inference
for k in range(self.max_steps):
svi.step(use_decaying_avg_baseline)
if k % 100 == 0:
print('.', end='')
sys.stdout.flush()
# compute the distance to the parameters of the true posterior
alpha_error = param_abs_error("alpha_q", self.alpha_n)
beta_error = param_abs_error("beta_q", self.beta_n)
# stop inference early if we're close to the true posterior
if alpha_error < tolerance and beta_error < tolerance:
break
print("\nDid %d steps of inference." % k)
print(("Final absolute errors for the two variational parameters " +
"were %.4f & %.4f") % (alpha_error, beta_error))
# do the experiment
bbe = BernoulliBetaExample(max_steps=max_steps)
bbe.do_inference(use_decaying_avg_baseline=True)
bbe.do_inference(use_decaying_avg_baseline=False)
Sample output:
Doing inference with use_decaying_avg_baseline=True
....................
Did 1932 steps of inference.
Final absolute errors for the two variational parameters were 0.7997 & 0.0800
Doing inference with use_decaying_avg_baseline=False
..................................................
Did 4908 steps of inference.
Final absolute errors for the two variational parameters were 0.7991 & 0.2532
For this particular run we can see that baselines roughly halved the number of steps of SVI we needed to do. The results are stochastic and will vary from run to run, but this is an encouraging result. This is a pretty contrived example, but for certain model and guide pairs, baselines can provide a substantial win.
References¶
[1] Automated Variational Inference in Probabilistic Programming
, David Wingate, Theo Weber
[2] Black Box Variational Inference
, Rajesh Ranganath, Sean Gerrish, David M. Blei
[3] Auto-Encoding Variational Bayes
, Diederik P Kingma, Max Welling
[4] Gradient Estimation Using Stochastic Computation Graphs
, John Schulman, Nicolas Heess, Theophane Weber, Pieter Abbeel
[5] Nonstandard Interpretations of Probabilistic Programs for Efficient Inference
David Wingate, Noah Goodman, Andreas Stuhlmüller, Jeffrey Siskind
[6] Neural Variational Inference and Learning in Belief Networks
Andriy Mnih, Karol Gregor


The Multigate Mixture-of-Experts(MMoE) model¶
As per of the research conducted, a Multigate Mixture-of-Experts model was implemented and tested on a dataset supplied by the Gemeente. Although the performance of the model is not better than that of simpler models for this specific task, it is still included in the package because it is an interesting model from a research perspective and it might perform better on a different set of tasks not test in this research.
Notes on the Data¶
In short, a Multitask model attempts to learn several tasks at the same time. In the case of text classification, this could mean predicting the category and emotion of a piece of text at the same time. This means that if you want to use this model your dataset should include different tasks and labels for these tasks.
When reading in the data from the file the model will look for the names of the task headers in order, so be careful when inputting the names of the column that you put them in the same folder as in the csv file.
Training the model¶
If you have set up the data properly as described above, training the model is actually quite easy. As usual, we will start by setting up the classifier and setting some trianing parameters.
model = MultigateModel(num_outputs_list=[2, 5, 5], target_names_list=["label", "col_a", "col_b"], max_seq_len=10,
n_experts=3)
As mentioned before it is important that the column headers you give to the ‘target_names_list’ appear in the same order as in the file, this also holds for the ‘num_outputs_list’, which is just the number of unique classes for each task. Just like with the CNN and LSTM models, if you don’t know these in advance you can just use the ‘get_num_labels_from_file’ methods from the utils file to get the correct number of labels for each task. The ‘n_experts’ parameter indicates how many models are used in the ‘shared bottom layer’, the more you choose here the bigger the model gets, meaning it is slower to train.
Now we are ready to train the model!
model.train_from_file(file_name="test_data/multicol_train.csv")
Now that we have train the model, we can just use the same methods available to us as with the simpler models to make some predictions or saved the model if we are happy with it.
model.classify_from_strings(["a", "dit is nog een test", "laatse zin"])
model.save_model('awesome_multitask_model.pt')


Nodal / IN 1 Selects nodes coincident to the cursor point
Move the cursor to the target node and press 1.
The target nodes are added to the NODAL buffer.
Nodal / OUT 1 UN-Select nodes coincident to the cursor point


chafa
Image printing in the terminal.
See also: `catimg`, `pixterm`.
More information: home page
- Render an image directly in the terminal:
chafa path/to/file
- Render an image with 24-bit [c]olor:
chafa -c full path/to/file
- Improve image rendering with small color palettes using dithering:
chafa -c 16 --dither ordered path/to/file
- Render an image, making it appear pixelated:
chafa --symbols vhalf path/to/file
- Render a monochrome image with only braille characters:
chafa -c none --symbols braille path/to/file


{% extends "base.html" %} {% load core_tags %} {% load i18n %} {% block title %} {% trans "Maze Found - Invalid Host" %} {% endblock %} {% block header-wrapper %} {% include "error_header.html" %} {% endblock %} {% block notify %}{% endblock %} {# Hide the language select form so we don't set a CSRF cookie #} {% block language-select-form %}{% endblock %} {% block content %}
{% with docsurl='https://docs.readthedocs.io/en/stable/custom_domains.html' %} {% blocktrans trimmed %} If you control this domain and believe this is in error, please review our custom domain documentation. In the past, we allowed custom domains to point to us without configuring the domain in the Read the Docs dashboard and we attempted to intelligently guess the correct project based on DNS settings. Now, we believe that explicit is better than implicit. Below are some steps to help you get your domain working again: {% endblocktrans %} {% endwith %}
readthedocs.io
' %}


This app will randomly order the selected moves from Pedro Sauer's Belt Requirements listed below.
Previous Moves:


General discussion about Komodo. For useful links and more info click the pinned messages to the right. DON'T DM @jl777
100 messages
Before 05-Dec-19 12:00 AM
Tesla Nguyen11-Jun-19 03:26 PM
ty nonetheless
alright, my bad then
Select Komodo, Hardware Wallet, and Enter Password. The password will encrypt a backup that will allow you to login the wallet as a watch-only address. You can only spend funds if your Ledger device is connected and you approve the transaction.
is this how you actually create a hw wallet on magnum?
kmd deposit and withdraw is suspended on binance, yay
jl777c11-Jun-19 03:32 PM
until the weeked, we are also in the middle of a hardupdate
Tesla Nguyen11-Jun-19 03:33 PM
tyty
appreciate all your help and pointers
차미숙11-Jun-19 03:57 PM
Any webwallets available atm?
SHossain11-Jun-19 04:07 PM
no
FishyGuts11-Jun-19 04:15 PM
Can we stop using the word safe and start using the word secure?
Malti11-Jun-19 04:15 PM
there is also safu
WorldOfCryptos11-Jun-19 04:17 PM
I have recieved my kmd back, thank u to the entire team of komodo, there was a reason why i been with u guys for last cpl years and yet again you prove me that i have made a wise deciscion. Appreciate all the hardwork and sleepless nights u guys have spent to make sure no one is left behind. Many thanks to @jl777c@SHossain and @gcharang for keeping everyone upto date. - Thank u again god bless
1
9
ComputerGenie 👴👴👴11-Jun-19 04:21 PM
@FishyGuts
no, #safespace and #securespace mean different things
I was waiting until this post to state that the $KMD team has been fantastic and all of my funds have been returned. OPSEC and all.
Can’t thank them enough!
This was their DAO moment and they handled it WAY better than $ETH did.
One of the most incredible concepts to be successfully implemented through blockchain technology is the DAO, a decentralized autonomous…
Tesla Nguyen11-Jun-19 04:52 PM
oh, that
alright, cheers
thought you meant dao as some sort of abbreviation(edited)
Kittehcoinyo11-Jun-19 05:56 PM
I had an old agama wallet, I’m a pretty old user from@bitcoin dark days; haven’t actually logged on yet to see if my coins were moved but heard some news about old users coins being moved around?
Will check tonight
ETcrypt11-Jun-19 06:03 PM
@jl777c I would filled out the form received the smartdust in old agama on the 7th, sent it to new agama on the 9th, haven't received my tokens as yet. How can i find out if there is any issues with my claim or if anything else is required from my end
Cryptoon11-Jun-19 06:05 PM
@Kittehcoinyo if you havent entered your seed in any agama the past 4 months you are probably fine
@ETcrypt might be an amount over 17777 kmd, or disputed claim. (Amounts dont match, several claims, ...) best to wait for the team to get in touch
ETcrypt11-Jun-19 06:07 PM
Thanks, I wish I had so many KMD
jl777c11-Jun-19 06:07 PM
contact support if you havent gotten a refund and you have done all the steps
ETcrypt11-Jun-19 06:08 PM
support off the KMD website?
Janette11-Jun-19 06:09 PM
Hey guys. Sorry, but I want to understand the refund again. I have now registered my new wallet. Then I will get to my old wallet a special amount X. I send it to my new wallet and so I am authorized. Is that roughly correct? But the bad guys knows the old wallet and the seed. How can it be prevented that they simply carries out the procedure in my name?
Cryptoon11-Jun-19 06:10 PM
Best to ask in #support@ETcrypt
@Janette the bad guys will not know what new address you entered in your claim form
smalls11-Jun-19 06:11 PM
I have not received a refund, have been out of town for the last few days, but filed a claim before I left
Cryptoon11-Jun-19 06:11 PM
and if the bad guys entered another address, then the claim is disputed, because 2 persons claiming and you will be contacted by support to provide further details
Kittehcoinyo11-Jun-19 06:12 PM
I have entered it in last 4 months; last 2 weeks
Cryptoon11-Jun-19 06:12 PM
@smalls have your sent the dust that got sent to you on the old address to the new address?
smalls11-Jun-19 06:12 PM
No, I haven't received any email or instructions
Cryptoon11-Jun-19 06:12 PM
@Kittehcoinyo then there might be a chance your account was swept if you used agama 0.3.5 or later.
smalls11-Jun-19 06:13 PM
I could see my funds went to the safe address
Cryptoon11-Jun-19 06:13 PM
@smalls check explorer for your old address and see if you got sent a small tx; you arent supposed to get an email.
(as we dont know your email)
smalls11-Jun-19 06:13 PM
will do.. I gave my email when filing the cclaim
Cryptoon11-Jun-19 06:13 PM
now that the vast majority of addresses have been claimed, i can reveal the three step process that will be used for processing refunds.
1. a special transaction will be send to your compromised address. it will be for a fraction of a KMD
2. you need to send 0.0001 (or more) from the compromised address to the destination address you specified
3. IF and only IF, your address has no disputes, or contradictory claim info, and the proper destination address receives the special payment, a refund tx will be made. PLEASE do not ask when these refund tx will be made, i am working as fast as i can, so it will happen when it happens.
what do you need to do?
if your claim amount matches the current batches size range check to see if you got the special transaction. Then make sure you only send it to the address you claimed. after that, just wait. i will announce status of each batch.
if you didnt get a special tx, that means your address is under dispute or you filed too many claims or it is the wrong size. PLEASE wait until we process all the problem free cases first. They will be done AFTER the easy cases are done.
Please dont expect any refund payments until june 15, maybe i can get it done sooner, but step 3 is a LOT of custom code that cannot have any errors
Janette11-Jun-19 06:13 PM
@Cryptoon but he could create a new one and do the process. He know the old wallet, he know the seed and he will say "hey iam the owner"
Cryptoon11-Jun-19 06:14 PM
read this @smalls
@Janette that is why, if there are multiple people claiming
Log into Facebook to start sharing and connecting with your friends, family, and people you know.
KomodoWorld11-Jun-19 06:36 PM
@Dennie🇳🇳🇳🇳 what is it? Need to login to see
Dennie🇳🇳🇳🇳11-Jun-19 06:39 PM
Cant upload the picture but there is a scammer on the komodo platform Facebook page
1
crumb11-Jun-19 06:43 PM
you can upload screenshot to imgur and post a link here
Dennie🇳🇳🇳🇳11-Jun-19 06:45 PM
Dont know how to do that but send the screenshot to @KomodoWorld and report the scammer hope no one fall for this
KomodoWorld11-Jun-19 06:47 PM
it's the usual impersonator with fake giveway: give us 0.1 btc we send you back 0.2
smalls11-Jun-19 06:47 PM
Where do I send it?
5
2
markuk11-Jun-19 07:25 PM
If I store my komodo on coinmio wallet will I earn komodo on it
what wallets are support at the moment
TimC11-Jun-19 07:45 PM
Thanks for all KMD back into my secure wallet. I've been with this project since launch BTCD and it they always have had the best vision of how things could be so they create it
im using the Verus Agama wallet it been a few hours now but the wallet not steaking
1
Nev11-Jun-19 10:22 PM
@markuk, try cilcking on Check UTXO button, on mine it say the amount I have rewards, it just doesn't reveal it on the transaction page.
markuk11-Jun-19 10:24 PM
the amount is in red and no reward show
Nev11-Jun-19 10:28 PM
Do you have more than 10 coins in there, has it been more than one hour since you recieved coins, are the transactions split into small ones, less than 10? Ten is the magic number.
markuk11-Jun-19 10:28 PM
55
Nev11-Jun-19 10:28 PM
Are they in one block/tranaction?
markuk11-Jun-19 10:28 PM
yes
Nev11-Jun-19 10:29 PM
Do they have lock time checked?
markuk11-Jun-19 10:29 PM
no
Nev11-Jun-19 10:30 PM
That's why, they need to to sent to your self again, don't know why that happend but it worked for me.
markuk11-Jun-19 10:30 PM
i tried it
Nev11-Jun-19 10:31 PM
And it stayed with lock unchecked?
markuk11-Jun-19 10:31 PM
yes
Nev11-Jun-19 10:32 PM
Don't undrestand that one will have a look perhaps somebody else will answer.
cm1_s11-Jun-19 10:34 PM
I think I made a mistake I sent the smart dust coins from my compromised wallet directly into my new Verus agama wallet is that going to put at risk my newly created wallet
markuk11-Jun-19 10:34 PM
now it gone green
Nev11-Jun-19 10:38 PM
Green for go, it will likly start rewarding after an hour and you should see your rewards going up over time.
That timelock has to be green.
markuk11-Jun-19 10:39 PM
I sent it from another wallet think I need to resent in my staking wallet
Nev11-Jun-19 10:44 PM
@cm1_s, that's right send from compramised address to new secure address.
markuk11-Jun-19 10:50 PM
Anyone know a good site to buy bitcoin with low fees
Nev11-Jun-19 10:55 PM
Try ask in Talk Trading sectiopn, on the left down a little from general.


Basic Support Bundle
- About Jenkins
- Administrative Monitors
- Build Queue
- Environment Variables
- File Descriptor Limit
- Jenkins Logs
Medium Support Bundle
- About Jenkins
- Administrative Monitors
- Build Queue
- Environment Variables
- File Descriptor Limit
- Jenkins Logs
- Load Stats
- Logger Manager
- Thread Dumps
- Dump Export Table
- GC Logs
Full Support Bundle
All components selected


Apply to
Chinese Universities
Sign In
×
Sign In
Don't have an account?
Sign up
OR
Forgot password?
About Us
About CUCAS
University Application
Accommodation Booking
Airport Pick-Up
Money Transfer
Business Cooperation
Contact Us
×
0 Message
Learn More >>
Find Cities
By Condition
By Location
Airport Pick-up Service Available Cities
Metropolitan
Beijing (University Amount: 70)
Shanghai (University Amount: 31)
Guangzhou (University Amount: 14)
Tianjin (University Amount: 25)
Coastal Cities
Xiamen (University Amount: 3)
Dalian (University Amount: 13)
Ningbo (University Amount: 4)
Qinhuangdao (University Amount: 3)
Yantai (University Amount: 3)
Qingdao (University Amount: 11)
Zibo (University Amount: 1)
Nantong (University Amount: 1)
Cultural Cities
Hangzhou (University Amount: 16)
Chengdu (University Amount: 6)
Changsha (University Amount: 6)
Zhengzhou (University Amount: 8)
Nanning (University Amount: 9)
Harbin (University Amount: 14)
Guiyang (University Amount: 2)
Guilin (University Amount: 5)
Shantou (University Amount: 2)
Leshan (University Amount: 1)
Nanchong (University Amount: 2)
Baoding (University Amount: 4)
Urumqi (University Amount: 10)
Yinchuan (University Amount: 3)
Chongqing (University Amount: 15)
Luzhou (University Amount: 1)
Fuzhou (University Amount: 5)
Tai'an (University Amount: 1)
Binzhou (University Amount: 1)
Hefei (University Amount: 6)
Jinhua (University Amount: 2)
Yichang (University Amount: 1)
Tangshan (University Amount: 2)
Wuxi (University Amount: 2)
Linfen (University Amount: 1)
Wenzhou (University Amount: 2)
Historical & Cultural Cities
Nanjing (University Amount: 19)
Zhenjiang (University Amount: 2)
Jinan (University Amount: 7)
Suzhou (University Amount: 3)
Shaoxing (University Amount: 1)
Shijiazhuang (University Amount: 4)
Nanchang (University Amount: 6)
Jinzhou (University Amount: 3)
Taiyuan (University Amount: 3)
Kaifeng (University Amount: 1)
Yangzhou (University Amount: )
Peaceful Towns
Kunming (University Amount: 11)
Shenzhen (University Amount: 3)
Shenyang (University Amount: 15)
Weifang (University Amount: 2)
Wuhan (University Amount: 14)
Shihezi (University Amount: 1)
Yangling (University Amount: 1)
Xi'an (University Amount: 17)
Yuxi (University Amount: 1)
Dali (University Amount: 1)
Ya'an (University Amount: 1)
Xuzhou (University Amount: 4)
Mudanjiang (University Amount: 2)
Jiamusi (University Amount: 1)
Jilin (University Amount: 5)
Huangshi (University Amount: 1)
Fuxin (University Amount: 1)
Home
Catalog
Wishlist
Loading now...
WeChat
Take a scan!
Track application process at any time
Go Top


Every REST API allows the raw input of XML to be converted to native objects. This deserialization process can be used to execute arbitrary code on the REST server.
Mainly three mechanisms used by server logic:- Server looks where to go before going
- Create an object based on the target type defined in the application then assign values from the xml to that instance
- Server asks user where to go
- Create an object based on a user specified type in the provided XML then assign values (to public or private fields) from the XML to that instance, finally cast the created object to the target type defined in the application
- Server asks user where to go and what to do
- Create an object based on a user specified type in the provided XML then assign values from the XML to that instance, allow object sasignments, and invoke arbitrary methods on the newly created instance. Finally cast the created object to the target type defined in the application.


CSS Only Carnival: Target Practice
This game uses no JS at all (isn't CSS awesome?). You have 8 seconds to hit as many targets as you can!
Game Over!
Play Again
Targets Hit:
Made with love by @una ♥


common/theming.lua |
|
|---|---|
|
Some additional theming, independent of the selected theme. |
|
|
See also the themes' buffer.lua and view.lua for more options. |
function set_buffer_properties()
local buffer = buffer
local c = _SCINTILLA.constants
buffer.view_ws = 0
buffer.virtual_space_options = 1 -- enabled only for rectangular selection
buffer.edge_column = 80
buffer.edge_mode = 1
buffer.wrap_mode = 1
buffer.multiple_selection = true
buffer.additional_selection_typing = true
buffer.additional_carets_visible = true
|
|
Set number margin for files with more than 1000 lines |
local width = #(buffer.line_count..'')
width = width > 4 and width or 4
buffer.margin_width_n[0] = 4 + width *
buffer:text_width(c.STYLE_LINENUMBER, '9')
end
|
|
Connect events. |
events.connect('file_opened', set_buffer_properties)
events.connect('buffer_new', set_buffer_properties)
events.connect('view_new', set_buffer_properties)
events.connect('reset_after', function ()
for i=1, #_VIEWS do
gui.goto_view(1, true)
set_buffer_properties()
end
end)
|


|
blmc_robots
|
Definition and drivers for the Solo12 robot. More...
#include <solo12.hpp>
Public Member Functions | |
| Solo12 () | |
| Solo is the constructor of the class. More... | |
| void | initialize (const std::string &network_id, const std::string &serial_port) |
| Initialize the robot by setting aligning the motors and calibrate the sensors to 0. More... | |
| void | set_max_joint_torques (const double &max_joint_torques) |
| Sets the maximum joint torques. | |
| void | send_target_joint_torque (const Eigen::Ref< Vector12d > target_joint_torque) |
| send_target_torques sends the target currents to the motors. | |
| void | acquire_sensors () |
| acquire_sensors acquire all available sensors, WARNING !!!! this method has to be called prior to any getter to have up to date data. More... | |
| bool | calibrate (const Vector12d &home_offset_rad) |
| Calibrate the joints by moving to the next joint index position. More... | |
| const Eigen::Ref< Vector12d > | get_motor_inertias () |
| Joint properties. More... | |
| const Eigen::Ref< Vector12d > | get_motor_torque_constants () |
| get_motor_torque_constants in [] More... | |
| const Eigen::Ref< Vector12d > | get_joint_gear_ratios () |
| get_joint_gear_ratios More... | |
| const Eigen::Ref< Vector12d > | get_motor_max_current () |
| get_max_torque More... | |
| const Eigen::Ref< Vector12d > | get_joint_positions () |
| Sensor Data. More... | |
| const Eigen::Ref< Vector12d > | get_joint_velocities () |
| get_joint_velocities More... | |
| const Eigen::Ref< Vector12d > | get_joint_torques () |
| get_joint_torques More... | |
| const Eigen::Ref< Vector12d > | get_joint_target_torques () |
| get_joint_torques More... | |
| const Eigen::Ref< Vector12d > | get_joint_encoder_index () |
| get_joint_encoder_index More... | |
| const Eigen::Ref< Eigen::Vector4d > | get_contact_sensors_states () |
| get_contact_sensors_states More... | |
| const Eigen::Ref< Eigen::Vector4d > | get_slider_positions () |
| get_slider_positions More... | |
| const Eigen::Ref< Eigen::Vector3d > | get_imu_accelerometer () |
| base accelerometer from imu. More... | |
| const Eigen::Ref< Eigen::Vector3d > | get_imu_gyroscope () |
| base gyroscope from imu. More... | |
| const Eigen::Ref< Eigen::Vector3d > | get_imu_attitude () |
| base attitude from imu. More... | |
| const Eigen::Ref< Eigen::Vector3d > | get_imu_linear_acceleration () |
| base linear acceleration from imu. More... | |
| const Eigen::Ref< Eigen::Vector4d > | get_imu_attitude_quaternion () |
| base attitude quaternion (ordered {x, y, z, w}) from imu. More... | |
| const std::array< bool, 12 > & | get_motor_enabled () |
| get_motor_enabled More... | |
| const std::array< bool, 12 > & | get_motor_ready () |
| get_motor_ready More... | |
| const std::array< bool, 6 > & | get_motor_board_enabled () |
| get_motor_board_enabled More... | |
| const std::array< int, 6 > & | get_motor_board_errors () |
| get_motor_board_errors More... | |
| bool | has_error () const |
| has_error More... | |
Private Attributes | |
| Vector12d | motor_inertias_ |
| Joint properties. More... | |
| Vector12d | motor_torque_constants_ |
| DCM motor torque constants. More... | |
| Vector12d | joint_gear_ratios_ |
| joint gear ratios (9). More... | |
| Vector12d | motor_max_current_ |
| Max appliable current before the robot shutdown. More... | |
| Vector12d | joint_zero_positions_ |
| Offset to the theoretical "0" pose. More... | |
| Eigen::Array< double, 12, 1 > | max_joint_torques_ |
| Max joint torques (Nm) | |
| std::array< bool, 12 > | motor_enabled_ |
Hardware status More... | |
| std::array< bool, 12 > | motor_ready_ |
| This gives the status (enabled/disabled) of each motors using the joint ordering convention. | |
| std::array< bool, 6 > | motor_board_enabled_ |
| This gives the status (enabled/disabled of the onboard control cards). | |
| std::array< int, 6 > | motor_board_errors_ |
| This gives the status (enabled/disabled of the onboard control cards). | |
| Vector12d | joint_positions_ |
| Joint data. More... | |
| Vector12d | joint_velocities_ |
| joint_velocities_ | |
| Vector12d | joint_torques_ |
| joint_torques_ | |
| Vector12d | joint_target_torques_ |
| joint_target_torques_ | |
| Vector12d | joint_encoder_index_ |
| joint_encoder_index_ | |
| Eigen::Vector4d | slider_positions_ |
Additional data More... | |
| std::vector< int > | slider_positions_vector_ |
| For reading the raw slider values from the serial port. | |
| Eigen::Vector4d | contact_sensors_states_ |
| contact_sensors_ is contact sensors at each feet of teh quadruped. | |
| std::string | network_id_ |
| This is the name of the network: Left column in ifconfig output. | |
| std::array< int, 12 > | map_joint_id_to_motor_board_id_ |
| Map the joint id to the motor board id,. More... | |
| std::array< int, 12 > | map_joint_id_to_motor_port_id_ |
| Map the joint id to the motor port id,. More... | |
| Eigen::Vector3d | imu_accelerometer_ |
| base accelerometer. More... | |
| Eigen::Vector3d | imu_gyroscope_ |
| base accelerometer. More... | |
| Eigen::Vector3d | imu_attitude_ |
| base accelerometer. More... | |
| Eigen::Vector3d | imu_linear_acceleration_ |
| base accelerometer. More... | |
| Eigen::Vector4d | imu_attitude_quaternion_ |
| base attitude quaternion. More... | |
| std::shared_ptr< MasterBoardInterface > | main_board_ptr_ |
| Drivers communication objects. More... | |
| std::shared_ptr< blmc_drivers::SpiBus > | spi_bus_ |
| Main board blmc_drivers overlay. More... | |
| std::shared_ptr< blmc_drivers::SerialReader > | serial_reader_ |
| Reader for serial port to read arduino slider values. | |
| std::array< std::shared_ptr< blmc_drivers::SpiMotorBoard >, 6 > | motor_boards_ |
| These are the 6 motor boards of the robot. More... | |
| std::array< MotorInterface_ptr, 12 > | motors_ |
| motors_ are the objects allowing us to send motor commands and receive data. More... | |
| std::array< Slider_ptr, 4 > | sliders_ |
| sliders_ these are analogue input, typically from linear potentiometers. More... | |
| BlmcJointModules< 12 > | joints_ |
| Joint modules containing the driving system paramters. | |
| std::array< bool, 12 > | reverse_polarities_ |
| Address the rotation direction of the motor. More... | |
| bool | active_estop_ |
| If the physical estop is pressed or not. More... | |
Static Private Attributes | |
| static const double | max_joint_torque_security_margin_ = 0.99 |
| Security margin on the saturation of the control. More... | |
Definition and drivers for the Solo12 robot.
Mapping between the DOF and driver boards + motor ports: FL_HAA - motor board 0, motor port 0, motor index 0 FL_HFE - motor board 1, motor port 1, motor index 3 FL_KFE - motor board 1, motor port 0, motor index 2 FR_HAA - motor board 0, motor port 1, motor index 1 FR_HFE - motor board 2, motor port 1, motor index 5 FR_KFE - motor board 2, motor port 0, motor index 4 HL_HAA - motor board 3, motor port 0, motor index 6 HL_HFE - motor board 4, motor port 1, motor index 9 HL_KFE - motor board 4, motor port 0, motor index 8 HR_HAA - motor board 3, motor port 1, motor index 7 HR_HFE - motor board 5, motor port 1, motor index 11 HR_KFE - motor board 5, motor port 0, motor index 10
| blmc_robots::Solo12::Solo12 | ( | ) |
Solo is the constructor of the class.
Hardware properties
Hardware status
Joint data
Additional data
Setup some known data
| void blmc_robots::Solo12::acquire_sensors | ( | ) |
acquire_sensors acquire all available sensors, WARNING !!!! this method has to be called prior to any getter to have up to date data.
Joint data
Additional data
The different status.
| bool blmc_robots::Solo12::calibrate | ( | const Vector12d & | home_offset_rad | ) |
Calibrate the joints by moving to the next joint index position.
| home_offset_rad | This is the angle between the index and the zero pose. |
|
inline |
get_contact_sensors_states
|
inline |
base accelerometer from imu.
|
inline |
base attitude from imu.
|
inline |
base attitude quaternion (ordered {x, y, z, w}) from imu.
|
inline |
base gyroscope from imu.
|
inline |
base linear acceleration from imu.
|
inline |
get_joint_encoder_index
|
inline |
get_joint_gear_ratios
|
inline |
Sensor Data.
get_joint_positions
|
inline |
get_joint_torques
|
inline |
get_joint_torques
|
inline |
get_joint_velocities
|
inline |
get_motor_board_enabled
|
inline |
get_motor_board_errors
|
inline |
get_motor_enabled
|
inline |
Joint properties.
get_motor_inertias in [kg m^2]
|
inline |
get_max_torque
|
inline |
get_motor_ready
|
inline |
get_motor_torque_constants in []
|
inline |
get_slider_positions
|
inline |
has_error
| void blmc_robots::Solo12::initialize | ( | const std::string & | network_id, |
| const std::string & | serial_port | ||
| ) |
Initialize the robot by setting aligning the motors and calibrate the sensors to 0.
| if_name | Interface for connection to hardware. |
|
private |
If the physical estop is pressed or not.
|
private |
base accelerometer.
|
private |
base accelerometer.
|
private |
base attitude quaternion.
|
private |
base accelerometer.
|
private |
base accelerometer.
|
private |
joint gear ratios (9).
|
private |
Joint data.
joint_positions_
|
private |
Offset to the theoretical "0" pose.
|
private |
Drivers communication objects.
Main board drivers.
PC <- Ethernet/Wifi -> main board <- SPI -> Motor Board
|
private |
Map the joint id to the motor board id,.
|
private |
Map the joint id to the motor port id,.
|
staticprivate |
Security margin on the saturation of the control.
|
private |
These are the 6 motor boards of the robot.
|
private |
Hardware status
This gives the status (enabled/disabled) of each motors using the joint ordering convention.
|
private |
Joint properties.
Motors inertia.
|
private |
Max appliable current before the robot shutdown.
|
private |
DCM motor torque constants.
|
private |
motors_ are the objects allowing us to send motor commands and receive data.
|
private |
Address the rotation direction of the motor.
|
private |
Additional data
slider_positions_ is the position of the linear potentiometer. Can be used as a joystick input.
|
private |
sliders_ these are analogue input, typically from linear potentiometers.
|
private |
Main board blmc_drivers overlay.
This object contains the API compatible with the blmc_drivers and BLMCJointModule(s).


public interface MasterPasswordProvider
A typical implementation of this class would pop up a dialog to ask the user
for the master password. Such providers should check
GraphicsEnvironment#isHeadless()
before returning, to avoid attempts
to pop up dialogues on server/headless installations.
Another example may be to read the master password from a file or from command line parameters.
CredentialManager
| Modifier and Type | Interface and Description |
|---|---|
static class |
MasterPasswordProvider.ProviderComparator
Set the provider's priority that determines the order in which various
master password providers will be invoked.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getMasterPassword(boolean firstTime)
Get the master password for the Credential Manager.
|
int |
getProviderPriority()
Get the priority of this provider.
|
void |
setMasterPassword(String password)
Set the master password.
|
String getMasterPassword(boolean firstTime)
This method will only be called if the provider returned
true
from #canProvideMasterPassword()
.
If the parameter firstTime
is true
, this is a
request for setting the master password, as the Keystore and
Truststore have not been created yet.
firstTime
- true
if this is the first time the keystore is
accessed, in which case the returned password will be used to
encrypt the keystore. If false
, the returned
password will be used to decrypt (unlock) the keystore.null
if not available (user
cancelled, etc.)#canProvideMasterPassword()
void setMasterPassword(String password)
password
- to setint getProviderPriority()
The providers with highest priority will be asked first, lower-priority
providers will be asked only if the higher ones either return
false
on the canProvideMasterPassword() method, or return
null
on the corresponding actual request.
It is undetermined who will be asked first if providers have the same priority.
A typical priority for UI providers that pop up a dialog to as the user
could be 100
, allowing server-side providers to override
with priorities like 500
, or fall-back providers (say by
reading system properties) to have a priority of 10
.
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.


--- layout: post title: Basic Python Training date: 2010-09-30 17:54:31.000000000 -05:00 type: post published: true status: publish categories: - Python tags: [] meta: _edit_last: '15714693' _wp_old_slug: '' _oembed_d53e1f3313c6bb1fc522567f21193bd2: "{{unknown}}" author: login: broberts65 email<EMAIL_ADDRESS>display_name: Bob Roberts first_name: '' last_name: '' ---
A friend of mine sent me a link today that has some good reading as far as Python training and the like. Check it out at http://learnpythonthehardway.org/index.
I especially like the "How to think like a computer Scientist" which is written specifically for Python.
BR


Home
Features
Demo
Dashboard
Login
Register
Login
{% if reset_link_sent == true %}
Reset link sent!
Please check your email to reset password.
{% endif %} {% if is_password_changed == true %}
Password changed!
You can now login with your new password.
{% endif %}
Login
Welcome
Email Address
Password
{% if invalid_cred == true %}
Incorrect email or password!
{% endif %}
Forgot Password?
Login
Don't Have an Account?
Register Now