projects/core/src/lib/action-abstract/action-abstract.ts
ActionAbstract
is extended by all action implementations
Provides all the behaviors, shared between each action
e.g. title, icon, visibility, disabled, active state
export class ActionCustom extends ActionAbstract<ActionCustomOptions, ActionCustomEvent> {
// Abstract properties need to be implemented by derived class
fire$: Observable<ActionCustomEvent>;
changes$: Observable<ActionCustomOptions>;
// A custom observable, specific to this action implementation
custom$: Observable<number>;
// A custom subject that is used to bridge reactive and non reactive world
protected custom: Subject<number>;
constructor(options: ActionCustomOptions,
component?: Type<ActionCustomComponentImpl>) {
this.fire = new Subject();
this.custom = new Subject();
this.fire$ = this.handleLivecycle(this.fire.asObservable(), false);
this.custom$ = this.handleLivecycle(this.custom.asObservable());
this.changes$ = this.handleLivecycle(Observable.merge(
this.title$.pipe(map(title => (<ActionCustomOptions>{ title }))),
this.icon$.pipe(map(icon => (<ActionCustomOptions>{ icon }))),
this.visible$.pipe(map(visible => (<ActionCustomOptions>{ visible }))),
this.disabled$.pipe(map(disabled => (<ActionCustomOptions>{ disabled }))),
this.custom$.pipe(map(custom => (<ActionCustomOptions>{ custom })))
));
}
// Abstract method trigger needs to be implemented by every derived class
trigger(): this {
this.fire.next({ action: this });
return this;
}
// A custom method to trigger custom subject and custom$ observable
fireCustom(): this {
this.custom.next(Math.random());
return this;
}
}
Properties |
Methods |
constructor(options: Options, component?: Type<ActionAbstractComponentImpl>)
|
||||||||||||
|
Abstract action
Parameters :
|
| Readonly ariaLabel$ |
Type : Observable<string>
|
|
|
| Readonly disabled$ |
Type : Observable<boolean>
|
|
|
| Abstract Readonly fire$ |
Type : Observable<FireEvent>
|
|
Abstract property, holding |
| Readonly icon$ |
Type : Observable<string>
|
|
|
| Readonly state$ |
Type : Observable<ActionState>
|
|
|
| Readonly title$ |
Type : Observable<string>
|
|
|
| Readonly visible$ |
Type : Observable<boolean>
|
|
|
| activate |
activate()
|
|
Will activate all observables in current action, unless action is already destroyed |
| deactivate |
deactivate()
|
|
Will deactivate all observables in current action, unless action is already destroyed |
| destroy |
destroy()
|
|
Will set action state to |
| disable |
disable()
|
|
Will disable action, if prevously enabled |
| enable |
enable()
|
|
Will enable action, if prevously disabled |
| getAriaLabel |
getAriaLabel()
|
|
Returns current action ariaLabel
Returns :
string
|
| getIcon |
getIcon()
|
|
Returns current action icon
Returns :
string
|
| getParent |
getParent()
|
|
Returns current parent of the action
Returns :
ActionGroup | undefined
|
| getTitle |
getTitle()
|
|
Returns current action title
Returns :
string
|
| hide |
hide()
|
|
Will nide the action, if previously visible |
| isActive |
isActive()
|
|
Returns boolean defining whether action has state
Returns :
boolean
|
| isDestroyed |
isDestroyed()
|
|
Returns boolean defining whether action has state
Returns :
boolean
|
| isDisabled |
isDisabled()
|
|
Returns boolean defining whether action is disabled
Returns :
boolean
|
| isEnabled |
isEnabled()
|
|
Returns boolean defining whether action is enabled
Returns :
boolean
|
| isHidden |
isHidden()
|
|
Returns boolean defining whether action is hidden
Returns :
boolean
|
| isInactive |
isInactive()
|
|
Returns boolean defining whether action has state
Returns :
boolean
|
| isVisible |
isVisible()
|
|
Returns boolean defining whether action is visible
Returns :
boolean
|
| setAriaLabel | ||||||||
setAriaLabel(ariaLabel: string)
|
||||||||
|
Will set the new ariaLabel and notify all ariaLabel subscribers
Parameters :
|
| setIcon | ||||||||
setIcon(icon: string)
|
||||||||
|
Will set the new icon and notify all icon subscriptions
Parameters :
|
| setTitle | ||||||||
setTitle(title: string)
|
||||||||
|
Will set the new title and notify all title subscriptions
Parameters :
|
| setVisibility | ||||||||
setVisibility(visibility: boolean)
|
||||||||
|
Will show or hide the action depending from the provided visibility boolean
Parameters :
|
| show |
show()
|
|
Will show the action, if previously hidden |
| Abstract trigger |
trigger()
|
|
Abstract method trigger should be implemented by each derived class, in
combination with |
import { Type } from '@angular/core';
import { BehaviorSubject, Observable, NEVER } from 'rxjs';
import { distinctUntilChanged, filter, switchMap, takeUntil } from 'rxjs/operators';
import {
ActionAbstractComponentImpl,
ActionAbstractEvent,
ActionAbstractOptions,
} from '../action-abstract/action-abstract.model';
import { ActionGroup } from '../action-group/action-group';
/**
* Default options for `ActionAbstract` - shared between **all** actions
* Extended by provided options in action `constructor`
*/
const defaultAbstractOptions: Required<ActionAbstractOptions> = {
title: '',
ariaLabel: '',
icon: '',
visible: true,
disabled: false,
};
/**
* The state of the action
* Can be `Active`, `Inactive` or `Destroyed`
*/
export const enum ActionState {
Active,
Inactive,
Destroyed,
}
/**
* @internal
*
* Used to uniquelly identify the action
*/
let increment = 0;
/**
* `ActionAbstract` is extended by **all** action implementations
* Provides all the behaviors, shared between **each** action
* *e.g. title, icon, visibility, disabled, active state*
*
* ## Example
*
```typescript
export class ActionCustom extends ActionAbstract<ActionCustomOptions, ActionCustomEvent> {
// Abstract properties need to be implemented by derived class
fire$: Observable<ActionCustomEvent>;
changes$: Observable<ActionCustomOptions>;
// A custom observable, specific to this action implementation
custom$: Observable<number>;
// A custom subject that is used to bridge reactive and non reactive world
protected custom: Subject<number>;
constructor(options: ActionCustomOptions,
component?: Type<ActionCustomComponentImpl>) {
this.fire = new Subject();
this.custom = new Subject();
this.fire$ = this.handleLivecycle(this.fire.asObservable(), false);
this.custom$ = this.handleLivecycle(this.custom.asObservable());
this.changes$ = this.handleLivecycle(Observable.merge(
this.title$.pipe(map(title => (<ActionCustomOptions>{ title }))),
this.icon$.pipe(map(icon => (<ActionCustomOptions>{ icon }))),
this.visible$.pipe(map(visible => (<ActionCustomOptions>{ visible }))),
this.disabled$.pipe(map(disabled => (<ActionCustomOptions>{ disabled }))),
this.custom$.pipe(map(custom => (<ActionCustomOptions>{ custom })))
));
}
// Abstract method trigger needs to be implemented by every derived class
trigger(): this {
this.fire.next({ action: this });
return this;
}
// A custom method to trigger custom subject and custom$ observable
fireCustom(): this {
this.custom.next(Math.random());
return this;
}
}
```
*/
export abstract class ActionAbstract<
Options extends ActionAbstractOptions,
FireEvent extends ActionAbstractEvent | null,
> {
/**
* @internal
*
* Used to uniquelly identify the action
*/
readonly _actionId = increment++;
/**
* `Observable` that notifies subscriptions when title changes
*/
readonly title$: Observable<string>;
/**
* `Observable` that notifies subscriptions when icon changes
*/
readonly icon$: Observable<string>;
/**
* `Observable` that notifies subscriptions when visibility state changes
* (visible or hidden)
*/
readonly visible$: Observable<boolean>;
/**
* `Observable` that notifies subscriptions when disabled state changes
*/
readonly disabled$: Observable<boolean>;
/**
* `Observable` that notifies subscriptions when action state changes
* e.g. `Active`, `Inactive`, `Destroyed`
*/
readonly state$: Observable<ActionState>;
/**
* `Observable` that notifies subscribers when the ariaLabel changes.
*/
readonly ariaLabel$: Observable<string>;
/**
* **Abstract** property, holding `Observable`
* Each derived class **should** implement it's own `fire$` observable,
* with it's own specific implementation
*/
abstract readonly fire$: Observable<FireEvent>;
/**
* **Abstract** property, holding `Observable`
* Each derived class **should** implement it's own `changes$` observable,
* merging all public observables, notifying for every change doen to action
*/
abstract readonly changes$: Observable<Options>;
/**
* Options of action instance
* **Merged** default options from derived class, default options from abstract class,
* and options provided on action creation to `constructor`
*/
protected readonly options: Options;
/**
* `Component`, provided to action `constructor`
* Should be forced and used instead of component in `Injector`
* That is handled by `ActionOutletDirective`
*/
protected readonly forcedComponent?: Type<ActionAbstractComponentImpl>;
/**
* Title `BehaviorSubject`, used **internally** to notify on title change
* Used to leverage reactive world with non reactive
*/
protected readonly title: BehaviorSubject<string>;
/**
* Icon `BehaviorSubject`, used **internally** to notify on icon change
* Used to leverage reactive world with non reactive
*/
protected readonly icon: BehaviorSubject<string>;
/**
* Visibility `BehaviorSubject`, used **internally** to notify on visibility state change
* Used to leverage reactive world with non reactive
*/
protected readonly visible: BehaviorSubject<boolean>;
/**
* Desabled state `BehaviorSubject`, used **internally** to notify on disabled state change
* Used to leverage reactive world with non reactive
*/
protected readonly disabled: BehaviorSubject<boolean>;
/**
* Action livecycle state `BehaviorSubject`, used **internally** to notify on action state change
* Used to leverage reactive world with non reactive
*/
protected readonly state: BehaviorSubject<ActionState>;
/**
* `Observable` that fires, when state matches `ActionState.Destroyed`
* Used to complete all **internal** subjects
*/
protected readonly finish: Observable<ActionState>;
/**
* `BehaviorSubject`, used to notify subscribers on aria label changes.
*/
protected readonly _ariaLabel$: BehaviorSubject<string>;
/**
* Parent of current action. This is a parent action,
* to whom current action belongs to, and renders into
*/
private parent?: ActionGroup;
/**
* Abstract action `constructor`. It will:
* - **Extend** default options with derived default options and custom options
* - **Create** all private subjects that are used to leverage reactive world with non reactive
* - **Create** observable for each private subject
* - **Assign** forced component, that is going to be used by `ActionOutletDirective`
*
* @param options Options for `ActionAbstract`
* @param component Optional custom `Component`
*/
constructor(options: Options, component?: Type<ActionAbstractComponentImpl>) {
const { title, icon, visible, disabled, ariaLabel } = (this.options = { ...defaultAbstractOptions, ...options });
this.title = new BehaviorSubject(title);
this.icon = new BehaviorSubject(icon);
this.visible = new BehaviorSubject(visible);
this.disabled = new BehaviorSubject(disabled);
this._ariaLabel$ = new BehaviorSubject(ariaLabel);
this.state = new BehaviorSubject(<ActionState>ActionState.Inactive);
this.finish = this.state.pipe(filter(state => state === ActionState.Destroyed));
this.title$ = this.handleLivecycleDistinct(this.title.asObservable());
this.icon$ = this.handleLivecycleDistinct(this.icon.asObservable());
this.ariaLabel$ = this.handleLivecycleDistinct(this._ariaLabel$.asObservable());
this.visible$ = this.handleLivecycleDistinct(this.visible.asObservable());
this.disabled$ = this.handleLivecycleDistinct(this.disabled.asObservable());
this.state$ = this.state.asObservable().pipe(distinctUntilChanged());
this.forcedComponent = component;
}
/**
* Abstract method trigger should be implemented by **each** derived class, in
* combination with `fire` subject and `fire$` observable
*/
abstract trigger(): this;
/**
* Used **internally** to handle livecycle of observables
* It will handle action state(`Active`, `Inactive` - **paused**, `Destroyed`),
* and will notify **only** when value or reference **changes**
*
* @param observable `Observable` to handle live cycle
* @param shouldPause Defining, whether it should be possible to pause provided observable. True by default
*/
protected handleLivecycleDistinct<T>(observable: Observable<T>, shouldPause?: boolean): Observable<T> {
return this.handleLivecycle(observable, shouldPause).pipe(distinctUntilChanged());
}
/**
* Used internally to handle livecycle of observables
* It will handle action state(`Active`, `Inactive` - **paused**, `Destroyed`)
*
* @param observable `Observable` to handle live cycle
* @param shouldPause Defining, whether it should be possible to pause provided observable. True by default
*/
protected handleLivecycle<T>(observable: Observable<T>, shouldPause: boolean = true): Observable<T> {
const source = observable.pipe(takeUntil(this.finish));
if (!shouldPause) {
return source;
}
return this.handleActivateState(source);
}
/**
* Used **internally** to handle pausing of observables
* Will deactivate observable, whenever state of the action changes to `Inactive`,
* and will activate observable again, when it switches back to `Active`
*
* @param observable `Observable` to handle pausing
*/
protected handleActivateState<T>(observable: Observable<T>): Observable<T> {
return this.state.pipe(switchMap(state => (state === ActionState.Inactive ? NEVER : observable)));
}
/**
* Will **activate** all observables in current action,
* **unless action is already destroyed**
*/
activate(): this {
if (this.isDestroyed()) {
return this;
}
this.state.next(ActionState.Active);
return this;
}
/**
* Will **deactivate** all observables in current action,
* **unless action is already destroyed**
*/
deactivate(): this {
if (this.isDestroyed()) {
return this;
}
this.state.next(ActionState.Inactive);
return this;
}
/**
* Will set action state to `Destroyed`, which will
* complete all observables
*/
destroy(): this {
this.state.next(ActionState.Destroyed);
this.state.complete();
return this;
}
/**
* Returns boolean defining whether action has state `ActionState.Active`
*/
isActive(): boolean {
return this.state.getValue() === ActionState.Active;
}
/**
* Returns boolean defining whether action has state `ActionState.Inactive`
*/
isInactive(): boolean {
return this.state.getValue() === ActionState.Inactive;
}
/**
* Returns boolean defining whether action has state `ActionState.Destroyed`
*/
isDestroyed(): boolean {
return this.state.getValue() === ActionState.Destroyed;
}
/**
* Will set the new title and notify all title subscriptions
*
* @param title The new action title
*/
setTitle(title: string): this {
this.title.next(title);
return this;
}
/**
* Returns current action title
*/
getTitle(): string {
return this.title.getValue();
}
/**
* Will set the new ariaLabel and notify all ariaLabel subscribers
*
* @param ariaLabel The new action title
*/
setAriaLabel(ariaLabel: string): this {
this._ariaLabel$.next(ariaLabel);
return this;
}
/**
* Returns current action ariaLabel
*/
getAriaLabel(): string {
return this._ariaLabel$.getValue();
}
/**
* Will set the new icon and notify all icon subscriptions
*
* @param icon The new action icon
*/
setIcon(icon: string): this {
this.icon.next(icon);
return this;
}
/**
* Returns current action icon
*/
getIcon(): string {
return this.icon.getValue();
}
/**
* Will show the action, **if previously hidden**
*/
show(): this {
this.visible.next(true);
return this;
}
/**
* Will nide the action, **if previously visible**
*/
hide(): this {
this.visible.next(false);
return this;
}
/**
* Will show or hide the action depending from the provided visibility boolean
*
* @param visibility The new visibility
*/
setVisibility(visibility: boolean): this {
this.visible.next(visibility);
return this;
}
/**
* Returns boolean defining whether action is visible
*/
isVisible(): boolean {
return this.visible.getValue();
}
/**
* Returns boolean defining whether action is hidden
*/
isHidden(): boolean {
return !this.visible.getValue();
}
/**
* Will enable action, **if prevously disabled**
*/
enable(): this {
this.disabled.next(false);
return this;
}
/**
* Will disable action, **if prevously enabled**
*/
disable(): this {
this.disabled.next(true);
return this;
}
/**
* Returns boolean defining whether action is disabled
*/
isDisabled(): boolean {
return this.disabled.getValue();
}
/**
* Returns boolean defining whether action is enabled
*/
isEnabled(): boolean {
return !this.disabled.getValue();
}
/**
* Returns a `Component`, that is provided as forced component via action `constructor`
* This component should be used by `ActionOutletDirective`, to represent
* the action in DOM, instead the component, provided via Angular `Injector`
*/
getForcedComponent(): Type<ActionAbstractComponentImpl> | undefined {
return this.forcedComponent;
}
/**
* Returns current parent of the action
*/
getParent(): ActionGroup | undefined {
return this.parent;
}
/**
* @internal
*
* **Internal** method to set parent of current action. It will:
* - **Set** parent, but only if currently not defined
* - **Disable** current action if parent is disabled
* - **Activate** current action if parent is active
*/
_setParent(parent: ActionGroup): this {
if (this.parent === undefined) {
this.parent = parent;
if (this.parent.isDisabled()) {
this.disable();
}
if (this.parent.isActive()) {
this.activate();
}
}
return this;
}
/**
* @internal
*
* **Internal** method to unset parent of current action. It will:
* - **Set** parent to undefined
* - **Enable** current action
* - **Deactivate** current action
*/
_unsetParent(): this {
this.parent = undefined;
this.enable();
this.deactivate();
return this;
}
}


