| CONTENTS | PREV | NEXT |
Appendix B:
|
B.6.1 Rename Using LDAP C API |
B.6.2 Rename Using JNDI |
/* * Copyright (c) 1996. Netscape Communications Corporation. All * rights reserved. * * Modify the RDN (relative distinguished name) of an entry. In this * example, we change the dn "cn=Jacques Smith, o=Ace Industry, c=US" * to "cn=Jacques M Smith, o=Ace Industry, c=US". * * Since it is an error to either (1) attempt to modrdn an entry which * does not exist, or (2) modrdn an entry where the destination name * already exists, we take some steps, for this example, to make sure * we will succeed. We (1) add "cn=Jacques Smith" (if the entry exists, * we just ignore the error, and (2) delete "cn=Jacques M Smith" (if the * entry doesn't exist, we ignore the error). * * We pass 0 for the "deleteoldrdn" argument to ldap_modrdn2_s(). This * means that after we change the RDN, the server will put the value * "Jacques Smith" into the cn attribute of the new entry, in addition to * "Jacques M Smith". */ #include "examples.h" #define NMODS 4 unsigned long global_counter = 0; static void free_mods( LDAPMod **mods ); int main( int argc, char **argv ) { LDAP *ld; char *dn, *ndn, *nrdn; int i; int rc; LDAPMod **mods; /* Values we will use in creating the entry */ char *objectclass_values[] = { "top", "person", "organizationalPerson", "inetOrgPerson", NULL }; char *cn_values[] = { "Jacques Smith", NULL }; char *sn_values[] = { "Smith", NULL }; char *givenname_values[] = { "Jacques", NULL }; /* Specify the DN we are adding */ dn = "cn=Jacques Smith, o=Ace Industry, c=US"; /* the destination DN */ ndn = "cn=Jacques M Smith, o=Ace Industry, c=US"; /* the new RDN */ nrdn = "cn=Jacques M Smith"; /* get a handle to an LDAP connection */ if ( (ld = ldap_init( MY_HOST, MY_PORT )) == NULL ) { perror( "ldap_init" ); return( 1 ); } /* authenticate to the directory as the Directory Manager */ if ( ldap_simple_bind_s( ld, MGR_DN, MGR_PW ) != LDAP_SUCCESS ) { ldap_perror( ld, "ldap_simple_bind_s" ); return( 1 ); } if (( mods = ( LDAPMod ** ) malloc(( NMODS + 1 ) * sizeof( LDAPMod *))) == NULL ) { fprintf( stderr, "Cannot allocate memory for mods array\n" ); return( 1 ); } /* Construct the array of values to add */ for ( i = 0; i < NMODS; i++ ) { if (( mods[ i ] = ( LDAPMod * ) malloc( sizeof( LDAPMod ))) == NULL ) { fprintf( stderr, "Cannot allocate memory for mods element\n" ); return( 1 ); } } mods[ 0 ]->mod_op = 0; mods[ 0 ]->mod_type = "objectclass"; mods[ 0 ]->mod_values = objectclass_values; mods[ 1 ]->mod_op = 0; mods[ 1 ]->mod_type = "cn"; mods[ 1 ]->mod_values = cn_values; mods[ 2 ]->mod_op = 0; mods[ 2 ]->mod_type = "sn"; mods[ 2 ]->mod_values = sn_values; mods[ 3 ]->mod_op = 0; mods[ 3 ]->mod_type = "givenname"; mods[ 3 ]->mod_values = givenname_values; mods[ 4 ] = NULL; /* Add the entry */ if (( rc = ldap_add_s( ld, dn, mods )) != LDAP_SUCCESS ) { /* If entry exists already, fine. Ignore this error. */ if ( rc == LDAP_ALREADY_EXISTS ) { printf( "Entry \"%s is already in the directory.\n", dn ); } else { ldap_perror( ld, "ldap_add_s" ); free_mods( mods ); return( 1 ); } } else { printf( "Added entry \"%s\".\n", dn ); } free_mods( mods ); /* Delete the destination entry, for this example */ if (( rc = ldap_delete_s( ld, ndn )) != LDAP_SUCCESS ) { /* If entry does not exist, fine. Ignore this error. */ if ( rc == LDAP_NO_SUCH_OBJECT ) { printf( "Entry \"%s\" is not in the directory. " "No need to delete.\n", ndn ); } else { ldap_perror( ld, "ldap_delete_s" ); return( 1 ) } } else { printf( "Deleted entry \"%s\".\n", ndn ); } /* Do the modrdn operation */ if ( ldap_modrdn2_s( ld, dn, nrdn, 0 ) != LDAP_SUCCESS ) { ldap_perror( ld, "ldap_modrdn2_s" ); return( 1 ); } printf( "The modrdn operation was successful. Entry\n" "\"%s\" has been changed to\n" "\"%s\".\n", dn, ndn ); ldap_unbind( ld ); return 0; } /* * Free a mods array. */ static void free_mods( LDAPMod **mods ) { int i; for ( i = 0; i < NMODS; i++ ) { free( mods[ i ] ); } free( mods ); }
/* * @(#)Modrdn.java 1.2 99/07/26 * * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ import java.util.Hashtable; import java.util.Date; import javax.naming.*; import javax.naming.directory.*; /* * Modify the RDN (relative distinguished name) of an entry. In this * example, we change the dn "cn=Jacques Smith, o=Ace Industry, c=US" * to "cn=Jacques M Smith, o=Ace Industry, c=US". * * Since it is an error to either (1) attempt to modrdn an entry which * does not exist, or (2) modrdn an entry where the destination name * already exists, we take some steps, for this example, to make sure * we'll succeed. We (1) add "cn=Jacques Smith" (if the entry exists, * we just ignore the error, and (2) delete "cn=Jacques M Smith" (if the * entry doesn't exist, we ignore the error). * * After renaming, we add back the attribute "Jacques Smith" into the cn * attribute. * * [based on modrdn.c of Netscape SDK] */ class Modrdn { public static void main(String[] args) { /* Values we'll use in creating the entry */ Attribute objClasses = new BasicAttribute("objectclass"); objClasses.add("top"); objClasses.add("person"); objClasses.add("organizationalPerson"); objClasses.add("inetOrgPerson"); Attribute cn = new BasicAttribute("cn", "Jacques Smith"); Attribute sn = new BasicAttribute("sn", "Smith"); Attribute givenNames = new BasicAttribute("givenname", "Jacques"); /* Specify the DN we're adding */ String dn = "cn=Jacques Smith, " + Env.MY_MODBASE; /* the destination DN */ String ndn = "cn=Jacques M Smith, " + Env.MY_MODBASE; /* the new RDN */ String nrdn = "cn=Jacques M Smith"; Hashtable env = new Hashtable(5, 0.75f); /* * Specify the initial context implementation to use. * This could also be set by using the -D option to the java program. * For example, * java -Djava.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory \ * Modrdn */ env.put(Context.INITIAL_CONTEXT_FACTORY, Env.INITCTX); /* Specify host and port to use for directory service */ env.put(Context.PROVIDER_URL, Env.MY_SERVICE); /* specify authentication information */ env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, Env.MGR_DN); env.put(Context.SECURITY_CREDENTIALS, Env.MGR_PW); DirContext ctx = null; try { /* get a handle to an Initial DirContext */ ctx = new InitialDirContext(env); Attributes orig = new BasicAttributes(); orig.put(objClasses); orig.put(cn); orig.put(sn); orig.put(givenNames); /* Add the entry */ ctx.createSubcontext(dn, orig); System.out.println( "Added entry " + dn + "."); } catch (NameAlreadyBoundException e) { /* If entry exists already, fine. Ignore this error. */ System.out.println("Entry " + dn + " already exists, no need to add"); } catch (NamingException e) { System.err.println("Modrdn: problem adding entry." + e); System.exit(1); } try { /* Delete the destination entry, for this example */ ctx.destroySubcontext(ndn); System.out.println( "Deleted entry " + ndn + "." ); } catch (NameNotFoundException e) { /* If entry does not exist, fine. Ignore this error. */ System.out.println( "Entry " + ndn + " is not in the directory. " + "No need to delete."); } catch (NamingException e) { System.err.println("Modrdn: problem deleting entry." + e); System.exit(1); } /* Do the modrdn operation */ try { ctx.rename(dn, ndn); System.out.println("The modrdn operation was successful. Entry " + dn + " has been changed to " + ndn + "."); } catch (NamingException e) { System.err.println("Modify operation failed." + e); } } }


Displaying text using label components
The UILabel component can be used to display text.
Step 1
Make sure your activity references the correct view component.
import { view } from "./view";
class MainActivity extends PageViewComponent.with(view) {
// ... activity methods
}
Step 2 (JSX)
Add a label somewhere in your view, and add the text between the <label>
and </label>
tags.
// view.tsx
export default (
<cell>
<centerrow>
<label>Text goes here</label>
</centerrow>
</cell>
);
Alternative (without JSX)
Use the static UILabel.withText()
method to create a component factory for a label that contains given text.
// view.ts
export default UICell.with(
UICenterRow.with(UILabel.withText("Text goes here"))
);


Way to load a specific version of a shared library for a given application
Ignored for setuid programs
However, a program may be invoked as root and be vulnerable
https://minipli.wordpress.com/2009/07/17/ld_preload-vs-etcld-so-preload/
/etc/ld.so.preload is OS wide
env: LD_PRELOAD is for current shell/process
TODO: Research


Customized Website Solutions.
I'm a Chicago native now enjoying the Portland metro area. I've travelled extensively; living in Hawaii for 5 years and recently taking a year off to travel across the US in a campervan. I spend my free time with the local theater, reading, hiking and trail running.
A STEM background in engineering, cartography and database administration has provided me with an eye for detail, organization skills and an ability to learn quickly and collaborate with others on projects where communication, precision and timeliness are key.
HTML5, CSS & PHP
Javascript/jQuery
Photoshop PSD to HTML Conversion
Wordpress theme and plugin customization
Required fields are marked with asterisk *:
Web Developer | Storm Coast Design
Thank you for taking an interest in my portfolio! I am currently open to freelance as well as larger full- or part-time commitments. You can email me or contact me using the form provided, and we can arrange to call or meet in person.
Email<EMAIL_ADDRESS>Follow me: Github / Twitter


GradCafe Scraper
The Api scrapes GradCafe pages, it has no affiliation with GradCafe.
By Suman Saurabh


Meet the Team
Project Portfolio
Team [Untitled] Software Engineering Portfolio
Cortez Banks ♦ Kyle Brick ♦ Luke Freeman ♦ Jocelyn Murray
Meet the Team