VisDA Challenge
Aeroplane
Bicycle
Bus
Car
Horse
Knife
Motorcycle
Person
Plant
Skateboard
Train
Truck


Latest News
-
Firefox and Chrome Extensions
I just broke over 100 users for my Quick Bookmarks addon/extension when I realized that I have never posted about it before, so here it goes. Quick Bookmarks is an add-on for Firefox and an extension for Chrome that allows the user to quickly access their favorite bookmarks, or to create a new bookmark.
Read More
-
Arduino Game
This is a game I made back in May of 2016 and haven't had time to post until now. It is an arduino version of the game "Simon", in which the player has to match a pattern given. If the player is correct, an additional item is added to the sequence until the player loses.
Read More
-
Gitlab
It has been a long time since I last posted, but I have been working on many projects that I can't wait to share with you.
Read More
-
3d Printing
These are some small 3d printed pieces that I made. I recently had some time to experiment with a 3d printer and I have been liking what I can do with it. All the pieces are from www.thingiverse.com and I can imagine it took the creators some time to make them.
Read More
-
Self Describing Number
Recently, there was a new riddle posted to youtube on the Singing Banana (the guy from Numberphile) channel. The riddle was to find a self describing number. That is to say, find a number where the first digit tells how many zeros there are in the number. The second digit tells how many ones are in the number. The third tells how many threes there are. And so on and so on. For a better description, check out the original video at https://www.youtube.com/watch?v=K6Qc4oK_HqY
Read More


Here, You can encrypt your PDF with a password to keep sensitive data confidential. Or, Decrypt the already encrypted PDF files to make them password free.


M.O.T.H Systems
Dashboard
Configure
Map
Other Pages
Login Page
Registration Page
Forgot Password Page
Logout
Dashboard
Home
UAV Roster
Serial Number: UMB2K9PS
Status: Ready to Launch
Payload: Radar
Serial Number: 47XS9DDX
Status: In Flight
Payload: EO/IR Camera
Serial Number: EME2YXZB
Status: In Repair
Payload: Radar
Serial Number: 7KVLV3BL
Status: Ready to Launch
Payload: Radar
Ready to Leave?
×
Select "Logout" below if you are ready to end your current session.


--- status: publish published: true title: Hadoop + HBase + Cygwin + Windows 7 x64 excerpt: "In this post I will describe how to get a Hadoop environment with HBase running in Cygwin on Windows 7 x64." date: '2010-10-24 13:15:42 +0200' date_gmt: '2010-10-24 12:15:42 +0200' ---
In this post I will describe how to get a Hadoop environment with HBase running in Cygwin on Windows 7 x64.
Having spent the better part of a week reading through blog posts and documentation, I found that none of them covered the process in full detail, at least not for the software versions I intended to use.
This guide was written for Cygwin 1.7.7, Hadoop 0.21.0 and HBase 0.20.6.
UPDATE (Sept. 5, 2011): I no longer have this system running (switched to Ubuntu), and will most likely not be able to answer questions about the setup. I would recommend you to ask your questions on the hadoop-users mailinglist. You will find information on how to subscribe and post to the list on the Hadoop website.
UPDATE (May 25, 2011): If you are using this guide, remember to have a look at the comments, some of them concern version updates and other related issues.
UPDATE (Nov. 1, 2010): I've noticed some errors arising when using Hadoop 0.21.0 and HBase 0.20.6 and gone back to Hadoop 0.20.2 instead as this does not produce the same errors. If you intend to use HBase together with Hadoop I would recommend setting up Hadoop 0.20.2 instead, the installation is more or less identical.
Throughout this guide I will assume that your Cygwin install path will be c:\cygwin and that Hadoop, ZooKeeper and HBase will be installed in c:\cygwin\etc\local (/etc/local/), this is however something you can choose yourself. If you choose to install Cygwin elsewhere, I would recommend to use folder names without whitespaces and other non-regular charaters.
The only prerequisite for this quite is that you have Java installed and added to your %PATH% variable (which is usually done automatically).
Throughout the Cygwin section - if you find yourself lost, please follow Vlad Korolev's guide on how to get Cygwin up and running for Hadoop and make sure to additionally install tcp_wrappers and diffutils when chosing packages. Follow steps 2 to 4 in the guide and then continue with the Hadoop installation guide below.
If you're familiar with Cygwin you just need to make sure you have these packages installed:
ssh-host-config
When asked about privilege separation answer no
When asked if sshd should be installed as a service answer yes
When asked about the CYGWIN environment variable, enter ntsec
Now go to the Services and Applications toll in Windows, locate the CYGWIN sshd service and start it.
Next Cygwin step is to set up the passwordless login. Go to your Cygwin terminal and enter
ssh-keygen
Do not use a passphrase and accept all default values. After the process is finished do the following
cd ~/.ssh \n
cat id_rsa.pub >> authorized_keys
This will add your identification key to the set of authorized keys, i.e. those that are allowed to login without entering a password.
Try connecting to localhost to see whether it works
ssh localhost
Doing this the first time should prompt you with a warning, enter yes and enter. Now try issuing the same command, this time there should be no warning and no need to enter a password.
This concludes the Cygwin installation.
First - copy the downloaded tar.gz file to c:\cygwin\usr\local (which corresponds to /usr/local in the Cygwin environment). When this is done, it's time to extract the package, this is done by issuing
tar xvzf hadoop-0.21.0.tar.gz
This command extracts the content of the downloaded hadoop file into c:\cygwin\usr\local\hadoop-0.21.0 (/usr/local/hadoop-0.21.0).
Hadoop requires some configuration, the configuration files are located in c:\cygwin\usr\local\hadoop-0.21.0\conf.
The files that need to be altered are:
core-site.xml
fs.default.name
hdfs://<IP_ADDRESS>:9100
mapred-site.xml
mapred.job.tracker
<IP_ADDRESS>:9101
and hdfs-site.xml
dfs.replication
1
dfs.permissions
false
Only Hadoop 0.21.0: Next, one line has to be added to the hadoop-config.sh file in hadoop-0.21.-0/bin
CLASSPATH=`cygpath -wp "$CLASSPATH"`
Add this line before the line containing
JAVA_LIBRARY_PATH=''
The reason for this is that in order for the CLASSPATH to be build with all the Hadoop jars (line ~120 to ~200) the path needs to be in the Cygwin format (/cygdrive/c/cygwin/usr/local/hadoop...), however in order for Java use the classpath, it needs to be in the Windows format (c:\cygwin\usr\local\hadoop..). The line transforms the Cygwin built classpath to one that is understood by Windows.
This should be enough for Hadoop to run, test the installation by issuing these commands in a Cygwin window:
cd /usr/local/hadoop-0.21.0
mkdir logs
bin/hadoop namenode -format
The last command will take some seconds to finish and should produce about 20 lines of output during the creation of the namenode filesystem.
The final step of the Hadoop setup is to start it and test it.
To start it issue the following commands in a Cygwin window:
cd /usr/local/hadoop-0.21.0
bin/start-dfs.sh
bin/start-mapred.sh
Providing no error messages are printed, this should have started Hadoop. This can be checked by opening http://localhost:9100 and http://localhost:9101 in a browser. The first link should provide information about the NameNode, make sure that the Live Nodes count is 1. The second link provides information about the cluster.
Now it's time to run a little job on the cluster to see whether or not the installation was successfull.
First, copy some files to the node:
cd /usr/local/hadoop-0.21.0
mkdir input
cp conf/*.xml input
bin/hadoop jar hadoop-*examples.jar grep input output 'dfs[a-z.]+'
cat output/*
Provided there were no errors, you've just run your first Hadoop process.
Luckily the ZooKeeper install and configuration is quite easy.
First, copy the download zookeeper-3.3.1-tar.gz file to your c:\cygwin\usr\local directory, open a Cygwin window and issue the following commands:
cd /usr/local/
tar xvzf zookeeper-3.3.1.tar.gz
ZooKeeper's configuration file (zoo.cfg) is located in /usr/local/zookeeper-3.3.1/conf (c:\cygwin\usr\loca\zookeeper-3.3.1\conf).
Open the file and paste the following content into it, overwriting the original config:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/tmp/zookeeper/data
# the port at which the clients will connect
clientPort=2181
Make sure to create the /tmp/zookeeper/data directory and make it writable for everyone (chmod 777).
ZooKeeper is started by typing:
cd /user/local/zookeeper-3.3.1
bin/zkServer.sh start
Make sure to test if ZooKeeper is running correctly by connecting to it
bin/zkCli.sh -server <IP_ADDRESS>:2181
This should connect you to ZooKeeper, you can type help to see what commands are available, however the only one you need to care about is quit.
tar xvzf hbase-0.20.6.tar.gz
in a Cygwin terminal.
Now it's time to create a symlink to your JRE directory in /usr/local/. Do this by typing:
ln -s /cygdrive/c/Program\ Files/Java/ /usr/local/
in a Cygwin terminal.
HBase's configuration files are located in /usr/local/hbase-0.20.6/conf/ (C:\cygwin\usr\local\hbase-0.20.6\conf), and to get HBase up and running we need to edit hbase-env.sh and hbase-default.xml.
In the hbase-env.sh the JAVA_HOME, HBASE_IDENT_STRING and HBASE_MANAGES_ZK variables have to be set, this is done by editing the lines containing the variable names to read:
export JAVA_HOME=/usr/local/jre6
export HBASE_IDENT_STRING=$HOSTNAME
export HBASE_MANAGES_ZK=false
The last variable tells HBase not to use the bundled ZooKeeper server, as we've already installed a stand alone one.
Next, the hbase-default.xml file has to be edited, the two properties that need to be set are hbase.rootdir and hbase.tmp.dir
hbase.rootdir
file:///C:/cygwin/tmp/hbase/data
The directory shared by region servers.
Should be fully-qualified to include the filesystem to use.
E.g: hdfs://NAMENODE_SERVER:PORT/HBASE_ROOTDIR
hbase.tmp.dir
C:/cygwin/tmp/hbase/tmp
Temporary directory on the local filesystem.
Make sure that both directories exist and are writeable by all users (chmod 777).
The command for starting HBase is:
cd /user/local/hbase-0.20.6
bin/start-hbase.sh
This section is very similar to what's found on the HBase wiki, the difference is the standalone ZooKeeper config.
The startup procedure should follow this order:
ZooKeeper:
cd /usr/local/zookeeper-3.3.1
bin/zkServer.sh start
Hadoop:
cd /usr/local/hadoop-0.21.0
bin/start-dfs.sh
bin/start-mapred.sh
HBase:
cd /usr/bin/hbase-0.20.6
bin/start-hbase.sh


Ourcord is a new and alternative discord library for js that focuses on speed and simplicity while retaining low level functions of the discord API
npm i ourcord
That's it for installation 🎈
const { Client } = require("ourcord");
const client = new Client("your bot token here");
client.connect();
client.on("ready", () => {
console.log("Client connected!");
});
| Option | Type | Default | Description | Optional? |
|---|---|---|---|---|
| browser | string |
ourcord | Specify the browser you want to connect via (can be anything) | yes |
| device | string |
ourcord | The device you want to connect with (can be anything) | yes |
| prefix | string |
Null |
Specify the prefix for the bot | yes |
| activity | object |
No activity | The activity you want to appear on your client on connect | yes |
| status | string |
dnd | The status you want your client to connect with | yes |
Generated using TypeDoc


Click on the following button to show the host of this web page using the location.host property:-
Click on the following button to go forward to the last web page using the history.forward method:-


| I l@ve RuBoard |
This appendix has discussed some of the major threading issues you will encounter using Python on Win32. We have made absolutely no attempt to explain either thread programming in general, or the many threading and synchronization functions available on the Win32 platforms. We simply tried to explain the Python-specific issues when using these functions.
For further information on Python's standard threading capabilities, please see the Python documentation optionally installed with the Python binaries. For more information on the Win32 threading and synchronization capabilities, please see the Microsoft Win32 documentation.
| I l@ve RuBoard |


Cards require a small amount of markup and classes to provide you with as much control as possible. These classes and markup are flexible though and can typically be remixed and extended with ease. For example, if your card has no flush content like images, feel free to put the .card-body
class on the .card
element to consolidate your markup.
Icing powder caramels macaroon. Toffee sugar plum brownie pastry gummies jelly.
Go somewhereSweet halvah dragée jelly-o halvah carrot cake oat cake. Donut jujubes jelly chocolate cake marzipan chocolate chocolate bar.

Card link Another linkCards support a wide variety of content, including images, text, list groups, links, and more. Mix and match multiple content types to create the card you need.
Some quick example text to build on the card title and make up the bulk of the card's content.
Go somewhereSome quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Some quick example text to build on the card title and make up the bulk of the card's content.
Candy cupcake sugar plum oat cake wafer marzipan jujubes lollipop macaroon. Cake dragée jujubes donut chocolate bar chocolate cake cupcake chocolate topping. Dessert jelly beans toffee muffin.
Card link Another linkConstrain the width of cards via custom CSS, our predefined grid classes, or with custom styles using our grid mixins.
You can quickly change the text alignment of any card—in its entirety or specific parts—with our text align classes.
Gummi bears I love oat cake gingerbread donut cotton candy pie biscuit tart. Chocolate cake chocolate cake I love marzipan cookie macaroon. Tart I love I love carrot cake carrot cake chupa chups caramels. Carrot cake pastry cotton candy.
Dessert I love brownie biscuit topping I love chocolate cake gingerbread jelly beans. Chocolate cake cake cheesecake. Chocolate cake pastry macaroon.
Go somewhereGummi bears I love oat cake gingerbread donut cotton candy pie biscuit tart. Chocolate cake chocolate cake I love marzipan cookie macaroon. Tart I love I love carrot cake carrot cake chupa chups caramels. Carrot cake pastry cotton candy.
Dessert I love brownie biscuit topping I love chocolate cake gingerbread jelly beans. Chocolate cake cake cheesecake. Chocolate cake pastry macaroon.
Go somewhereGummi bears I love oat cake gingerbread donut cotton candy pie biscuit tart. Chocolate cake chocolate cake I love marzipan cookie macaroon. Tart I love I love carrot cake carrot cake chupa chups caramels. Carrot cake pastry cotton candy.
Dessert I love brownie biscuit topping I love chocolate cake gingerbread jelly beans. Chocolate cake cake cheesecake. Chocolate cake pastry macaroon.
Go somewhereSimilar to headers and footers, cards include top and bottom image caps.
Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need .text-white
Jelly-o sesame snaps cheesecake topping. Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin. Dessert bonbon caramels brownie chocolate bar chocolate tart dragée.
Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin.
Last updated 3 mins ago
Jelly-o sesame snaps cheesecake topping. Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin. Dessert bonbon caramels brownie chocolate bar chocolate tart dragée.
Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin.
Last updated 3 mins ago
Cards include their own variant classes for quickly changing the background-color
and border-color
of a card. Darker colors require the use of .text-white
.
Cards include a class for quickly toggling the text color. By default, cards use dark text and assume a light background. Add .text-white
for white text and specify the background-color
and border-color
to go with it.
You can also use .text-white
with the contextual backgrounds variants.
Donut toffee candy brownie soufflé macaroon.
456 items
Donut toffee candy brownie soufflé macaroon.
Donut toffee candy brownie soufflé macaroon.
945 items
Donut toffee candy brownie soufflé macaroon.
In need of a colored card, but not the hefty background colors they bring? Replace the default modifier classes with the .border-*
ones to style just the border-color
of a card.
Donut toffee candy brownie soufflé macaroon.
456 items
Donut toffee candy brownie soufflé macaroon.
Donut toffee candy brownie soufflé macaroon.
945 items
Donut toffee candy brownie soufflé macaroon.
Use card groups to render cards as a single, attached element with equal width and height columns. By default, card groups use display: table;
and table-layout: fixed;
to achieve their uniform sizing. However, enabling flexbox mode can switch that to use display: flex;
and provide the same effect.
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
Need a set of equal width and height cards that aren’t attached to one another? Use card decks. By default, card decks require two wrapping elements: .card-deck-wrapper
and a .card-deck
. We use table styles for the sizing and the gutters on .card-deck
. The .card-deck-wrapper
is used to negative margin out the border-spacing
on the .card-deck
.
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
Cards can be organized into Masonry-like columns with just CSS by wrapping them in .card-columns
. Only applies to small devices and above.
Heads up! This is not available in IE9 and below as they have no support for the column-* CSS properties.
Some quick example text to build on the card title and make up the bulk of the card's content.
Go somewhereDonut toffee candy brownie soufflé macaroon.
945 items
456 items
Jelly-o sesame snaps cheesecake topping. Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin. Dessert bonbon caramels brownie chocolate bar chocolate tart dragée.
Cupcake fruitcake macaroon donut pastry gummies tiramisu chocolate bar muffin.
Last updated 3 mins ago
Donut toffee candy brownie soufflé macaroon.


class: center, middle, inverse, title-slide # Geography 13 ## Lecture 03: The Digital Environment ### Mike Johnson --- class: center, middle  --- class: middle, center ## Today -- Files -- Naming Things -- Data Types --- class: center, middle ## Managing your projects in a reproducible way doesn't just make your science better, but it makes your life easier --- # Your Computer **Computer**: an electronic device for _storing_ and _processing_ data, typically in binary form, according to instructions    -- **File**: a block of arbitrary information available to a computer program    --- # File Storage - Files are stored as a collection of bytes on a hard drive -- - Hard drives do not understand files - they just store bytes -- - We need ways to retrieve (and write) **bytes** from (to) the hard drive. --- # Bytes? But what is a byte? - a group of binary digits or bits (usually eight) operated on as a unit. - a byte considered as a unit of memory size. - The bit is a basic unit of information in computing and represents a logical state with two possible values (0 or 1).  --- class: center, middle # [Example](https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html) --- count: false #Bytes - Raw - Human Readable... .panel1-bytes-auto[ ```r *(x <- "GIS is Great!!!") ``` ] .panel2-bytes-auto[ ``` [1] "GIS is Great!!!" ``` ] --- count: false #Bytes - Raw - Human Readable... .panel1-bytes-auto[ ```r (x <- "GIS is Great!!!") *(y <- charToRaw(x)) ``` ] .panel2-bytes-auto[ ``` [1] "GIS is Great!!!" ``` ``` [1] 47 49 53 20 69 73 20 47 72 65 61 74 21 21 21 ``` ] --- count: false #Bytes - Raw - Human Readable... .panel1-bytes-auto[ ```r (x <- "GIS is Great!!!") (y <- charToRaw(x)) *(z <- rawToBits(y)) ``` ] .panel2-bytes-auto[ ``` [1] "GIS is Great!!!"     -- - There are 1000's of different formats for data -- - Each format defines how the sequence of bits and bytes are laid out -- - indicate the characteristics of the file, its intended use, and the default applications that can open/use the file. -- - If you double click a .docx file it opens in Word and the Word software interprets the meaning of the bytes -- - If you double click an .R file it opens with RStudio, and RStudio interprets the meaning of the bytes -- can be considered a type of metadata that provides information about the way data might be stored -- - common extensions include .doc, .docx, .txt, .csv, .ppt, .shp, .R ... <br> <center> <i class="fas fa-file-code fa-5x"></i> <i class="fas fa-file-word fa-5x"></i> <i class="fas fa-file-pdf fa-5x"></i> <i class="fas fa-file-image fa-5x"></i> <i class="fas fa-file-video fa-5x"></i> <i class="fas fa-file-csv fa-5x"></i> </center> --- **Filesystem**: describes the methods that an operating system uses to organize files <center>
</center> --- # ... **Directory**: is a location for storing, organizing, and separating files and other directories on a computer. Think of folders! <center> <i class="fas fa-folder fa-5x"></i> <i class="fas fa-folder-open fa-5x"></i> </center> --- **Root directory**: the "highest" or top-level directory in the hierarchy. The root directory contains all other folders/files in the drive or folder <center> <i class="fas fa-home fa-5x"></i> </center> - Sometimes referred to as the home directory --- # File Paths - File paths tell us the location of a file within the file system -- - Directories are stored as hierarchies, again with root (home) directory being the one holding everything on a system -- ![](lec-img/03-file-system.png) - The folder you are in, is called your **working directory**. (think pwd) - The folder above
the working directory is the **parent directory** - All folders within the working directory are **subfolders** or **child** folder --- # Declaring File Paths Files are located by their path. Think of this as the directions - from the root directory. - Directories are separated with backslashes ("\") on windows, and forward slashes ("/") or MacOS and Linux machines. ## Example: <span style=" color: red !important;font-size: 24px;" >/Users/mikejohnson/github/spds/lectures/lec-img/02-isaias-track.png</span> - **Root**: /Users/mikejohnson ```bash cd ~ pwd ``` ``` /Users/mikejohnson ``` - **git-enabled projects**: github - **project**: spds - **subdirectory**: lectures - **subdirectory**: lec-img - **file**: 02-isaias-track.png --- # Absolute vs Realative Paths There are two ways to specify a file path. - An absolute path always begins in the **root folder** - A relative path is relative to the current working directory - The dot (.) and dot-dot (..) notation to help us write shorter paths - A single '.' denotes “this directory”. - Two periods (“..”) means “the parent directory” <center> <img src="lec-img/03-realtive-absolute-paths.jpg" width="60%"> </center> --- class: inverse, middle, center ## Working with absolute paths can be a pain compared to relative paths... --- # Enforcing Relative Paths ... It is a good practice to keep all the files associated with a project — input data, R scripts, analytic results, figures - together. -- This is such a common practice that RStudio has built-in support for this via **projects**. -- A good project layout will ultimately make your life easier: -- - It will help ensure the integrity of your data; - It makes it simpler to share your code with someone else (a lab-mate, collaborator, or supervisor); - It allows you to easily upload your code with your manuscript submission; - It makes it easier to pick the project back up after a break. --- class: middle, center # Things that are good but not fun <img src="lec-img/03-laundry.jpeg" width="100%"> --- # Code Organization ## Typical Project ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ├── R │ └── some-code.R | └── utils.R ├── img | └── cool-img.png ├── docs | └── index.Rmd | └── index.html ├── data └── data.csv ``` --- # my_project - This is a project called "my_project" -- - The name of the project is the same as the directory -- - <i class="fa fa-ban" aria-hidden="true"></i> spaces -- - <i class="fa fa-ban" aria-hidden="true"></i> special characters -- - Each Project is a directory containing files relevant to that project -- - all git enabled projects can go in our `~/github` directory --- # Creating an R Project - RStudio can help us create a new R project. - An RStudio Project file (.Rproj) is analogous to an .mxd file for ArcMap. It contains information about the specific settings for a “project”. -- - File --> New Project -- Everything we do in R should be version controlled (with git!). When making a new project: -- - File --> New Project --> New Directory --> New Project -- - Create the project as a subfolder of the `~github` directory -- - <i class="fas fa-check-square"></i> create git repository -- ```r . └── github └── my_project └── my_project.Rproj └── .gitignore ``` The "."  --- # R Project - An R project is a working directory designated with a .RProj file. ```r . └── github └── my_project └── my_project.Rproj └── .gitignore ``` -- - When you open a project: - In RStudio: File --> Open Project - Outside RStudio: double–clicking on the .Rproj file the working directory is automatically be set to the directory where .RProj file is located! -- - Allows you to work with relative rather then absolute paths! -- - Consider creating a new R Project whenever you are starting a new project. -- - This will enforce a self contained project with associated data, scripts, and output --- # Building the rest of the Project... --- # README.md README files are the "users manual" for the project - What is the name - purpose - installation directions - rules of use We use the md extension (markdown) because GitHub For us, a title, 1-2 sentence description and data attribution is plenty. ```bash touch README.md ``` ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ``` --- # R or (src) - A directory call R (or src) is used to hold all scripts used in the analysis. - The can be data processing, analysis, or figure generation sripcts ```bash mkdir R # make a R directory cd R # Enter the R directory touch some-code.R # make a file touch utils.R # make a file cd.. # move back up to my_project directory ``` ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ├── R └── some-code.R └── utils.R ``` --- # imgs (or img or figs or output) This folder is for things that are saved as a result of your scripts - Plot images - Maps - Ect This directory only contains generated files; that is, you should always be able to delete the contents and regenerate them. ```bash mkdir imgs # make a imgs directory ``` ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ├── R │ └── some-code.R | └── utils.R ├── img └── cool-img.png ``` --- # docs (only docs) - the docs folder should hold your Rmarkdown files and there rendered output - Github Pages can be deployed from the docs folder making this a good practive if you want to share information over the web in a free secure way ```bash mkdir R # make a docs directory cd docs # Enter the docs directory touch index.Rmd # make a file cd.. # move back up to my_project directory ``` ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ├── R │ └── some-code.R | └── utils.R ├── img | └── cool-img.png ├── docs └── index.Rmd └── index.html ``` --- # data - the data folder is an storage archive for raw data - Its **crucial** to make a distinction between source/raw data and generated data: Treat source/raw data as **read-only** Treat generated data as disposable. - Some might separate raw and generated data into separate sub directories. I prefer to segment them through the naming ```bash mkdir data # make a data directory ``` ```r . └── github └── my_project └── my_project.Rproj └── .gitignore └── README.md ├── R │ └── some-code.R | └── utils.R ├── img | └── some-code.R ├── docs | └── index.Rmd | └── index.html ├── data └── data.csv ``` --- # Rules... ###1. Treat data as read only ###2. Treat generated output as disposable ###3. Other then that, structure should match the project goals and is flexable! <img src="lec-img/03-rules.jpeg" width="100%"> --- # The goal for workflows: We will do everything in **well-annotated**, **organized** scripts that contain streamlined and easy-to-follow records of our entire analyses from **raw data** through **final reports**, with **unbreakable** file paths and with a **complete history** of changes made ^[Allison Horst]. -- - **Well-annotated**: Through documentation and comments -- - **Organized**: Directory Strucutre -- - **Raw Data**: Keep raw data raw! -- - **Final Reports**: Rmarkdown files -- - **Unbreakable Paths**: Rproj to the rescue -- - **Complete History**: Version control with git and GitHub --- class: inverse, middle, center # File Names File names are how we locate and identify information stored on on machine. File names should be machine readable, human readable, and play well with default ordering: --- class: middle, center ## "There are only two hard things in Computer Science: cache invalidation and naming things." -- Phil Karlton --- # Three Principles for file names - machine readable - human readable - sortable --- ## machine readable -- - avoid spaces, punctuation, accented characters, and mixed cases -- - regular expression friendly (e.g. use patterns!) -- - use ISO 8601 dates (YYYY-MM-DD) -- - be consistent with delimiters (easy to compute on) - Use "_" (underscores) to separate "metadata" you want latter - Use "-" (hyphens) to separate words for readability (like dates or names) --- ## Doing so makes files ... easy to search for & narrow ```r # Only those files with pattern "_tx" files = list.files("data/usgs-files", pattern = "_tx") length(files) # total number of Texas files ``` ``` [1] 27 ``` ``` [1] "1903-07-01_08033500_00060_tyler_tx.txt" "1923-10-01_08033000_00060_angelina_tx.txt" ``` ### and metadata easy to recover (easy to compute on) ```r str_split(files, "[_\\.]", simplify = TRUE) ``` <table> <thead> <tr> <th style="text-align:left;"> StartDate </th> <th style="text-align:left;"> siteID </th> <th style="text-align:left;"> parameterCode </th> <th style="text-align:left;"> county </th> <th style="text-align:left;"> state </th> <th style="text-align:left;"> extension </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> 1903-07-01 </td> <td style="text-align:left;"> 08033500 </td> <td style="text-align:left;"> 00060 </td> <td style="text-align:left;"> tyler </td> <td style="text-align:left;"> tx </td> <td style="text-align:left;"> txt </td> </tr> <tr> <td style="text-align:left;"> 1923-10-01 </td> <td style="text-align:left;"> 08033000 </td> <td style="text-align:left;"> 00060 </td> <td style="text-align:left;"> angelina </td> <td style="text-align:left;"> tx </td> <td style="text-align:left;"> txt </td> </tr> <tr> <td style="text-align:left;"> 1923-10-01 </td> <td style="text-align:left;"> 08180500 </td> <td style="text-align:left;"> 00060 </td> <td style="text-align:left;"> medina </td> <td style="text-align:left;"> tx </td> <td style="text-align:left;"> txt </td> </tr> <tr> <td style="text-align:left;"> 1923-12-01 </td> <td style="text-align:left;"> 08082500 </td> <td style="text-align:left;"> 00060 </td> <td style="text-align:left;"> baylor </td> <td style="text-align:left;"> tx </td> <td style="text-align:left;"> txt </td> </tr> <tr> <td style="text-align:left;"> 1924-08-01 </td> <td style="text-align:left;"> 08062500 </td> <td style="text-align:left;"> 00060 </td> <td style="text-align:left;"> ellis </td> <td style="text-align:left;"> tx </td> <td style="text-align:left;"> txt </td> </tr> </tbody> </table> --- ## human readable - File names contain information about the content and purpose of the file - easy to find the right file a year from now ```r list.files("R/code-files") ``` ``` character(0) ``` Here, we see the order that the files run (utilities, download, clean, analyze, figures), the project they belong to (src), are archived in the file names. --- ## Sort easily - put numeric values first (use leading 0 for 1-9) - use ISO 8601 dates (YYYY-MM-DD) ### Chronological ```r list.files("data/usgs-files")[1:5] %>% sort() ``` ``` [1] "1873-06-02_05420500_00060_clinton_ia.txt" "1877-04-01_03193000_00060_fayette_wv.txt" "1887-10-01_01335754_00060_saratoga_ny.txt" [4] "1892-11-01_14174000_00060_linn_or.txt" "1895-03-01_01551500_00060_lycoming_pa.txt" ``` ### Logical ```r list.files("R/code-files") %>% sort() ``` ``` character(0) ``` --- class: center, middle #Now we have a project, a project structure, and well named files... Lets get into R ![](lec-img/03-R-full.jpeg) --- # Variables - Variables store data (values) (my.school = "UCSB") -- - Values can be changed according to our need. (my.school = "Cal Poly") -- - A variable provides us with **named** storage that our programs can manipulate. -- - Variables have a human readable **name** -- a unique identifier -- - An operable value -- - A location in memory where it is stored -- ## So how do we define variables? --- # Variable Names & Values - The variable `name` is arbitrary and helps reference `values.` -- - Names are used by reader (
) of the program -- - Variable `values` are "bound" to a `name` using the `=` or `<-` assignment operators ```r a = 3 a <- 3 ``` -- The result is the value 3 is bound to the name "a". And R can interpret the name as the object/value it holds. ```r 3*a ``` ``` [1] 9 ``` ```r a = 5 rep("TEXT", a) ``` ``` [1] "TEXT" "TEXT" "TEXT" "TEXT" "TEXT" ``` --- ### Binding 101 It is easy to read this statement as "create an object, named x, containing the value 10" ```r x = 10 ``` -- But this is a simplification, in actuality: -- - It's creating a object of value 10 -- - And binding that object to a name 'x' -- - Therefore the value (10) does not have a name, rather, the name (x) has a value --- ### Object Address - Objects have unique identifiers. - These identifiers have a form that looks like the object’s memory “address” - The actual memory addresses changes every time the code is run, so we use these identifiers instead. ```r x = 10 obj_addr(x) ``` ``` [1] "0x7faaccecc3c0" ``` --- ## To illustate this... In the code below, `y` doesn't make another copy of the value `10`, but instead creates an additional binding to the existing object. ```r x = 10 y = x obj_addr(x) ``` ``` [1] "0x7faad9239020" ``` ```r obj_addr(y) ``` ``` [1] "0x7faad9239020" ``` --- Equally, if we create two unique objects (even with the same value), they are different: ```r x2 = 10; y2 = 10 obj_addr(x2) ``` ``` [1] "0x7faad362a848" ``` ```r obj_addr(y2) ``` ``` [1] "0x7faad362a8b8" ``` This is because the values are stored as bytes in memory rather then on hard disk! --- class: center, middle <img src="lec-img/03-new-mac-mem.png" width="75%"> --- class: center, middle <img src="lec-img/03-memory-storage.jpg"> --- ### So what can we do with objects? Remember our school example <i class='fas fa-university'></i> ? We wanted to store information about the school as named values: ```r my.school = "UCSB" lat = 34.4140 lng = -119.8489 ``` -- But these are very different kinds of information with defined capabilities. -- What would happen if we tried to add `lng` to `lat`? ```r lng + lat ``` ``` [1] -85.4349 ``` -- What would happen if we tried to add `lng` to `my.school`? ```r lng + my.school ``` ``` Error in lng + my.school: non-numeric argument to binary operator ``` We see a `non-numeric` argument error telling us that name is not a numeric value. This is our first hint that values have different classes/types. --- #Also ... ```r charToRaw("3") ``` ``` [1] 33 ``` ```r charToRaw(3) ``` ``` Error in charToRaw(3): argument must be a character vector of length 1 ``` --- # Assignment - Today you are going to make your first project. - Starting from Github you are going to make a repository, clone it in RStudio - Then use you knowledge of a good project structure and the Terminal to create an empty project structure. - You will then push this project back to github and submit it via URL  # [Details](assignment-03.html) <\center> --- class: center, middle # END


Thilanka Munasinghe
Email<EMAIL_ADDRESS><EMAIL_ADDRESS>Website: http://thilankam.github.io
Phone:<PHONE_NUMBER>
EDUCATION
Master
of Science in Applied Mathematics (Expected Graduation: December 2016)
West Virginia University, WV, USA
Advisor:
Dr. Marjorie Darrah.
Thesis:
Cooperative Control of Multi-Agents Optimization (UAVs) Using Genetic Algorithms.
Master
of Science in Mechanical Engineering, December 2015
West Virginia University, WV, USA.
Advisor:
Professor. John Kuhlman.
Thesis: Studying the Characteristics
of Bubble Motion in Pool Boiling in Microgravity Conditions Under the Influence
of a Magnetic Field.
Bachelor
of Science in Aerospace Engineering, August 2008
West Virginia University, WV, USA.
Advisor:
Professor. John Loth.
WORK EXPERIENCE
2014 Aug – Present CodeLab Instructor (Android Programing) and
Graduate Intern at WVU Office of Innovation, Entrepreneurship and
Commercialization (LaunchLAB).
2014 Feb – 2014 May: Visiting Research Student at Laboratory for
Autonomous Marine Sensing Systems, MIT.
I worked with the
MIT underwater robotic research group to develop autonomous decision-making path
planning software in C++ for Autonomous Under Water Vehicles (AUVs).
2013 May – 2013 Aug: Visiting Research Student at Laboratory for
Autonomous Marine Sensing Systems, MIT.
I developed a smooth curve path-planning
algorithm for MIT MOOS-IvP open source software for AUVs.
2011 May – 2013 Jul: Research Assistant at Mathematics
Department, WVU
I developed Genetic Algorithms (GA) and
undertook Genetic Programming for Cooperative Control Systems, Task Management,
and Multi-Agent Systems.
2012 Jan – 2012Aug: Research Intern at Information Research
Corporation, Fairmont, WV.
I
integrated Genetic Algorithm software systems to a ground control station, and
tested them with Unmanned Aerial Vehicles (UAVs).
2010
Jan– 2011 May:
Research Assistant at Mechanical
and Aerospace Engineering.
I conducted microgravity
experiments to study the Kelvin Force Effect on Bubbles in paramagnetic liquids
under microgravity conditions.
2005
Aug– 2009 May: Resident Assistant at Dadisman Hall.
I was a student mentor and
staff member at the Dadisman Hall.
2003 Jun – 2004 Aug: Intern at Arthur C. Clarke Institute for
Modern Technology, Moratuwa, Sri Lanka.
I conducted meteorite testing and studied
the characteristics and composition of meteorites found in Sri Lanka.
TEACHING EXPERIENCE
Fall 2014 & Spring 2015: Android Programming Instructor
Fall 2011:
Math
Tutor at Mathematics Learning Center, Department of Mathematics WVU
Aug 2005 –
May 2010: Math
and Physics Tutor at WVU Engineering Learning Center
Summer & Fall
2009: Instructor
for Engineering 102 (Intro to Engineering II)
Spring 2009: Instructor
for Engineering 101 (Intro to Engineering I)
Fall
2008: Teaching
Assistant University 101
PROGRAMMING SKILLS
Proficient in Object Oriented Programing using JAVA
and C++
Proficient in Mobile Application Development using
the Android Platform
Proficient in Scientific Computing using Matlab and R
Proficient in Design Tools such as AutoCAD and Solid
Works
AWARDS
Best
Business/Project Idea and Most Technically Interesting Award at the Big Travel
Data Hackathon 2013, organized by Hack Reduce for FlightR.
Resident Assistant (RA) of the Year Award of West Virginia University Dadisman Hall, 2008-2009
Academic Year.
Recognition Award
from Sir Arthur. C. Clarke for the meteorite and planetary science research 2003.
INVITED TALKS
Fluids and Bubble Motion Behavior in Microgravity
Conditions at Arthur C. Clarke Institute
for Modern Technology, Sri Lanka; May 2010.
High Altitude
Balloon Satellites at American
National College, Sri Lanka; June 2007.
Guest Speaker at S.Thomas
College Mt.Lavinia to address the College Teaching
Staff on How to Teach High School
Students Effectively invited by Warden Dr. Indra
De Soysa, Jan 2014.
PUBLICATIONS
Journal Publications
Using Genetic Algorithms for Tasking
Teams of Raven UAVs. Journal of Intelligent and Robotics Systems, Marjorie Darrah, Edgar Fuller, Thilanka Munasinghe, Kristin Duling, Mridul Gautam, Mitchell Wathen. 20th
July 2012.
A
Flexible Genetic Algorithm System for Multi UAV Surveillance: Algorithm and
Flight Testing. Journal of Unmanned Systems. Marjorie Darrah, Jay Wilhelm, Thilanka
Munasinghe, Mitch Wathen, Steve Yokum,
Eric Sorton. 7th January 2015.
Conference Publications
Dynamic and
Kinematic Characteristics of Bubble Flow Motion in Paramagnetic Liquid under Microgravity
Conditions. International Conference on Fluid
Flow Dynamics (ICFD), Sendai, Japan, Thilanka
Munasinghe, November 2009.
Transformation Mapping of BubblesŐ
2-D Circular Shape to an Elliptical Shape Under Influence of a Magnetic Field
in Pool Boiling in Microgravity Conditions. 5th MIT Conference
on Computational Fluid and
Solid Mechanics, Massachusetts Institute of Technology (MIT), Cambridge, MA, Thilanka Munasinghe. June 2009.
Investigating Bubble Expansion in
Pool Boiling Under Influence of Magnetic Field in Microgravity Conditions.
World Scientific and Engineering Academy and Society, (WSEAS), Moscow, Russia, Thilanka Munasinghe, Sanket
Joshi. August 2009.
Studying the Characteristics of
Bubble Motion in Pool Boiling in Microgravity Conditions Under the Influence of
a Magnetic Field. Recent Advances on Space Technology (RAST),
IEEE – AIAA Joint Conference, Istanbul, Turkey. Thilanka Munasinghe. June 2009.
Investigating Bubble Behavior in
Pool Boiling in Microgravity Conditions, World Congress on Engineering (WCE),
International Association of Engineers (IAENG), Imperial College, London, UK, Thilanka Munasinghe, July
2008.
Poster Presentations
Efficient Path Planning
Algorithms for AUVs. Google Research Labs
Conference, June 2014.
Laminar to Turbulent Transition in Fluid Flow in Boiling, AIAA Young Professional and Student Education Conference, John
Hopkins University, Baltimore, Maryland, November, 2008.
Boling in Microgravity,
AIAA Student Conference, University of Maryland, College Park, April, 2008.
Research Day at Capitol - 2008, GovernorŐs Chamber, Charleston, West Virginia. January
2008.
WV-NANO, West Virginia
University, Alumni Center, May 2009.
PROFESSIONAL SERVICE
Mar
2014 – May 2014: Member
of the MIT Cricket Team
Aug
2005 – May 2008: Senior
Mentor at Office of International Students and Scholars
Jul
– Dec 2008: Member
of the Student Conduct Board of WVU
2007
– 2008: Vice
President, International Student Association WVU
2007
– 2009: Member
of the WVU Cricket Club
2007
– 2008: Member
of Multi-Cultural Leadership Club WVU
Aug
2005 – Dec 2008: Member
of Hall Council, Dadisman & Stalnaker Hall
2000
– 2004: Member
of Sri Lanka Student Red Cross Society
REFERENCES
Mr. Matt Harbaugh
Director at WVU, Office of Innovation,
Entrepreneurship and Commercialization (LaunchLAB)
Tel:<PHONE_NUMBER>
|
Dr. Marjorie Darrah |
|
Professor
at Department of Mathematics, WVU |
|
<EMAIL_ADDRESS>|
Tel:<PHONE_NUMBER>
Prof. John Kuhlman
Professor at Department of
Mechanical and Aerospace Engineering,
College of Engineering, WVU
Tel:
304-293-3180
|
Dr. Robin Hensel |
|
Assistant
Dean of College of Engineering, WVU |
Tel:
304-293-0395
|
Prof. Eddie Fuller |
|
Chairman
Department of Mathematics, WVU |
Tel:
304-293-2011
|
Prof. David Stewart |
|
Associate
Vice President for Student Affairs and Global Services, WVU |
Tel:
304-293-5811
|
Dr. Arjuna Balasuriya |
|
Research
Scientist, MIT |
Tel:<PHONE_NUMBER>


---
title: Launching my second Firefox-Os App - GistHub
description: >
Smile. Laugh.
created: !!timestamp '2013-07-12 00:00:00'
tags:
- HTML5
- CSS3
- JavaScript
- JQuery
- AJAX
- IndexedDB
- Bootstrap
- GithubAPI
toc:
- inspiration
- features
- authentication
- view-gist
- create-gist
- search-and-others
tweetShortUrl: https://bit.ly/1zWUVeG
readTime: 5
---
{% mark excerpt -%}
Yay! this is my second approved FIREFOX-OS(FOS) App- **GistHub**, after the basic [Calculator](../07/fOS-intro.html) app. It's an app for firefox smartphones, which helps Github Users to access and manage their Gists instantly without opening the site in browser. It's free to download from [Firefox marketplace](https://marketplace.firefox.com/app/gisthub/) for firefox smartphones :)
{% endmark %}
+++++
+++++
User Authentication
-------------------
A User can Login into the app using his Github email-id/username along with the password. The engine used behing the authentication has been carried out using the [IndexedDB API](https://developer.mozilla.org/en/docs/IndexedDB), a client-side storage of significant amounts of structured data and for high performance searches on the data using indexes.
Initialize Database
{% syntax javascript %}
initializeDB: function initializeDB() {
var notes = '',
objectStore = this.database.transaction('notes').objectStore('notes'),
objectStore = this.database.transaction('notes').objectStore('notes');
objectStore.openCursor().onsuccess = function (event) {
var cursor = event.target.result;
if (cursor) {
//... Already logged in, do stuff and redirect
location.href = 'view_gists.html';
cursor.continue();
}
};
}
{% endsyntax %}
Identification & Authentication using AJAX call
{% syntax javascript %}
// function for saving the credentials after successful logging
saveCredentials: function saveCredentials (username, password, UserImage, UserLogin) {
var note = {'name': username,'pass': password,'image': UserImage,'login': UserLogin},
transaction = this.database.transaction(['notes'], 'readwrite'),
objectStore = transaction.objectStore('notes'),
request=objectStore.put(note);
request.onsuccess = function(event) {
location.href = 'view_gists.html';
};
}
// function to generate the BASIC Hash for authentication
generateTokenHash: function generateTokenHash(user, password) {
var tok = user + ':' + password,
hash = btoa(tok);
return 'Basic ' + hash;
},
// AJAX call to test authorization
loginNauth: function loginNauth(username,password) {
var obj = new Object();
obj = this;
$.ajax({
url: 'https://api.github.com/user',
type: 'GET',
dataType: 'json',
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', obj.generateTokenHash(username,password));
}
})
.success( function(e) {
/* successfully logged in, parse the data,
GET as JSON Object, and store for future refrences */
obj.saveCredentials(UserLogin,password,UserImage,UserLogin);
})
.error( function(e) {
alert('Authentication Failed !');
})
}
{% endsyntax %}
+++++