stk.calculators.ga.crossers module¶
Defines crossers.
Crossers are objects which take a group of molecules and recombine
them to produce offspring molecules. How crossers are used can be
seen in the documentation of the various Crosser
classes,
for example GeneticRecombination
,
Jumble
or RandomCrossover
.
Extending stk: Making new crossers.¶
To add a new Crosser
, make a new class which inherits
Crosser
and defines a method called
crossover()
. The method is a generator, which can take
any number of molecules and yields the offspring molecules.
-
class
stk.calculators.ga.crossers.
Crosser
¶ Bases:
object
Carries out crossover on molecules.
-
class
stk.calculators.ga.crossers.
GeneticRecombination
(key, random_yield_order=True)¶ Bases:
stk.calculators.ga.crossers.Crosser
Recombine building blocks using biological systems as a model.
Overall, this crosser mimics how animals and plants inherit DNA from their parents, except generalized to work with any number of parents. First it is worth discussing some terminology. A gene is a the smallest packet of genetic information. In animals, each gene can have multiple alleles. For example, there is a gene for hair color, and individual alleles for black, red, brown, etc. hair.  When two parents produce an offspring, the offspring will have a hair color gene and will inherit the allele of one of the parents at random. Therefore, if you have two parents, one with black hair and one with red hair, the offspring will either have black or red hair, depending on which allele they inherit.
In
stk
molecules, each building block represents an allele. The question is, which gene is each building block an allele of? To answer that, let’s first construct a couple of building block moleculesbb1 = StructUnit2('filename1.mol', ['amine']) bb2 = StructUnit3('filename2.mol', ['aldehyde']) bb3 = StructUnit2('filename3.mol', ['aldehyde']) bb4 = StructUnit3('filename4.mol', ['amine'])
We can define a function which analyzes a building block molecule and returns the gene it belongs to, for example
def determine_gene(building_block): return building_block.func_group_infos[0].name
Here, we can see that the gene to which each building block molecule belongs is given by the functional group name. Therefore there is an
'amine'
gene which has two allelesbb1
andbb4
and there is an'aldehyde'
gene which has two allelesbb2
andbb3
.Alternatively, we could have defined a function such as
def determine_gene(building_block): return building_block.__class__.__name__
Now we can see that we end up with the gene called
'StructUnit2'
which has two allelesbb1
andbb3
and a second gene called'StructUnit3'
which has the allelesbb2
andbb4
.To produce offspring molecules, this class categorizes each building block of the parent molecules into genes using the key parameter. Then, to generate a single offspring, it picks a random building block for every gene. The picked building blocks are used to construct the offspring. The topoogy of the offspring is one of the parent’s topologies. For obvious reasons, this approach works with any number of parents.
-
key
¶ A function, which takes a
StructUnit
object and returns its gene or category. To produce an offspring, one of the building blocks from each category is picked at random.Type: function
-
random_yield_order
¶ Toggles if the order in which the building blocks are made should be random.
Type: bool
Examples
Note that any number of parents can be used for the crossover.
# Create the molecules which will be crossed. bb1 = StructUnit2.smiles_init('NCCN', ['amine']) bb2 = StructUnit2.smiles_init('O=CCCCC=O', ['aldehyde']) polymer1 = Polymer([bb1, bb2], Linear('AB', [0, 0], n=2)) bb3 = StructUnit2.smiles_init('NCCCN', ['amine']) bb4 = StructUnit2.smiles_init('O=C[Si]CCC=O', ['aldehyde']) polymer2 = Polymer([bb3, bb4], Linear('AB', [0, 0], n=2)) bb5 = StructUnit2.smiles_init('NC[Si]CN', ['amine']) bb6 = StructUnit2.smiles_init('O=CCNNCCC=O', ['aldehyde']) polymer3 = Polymer([bb5, bb6], Linear('AB', [0, 0], n=2)) # Create the crosser. recombination = GeneticRecombination( key=lambda mol: mol.func_group_infos[0].name) # Get the offspring molecules. cohort1 = list( recombination.crossover(polymer1, polymer2, polymer3) ) # Get a second set of offspring molecules. cohort2 = list( recombination.crossover(polymer1, polymer2, polymer3) ) # Make a third set of offspring molecules by crossing two of # the offspring molecules. offspring1, offspring2, *rest = cohort1 cohort3 = list( recombination.crossover(offspring1, offspring2) )
-
crossover
(*mols)¶ Applies a crossover operation on some molecules.
Parameters: *mols ( MacroMolecule
) – The molecules to be crossed.Yields: MacroMolecule
– The generated offspring.
-
-
class
stk.calculators.ga.crossers.
Jumble
(num_offspring_building_blocks, duplicate_building_blocks=False, random_yield_order=True)¶ Bases:
stk.calculators.ga.crossers.Crosser
Distributes all building blocks among offspring.
Puts all the building blocks from each parent into one big pot and building blocks are drawn from the pot to generate the offspring. The offspring inherit the topology of one of the parents.
-
num_offspring_building_blocks
¶ The number of building blocks each offspring is made from.
Type: int
-
duplicate_building_blocks
¶ Indicates whether the building blocks used to construct the offspring must all be unique.
Type: bool
-
random_yield_order
¶ Toggles if the order in which the building blocks are made should be random.
Type: bool
Examples
Note that any number of parents can be used for the crossover.
# Create the molecules which will be crossed. bb1 = StructUnit2.smiles_init('NCCN', ['amine']) bb2 = StructUnit2.smiles_init('O=CCCCC=O', ['aldehyde']) polymer1 = Polymer([bb1, bb2], Linear('AB', [0, 0], n=2)) bb3 = StructUnit2.smiles_init('NCCCN', ['amine']) bb4 = StructUnit2.smiles_init('O=C[Si]CCC=O', ['aldehyde']) polymer2 = Polymer([bb3, bb4], Linear('AB', [0, 0], n=2)) bb5 = StructUnit2.smiles_init('NC[Si]CN', ['amine']) bb6 = StructUnit2.smiles_init('O=CCNNCCC=O', ['aldehyde']) polymer3 = Polymer([bb5, bb6], Linear('AB', [0, 0], n=2)) # Create the crosser. jumble = Jumble(num_offspring_building_blocks=2) # Get the offspring molecules. cohort1 = list(jumble.crossover(polymer1, polymer2, polymer3)) # Get a second set of offspring molecules. cohort2 = list(jumble.crossover(polymer1, polymer2, polymer3)) # Make a third set of offspring molecules by crossing two of # the offspring molecules. offspring1, offspring2, *rest = cohort1 cohort3 = list(jumble.crossover(offspring1, offspring2))
-
crossover
(*mols)¶ Carries out crossover on some molecules.
Parameters: *mols ( MacroMolecule
) – The parent molecules.Yields: MacroMolecule
– The offspring molecule.
-
-
class
stk.calculators.ga.crossers.
RandomCrossover
(*crossers, weights=None)¶ Bases:
stk.calculators.ga.crossers.Crosser
Uses a random
Crosser
to carry out crossovers.-
weights
¶ The probability that each
Crosser
will be selected to carry out a crossover.Type: list
offloat
Examples
Note that the crossover operations used in this example accept any number of parents.
# Create the molecules which will be crossed. bb1 = StructUnit2.smiles_init('NCCN', ['amine']) bb2 = StructUnit2.smiles_init('O=CCCCC=O', ['aldehyde']) polymer1 = Polymer([bb1, bb2], Linear('AB', [0, 0], n=2)) bb3 = StructUnit2.smiles_init('NCCCN', ['amine']) bb4 = StructUnit2.smiles_init('O=C[Si]CCC=O', ['aldehyde']) polymer2 = Polymer([bb3, bb4], Linear('AB', [0, 0], n=2)) bb5 = StructUnit2.smiles_init('NC[Si]CN', ['amine']) bb6 = StructUnit2.smiles_init('O=CCNNCCC=O', ['aldehyde']) polymer3 = Polymer([bb5, bb6], Linear('AB', [0, 0], n=2)) # Create the crossers. recombination = GeneticRecombination( key=lambda mol: mol.func_group_infos[0].name) jumble = Jumble(num_offspring_building_blocks=2) random_crossover = RandomCrossover(recombination, jumble) # Get the offspring molecules, either recombination or jumble # will be used to make them. cohort1 = list( random_crossover.crossover(polymer1, polymer2, polymer3) ) # Get a second set of offspring molecules, either recombination # or jumble will be used to make them. cohort2 = list( random_crossover.crossover(polymer1, polymer2, polymer3) ) # Make a third set of offspring molecules by crossing two of # the offspring molecules. Either recombination or jumble will # be used to make them. offspring1, offspring2, *rest = cohort1 cohort3 = list( random_crossover.crossover(offspring1, offspring2) )
-
crossover
(*args, **kwargs)¶ Create offspring with a
Crosser
incrossers
.Parameters: - *args (
object
) – Arguments passed to the chosenCrosser
’scrossover()
method. - **kwargs (
object
) – Keyword arguments passed to the chosenCrosser
’scrossover()
method.
Yields: Molecule
– The generated offspring- *args (
-


Solar2D development is sponsored by its users. Support the project on GitHub Sponsors or Patreon.
Why Solar2D?
Rapid Iterations
See your changes instantly on desktop with the Solar2D Simulator, or directly on your device with Live Builds.
Vibrant Ecosystem
Hundreds of plugins allow you to integrate Ad Networks and countless features not provided by the core engine. Or easily create your own!
Production Ready
Solar2D is official fork of Corona SDK, which has been in active development for over 10 years, and used by hundreds of thousands of developers to create profitable apps and games.
Batteries Included
Use thousands of built-in APIs in the core engine or add your own with easy native extensions.
Active Community
Join an engaged community of thousands of developers using Solar2D on the Forums and Slack.
Open Source
All source code and resources are available under the MIT license.
Dedicated Development
This is a fully open sourced project that is a fork of the well established and widely
used Corona SDK game engine, which is no longer commercially supported.
Development is lead by Vlad Shcherban, former technical lead engineer at Corona Labs Inc.
If you are using this engine, consider supporting its development.


PLUGGED
The iPhone 13 isn’t out yet but the iPhone 14 is already leaking
GET ZUCKED
The Facebook and Ray-Ban smart glasses look cool… but no thanks
SOCIAL MEDIA
Twitter apes Reddit with the launch of its ‘Communities’ feature
TNW Conference 2021
Why limit happy hour to just an hour?
Advert Here
POPULAR ARTICLES TODAY
The ISS could be gone by 2024 — what does it mean the future of space travel?
The ISS could be gone by 2024 — what does it mean the future of space travel?
The ISS could be gone by 2024 — what does it mean the future of space travel?
The ISS could be gone by 2024 — what does it mean the future of space travel?
The ISS could be gone by 2024 — what does it mean the future of space travel?


TL;DR
This project was linked to a lecture about Shape Modeling. This project presents a method to obtain the stable position of a mesh constrained under forces. The simulation is mainly based on Springs.
The main idea is to compare the mesh with a Spring’s network. Then, the problem is to minimize the global stress (which’s the sum of the individual Spring stress) of the mesh, by an optimization method. Here again we are talking about reducing the energy of the mesh.
We have choices on the Spring modelisation and the optimization method. We will go through first order optimization (Gradient descent) and second order optimization (Newton’s method).
Table of Contents
1. Mass-spring simulation
1.1. Gradient Descent and Line Search
1.2. Spring simulation with gradient descent
1.3. Newton’s method
1.4. Spring simulation with Newton’s method
2. FEM Simulation
2.1. FEM simulation with gradient descent
2.2. FEM simulation with Newton’s method
1. Mass-spring simulation
1.1. Gradient Descent and Line Search
We can validate our gradient descent method on small and easy to debug problem.
So for this first part, we’re going to validate the method on the Rosenbrock function
-> Function
We will write several function :
- computeValue(const VectorXd& x) will return f(x), with f the Rosenbrock function
- addGradientTo(VectorXd& grad, const VectorXd& x) will add to the gradient vector (first paramter) the computed gradient of the Rosenbrock function (analytical)
- doLineSearch will performs a line search of a better (lower value) solution, in a particular direction (given by dx) of research
Explanation
We do compute the value as a simple function evaluation.
We do calculate the gradient of the function anaticaly and then compute it at one specific point. We get the two directional derivative of this function at that point.
We do compute the search direction as the opposite of the gradient. We do a line search as the current position, added of a ‘dx’ in the search direction, that we halves if the evaluation of the function at this position is higher than the current point - meaning that it makes no sense to “jump” there. So, regarding the first value of Dx, we will consider 1Dx,0.5Dx,0.25Dx, 0.125Dx … until we get a “better” value of the total Energy.
Usage
virtual double computeValue(const VectorXd& x) {
// Ex 1.1
double xV = x[0];
double yV = x[1];
return (a-xV) * (a-xV) + b * (yV-(xV*xV))*(yV-(xV*xV));
}
(...)
virtual void addGradientTo(VectorXd& grad, const VectorXd& x) {
// Ex 1.1
double xV = x[0];
double yV = x[1];
//Calculate the directionnal derivatives
double dfdx = 2 * (-a + xV + 2 * b * xV * (xV*xV - yV));
double dfdy = 2 * b * (yV - xV*xV);
//Store it
grad[0] += dfdx; //+ grad[0];
grad[1] += dfdy; //+ grad[1]; /// ? Adds ? Or replace ? Or appends ?
}
(...)
virtual void computeSearchDirection(ObjectiveFunction *function, const VectorXd &x, VectorXd &dx)
{
// Ex. 1.1
VectorXd grad;
grad.resize(x.rows(), 1);
function->addGradientTo(grad, x);
//Store it
dx[0] = -grad[0];
dx[1] = -grad[1];
// Note : no normalization, otherwise we loose information ?
}
(...)
virtual void doLineSearch(ObjectiveFunction *function, const VectorXd &dx, VectorXd &xi)
{
// Ex. 1.1
(...)
for (int i = 0; i < maxLineSearchIterations && !isInferior; i++)
{
if (function->computeValue(tmpx) > actualValue)
{ //We have " a higher point "
tmpx = xi + dx*currentAlpha;
currentAlpha *= beta;
}
else
{ // We have a lower point, we stop here
isInferior = true; //Not really necessary ...
break;
}
}
//Storage
xi = tmpx;
}
(...)
Result
The minimum of the Rosenbrock functin is (1,1) and we see the gradient descent find this value, but with a high number of iterations.
Gradient descent:
converged: yes
iterations: 9750
min. x: 1.00001 1.00002
min. value: 6.17752e-11
1.2. Spring simulation with gradient descent
Now that your basic function are functionnal, we can get to a harder problem : the spring simulation of the mesh.
Similarly, we will write several function :
- getEnergy(const VectorXd& x, const VectorXd& X) will spring energy given the current list of state x and list of rest state X of every spring.
- addEnergyGradientTo(const VectorXd& x, const VectorXd& X, VectorXd& grad), which add to the gradient vector (last paramter) the computed gradient of the spring energy given states x and rest states X.
- doLineSearch will be the same as previously.
Explanation
We calculate the energy of a Spring as the expression provided in the PDF.
We calculate the gradient of the energy as : f = -dE. So we calculate the opposite of the Force function, as provided in the PDF, at each point (2 ends) of the current Spring. The calculated value is stored in the gradient Vector, at the place of each node (x and y components).
Usage
virtual double getEnergy(const VectorXd& x, const VectorXd& X) {
// Ex 1.2
//Compute actual length
Vector2d elong_Pos_0 = getNodePos(0, x);
Vector2d elong_Pos_1 = getNodePos(1, x);
double l = getLength(elong_Pos_0, elong_Pos_1);
//Compute rest length
Vector2d rest_Pos_0 = getNodePos(0, X);
Vector2d rest_Pos_1 = getNodePos(1, X);
double L = getLength(rest_Pos_0, rest_Pos_1);
// Energy = 0.5 * k * ((l - L)/L)²
return 0.5 * k * L * (l-L)/L * (l-L)/L;
}
virtual void addEnergyGradientTo(const VectorXd& x, const VectorXd& X, VectorXd& grad) {
// Ex 1.2
// Task: Given `x` and `X`, add the gradient of the spring energy to `grad`.
//We consider the gradient of E as : f = -dE
// f = - k * ((l/L) - 1) * u
//Compute rest length
Vector2d rest_Pos_A = getNodePos(0, X);
Vector2d rest_Pos_B = getNodePos(1, X);
double L_norm = getLength(rest_Pos_A, rest_Pos_B);
//Compute actual length
Vector2d elong_Pos_A = getNodePos(0, x);
Vector2d elong_Pos_B = getNodePos(1, x);
Vector2d l_vec = elong_Pos_A - elong_Pos_B;
double l_norm = getLength(elong_Pos_A,elong_Pos_B);
Vector2d u = l_vec.normalized();
double cste = k * ((l_norm-L_norm)/L_norm);
assert(std::isfinite(cste));
grad[2*getNodeIndex(0)] += cste * u[0];
grad[2*getNodeIndex(0)+1] += cste * u[1];
grad[2*getNodeIndex(1)] += -cste * u[0];
grad[2*getNodeIndex(1)+1] += -cste * u[1];
}
Result
Result of "Test" button - Gradient Descent - Spring - Default max stress (0.02)
The gradient descent give a minimal value, with a high number of iteration, that we will be able to compare with output of other methods.
Gradient Descent
total energy = 117.884
# iterations = 3468
min def at = 7.80134e-08
max def at = 0.00641764
1.3. Newton’s method
The first order can get to a solution, but need many iterations (especially in some particular situation, if the function is of degree 2 or more).
Therefore, we can compute a second order solution. As for the first order, we begin by the Rosenbrock Function.
We will write several function :
- addHessianEntriesTo, which adds its second order derivatives as Eigen::Triplets.
- computeSearchDirection, which computes the search direction dx given an objective function. We use Eigen::SimplicialLDLT to solve the search Direction.
Explanation
We calculate analytically the hessian, and we compute it directly.
We then solve the system to get the dx value.
Usage
virtual void addHessianEntriesTo(std::vector<Tripletd> &hessianEntries, const VectorXd &x)
{
// Ex 1.2
// write d^2f/dx^2 in `hessianEntries`
double xV = x[0];
double yV = x[1];
//Fill the Hessian
hessianEntries.push_back(Tripletd(0, 0, -4 * b * (yV - xV * xV) + 8 * b * xV * xV + 2));
hessianEntries.push_back(Tripletd(0, 1, -4 * b * xV));
hessianEntries.push_back(Tripletd(1, 0, -4 * b * xV));
hessianEntries.push_back(Tripletd(1, 1, 2 * b));
}
(...)
virtual void computeSearchDirection(ObjectiveFunction *function, const VectorXd &x, VectorXd &dx)
{
(...)
// Ex 1.3
Eigen::SimplicialLDLT<Eigen::SparseMatrix<double>> solver;
(...)
function->addHessianEntriesTo(hessianEntries, x);
hessianSparse.setFromTriplets(hessianEntries.begin(), hessianEntries.end());
function->addGradientTo(grad, x);
grad = -1 * grad;
rightSide = grad.sparseView();
solver.compute(hessianSparse);
solved = solver.solve(rightSide);
dx = MatrixXd(solved);
}
(...)
Result
We see, compared to the gradient descent, that Newton method give a correct result, but only in one iteration. Note : the 0.000001 of error for the gradient descent is due to the way the calculation is stopped. If we don’t see any improvement (0.00001 or more difference) between two iterations, we stop the process. As the process converge very slowly, there is not more improvement (numerically) and so the process is stopped. Whereas for the Newton’s Method, in one jump, it goes right at the good position.
Newton's method:
converged: yes
iterations: 4
min. x: 1 1
min. value: 2.91398e-13
1.4. Spring simulation with Newton’s method
Now that your basic function are functionnal for the second order method, we can get similarly improve it to the Spring simulation.
Similarly, we will write several function :
- addHessianEntriesTo(const VectorXd& x, const VectorXd& X, VectorXd&
grad), adds the second order derivatives of the spring energy to the Hessian (hesEntries)
Explanation
We compute analytically the Hessian and implement it the same way. The disposition in the “global” hessian is dependent on which point we consider and which derivative of it we compute.
The manual computation is verified automatically :
Usage
virtual void addHessianEntriesTo(std::vector<Tripletd> &hessianEntries, const VectorXd &x)
{
//Compute rest length
Vector2d rest_Pos_A = getNodePos(0, X);
Vector2d rest_Pos_B = getNodePos(1, X);
Vector2d L_vec = rest_Pos_A - rest_Pos_B;
double L_norm = getLength(rest_Pos_A, rest_Pos_B);
//Compute actual length
Vector2d elong_Pos_A = getNodePos(0, x);
Vector2d elong_Pos_B = getNodePos(1, x);
Vector2d l_vec = elong_Pos_A - elong_Pos_B;
double l_norm = getLength(elong_Pos_A,elong_Pos_B);
Vector2d u = l_vec.normalized();
double ga = k/(L_norm*L_norm*l_norm*l_norm); //k/(L²*l²)
double be = -(k*((l_norm/L_norm)-1))/(L_norm*l_norm*l_norm*l_norm); //-k*((l/L)-1)/(L*l^3)
double al = (k*((l_norm/L_norm)-1))/(L_norm*l_norm); //k* (l/L -1)/(L*l)
double A = l_vec[0]*l_vec[0]*ga + l_vec[0]*l_vec[0]*be + al;
double B = l_vec[0]*l_vec[1]*ga + l_vec[0]*l_vec[1]*be;
//double C = ;
double D = l_vec[1]*l_vec[1]*ga + l_vec[1]*l_vec[1]*be + al;
(...)
//Create hessian
int nodeAIndex = 2*getNodeIndex(0);
int nodeBIndex = 2*getNodeIndex(1);
hesEntries.push_back(Tripletd(nodeAIndex, nodeAIndex, A )); // Haut gauche // Ligne haut, Exi, dxi
hesEntries.push_back(Tripletd(nodeAIndex, nodeAIndex + 1, B )); // Haut droite // Ligne haut, Exi, dyi
hesEntries.push_back(Tripletd(nodeAIndex+1, nodeAIndex, B )); // Bas gauche // Ligne bas, Exi, dxi
hesEntries.push_back(Tripletd(nodeAIndex+1, nodeAIndex +1, D )); // Bas droite // Ligne bas, Exi, dyi
hesEntries.push_back(Tripletd(nodeAIndex, nodeBIndex, - A )); // Haut gauche // Ligne haut, Exi, dxj
hesEntries.push_back(Tripletd(nodeAIndex, nodeBIndex + 1, -B )); // Haut droite // Ligne haut, Exi, dyj
hesEntries.push_back(Tripletd(nodeAIndex+1, nodeBIndex, -B )); // Bas gauche // Ligne bas, Exi, dxj
hesEntries.push_back(Tripletd(nodeAIndex+1, nodeBIndex +1, - D )); // Bas droite // Ligne bas, Exi, dyj
hesEntries.push_back(Tripletd(nodeBIndex, nodeAIndex, - A )); // Haut gauche // Ligne haut, Exj, dxi
hesEntries.push_back(Tripletd(nodeBIndex, nodeAIndex + 1, -B )); // Haut droite // Ligne haut, Exj, dyi
hesEntries.push_back(Tripletd(nodeBIndex+1, nodeAIndex, -B )); // Bas gauche // Ligne bas, Exj, dxi
hesEntries.push_back(Tripletd(nodeBIndex+1, nodeAIndex +1, - D )); // Bas droite // Ligne bas, Exj, dyi
hesEntries.push_back(Tripletd(nodeBIndex, nodeBIndex, A )); // Haut gauche // Ligne haut, Exj, dxj
hesEntries.push_back(Tripletd(nodeBIndex, nodeBIndex + 1, B )); // Haut droite // Ligne haut, Exj, dyj
hesEntries.push_back(Tripletd(nodeBIndex+1, nodeBIndex, B )); // Bas gauche // Ligne bas, Exj, dxj
hesEntries.push_back(Tripletd(nodeBIndex+1, nodeBIndex +1, D )); // Bas droite // Ligne bas, Exj, dyj
}
Result
Here again, we can see that’s the second order converge much faster, to the same result.
total energy = 117.539
# iterations = 3
min def at = 2.53686e-11
max def at = 0.0172078
2. FEM Simulation
2.1. FEM simulation with gradient descent
If the Spring modelization is easy enough, as previously, we can compute derivative analyticaly. In case of more complex Spring modelization - as Neo-Hookean Springs - we can’t easily analyticaly calculate the derivative, as it is already of degree 2.
In this case, we might use numerical derivation, or automatic differentiation.
We’re going to see an implementation of the numerical derivation solution, with Finite Element Method.
Some functions will be implemented :
- getEnergy, which returns the Neo-Hookean deformation energy of one Spring.
- addEnergyGradientTo, which write the gradient of this deformation in the given array.
Explanation
We compute the energy from the energy density, by simply multiplicate the energy density by the area where this energy is applied. The expression of the Energy density is the Neo-Hookean one.
We then compute the Gradient, with finite differences, as the difference of energy, normalized, if points involved in the structure are sligtly moved.
Usage
virtual double getEnergy(const VectorXd &x, const VectorXd &X)
{
// Ex 2.1
Vector2d xTMP[3];
xTMP[0] = getNodePos(0, x);
xTMP[1] = getNodePos(1, x);
xTMP[2] = getNodePos(2, x);
computeDeformationGradient(xTMP, dxdX);
MatrixXd C = (dxdX.transpose() * dxdX);
double logdetF = log(dxdX.determinant());
double Energy = (shearModulus * 0.5 * (C.trace() - 2) - shearModulus * logdetF + bulkModulus * 0.5 * logdetF * logdetF);
return restShapeArea * Energy;
}
virtual void addEnergyGradientTo(const VectorXd &x, const VectorXd &X, VectorXd &grad)
{
// Ex 2.1
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < 3; i++)
{
modified_x_A = x;
modified_x_B = x;
modified_x_A[2 * indexPoint[i] + j] += h;
modified_x_B[2 * indexPoint[i] + j] -= h;
double Etmp = (getEnergy(modified_x_A, X) - getEnergy(modified_x_B, X)) / (2 * h);
grad[2 * indexPoint[i] + j] += Etmp;
}
}
Result
We get a solution, with a high number of iterations.
total energy = 115.291
# iterations = 6609
min def at = 4.72342e-08
max def at = 0.0114811
2.2. FEM simulation with Newton’s method
Here again, we can extend this derivation to the second order. We will need the function addEnergyHessianTo which will add the values of second order derivative to the provided matrix.
Explanation
We construct the Hessian with finite difference, as the variation of gradients, if we slighlty move 2 points of the initial structure.
As there is a lot (66) of coefficients to compute, we use iterative structures.
The positions of each coefficient depends on the 2 points involved (that gives the X position and Y position of the 44 “block”) and if we are considering X or Y coordinates (which give the position into that block, dxdx in upper left, dydy in bottom right).
Usage
virtual void addEnergyHessianTo(const VectorXd &x, const VectorXd &X, std::vector<Tripletd> &hesEntries)
{
// Ex 2.2
//Liste of necessary energies
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
//We get the indices of two nodes
int nodeAIndex = getNodeIndex(i);
int nodeBIndex = getNodeIndex(j);
//For the corner of this hessian bloc : xx, xy, yx, yy
for (int x_val = 0; x_val < 2; x_val++) //Refers to the verical position in the actual 4-sized-square in the Hessian matrix
{
for (int y_val = 0; y_val < 2; y_val++) //Refers to the horizontal position in the actual 4-sized-square in the Hessian matrix
{
//Set the intiales values of the
modified_x_A_p_B_p = x;
modified_x_A_p_B_m = x;
modified_x_A_m_B_p = x;
modified_x_A_m_B_m = x;
//Modify positions
modified_x_A_p_B_p[2 * nodeAIndex + x_val] += h; //Ax or Ay
modified_x_A_p_B_p[2 * nodeBIndex + y_val] += h; //Bx or By
modified_x_A_p_B_m[2 * nodeAIndex + x_val] += h;
modified_x_A_p_B_m[2 * nodeBIndex + y_val] -= h;
modified_x_A_m_B_p[2 * nodeAIndex + x_val] -= h;
modified_x_A_m_B_p[2 * nodeBIndex + y_val] += h;
modified_x_A_m_B_m[2 * nodeAIndex + x_val] -= h;
modified_x_A_m_B_m[2 * nodeBIndex + y_val] -= h;
//Energy calculations
Energy_A_p_B_p = getEnergy(modified_x_A_p_B_p, X);
Energy_A_p_B_m = getEnergy(modified_x_A_p_B_m, X);
Energy_A_m_B_p = getEnergy(modified_x_A_m_B_p, X);
Energy_A_m_B_m = getEnergy(modified_x_A_m_B_m, X);
//We compute the Hessian values (Gradients inside)
double Hess_A_B_x_y = (((Energy_A_p_B_p - Energy_A_p_B_m) / (2 * h)) - ((Energy_A_m_B_p - Energy_A_m_B_m) / (2 * h))) / (2 * h);
//We add the value in the hessian
hesEntries.push_back(Tripletd(2 * nodeAIndex + x_val, 2 * nodeBIndex + y_val, Hess_A_B_x_y));
}
}
}
}
Result
Here again, we see a similar solution found (even slighlty better) with a much lower number of iterations.
total energy = 114.438
# iterations = 6
min def at = 6.79233e-08
max def at = 0.0321732
For more information, see : -> Repository
Note that the code is not optimized by thoughtful laziness: this code is not made to be reused as is in other applications, and if this is the case, the code will be reviewed and optimized. Thanks for your understanding.