Prima's is the leading manufacturer of automobile rubber hoses and rubber parts in Sri Lanka. With more than 250 automobile dealer locations in Sri Lanka Prima's hoses offer the best value for the money. Reinforced with Nilon 66 to withstand high pressure high temperature conditions, primas rubber hoses ensure durability and robustness built in. Radiator/Coolant/Alternator Hoses are available for many makes and models ranging from Audi, Bentley, BMW, Toyota ... to Volvo etc.


Valores X:
Valores Y:
Valores:
latentVectors: 10, tolerance: 1e-4,
T - Score matrix of X
P - Loading matrix of X
U - Score matrix of Y
Q - Loading matrix of Y
B - Matrix of regression coefficient
W - Weight matrix of X


How to contribute on OpenEnergyMonitor dev + development plans
If your wondering how best to get involved with OpenEnergyMonitor development here are a couple of thoughts and possible pointers.
First a few insights and ideas from an another open source project we follow: DIYdrones. Thanks to Amin Zayani for the heads up on these: [1] [2] [3]
In Chris Anderson of DIY drones's words, who we think has articulated it well:
“The best way to participate is to do something cool on your own and share it here. All of our code bases and hardware design files are open. If you see an opportunity to improve something, just do it, post it and then tell the community about what you've done. If it's good, people will use it, help improve it, and we'll get a sense of what you can do. That makes it much easier for us to figure out what your skills are and where you'd fit in best.”
The following is an outline of our short term development plans and also longer term wish list of features that would be great to have. If you could help us with any of these items that would be very helpful.
Short term goals
For a general overview here are the short term goals that are being worked on at the moment and in the very near future:
- New casing design for emontx and emonbase
-
Transfer emonbase sketches over to EtherCard library -
Compatibility of main sketches with Arduino 1.0 -
Complete watchdog addition -
Complete and publish energy audit software v1.0 - Add wireless range indicator to emonGLCD based on jeelabs range example.
- Create pachube emonbase examples
Documentation
-
Write guide on building an end-to-end single CT emontx- emonglcd, emonbase setup. - Complete emontx solar hot water application documentation
For web application short and long term goals see emoncms development: feature plans and discussion thread
Longer term wish list
-
3 phase monitoringThere are sketches on GitHub for all the emonTx versions
-
Use NanodeRF onboard SRAM to buffer logging data in the event of internet connection.The Raspberry Pi can do this.
- Investigate BeagleBoard, Raspberry Pi emonBase with nice web-setup and configure. Discussion here: http://openenergymonitor.org/emon/node/488 and http://openenergymonitor.org/emon/emonbase/alternatives%20
- Plug based energy monitor - for per appliance monitoring - an alternative method to appliance inference.
-
Develop a series of control modules, that extend the emon system into an open source monitoring and control system that can be used for domestic and industrial situations. Control modules could include:
- multiple relay board (for dump load control, immersion heaters, pumps, lighting)
- solenoid valve driver board for central heating control.
- motor control
- triac controlled immersion heater dump load for dumping the exact right amount of power from excess pv generation. Two designs do this: See Choosing an Energy Diverter
- This emon monitoring and control system could link together by either a wireless bus say rfm12 or a wired bus (maybe rs485). The modules could be designed to fit in both DIN rail style casing or non-DIN rail casing.
- This could be a collaboration with other open source projects such as the All Power Labs GEK gasifier project who are interested in such a system.
-
Merge emonTx firmware examples into an Arduino library- Partly done with emonLib
- Appliance inference - infer from a single power feed of a house what each appliance uses and so providing a energy use by appliance breakdown. An initial start was made on this here: appliance inference 1.0
- PCB and casing for the 12 input pulse counter (a DIN rail and non din rail option)
- Larger monitoring PCB's: maybe 12 input CT?
- Explore using MQTT as an internet of things protocol
-
Using one power supply:
There is an ongoing discussion about whether its possible to power the monitoring circuit from the ac-ac adapter that makes the ac voltage reading, the discussion on this topic can be found here: Using one power supply ideasThe emonTx V3 series incorporates this principle.
Re: How to contribute on OpenEnergyMonitor dev + development plans
I would also add to the list :
- A way to supply the emonTX with current from the voltage sensor (tricky but possible)
A propos monitoring 3 phases I am working on it... expect some code after the holidays.
Re: How to contribute on OpenEnergyMonitor dev + development plans
and we should probably also start a developpers mailing list.
Re: How to contribute on OpenEnergyMonitor dev + development plans
Great to hear your working on 3 phase code Amin that will be a great help!
Supplying current from the AC-AC adaptor could be done if we can find a AC-AC adapter that has a centre tap and brings this centre tap out to the power jack. Does anyone know of such an adapter that brings out the centre tap?
Re: How to contribute on OpenEnergyMonitor dev + development plans
Im not sure if this will be beneficial? having to many different places to discuss and develop is hard to keep track of. I think we should focus development discussion here on the forums. Then it is all open and everyone can see whats going on.
Re: How to contribute on OpenEnergyMonitor dev + development plans
Trystan, I had written a rebuttal to your suggestion that a center-tapped AC supply could be used to both power the project and supply the AC sample, but I've come back and edited it after thinking this over for a bit.
I'm thinking that a full-wave rectified but unfiltered DC signal could be used as the reference voltage. This would eliminate the need for the 2.5 VDC bias on the sample voltage, and allow the center-tap of an AC supply to be connected directly to the project ground. There might be some sticky bits preventing the DC filtering downstream of the rectifier from smoothing out the needed AC component, but that might easily be prevented by using a series diode between the rectifier output/sample tap and the filtering network.
There would be some non-linearity in the full-wave diodes during the rectification, but it would take place at zero-crossing, where it's not very significant to the overall sample value. The value in the sketch would have to be computed on a multiplier of x2, as the total AC amplitude of the rectified sample would be half what a sine wave would be, but the full-wave representation of the sine wave would still be accurate and represent the mains voltage accurately.
The big problem I see with this is that using a full-wave rectified voltage smaple will knock the stuffing out of any phase calculations that the sketch performs. Perhaps the sktech could be modified to ignore or mirror outrageously "wrong" phase angles (as produced every half-cycle of the voltage sample)?
Otherwise, I don't see how a center-tapped AC supply can provide the isolation necessary to not upset the DC bias of the AC sample at the analog input.
Re: How to contribute on OpenEnergyMonitor dev + development plans
I also dont see how this could work without a second galvanic separation...
Re: How to contribute on OpenEnergyMonitor dev + development plans
I created a new topic for this subject:
Using one power supply - Ideas
Re: How to contribute on OpenEnergyMonitor dev + development plans
Hi!
Do you already have any ideas about construction of plug based energy monitor? I work on my own opensource energy measurement project. First I just released wall outlet plugable development version. Sorry, for now I havent any blog or site. Only photos.
It based on invasive measurement method with current sensing shunt and voltage divider. Plugmeter have isolated RS-232 interface for calibrating, isolated bus for numerous interfaces such as SPI, UART and others. Also nonisolated side powered from mains with low current capacitive power supply. Isolated side may be powered from AC/DC converter (not soldered on this board) or from external 12..5V DC power supply. And as you can see, it is not Arduino based..
If you are interested, I will glad to give my experience to your project.
WBR, Aleksander Senin
Re: How to contribute on OpenEnergyMonitor dev + development plans
Nice work! looks well built and cased. Whats your plans with it? and for pulishing/documenting it? Looks like you have invested a lot of time down the xbee route and im sure you have good reasons for this, but whats your thoughts on an arduino and rfm12 version?
Re: How to contribute on OpenEnergyMonitor dev + development plans
Thanks. My goal is creating open smartmetering platform for industrial and home using. It must be flexible and meets the open standards for data interchange. Inspired by your project I planning publish all documentation and sources. Several reasons why this is not done right now:
1. PCB of prototype tracerouted not in free EDA. I am trying work with KiCAD and gEDA, but for me now it is more head pain then work (or I just havent enought skills).
2. For quickstart I am using firmware sources from TI AppNote. It is open, but not absolutely free. And there is a big question - rewrite metering level from the ground or providing TI sources under license conditions.
In development version of device I am using XBee in experimental purpose. XBee have very usable footprint and formfactor. One of thoughts is using this footprint and pinout for custom communication modules. In addition Digi provide nice product ConnectPort X2. It is a some type of border router. ConnectPort works with iDigi cloud and may be custom programmed using Python scripts for transfering data in Google PowerMeter, Pachube or any other service include emoncms based. And also XBee lets quickly starts play with ZigBee SmartEnergy profile.
RFM12 is a good thing. But can it works in network, not only point-to-point? Or mesh network? For mobile plug based monitor it is may be important.
And of course I love Arduino. What about metering shield? I can redesign my device to this formfactor. Using Arduino for energy monitoring with CT is well but using it to measurement.. Voltage divider needs galvanic isolation for safety. An external measurement board such as metering shield can provide precision measurement with shunt and full isolation. Arduino will gets conditioned measurement results via uart and can spend more resources for communication.
Re: How to contribute on OpenEnergyMonitor dev + development plans
hey! interesting work.
i'm also working on something similar, are you familiar with the tweet a watt kit from adafruit industries?
Re: How to contribute on OpenEnergyMonitor dev + development plans
No, I din't know about Tweet-A-Watt before. It looks interesting.
And tell pair of words about your work. It based on Arduino or special metering chip?
Re: How to contribute on OpenEnergyMonitor dev + development plans
Thanks for the further information Alsenin. Here are my thoughts:
1) Although of course it would be better if the pcb and schematics could be created in open source EDA, we do and many other open source hardware projects are using Eagle, so if you use eagle dont worry too much about that.
2) I may well be wrong but I dont think it would be too hard to rewrite the metering level firmware and it would be better to have an open source solution, is it essentially the same maths as we use for voltage and current measurement giving real, apparent power, powerfactor, v rms and i rms? As in Emon.cpp and Emon.h here: https://github.com/openenergymonitor/emonTxFirmware/tree/master/emonTx_1CT_Voltage
Having the option to interchange communication option seems like a good idea. There could be a drop in board containing an atmega and a rfm12. But it might be nice to have an all-in-one pcb option?
The rfm12 can certainly be configured for multi node networking, it can have 28 nodes per network and 250 network groups, Glyn wrote some information about it here: http://openenergymonitor.org/emon/node/271 the rfm12's capabilities are the result of jean claud wipplers amazing work at jeelabs.net. One of the big advantages of it is its low cost, I have also had better experience with its range over xbee's in the past.
As for isolation, it is possible to isolate the arduino side from the high voltage side, I once built a circuit based on Cliff Jao and Xi Guo's work that used hcpl optoisolator amplifiers for this: openenergymonitor.org/emon/node/2 and if you use an RF solution for communication, the user is further isolated.
It would be great if you could build a plug based energy monitor that could interface and be used in parallel with the emontx, emonbase, emonglcd etc, I think that would complement the system nicely
Re: How to contribute on OpenEnergyMonitor dev + development plans
Good to hear Amin, let us know more about your plans!
Re: How to contribute on OpenEnergyMonitor dev + development plans
Trystan, thanks for links. I will learn it closely.
About working plugmeter together with emonXXX seems absolutely no problems. Just requires purchasing by me the RFM12 and do it. :) Yet another replaceable RF module.
Re: How to contribute on OpenEnergyMonitor dev + development plans
Modular design the MVC design allows extension to be added to implement new features / visualisations< boşanma avukatı Powerful visualisation - Using flot graphing emoncms allows viewing of large number of data avukat points (multiple years of power data) with fast loading times
Re: How to contribute on OpenEnergyMonitor dev + development plans
Amin, how did you make the case for your plug meter? I'm interested in working on a North American version in the near future.
Re: How to contribute on OpenEnergyMonitor dev + development plans
What's the status on the Plug based energy monitor? Alsenin, are you still working on this?
Re: How to contribute on OpenEnergyMonitor dev + development plans
Does anyone will develop emoncms RPI module, which will be using nRF2401 or nRF51822 instead of RFM12B, because RFM12B is end of life :/
Re: How to contribute on OpenEnergyMonitor dev + development plans
Hello,
IMO, an important aspect to take into consideration is that the nFR2401 is not IEEE802.15.4 compliant (internal buffer of only 32bytes) while, for example, the MRF24J40MA, based on a MRF24J40 (microchip), has a 128 bytes buffer and is fully IEEE802.15.4 compliant allowing to support 6LowPan, CoAp, ... all the protocols that have been designed for the Internet of Things.
There is few drawback on the choice of the MRF24J40MA dough: Limited range (distance sender-receiver) due to the low power permitted by the regulation and due to the high frequency (2.4GHz) (need a better antenna than the PCB antenna probably), and the price tag is higher (around 10 Euro for the radio).
Using IEEE802.15.4 will bring a lot of interoperability in the near future (each sensor could be access from anywhere, using standard tools...) I think this aspect should be strongly taken into consideration: Interoperability.
Note: The nRF51822 is a bluetooth low energy single chip solution (include a processor, RAM and Flash) that will require a specific firmware to be written for it... maybe not as DYI friendly than the current approach...
Best regards, Bernard.


Include comments about your shift experience and any feedback for the Night Patrol Coordinator e.g. requests for stock, complaints, near misses and general service comments.
Use the communications book in the kitchen to relay messages to the teams coming in the next night.


Mascot Search
Licensed to: University of Colorado, School of Pharmacy, (1 processor).
Finished uploading search details and file...

Click here to see Search Report


Short summary of PyCon... seemed much bigger this year. It was bigger, but I think it seemed bigger still. I guess what I found surprising was that the conference felt more dense despite its larger size. Most of the people were pretty well informed and quite invested in Python. In other years it felt like there were a larger proportion of people who were just checking out Python, or would have liked to do Python but weren't able to. I think of them as tourists, and this year there weren't that many.
Probably the location had something to do with this too, as there wasn't a lot of local attendees. You have to be a little more serious to actual fly somewhere; in D.C. there were a lot of people there on a lark. So next year in Chicago I expect more local beginners.
Another thing I like is that people seemed to really be using Python to do useful things. There wasn't nearly so much time spent talking about Why Python Is Good, or How To Sell Python To Your Boss. That's kind of silly anyway -- if you are at the conference, you don't need to be sold on it. But even so, the language seems to be in a much more self-confident place, and the users don't need to spend so much time justifying their choices. It's also good because Python's utility in the world isn't defined by its own attributes but instead by the things people do with it, and a lot of people are doing good things.
Something I've noticed in general is that the term "ready for the enterprise" isn't being talked about as much; not just at the conference but generally. I'm happy about this -- there was a tedious period of open source advocacy when people were way to obsessed with the enterprise. I think we have the Rails narrative arc to thank for some of that shift. Really "enterprise" means "boring and obtuse", which in turn means "someone will pay you to do this". And that's fine and well, but certainly not something worth fighting for, and definitely not what I want to see at a conference.
I also feel like I've self-defined too exclusively with Python. It's a nice programming language, but it's just a programming language. And it's a nice community, but I should be part of other communities besides it. I'm not 100% sure what communities, or what conferences, but I guess I have to stretch a bit more.
Anyway, a good conference. Next to North Carolina. Oh damn, once again I mention it here far too late. Anyway, there I'll be sprinting on Deliverance.
If you are looking for another language community to join, consider Haskell.
We are still pretty small, but the discussions on the list and IRC are always interesting and low-heat.
That, and Haskell is the opposite of Python in many ways. So (without applying too many prejudgements) it is likely to stretch your mind more than other languages might.
Personally, Python and Haskell are the languages that have had the most influence on my skills as a software developer. Although, I still haven't learned a lisp flavor, so it might be a little early to judge.
# Alan Falloon
I'm not so much looking for another language, as a community that isn't a language. Or a pan-language community. To a degree "the free software community" might be that community. But I'm not sure what/where that community is. I think GNU used to be a community, but I'm not sure if it is anymore. That mission is either lost or satisfied.
# Ian Bicking