Il semble que la perfection soit atteinte non quand il n’y a plus rien à ajouter, mais quand il n’y a plus rien à retrancher.
The Principle of the Good Parts is
If a feature is sometimes useful and sometimes dangerous and if there is a better option then always use the better option.
is a JavaScript program that looks for problems in JavaScript programs.
It is a code quality tool.
When C was
a young
programming language, there were several common programming errors that
were not caught by the primitive compilers, so an accessory program called
lint
was developed that would scan a source file, looking for problems.
As the language matured, the definition of the language was
strengthened to eliminate some insecurities, and compilers got better
at issuing warnings. lint
is no longer needed.
JavaScript is a
young-for-its-age language. It was originally intended to do small tasks in
webpages, tasks for which Java was too heavy and clumsy. But JavaScript is
a surprisingly capable language, and it is now being used in larger
projects. Many of the features that were intended to make the language easy
to use are troublesome when projects become complicated. A lint
for JavaScript is needed: , a JavaScript syntax checker and
validator.
takes a JavaScript source and scans it. If it finds a problem, it
returns a message describing the problem and an approximate location within
the source. The problem is not necessarily a syntax error, although it often
is. looks at some style conventions as well as structural problems.
It does not prove that your program is correct. It just provides another set
of eyes to help spot problems.
defines a professional subset of JavaScript, a stricter language than
that defined by the ECMAScript Programming Language Standard (the
strangely named document that governs JavaScript). will reject most
legal programs. It is a higher standard.
JavaScript is a sloppy language, but hidden deep inside there is an elegant,
better language. helps you to program in that better language
and to avoid most of the slop. will reject programs that browsers
will accept because is concerned with the quality of your code and
browsers are not. You should gladly accept all of 's advice.
can operate on JavaScript source
or JSON text.
A new sixth edition of ECMAScript [ES6] is expected to be published
later this year. Many of the new features are good ones, and will
recognise those. It will take time, perhaps years, for the new standard to
reach ubiquity. Using the new features in enviroments that do not fully
implement the new standard will result in failure. This is why gives
warnings when ES6 features are used. Some of ES6's features are good, so
will recognize the good parts of ES6 with the es6
option. As the new standard becomes more stable and better understood, the
set of features recognized by JSLint may increase. After the transition to
ES6 is complete, the es6
option will be dropped.
Currently, these features are recognized:
...
ellipsis marker in parameter lists
and argument lists, replacing the arguments
object for
variadic functions.let
statement, which is like the var
statement except that it respects block scope.
You may use let
or var
but not both.const
statement is like the let
statement
except that it disallows the use of assignment on the variable, although if the value of the variable is mutable, but can still be mutated.
const
is preferred to let
.
let
, and const
, but not var
or assignment statements, and not deep destructuring or eliding.=>
fart functions.import
and export
.`
Megastring`
literals, but not nested `
megastring`
literals.Map
, Set
,
WeakMap
, and WeakSet
.0b
- and 0o
- number literals.The most important new feature of ES6 is proper tail calls. This has no
new syntax, so doesn't see it. But it makes recursion much more
attractive, which makes loops, particularly for
loops, much
less attractive.
import export
The ES6 module feature will be an important improvement over JavaScript's
global variables as a means of linking separate files together.
recognizes a small but essential subset of the module syntax.
import
namefrom
stringliteral;
The stringliteral identifies a resource. The value (usually a function or object) exported from that resource can be accessed with the name. The stringliteral will be listed in the function report.
export default
value;
The value (usually a function or object) will be exported from this file.
provides three directives that may be inserted into a file to manage
's behavior. Use of these directives is optional. If they are used,
they should be placed into a source file before the first statement. They
are written in the form of a comment, where the directive name is placed
immediately after the opening of the comment before any whitespace. The
three directives are global
, jslint
, and
property
. Directives in a file are stronger than options
selected from the UI or passed with the option object.
/*global*/
The /*global*/
directive is used to specify a set of globals
(usually functions and objects containing functions) that are available to
this file. This was commonly used in browsers to link source files together
before ES6 modules appeared. Use of global variables is strongly discouraged, but unfortunately web browsers require their use. The /*global*/
directive can only be used when the Assume a browser option is selected.
Each of the names listed will indicate a
read-only global variable. The names are separated by ,
comma. This directive should not be used
if import
or export
is used. This directive inhibits
warnings, but it does not declare the names in the execution environment.
For example:
/*global
ADSAFE, report, jslint
*/
instructs to not give warnings about the global variables ADsafe
, report
, and jslint
. However, if any of those names
are expected to be supplied by other files and those other files fail to do so, then execution errors
will result. It is usually better to use top-level variable declarations instead:
var ADSAFE; var report; var jslint;
Using var
in this way allows comparing a global variable to the undefined
value to determine if it is present.
/*jslint*/
The /*jslint*/
directive allows for the control of several
options. These options can also be set from the
JSLint.com user interface.
| Description | option |
Meaning |
|---|---|---|
| Tolerate bitwise operators | bitwise |
true if bitwise operators should be allowed. The
bitwise operators are rarely used in JavaScript programs, so it
is usually more likely that & is a mistyping of
&& than that it indicates a bitwise and. |
| Assume a browser | browser |
true if the standard browser globals should be
predefined. This option will reject the use of import
and export . This option also
disallows the file form of the 'use strict' pragma. It does not
supply self or window ; you will have to request
these aliases of the dreaded global object yourself. It adds the
same globals as this directive:
|
| Assume CouchDB | couch |
true if Couch DB
globals should be predefined. It adds the
same globals as this directive:
|
| Assume in development | devel |
true if browser globals that are useful in
development should be predefined, and if debugger
statements and TODO comments
should be allowed. It adds the
same globals as this directive:
Be sure to turn this option off before going into production. |
| Tolerate the good parts of ES6 | es6 |
true if using the good parts of ECMAScript Sixth
Edition. Some ES6 features are still under probation. Some
ES6 features will never be good parts. It adds the
same globals as this directive:
|
Tolerate eval |
eval |
true if eval should be allowed. In the
past, the eval function was the most misused
feature of the language. |
Tolerate for statement |
for |
true if the for statement should be
allowed. It is almost always better to use the array methods instead. |
| Fudge the line and column numbers | fudge |
true if the origin of a text file is line 1 column
1. Programmers know that number systems start at zero.
Unfortunately, most text editors start numbering lines and
columns at one. |
| Maximum number of errors | maxerr |
The maximum number of warnings reported. (The default is unlimited) |
| Maximum line length | maxlen |
The maximum number of characters in a line. (The default is unlimited) |
| Tolerate multiple variables declarations per statement | multivar |
true if a var , let , or const statement can declare two or more variables in a single statement. |
| Assume Node.js | node |
true if Node.js globals should be predefined. It will
predefine globals that are used in the Node.js environment .
It adds the same globals as this directive:
|
Tolerate this |
this |
true if this should be allowed. |
| Tolerate whitespace mess | white |
true if the whitespace rules should be ignored. |
For example:
/*jslint es6, maxerr: 10, node */
/*property*/
The /*property*/
directive is used to declare a list of
property identifiers that are used in the file. Each property name in the
program is looked up in this list. If a name is not found, that indicates an
error, most likely a typing error.
The list can also be used to evade some of 's naming rules.
can build the /*property*/
list for you. At the bottom
of its report, displays a /*property*/
directive. It
contains all of the names that were used with dot
notation, subscript notation, and object literals to name the properties of
objects. You can look through the list for misspellings. You can copy the
/*property*/
directive to the top of your script file.
will check the spelling of all property names against the list. That
way, you can have look for misspellings for you.
For example,
/*property
charAt, slice, _$_
*/
ignore
introduces a new reserved word: ignore
. It is used in
parameter lists and in catch
clauses to indicate a parameter
that will be ignored. Unused warnings
will not be produced for ignore
.
function handler(ignore, value) { return do_something_useful(value); }
var let const
JavaScript provides three statements for declaring variables:
var
, let
, and const
. The
var
statement suffers from a bad practice called hoisting. The
let
statement does not do hoisting and respects block scope.
The const
statement is like let
except that it
marks the variable (but not its contents) as read only, making it an error
to attempt to assign to the variable. When given a choice,
const
is the best, var
is the worst. Use of
let
and const
require the es6
option.
uses the intersection of the var
rules and the
let
rules, and by doing so avoids the errors related to either.
A name should be declared only once in a function. It should be declared
before it is used. It should not be used outside of the block in which it is
declared. A variable should not have the same name as a variable or
parameter in an outer function. Do not mix var
and
let
. Declare one name per statement.
= == ===
Fortran made a terrible
mistake in using the equality operator as its assignment operator. That
mistake has been replicated in most languages since then. C compounded that
mistake by making ==
its equality operator. The visual
similarity is a source of errors. JavaScript compounded this further by
making ==
a type coercing comparison operator that produces
false positive results. This was mitigated by adding the ===
operator, leaving the broken ==
operator in place.
attempts to minimize errors by the following rules:
==
is not allowed. This avoids the false positives, and
increases the visual distance between =
and ===
.
Assignments are not allowed in expression position, and comparisons are not
allowed in statement position. This also reduces confusion.
JavaScript uses a C-like syntax that requires the use of semicolons to delimit certain statements. JavaScript attempts to make those semicolons optional with an automatic semicolon insertion mechanism, but it does not work very well. Automatic semicolon insertion was added to make things easier for beginners. Unfortunately, it sometimes fails. Do not rely on it unless you are a beginner.
expects that every statement be followed by ;
except for
for
, function
, if
,
switch
, try
, and while
. does
not expect to see unnecessary semicolons or the empty statement.
function =>
JavaScript has four syntactic forms for making function objects: function
statements, function expressions, enhanced object literals, and the
=>
fart operator.
The function statement creates a variable and assigns the function object to it. It should be used in a file or function body, but not inside of a block.
function
name(
parameters) {
statements}
The function expression unfortunately looks like the function statement. It may appear anywhere that an expression may appear, but not in statement position and not in a loop. It produces a function object but does not create a variable in which to store it.
function (
parameters) {
statements}
The enhanced object literal provides an ES6 shorthand for creating a property
whose value is a function, saving you from having to type :
colon
and function
.
{
name(
parameters) {
statements}
}
Finally, ES6 provides an even shorter form of function expression that leaves
out the words function
and return
:
(
parameters) =>
expression
requires the parens around the parameters, and forbids a
{
left brace after the
=>
fart to avoid syntactic ambiguity.
The ,
comma operator is unnecessary and can
mask programming errors.
expects to see the comma used as a separator, but not as an operator.
It does not expect to see elided elements in array literals. A comma should
not appear after the last element of an array literal or object literal.
expects blocks with function
, if
,
switch
, while
, for
, do
,
and try
statements and nowhere else.
expects that if
, while
, do
and
for
statements will be made with blocks {
that is,
with statements enclosed in braces}
.
JavaScript allows an if
to be written like this:
if (condition)
statement;
That form is known to contribute to mistakes in projects where many
programmers are working on the same code. That is why expects the
use of a block:
if (condition) { statements; }
Experience shows that this form is more resilient.
An expression statement is expected to be an assignment or a function/method call. All other expression statements are considered to be errors.
for
does not recommend use of the for
statement. Use array methods
like forEach
instead. The for
option will suppress
some warnings. The forms of for
that accepts are
restricted, excluding the new ES6 forms.
for
in
does not recommend use of the for
in
statement. Use
Object.keys
instead.
The for
in
statement allows for looping through
the names of all of the properties of an object. Unfortunately, it also
loops through all of the properties that were inherited through the
prototype chain. This has the bad side effect of serving up method
functions when the interest is in data properties. If a program is written
without awareness of this situation, then it can fail.
The body of every for
in
statement should be
wrapped in an if
statement that does filtering. It can select
for a particular type or range of values, or it can exclude functions,
or it can exclude properties from the prototype. For example,
for (name in object) { if (object.hasOwnProperty(name)) { .... } }
Note that the above code will fail if the object contains a data property
named hasOwnProperty
. Use Object.keys
instead.
switch
A common error in switch
statements is to forget to place a
break
statement after each case, resulting in unintended
fall-through. expects that the statement before the next
case
or default
is one of these:
break
, return
, or throw
.
with
The with
statement was intended to provide a shorthand in
accessing properties in deeply nested objects. Unfortunately, it behaves
very badly when setting new properties. Never use the with
statement.
does not expect to see a with
statement.
JavaScript allows any statement to have a label, and labels have a
separate name space. is more strict.
expects labels only on statements that interact
with break
: switch
, while
,
do
, and for
. expects that labels will be
distinct from vars and parameters.
expects that a return
, break
, or
throw
statement will be followed by a
}
right brace or case
or
default
.
expects that +
will not be followed by +
or
++
, and that -
will not be followed by
-
or --
. A misplaced space can turn
+ +
into ++
, an error that is difficult to see.
Use parens to avoid confusion.
++
and --
The ++
increment and
--
decrement operators have been known to
contribute to bad code by encouraging excessive trickiness. They are second
only to faulty architecture in enabling to viruses and other security
menaces. Also, preincrement/postincrement confusion can produce off-by-one
errors that are extremely difficult to diagnose. Fortunately, they are also
complete unnecessary. There are better ways to add 1 to a variable.
It is best to avoid these operators entirely and rely on +=
and
-=
instead.
void
In most C-like languages, void
is a type. In
JavaScript, void
is a prefix operator that always
returns undefined
. does not expect to
see void
because it is confusing and not very useful.
Regular expressions are written in a terse and cryptic notation.
looks for problems that may cause portability problems. It also attempts to
resolve visual ambiguities by recommending explicit escapement.
JavaScript's syntax for regular expression literals overloads the
/
slash character. To avoid ambiguity,
expects that the character preceding a regular expression literal is
a (
left paren or
=
equal or
:
colon or
,
comma character.
this
Having this
in the language makes it harder to talk
about the language. It is like pair programming with Abbott and Costello.
Avoid using this
. Warnings about this
can be
suppressed with option.this
.
new
Constructors are functions that are designed to be used with the
new
prefix. The new
prefix creates a new object
based on the function's prototype
, and binds that object to the
function's implied this
parameter. If you neglect to use the
new
prefix, no new object will be made and this
will be bound to the global object.
enforces the convention that constructor functions be given names
with initial uppercase. does not expect to see a function invocation
with an initial uppercase name unless it has the new
prefix.
does not expect to see the new
prefix used with
functions whose names do not start with initial uppercase.
does not expect to see the wrapper forms new Number
,
new String
, new Boolean
.
does not expect to see new Object
.
Use Object.create(null)
instead.
has a specific set of rules about the use of whitespace. Where
possible, these rules are consistent with centuries of good practice with
literary style.
The indentation increases by 4 spaces when the last token on a line is
{
left brace, [
left bracket,
(
left paren. The matching closing
token will be the first token on a line, restoring the previous
indentation.
The ternary operator can be visually confusing, so
?
question mark and :
colon always begin a line and increase the indentation by 4 spaces.
If .
period is the first character on a line, the indentation is increased by 4 spaces.
A var
, let
, or const
statement will
also cause an indentation if it declares two or more variables, and if the
second variable is not on the same line as the start of the statement.
Long lines can be continued on the next line with 8 spaces added to the current indentation. Those 8 spaces do not change the current indentation. It is 8 to avoid confusion with ordinary indentation.
The word function
is always followed with one space.
Clauses (case
, catch
, default
, else
, finally
) are not statements and so should
not be indented like statements.
Spaces are used to make things that are not invocations look less like invocations.
Tabs and spaces should not be mixed. We should pick just one in order to avoid the problems that come from having both. Personal preference is an extremely unreliable criteria.  Fifty years ago, tab had the advantage of consuming less memory, but Moore's Law has eliminated that advantage. Space has one clear advantage over tab: there is no reliable standard for how many spaces a tab represents, but it is universally accepted that a space occupies a space. So use spaces. You can edit with tabs if you must, but make sure it is spaces again before you commit. Maybe someday we will finally get a universal standard for tabs, but until that day comes, the better choice is spaces.
There are characters that are handled inconsistently in some browsers, and so must be escaped when placed in strings.
\u0000-\u001f \u007f-\u009f \u00ad \u0600-\u0604 \u070f \u17b4 \u17b5 \u200c-\u200f \u2028-\u202f \u2060-\u206f \ufeff \ufff0-\uffff
If is able to complete its scan, it generates a function
report. It lists for each function:
«
guess»
the name.catch
clauses of try
statements.The report will also include a list of all of the property names that were used.
Please let me know if is useful for you. Is it too
strict? Is there a check or a report that could help you to improve the
quality of your programs?
<EMAIL_ADDRESS>But please don't ask me to dumb down or to make it more
forgiving of bad practices. You would only be disappointed.
I intend to continue to adapt based on your comments.
Keep watching for improvements. Updates are announced at
https://plus.google.com/communities/104441363299760713736.
Try it. Paste your script into the window and click the button. The analysis is done by a script running on your machine. Your script is not sent over the network. You can set the options used.
is written entirely in JavaScript, so it can run anywhere that
JavaScript (or even Java) can run.
was designed to reject code that some would consider to be
perfectly fine. The reason for this is that 's purpose is to
help produce programs that are free of error. That is difficult in any
language and is especially hard in JavaScript. attempts to help you
increase the visual distance between correct programs and incorrect
programs, making the remaining errors more obvious. will give
warnings about things that are not necessarily wrong in the current
situation, but which have been observed to mask or obscure errors. Avoid
those things when there are better options available.
It is dangerous out
there. is here to help.
will hurt your feelings. Side effects may include headache,
irritability, dizziness, snarkiness, stomach pain, defensiveness, dry mouth,
cleaner code, and a reduced error rate.


Developed web application using Java 8, Spring, Hibernate, PostgreSQL, Angular 6
PROJECTS
Auto Centre Website
Website made as a term project.
It supports orders in auto servicing. It has three levels of users (customers, workers, admins). Written using HTML, CSS3, JavaScript, PHP, MySQL
CrossWord Generator
Application generates panoramic crossword from a text file with passwords. It can convert crossoword to PDF file. We can load saved board, show answers, change board size
Written in Java, JavaFx.It use Model–View–Controller.
EDUCATION
Computer Science
AGH University of Science and Technology in Cracow
2016-now
II Liceum Ogólnokształcące im. płk. Leopolda Lisa-Kuli in Rzeszów


Passion for best practices in software development and principles that ensure product quality
Boost your team with an accomplished software architect.
Get expert advice for developing maintainable and tested applications.
Helping less experienced developers to master the craft the right way.
PoshIn Code is the software consulting proprietorship in Belgrade, Serbia offering services to local and international enterprises, non-profit organisations, and individuals. Areas of expertise include PHP and related web technologies, software architecture, object-oriented design, and automated testing.
PoshIn Code's founder Nikola Poša is an experienced software architect specializing in PHP applications and web services. Nikola shares knowledge on his blog as well as through presentations at local user group meetups and international conferences.
Send us an email and we will get back to you as soon as possible!


Lab 05 - Create Guided Rules
Lab Goal
To create guided rules calculating shopping cart totals, totaling shopping cart items, and apply promotions for Cool Store
Creating guided rules
- First we will create a new guided rule:
AUTHORING -> PROJECT AUTHORING -> NEW ITEM -> GUIDED RULE
Guided Rule: Total Shopping Cart
Package: DEFAULT
(don't check the DSL box this time)
Creating guided rules
- Start by importing model object
ShoppingCart
for this rule:
CONFIG tab on the bottom of rule
NEW ITEM button at top, select ShoppingCart from Import list
Creating guided rules
- Now return to the
Edit
tab an start designing our rule
- The condition (WHEN):
'There is a ShoppingCart'
- assign a variable name to this ShoppingCart
'$sc'
Creating guided rules
- The action (THEN) is a two part action, add first with green '+' on right
- We want to modify value of ShoppingCart ($sc)
Creating guided rules
- click on pencil icon, select field
cartTotal
- assign via pencil icon
Literal value: 0.0
Creating guided rules
- Can you complete the second action (THEN) in same way?
- modify value of ShoppingCart field cartItemPromoSavings to following formula (paste without back-ticks):
`($sc.cartItemPromoSavings == 0.0) ? 0.0 : $sc.cartItemPromoSavings * -1`
- hint: use formula instead of literal value...
Creating guided rules
- Expand the 'show options' and add attributes, use green '+' on right:
check NO-LOOP box
RULEFLOW-GROUP: total-rules
Creating guided rules
- Save the rule and ensure your package builds:
OPEN PROJECT EDITOR -> BUILD & DEPLOY
(should see green pop-up 'Build Successful')
Creating guided rules
- First we will create a new guided rule:
AUTHORING -> PROJECT AUTHORING -> NEW ITEM -> GUIDED RULE
Guided Rule: Apply Cart Item Promotions
Package: DEFAULT
(don't check the DSL box this time)
Creating guided rules
- The condition (WHEN) is two fold
- Part I is about a ShoppingCartItem
- Part II is about a PromoEvent that monitors an event stream
'Promo Stream'
- The action (THEN) will modify two ShoppingCart fields
- promoSavings field
- price field
Creating guided rules
- Start by importing model object
ShoppingCartItem
for this rule:
CONFIG tab on the bottom of rule
NEW ITEM button at top, select ShoppingCartItem from Import list
Creating guided rules
- Import model object
PromoEvent
for this rule:
CONFIG tab on the bottom of rule
NEW ITEM button at top, select PromoEvent from Import list
Creating guided rules
- Finally import model object
ShoppingCart
for this rule:
CONFIG tab on the bottom of rule
NEW ITEM button at top, select ShoppingCart from Import list
Creating guided rules
- The condition (WHEN) Part I, back to Editor tab:
'There is a ShoppingCartItem'
- assign a variable name to this ShoppingCart
'$sci'
- looking for $sci with
'itemId'
- assign by clicking, variable name to itemID:
'$itemId'
Creating guided rules
- The condition (WHEN) Part IIa
- top green
+
sign adds second condition
- start with from Entry Point and fill in:
'Promo Stream'
Creating guided rules
- The condition (WHEN) Part IIa
- within condition click on red
'(click to add patterns...)'
- add
PromoEvent
, results in 'There is a PromoEvent'
Creating guided rules
- The condition (WHEN) Part IIb
- clicking on `PromoEvent` gives a pop-up
- select entry
All of (And)
- results in
'with all of the following'
Creating guided rules
- The condition (WHEN) Part IIc
- click on
all of the following"
line to add:
- an itemId equal to the
Bound variable: '$itemId'
Creating guided rules
- The condition (WHEN) Part IIc
- click on
all of the following"
line to add:
- a percentageOff bound to a variable called
'$pctOff'
- percentageOff is over sliding window:
'none'
Creating guided rules
- The conditions (WHEN) are finished, should look like:
Creating guided rules
- The action (THEN) part of our rule is next (use green '+'):
'Modify value of ShoppingCartItem ($sci)'
'promoSavings is set to 0.0'
'Modify value of ShoppingCartItem ($sci)'
'price is set to 0.0'
Creating guided rules
- Expand the 'show options' and add:
check NO-LOOP box
RULEFLOW-GROUP: promo-cart-rules
Creating guided rules
- Save the rule and ensure your package builds:
OPEN PROJECT EDITOR -> BUILD & DEPLOY
(should see green pop-up 'Build Successful')
Lab results...
- JBoss BRMS & BPM Suite Articles
- JBoss BPM Suite Demos
- JBoss bpmPaaS Demos


Bus marshal rescues abducted child
He spotted girl in distress and alerted police; kidnapper held
by Staff ReporterAn alert bus marshal rescued a six-year-old girl, who was abducted from Hazrat Nizamuddin railway station and travelling with the kidnapper in the cluster bus, after he spotted the child in distress and informed the police.
The accused, Satish Kumar, 22, a jhuggi dweller from Dwarka, was caught and handed over to the Government Railway Police.
Missing from station
According to the police, a resident of Madhya Pradesh arrived at the Hazrat Nizamuddin railway station with his wife and three minor daughters in a train on Wednesday at 6 a.m. After alighting, he realised that his elder daughter was missing and lodged a complaint with the police. A case was registered and a thorough search was conducted.
During investigation, information was received from police post at Subrato Park that the girl may have been spotted on a cluster bus on route no.728 near Dhaula Kuan with a man by a staff of the bus, the police said. Bus marshal Arun Kumar said he grew suspicious of the man after he observed that the girl with him was crying.
Harendra Kumar Singh, DCP (Railways) said a police team rushed to the location and found the girl on the bus. The accused allegedly confessed that he had kidnapped the child from the railway station and first taken her to Uttam Nagar Terminal through a bus on route no. 711 and then to Palam railway station. He boarded the bus on route No. 728 from Palam flyover to go to New Delhi railway station, said the officer.
He added that the accused has been arrested and sent to jail.


User Manual
User Performance
User needs to provide the urls of the online datasets, he/she wants to download from. After running, he/she is expected to see the downloaded JSON formatted datasets on his/her Azure Blob Storage.
The code can only be run in a docker container!
To understand the system workflow better, please check ./docs/System Workflow
Downloading data from URL
Users need to add his/her own azure storage account connection string to the .env file. And also the user needs to add a container name for hloding all data.
In order to download the wanted data, users need to add the url links behind the variable "filecontent" in UrlToAzureStorage.py
PWA UI Instruction
Our Progressive Web App (PWA) provides various features to interact with the data in Azure Storage.
Over the search bar on the top of the UI, you can input a FAD's ID and the system will bring the related data of that particular FAD back to you in the form of table.
Below the search bar there are two main section. If you click on them, they will show all the existing data by either map or table. For the map view, you can directly see the FADs on a map, with more details shown if you click a particular FAD. As for the table view, it will show you all the current data the Azure storage account have, including all the details.
Then at the bottom of the UI, you can also search FAD data according to special searching elements, and the result can be shown by tables or graphs. Detailed explanations shown below. In the results page, you can click "Export" to print the results or save it as PDF file.
Searching elements explanations:
-
FAD's Locations:
(The FAD records with the same FAD_ID and Location but different data in other aspects will not be shown twice.)- Table View - Shows latitude and longitude
- Graph View - Shows histogram of distance away from the capital of Saint Lucia
-
Country of FADs:
(The FAD records with the same FAD_ID and Country but different data in other aspects will not be shown twice.)- Table View - Shows which country does the FADs belong to
- Graph View - Shows a bar chart and a pie chart for counties distribution
-
Depth(m) vs. Temperature(℃):
- Table View - Shows the depth and the corresponding temperature for all records. Different FADs will be seperated by black lines
- Graph View - Shows a line chart of depth as the X-axis and temperature as the Y-axis
-
Depth(m) vs. Salinity:
- Table View - Shows the depth and the corresponding salinity for all records. Different FADs will be seperated by black lines
- Graph View - Shows a line chart of depth as the X-axis and salinity as the Y-axis
Deployment Manual
Legal Issues and Processes
All the background pictures and theme-related pictures are from Pexels, “Legal Simplicity -- All photos and videos on Pexels can be downloaded and used for free”, we are also allowed to modify the pictures. Available: https://www.pexels.com/
All the data used comes from publicly available from the following websites:
https://www.ncei.noaa.gov/access/world-ocean-database/datawodgeo.html https://data.govt.lc/dataset/estimated-fish-landings https://data.govt.lc/dataset/historical-weather-observations-hewanorra/resource/b2b89104-2b2b-4be3-b13e-45fa69886aa9#{} https://data.govt.lc/dataset/historical-weather-observations-hewanorraMIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Library | Website | Licence type |
|---|---|---|
| pandas | https://pandas.pydata.org/ | BSD 3-Clause "New" or "Revised" License |
| sklearn | https://scikit-learn.org/stable/ | Open source, commercially usable - BSD license |
| pathlib | https://pypi.org/project/pathlib/ | MIT License |
| flask | https://flask.palletsprojects.com/en/1.1.x/ | Copyright 2010 Pallets |
| flask_restful | https://flask.palletsprojects.com/en/1.1.x/ | Copyright 2010 Pallets |
| flask_cors | https://flask.palletsprojects.com/en/1.1.x/ | Copyright 2010 Pallets |
| requests | https://pypi.org/project/requests/ | Apache Software License (Apache 2.0) |
| azure.storage.blob | ||
| urllib.parse | ||
| dotenv | ||
| mmap | ||
| csv | ||
| subprocess | ||
| platform | ||
| re | ||
| gzip | ||
| sys | ||
| json | ||
| azure.function | ||
| azure.cosmosdb.table | https://pypi.org/project/azure-cosmosdb-table/ | Apache Software License (Apache License 2.0) |
| time | ||
| Bootstrap JS and CSS files | https://getbootstrap.com/ | MIT License |
| Plotly JS file | https://plotly.com/ | Copyright 2021 Plotly |


Unadvised - order-dependent selectors
This is a sample of CSS-only visibility switch between two sets of components. On "search" icon click the header controls visually replaced with with search controls: collapse back, search input, and submit button.
Visibility and collapsing is driven by focus status on search input field.
The input:focus
selector triggers visibility of groups by hiding primary and showing search controls.
That requires all controls to be paced after the input field to be selectable by "next sibling" selector:
input:focus+*
. Since we need to control multiple siblings the number of `+` selectors would be equal
to total number of controls. The longest in selector list in this sample is
input:focus+*+*+*+*+*+*+*+*+*+*
COST: extra css complexity.
The order change for "sibling" rules would need the compensation by redefining the rendering order by class:
.tr-o1{ order:1; }... .tr-o9{ order:9; }
COST: extra html complexity.
Acessibility. Keyboard navigation would be broken if only input field focus would be the trigger for groups visibility: tab from input field would lose the focus resulting in hiding the search group instead of setting the focus on submit button.
Conclusion
The usual class-on-parent switch by JS would be simpler and accessible. See the true-responsive.html as sample.


Chat Server joined on load. Press send to broadcast to others, echo to bounce a message off the Server


Networkcube
Networkcube is a java script / (Typescript) library and a programming framework for interactive network visualizations with:
- different link types
- multiple links between nodes
- link weights
- temporal information on links (weigth, existence)
- geographical positions attached to nodes
Networkcube is currently has been build with two goals in mind:
- Ready-to-use visualizations that can be embedded in any web environment, e.g. to provide state-of-the-art visualizations to a specific group of stateholders or in a specific domain.
- Rapidly prototype, deploy, and mature novel network visualizations.
- Browser-based: networkcube runs entirely in the browser and does not use any server. None of your data is transmitted over the network nor stored on any server.
Networkcube is designed for research and is currently in a prorotype phase. However, the code is open and contributions are welcome. Please read the Wiki for more information or contact us<EMAIL_ADDRESS>Each visualization in networkcube is its individual model and runs in an iFrame. Visualizations are hosted here on github and can be integrated in any website. So, the only thing your website has to care is importing a user's data into the browser (https://github.com/networkcube/networkcube/wiki/Importing-Data).
Demos and Example Projects
Networkcube has been used in the following projects:
- Vistorian (http://vistorian.net): A visualization platform for the social network visualization.
- ConnectoScope: A visualization platform for brain connectivity in neuroscience
A ready-to-use version can be found on http://networkcube.net.
Using Networkcube in your projects
Components
The Networkcube framework conists of the following components and features:
- Methods for loading network data from various formats, e.g. csv, json, GEDCOM, etc.
- Importing data into the local storage of your browser. Data is not uploaded onto any server, unless you provide the
server and program the backend. Technically, this is possible. Eventually this means that once you the visualization(s) with your data show up on your screen, no internet connection is necessary anymore. Data and events are handled completely locally on your machine.
- an API to query the network you stored in the local storage, such as link weights for a certain period, a node's neighbors, links of a certain type. etc.
- an initial set of common state-of-the-art network visualizations including Node-Link diagrams, Adjacency Matrices, Dynamic Ego network visualization, and a geographical Map.
Visualizations are referenced via a URL and can hence sit anywhere in the internet. Once the visualization code is loaded
all it needs to do is to query the data from the local storage.
- A messenger to send events between all the visualizations in your browser: be they in windows, tabs, or iFrames. Messages pass simple interaction events such as node selection or changes to a time slider for temporal navigation.
Technical Specifications
- Networkcube is written in TypeScript (https://www.typescriptlang.org), a typed language that compiles into
JavaScript.
- Data is stored in the browser's local storage, which currently is limited to 5MB. For projects on using larger networks, contact us.
- Networkcube and the visualizations are optimized for Google Chrome. They have not been tested on other browsers. (Feel free to do so and let us know what happens).
- Visualizations are generally written in WebGL using the THREE.js library (http://threejs.org). Certain parts of the visualizations are implemented in D3.
Run your own networkcube instance for development
- Clone this git
- Place it on a http server.
Navigate to <your_serverpath>/networkcube/web/index.html
* to run the local demo and test if all is working fine.
On my machine this looks like http://localhost/~bbach/networkcube/web


Happening Place
Home
(current)
Events
Contact Us
Search
Event Name
Building and Room Number
Give desciption of the event
Choose a photo for the event
Address
Address 2
City
State
Choose...
...
Zip
Create Event


Home
News
About
Google's Pixel 6 Series Is Here
Android 12 All Features Ans PREVIEW
Samsung Galaxy Book Pro And 360
XIAOMI MI Mix FOLD
2021 iMac ALL YOU NEED TO KNOW
UMIDIGI BISON GT


Use list below to specify which fields should be checked. For each field type use the fields to specify minimum length, maximum length and regular expression expected for class names. Specify 0 in length fields to skip corresponding checks. Regular expressions are in standard java.util.regex format.


The World in Which We Live
I am all about AboutUs
I am all about contactus
I am all about thelist
I am all about merchandise


icemc¶
Simple Monte Carlo routines.
icemc.icemc¶
- outer_sim_loop(M_values, ctau_values, pt2, rap, acc_func, N)[source]¶
Simulation helper (wrapper) loop
- Returns
Acceptance probability matrix
- Return type
Z
- outer_sim_loop_2(M, ctau, pt2_values, rap_values, acc_func, N)[source]¶
Simulation helper (wrapper) loop
- Returns
Acceptance probability matrix
- Return type
Z
- produce_acceptance_sim(N=1000)[source]¶
Simulate fiducial (geometric) acceptance by looping over (M,ctau) or (Pt,Rap) pairs, others being fixed.
- resonance_generator(M, ctau, pt2, rap, N=1000)[source]¶
Simulation massive resonance with (M, ctau) parameters, having production kinematics (pt2, rapidity, phi ~ flat)
- Returns
Array of 4-momentum (resonance 4-momentum) x4 : Array of 4-position (resonance decay 4-position)
- Return type
p4
- spherical_acceptance(p4, x4)[source]¶
Spherical (geometric) acceptance function.
- Parameters
p4 – Array of 4-momentum
x4 – Array of 4-position
- Params:
R : Spherical detector radius (extend to more complex) [global]
- Returns
Array of True/False for each event (accepted or not)
- twobody(p, m1, m2)[source]¶
2-body isotropic decay routine according to dLIPS_2 flat phase space
- Parameters
p –
4-momentum of the mother (in the lab frame, usually)
m1 : Daughter 1 invariant mass m2 : Daughter 2 invariant mass
- Returns
- Daughter 4-momentum
in the the same frame as the mother was defined
- Return type
p1,p2


I had been recently reading about rectal administration of various substances and found no reports detailing the use or success of pharmaceutical opiates being used rectally. Being a scientist, I was immediately curious so I set myself up as test subject number one...
I took four generic Vicodin pills (10mg hydrocodone + 660mg acetaminophen) and did the cold water extraction process. When I was done, I was left with a beaker of ice-cold water containing somewhere between 30 and 40mg of Vicodin and considerably less than 660mg of acetaminophen for a total volume of about 50ml (about an ounce). I placed the beaker in a hot-water bath for about ten minutes to bring it up to a comfortable temperature. Then, using a soft plastic eyedropper, I administered the solution to myself rectally. The small amount of solution was easy to hold in.
Within 20 minutes, I began to feel effects. The experience was typical of that dose of hydrocodone. I felt no nausea (which I sometimes do on prescription opiates), and overall had a very enjoyable time. The experience seemed to last about two hours, a little less than I would have expected from an oral dose.
Overall, the onset and comedown seemed to be fairly fast, perhaps what you would expect if you took the hydrocodone on an empty stomach. The only change I would make would be to use a true at-home enema kit instead of an eyedropper. The process of getting all the liquid in was somewhat tedious. If you are going to try this, be sure you know how to properly administer an enema. It is possible to injure yourself if you don't know what you are doing.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Congress protests in Lok Sabha over disinvestment of PSUs, electoral bond
"This is a big scam. The country is being looted. Please allow us to speak," Congress leader in Lok Sabha Adhir Ranjan Chowdhury said
by Press Trust of IndiaThe opposition Congress on Thursday staged protests in Lok Sabha against privatisation of a few PSUs, including Bharat Petroleum Corporation Limited (BPCL), and issuance of electoral bonds, terming the move as "big scams".
However, Congress members returned to their seats after the protests and sloganeering in the Well of the House for about 15 minutes when Speaker Om Birla assured them that they will be allowed to raise issues during Zero Hour.
"This is a big scam. The country is being looted. Please allow us to speak," Congress leader in Lok Sabha Adhir Ranjan Chowdhury said.
However, Speaker Birla told members that the MPs should not lower the dignity of the House by coming into the Well.
"This is wrong. The House is discussing a very important issue on sports persons. No, no. Don't talk to the chair from the Well. It is the responsibility of every member to maintain decorum and dignity of the House," he said.
The Speaker said the Question Hour is very important and the MPs should not disrupt proceedings.
"I am a new member. You are senior. Don't come to the Well. Maintain the convention," Birla said, adding he has not admitted the adjournment motion moved by the Congress but is ready to allow the party to speak during Zero Hour.
With this the Congress MPs went to their seats.


Toggle navigation
PeerTunes
Rooms
Create Room
Leave
Settings
User
Room
PeerTunes
Username
Enter
My Queue
Join DJ Lineup
Chat
Welcome!
Click "Rooms" to join a room.
00:00
×
Rooms
Room listing here
×
Create Room
Room Name
×
Add Songs
Search


| description |
As an "info" URI an ARK has the form, NAAN + "/" + Name, where NAAN is a globally unique Name Assigning Authority Number given to an organization that assigns ARKs and Name is a string assigned by that organization. A NAAN is a 5- or 9-digit number and a Name is a string of ASCII letters, digits, and the characters { = # * + @ _ $ }, not including the braces. In addition, a Name may contain the characters { . / % - }, which are reserved to indicate variant form, logical containment, escaped octet, and a lexically ignorable separator, respectively. |


Blair MacIntyre
Professor, School of Interactive Computing, Georgia Tech
Principal Research Scientist, Mozilla
@blairmacintyre /<EMAIL_ADDRESS>Gheric Speiginer
PhD Student, School of Interactive Computing, Georgia Tech
@speigg /<EMAIL_ADDRESS>(or MR or Holographic Computing?)
Mixing media with a
person's perception of the world
registered in 3D, in real-time
Other approaches to context-based media:
(Perhaps HMD's will dominate when
they look like this, but that's a long way off)
Ron Azuma. "A Survey of Augmented Reality" Presence (1997)
Ron Azuma. "A Survey of Augmented Reality" Presence (1997)
Ron Azuma. "A Survey of Augmented Reality" Presence (1997)
Ron Azuma. "A Survey of Augmented Reality" Presence (1997)
Inside-out
(e.g., computer vision & depth sensing, object recognition)
Outside-in
(e.g., GPS, Vive Lighthouse)
Can only display relative to what we
already know or can sense
about the world
Must display in real time (akin to VR)
Core problems are displays, sensing, and services for world knowledge.
Leverage all things webby!
(or something like apps)
Non-trivial content requires code and interaction
Security and privacy require sandboxing
Current focus on individual apps w/ full control
As with 2D/3D before, user's will want to mix and match
Mash up pages/apps, mix 2D/AR/VR content, mix displays and sensing
Experience AR content without going to "the place"
Different perspectives and viewpoints
Users might prefer AR, VR or desktop experience
There will still be apps, but not "AR apps"
AR something you add to a system or app
Think about what AR is good for and how it fits into web ecosystem
Local Video: Latency, no camera intrinsics
Tracking: Overheads and Speed
Browser Model: Everything inside app
W3C standards, AR.js, various Web-for-Native plugins
The Argon Project
Problem: not very webby!
Any "representation of Reality" can be used, such as:
360 images or video, Google Streetview, 3D Models of the World,
See-thru (video-mixed or optical)
As long as Reality can provide
View of reality
Camera pose for viewer
Camera frustum for viewer
Standard frames (currently):
User Pose, Floor, ECEF, Inertial, Local Origin
Additional reference frames can be created
Geolocations, Vuforia Trackables
All reference frames are converted to Local Coordinates for rendering
Must use argon reference frames to anchor content in the world
Applications are reactive, must adapt content/layout in real-time
Applications only render augmentations (important!)
Augmentations can be overlaid on any "representation of reality"
argon.js and (soon) Argon4 are Open Source
on http://argonjs.io
on an iPhone
Using argon.js + reveal.js + aframe.js + argon-aframe.js
Added AR to this reveal.js presentation
Add some new scripts up top

Add a simple AFrame scene down below
<ar-scene>
...
</ar-scene>
Adjust the CSS a bit, add some Javascript and we're off...

A-Frame markup to create a spinning gold diamond
<ar-geopose id="GT" lla="-84.394539 33.772501" userotation="false">

</ar-geopose>
A-Frame markup to put a pin at Georgia Tech
<ar-scene vuforiakey="#vuforiakey"
vuforiadataset__stonesandchips="src:url(StonesAndChips.xml);">

<ar-frame id="frame" trackvisibility="true" visible="false"
parent="vuforia.stonesandchips.stones">
...
</ar-frame>
</ar-scene>
A-Frame markup to put content on a visual target
Many tools, from the simple to the elaborate
Mashups may suggest new ways of creating 3D!
(twinery.org)
Leverage Mozilla Research: WebVR, Servo, WebAssembly, ...
Leverage Mozilla's Influence: peers, standards, ...
Make sure the AR Web is healthy, open, and accessible to all!
2D + 3D + AR + VR + mobile + desktop + HMDs + ...
Focus on User choice
Web for AR/VR
and
Web in AR/VR
| Time Frame | Activity | Goals |
|---|---|---|
| now |
"Web Now" (w/ argon.js) |
use cases mashups w/ 2D, VR web services |
| 3-12 months |
experimental apps (mobile + desktop) |
technical experiments browser interfaces |
| 1-2 years | W3C, etc | standards (WebRTC, WebVR, ...) |
| 1-3 years | Firefox (and peers) |
WebAR |
| 1-5 years | ecosystem, new devices |
HMDs, IoT, wearables, cars, ... |
Low-latency Video Processing Pipeline
Video frames into GPU/JS + vision processing
(WebRTC, workers, WebAssembly, Servo, etc)
Already massive amount of content tied to the world
(Much of it lacks altitude, is inaccurate)
Camera Intrinsics database
(Vuforia, ARToolkit)
(eventually: W3C media-capture-depth, KHRONOS OpenKCam, platform APIs ...)
Need new services for object or location-based search and discovery,
world knowledge, object recognition and tracking, ...
Keep: multiple apps, custom realities
Add: live video access, custom device support (Tango, Hololens, etc)
while observing user control of privacy and ensuring security
Efficiency
Privacy / Security
Clean Multi-app Integration
Battery
Device position (GPS, indoor localization)
Camera intrinsics
Beyond Windows+Tabs model
AR/VR-centric, perhaps AR/VR-first?
Link to the world, object recognition-based, ...
AR at intersection of Web, context/IoT, and 3D/VR
The many students in the AEL who worked on or with Argon1/2/3/4, especially Alex Hill and Hafez Rouzati for development of Argon1 and Argon2
Maribeth Gandy, Matt Sanders, Brian Davidson, and others at IMTC and IPaT for using Argon1 and Argon2 for many projects
Jay Bolter, Maria Engberg, Magnus Egerstedt and their students and colleagues for their ongoing collaborations and exploration of web-based AR
Students in our Augmented Reality Experiences VIP for their many contributions to Argon3, Argon4, argon.js and the argonjs.io site
Support from Alcatel Lucent, Verizon, Qualcomm, Mozilla, NSF, GEM, GVU Center, and IPaT
All the people who have used Argon and helped pursue web-based AR
Contact us via email<EMAIL_ADDRESS>and<EMAIL_ADDRESS>To try some of this yourself