I learned vanilla JavaScript awhile ago and had yet to get into any of the frameworks, Backbone, Anjular, React, Done or any others. During Dev Bootcamp, I learned about prototyping and reasoning for object literals and constructor methods. Mindblowing! Who knew JavaScript could be so versatile?
Below is a clipping of some React. During coffee with a DBC alumni, I noticed his eyes light up when I mentioned React in conversation. Taking note, I looked into it further and thought it might be fun to try it.
So what's happening here?
React is building the start of a table.
Line 1-3 are inializing the class. Think a process similar to the Ruby initialize method. The initialized object has a state, the data from the row in the table of the database. The 'getDefaultProp' puts the data into the clearly marked array. The first few lines of code takes the data and builds objects with them and organized them into an array for easy access (meaning iterating through them).
Lines 6 -24 build the DOM elements, meaning the HTML and the styling. This is what is shown on the page. This code snippet only show the start of the table, the data for the table comes later but the last few lines(23-24) display the characteristic for loop of JavaScript.
It's neat to be building the page using only JavaScript and React.


A Crash Course in Responsive Design
with Angelina Fabbro & Jacky Gilbertson
WELCOME
(image credit: pusheen.com)
Mobile Matters
Mobile Matters
(photo credit: International Institute for Communication and Development (IICD))
How do we make mobile websites?
- Design separate sites for mobile and desktop (sometimes a tablet version too)
- Mobify it (3rd party - http://www.mobify.com/mobifyjs/)
- Responsive design
Pros of designing separate sites
- Best performance
- Highest level of detail control
Cons of designing separate sites
- Multiple websites to maintain
- Poor redirection/no redirection for link sharing
Pros of Mobify (3rd party)
- Can use it on any existing desktop site, with existing security
- Serves up the page to mobile users at the same URL
- Separate templates mean conditonal content loading
- Transform DOM elements into other DOM elements
Cons of Mobify (3rd party)
- AJAX (content loaded asynchronously by JS) - based sites end up being slower
- Relies on 3rd party Javascript
- Learning curve - need to be familiar with Javascript, command line tools etc.
Pros of Responsive Design
- You only make one website!
- Not just about the device - resize the browser and it still looks good!
Cons of Responsive Design
- Development time
- Worse performance
Design Tools
Development Tools
- HTML5 (check http://caniuse.com/)
- CSS 3 (check http://caniuse.com/)
- Javascript (Crockford's Javascript: The Good Parts)
Designing for Mobile
- You will get the best results if you design for mobile first
- Don't design to a fixed grid and then try to make it fluid later. Fluid grids/layout all the way!
- Assume that you're designing for touch screens (iOS HIG suggests 44px^2 as tap target)
- Large headings work better on wider layouts
Designing for Mobile
- Navigation is less important than you think sometimes
- Get rid of superfluous content
- Don't be afraid of whitespace
- If you're a business: make it easy to find you
Bad Examples
Steam Clock's website :(
Good Examples
createdm.com
choiceresponse.com
Performance
- You NEED to care about performance
- Performance is actually about perception rather than stats - users first!
- Minify CSS and JS
- CSS in the head, JS in the footer (there are exceptions, like Mobify/Modernizer)
- Keep components under 25k
For more check out: http://developer.yahoo.com/performance/rules.html/
BREAK - THEN CODING!
Angelina Fabbro / @angelinamagnum /<EMAIL_ADDRESS>Jacky Gilbertson / @jackygilbertson / jackymakesthings@gmail.com


IP Pools
IP addresses can be allocated from pools. The pools can be managed in SQL databases, or via local GDBM files.
When using an SQL database, the IP pools have been tested with pools containing tens of millions of addresses. Scalability is not a problem.


Implementing Mood
The Mood library allows applications to generate playlists and user interfaces based on Gracenote Mood descriptors. Mood provides Mood descriptors to the application in a two-dimensional grid that represents varying degrees of moods across each axis. One axis represents energy (calm to energetic) and the other axis represents valence (dark to positive). When the user selects a mood from the grid, the application can provide a playlist of music that corresponds to the selected mood. Additional filtering support is provided for genre, origin, and era music attributes.
For more information on Moodgrid, see the Moodgrid Overview
The Moodgrid APIs:
- Encapsulate Gracenote’s Mood Editorial Content (mood layout and ids).
- Simplify access to Mood results through x,y coordinates.
- Allow for multiple local and online data sources through Mood Providers.
- Enable pre-filtering of results using genre, origin, and era attributes.
- Support 5x5 or 10x10 MoodGrids.
- Provide the ability to go from a cell of a 5x5 Mood to any of its expanded four Moods in a 10x10 grid.
Mood terminology
- Mood Provider—A collection of audio tracks such as a Playlist Collection Summary (
GnPlaylistCollectionSummary
) - Mood Presentation—An instance of
GnMoodgridPresentation
representing a 5x5 or 10x10 grid containing
To implement Mood:
- Allocate a
GnMoodgrid
class. - Enumerate the data sources using Mood Providers
- Create and populate a Mood Presentation
- Filtering the results, if needed
Prerequisites
Using the Mood APIs requires the following modules:
If you are using MusicID to recognize music, you must enable Playlist
Enumerating Data Sources using Mood Providers
GNSDK automatically registers all local and online data sources available to Mood. For example, if you create a playlist collection using the Playlist API, GNSDK automatically registers that playlist as a data source available to Mood. These data sources are referred to as Providers. Mood is designed to work with multiple providers. You can iterate through the list of available Providers using the GnMoodgrid
class' Providers
method. For example, the following call returns a handle to the first Provider on the list (at index 0):
C++
moodgrid::GnMoodgrid myMoodgrid; moodgrid::GnMoodgridProvider myProvider = *(myMoodgrid.Providers().at(0));
C#
GnMoodgrid moodgrid = new GnMoodgrid(); GnMoodgridProvider provider = moodgrid.Providers.at(0).next();
Java
GnMoodgrid myMoodGrid = new GnMoodgrid(); GnMoodgridProvider myProvider = myMoodGrid.providers().at(0).next();
You can use the GnMoodGridProvider
object to retrieve the following information
- Name
- Type
- Requires network
Creating and Populating a Mood Presentation
Once you have a GnMoodgrid
object, you can create and populate a Mood Presentation with Mood data. A Presentation is a GnMoodgridPresentation
object that represents the Mood, containing the mood name and playlist information associated with each grid cell.
To create a Mood Presentation, use the GnMoodgrid
class' "create presentation" method, passing in the user handle and the Mood type. The type can be one of the enumerated values in GnMoodgridPresentationType
: either a 5x5 or 10x10 grid. The method returns a GnMoodgridPresentation
object:
C++
moodgrid::GnMoodgridPresentation myPresentation = myMoodgrid.CreatePresentation(user, GnMoodgridPresentationType.kMoodgridPresentationType5x5);
C#
presentation = moodGrid.CreatePresentation(user, GnMoodgridPresentationType.kMoodgridPresentationType10x10);
Java
GnMoodgridPresentation myPresentation = myMoodGrid.createPresentation(user, GnMoodgridPresentationType.kMoodgridPresentationType5x5);
Iterating Through a Mood Presentation
Each cell of the Presentation is populated with a mood name an associated playlist. You can iterate through the Presentation to retrieve this information from each cell:
/* Create a moodgrid presentation for the specified type */ moodgrid::GnMoodgridPresentation myPresentation = myMoodgrid.CreatePresentation(user, type); moodgrid::GnMoodgridPresentation::data_iterator itr = myPresentation.Moods().begin(); for (; itr != myPresentation.Moods().end(); ++itr) { /* Find the recommendation for the mood */ moodgrid::GnMoodgridResult result = myPresentation.FindRecommendations(myProvider, *itr); printf("\n\n\tX:%d Y:%d\tMood Name: %s\tMood ID: %s\tCount: %d\n", itr->X, itr->Y, myPresentation.MoodName(*itr), myPresentation.MoodId(*itr), result.Count()); moodgrid::GnMoodgridResult::iterator result_itr = result.Identifiers().begin(); /* Iterate the results for the identifiers */ for (; result_itr != result.Identifiers().end(); ++result_itr) { printf("\n\n\tX:%d Y:%d", itr->X, itr->Y); printf("\nident:\t%s\n", result_itr->MediaIdentifier()); printf("group:\t%s\n", result_itr->Group()); playlist::GnPlaylistMetadata data = collection.Metadata(user, result_itr->MediaIdentifier(), result_itr->Group()); printf("Album:\t%s\n", data.AlbumName()); printf("Mood :\t%s\n", data.Mood()); } }
/* Create a moodgrid presentation for the specified type */ presentation = moodGrid.CreatePresentation(user, gnMoodgridPresentationType); /* Query the presentation type for its dimensions */ GnMoodgridDataPoint dataPoint = moodGrid.Dimensions(gnMoodgridPresentationType); Console.WriteLine("\n PRINTING MOODGRID " + dataPoint.X + " x " + dataPoint.Y + " GRID "); /* Enumerate through the moodgrid getting individual data and results */ GnMoodgridPresentationDataEnumerable moodgridPresentationDataEnumerable = presentation.Moods; foreach (GnMoodgridDataPoint position in moodgridPresentationDataEnumerable) { uint x = position.X; uint y = position.Y; /* Get the name for the grid coordinates in the language defined by Locale */ string name = presentation.MoodName(position); /* Get the mood id */ string id = presentation.MoodId(position); /* Find the recommendation for the mood */ GnMoodgridResult moodgridResult = presentation.FindRecommendations(provider, position); /* Count the number of results */ count = moodgridResult.Count(); Console.WriteLine("\n\n\tX:" + x + " Y:" + y + " name: " + name + " count: " + count + " "); /* Iterate the results for the idents */ GnMoodgridResultEnumerable identifiers = moodgridResult.Identifiers; foreach (GnMoodgridIdentifier identifier in identifiers) { string ident = identifier.MediaIdentifier; string group = identifier.Group; Console.WriteLine("\n\tX:" + x + " Y:" + y + " \nident:\t" + ident + " \ngroup:\t" + group ); } }
/* Create a moodgrid presentation for the specified type */ GnMoodgridPresentation myPresentation = myMoodGrid.createPresentation(user, type); /* Query the presentation type for its dimensions */ GnMoodgridDataPoint dataPoint = myMoodGrid.dimensions(type); System.out.println("\n PRINTING MOODGRID " + dataPoint.getX() + " x " + dataPoint.getY() + " GRID "); GnMoodgridPresentationDataIterator itr = myPresentation.moods().begin(); while(itr.hasNext()) { GnMoodgridDataPoint position = itr.next(); /* Find the recommendation for the mood */ GnMoodgridResult moodgridResult = myPresentation.findRecommendations(myProvider, position); System.out.println("\n\n\tX:" + position.getX() + " Y:" + position.getY() + " name: "+ myPresentation.moodName(position) + " count: " + moodgridResult.count() + " "); GnMoodgridResultIterator resultItr = moodgridResult.identifiers().begin(); while(resultItr.hasNext()) { GnMoodgridIdentifier resultIdentfier = resultItr.next(); System.out.println("\n\tX:" + position.getX() + " Y:" + position.getY()+" "); System.out.println("ident:\t" + resultIdentfier.mediaIdentifier()+" "); System.out.println("group:\t" + resultIdentfier.group()); } }
Filtering Mood Results
You can use genre, origin, and era to filter Mood results. To do this, use the GnMoodgridPresentation
's addFilter
method. If you apply a filter, the results that are returned are pre-filtered, reducing the amount of data transmitted. For example, the following call sets a filter to limit results to tracks that fall within the punk rock genre.
Java:
myPresentation.addFilter("pres1", kMoodgridListTypeGenre,"punk", kConditionTypeInclude);


Assign and Define
Just like all computing languages, the VPL allows you to define variables.
To do this, bring down Define from the Definition palette menu.
Once you define a variable, it appears in the Variables menu.
To assign values to multiple variables, bring down Assign from the
Variables menu.
You can reassign variables without problem. Or you can simply delete
them by selecting Expunge from the Variables menu. You can expunge all variables,
or just a specific one.


| POS_display | index /Users/ryangiarusso/PycharmProjects/CS2720-SE/Flask-App/POS_display.py |
File: POS_display.py
Author: Ethan Morisette
Created: 3/9/2016 (Last Modified: 4/24/2016)
Purpose: Module containing functions that get data input from the user interface, process it into appropriate
formats, and route it accordingly.
| Modules | ||||||
|
| Classes | ||||||||||
|
|
| Functions | ||
|
| Data | ||
| abort = <werkzeug.exceptions.Aborter object> appcontext_popped = <blinker.base.NamedSignal object at 0x1036acb70; 'appcontext-popped'> appcontext_pushed = <blinker.base.NamedSignal object at 0x1036a6fd0; 'appcontext-pushed'> appcontext_tearing_down = <blinker.base.NamedSignal object at 0x1036a6f98; 'appcontext-tearing-down'> current_app = <LocalProxy unbound> g = <LocalProxy unbound> got_request_exception = <blinker.base.NamedSignal object at 0x1036a6f60; 'got-request-exception'> json_available = True message_flashed = <blinker.base.NamedSignal object at 0x1036ac1d0; 'message-flashed'> request = <LocalProxy unbound> request_finished = <blinker.base.NamedSignal object at 0x1036a6e10; 'request-finished'> request_started = <blinker.base.NamedSignal object at 0x1036a6da0; 'request-started'> request_tearing_down = <blinker.base.NamedSignal object at 0x1036a6f28; 'request-tearing-down'> session = <LocalProxy unbound> signals_available = True template_rendered = <blinker.base.NamedSignal object at 0x1036a6d30; 'template-rendered'> |