Methods
action(ip, parametersOrType, callbackopt)
Create an action on the identified floating ip.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
strint | The IP of the floating ip for which to create the action | |
parametersOrType |
string | object | The name of the action to create or an object with key value pairs of parameters. | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
assign(ip, parametersOrDropletId, callbackopt)
Assign the identified floating IP to a Droplet.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
strint | The IP of the floating ip for which to create the action | |
parametersOrDropletId |
number | object | If a number, the identifier of the Droplet. Otherwise, an object with required keys of `droplet_id`. See the official docs for valid attributes. | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
create(attributes, callbackopt)
Create a floating IP object.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
attributes |
object | The attributes with which to create the floating ip. See the official docs for valid attributes. | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
delete(ip, callbackopt)
Delete the identified floating ip object.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
string | The ip of the floating ip to delete | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
get(ip, callbackopt)
Get the identified floating ip object.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
string | The IP of the floating ip to retrieve | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
getAction(ip, id, callbackopt)
Get the identified action object.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
strint | The IP of the floating ip for which to retrieve the action | |
id |
number | The id of the action to retrieve | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:
list(page or queryObjectopt, perPageopt, callbackopt)
List Floating IP objects.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
page or queryObject |
number | object |
<optional> |
page number to retrieve or key value pairs of query parameters |
perPage |
number |
<optional> |
number of result per page to retrieve |
callback |
listRequestCallback |
<optional> |
callback that handles the response |
- Source:
listActions(ip, page or queryObjectopt, perPageopt, callbackopt)
List of action objects.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
string | The IP of the floating ip for which to retrieve actions | |
page or queryObject |
number | object |
<optional> |
page number to retrieve or key value pairs of query parameters |
perPage |
number |
<optional> |
number of result per page to retrieve |
callback |
listRequestCallback |
<optional> |
callback that handles the response |
- Source:
unassign(ip, callbackopt)
If the identified floating IP is assigned to a Droplet, unassign it.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
ip |
strint | The IP of the floating ip for which to create the action | |
callback |
requestCallback |
<optional> |
callback that handles the response |
- Source:


Description
This is an example of Custom element Chart Sparklines series. The data is loaded from an array. The type of the sparklines series is line or column depending on the trend data.


Hello! 👋🙂
My name is Ghadeer, and this is my "playcloud" (as opposed to a playground). It is where I will be creating toys, often purposeless ones, just for the pure joy of programming, to learn something new in the process, and hopefully to stir some curiosity in the passers-by.
Please feel free to play with them! Feedback, including bug reports, is appreciated.
Cheers!
Path Tracing
GPUGravity
GPUScalar Field
Ray Casting
Sculpting
glTF Renderer
(wire frames)
GPUglTF Renderer
Scalar Field
Mandelbrot
Tree
Sierpinski Triangles
WebGL Lab
Scanner
MSX Programs
The "toys" presented in this site were mainly vehicles for me to experiment with different ideas and web technologies. Most of the toys are about graphics, but there are and there will be some toys focusing on other interests such as simulation, audio/music, parsing, and retro-computing (MSX).
Some of the toys have the GPU suffix. These toys use the new and promising WebGPU API, which is still not officially released, but is accessible either through Origin Trials or a browser experimental feature flag.
| ➡ | icons by www.wishforge.games on freeicons.io | |
| ➡ | icon by Rolas Design on freeicons.io |
The controls should be quite intuitive. Just click on on the tiles to load the various toys.
Try interacting with the image in this panel (including dragging and dropping images onto it).


I'm a self taught JavaScript developer with trade certificates in both Mechanical Engineering and Maintenance Engineering. I've always found coding intuitive and I've pushed myself to learn the most effective ways to achieve a result.
I also enjoy surfing, lifting weights and combat sports.
View ResumeThis was the final project in my web developer bootcamp. A full stack web app that recognises faces in image URL's. The stack was React.js, Node.js, Express.js and PostgreSQL.
This was the result of the Devs hackathon 2021. We created a VS Code extension that allows you to take notes inside the code editor. The problem we were trying to solve was having to rely on external notes software or pen and paper. Cheat Sheet is a React web app that runs inside VS Code, using the webview api. I was responsible for the front end code and ui/ux design.
This was my first JavaScript program. It's built with simple HTML, CSS and of course JavaScript. Refresh the page to start a new game and go head to head with a friend!
After getting to chat with the team at Future Loop, I was asked to provide feedback. So I created this UI for the app. It's a news application that uses AI to find relevant articles to your interests on the web.
Slobba was a startup idea I had for a platform that helps dog owners see the activity level of nearby dog parks before they leave the house. This makes sure your dog always gets a social experience on your outing!


{{ site.title }}
{{ site.description }}
Home
{% comment %} The code below dynamically generates a sidebar nav of pages with `layout: page` in the front-matter. See readme for usage. {% endcomment %}
About
Projects
Study Notes
NLP
Algorithms
Others
© {{ site.time | date: '%Y' }}. All rights reserved.
Last modified {{ site.version }}


Mkoolima is an app that brings modern farming techniques to you from anywhere in Kenya. Find out all the latest news, weather forecasts, pest and disease recognition using our state of the art AI technology and much more.
To learn more on how mkoolima is helping farmers in Kenya, or queries on careers, donations or for any other query , please do not hesitate to contact us at:
Contacts: +254746485236
Email<EMAIL_ADDRESS>Donation: Wallet: 3FZbgi29cpjq2GjdwV8eyHuJJnkLtktZc5
P.O. Box: 69, GPO, Nairobi,Kenya
The team: Developers
Regards: @storyset


Summary
A software engineer with 10+ years experience in web development who loves to share her knowledge with people.
Work
-
McKinsey & Company
mckinsey.com
Senior Software Engineer
March 2018 - Present
Languages
- Turkish - Native
- English - Fluent
- Italian - Fluent
- Czech - Beginner
- Japanese - Beginner
Skills
- PHP
- HTML
- JavaScript
- CSS


Wonder Humans is a technology platform designed to provide easy access to the homeless population within local communities. The platform allows its users to identify, interact with and offer support to those in need. The Wonder Humans beta is rolling out in Miami as its first market, to test and perfect the platform, allowing for seamless duplication in every city.
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Cumque ex nostrum ipsum, distinctio eos provident ratione delectus expedita soluta.
Read moreLorem ipsum, dolor sit amet consectetur adipisicing elit. Cumque ex nostrum ipsum, distinctio eos provident ratione delectus expedita soluta.
Sign upOur Mission
To provide a technology platform that empowers WonderHumans all over the world to help end homelessness through financial donations and employment opportunities.
To provide a technology platform that allows community members to make monetary contributions as gifts or in exchange for services rendered that meet the skill set and abilities of an individual in need. Empower anyone that wants to help to be a Wonder Humans and make a positive impact worldwide.
Provide support, resources and tools the homeless need in order to change their current situation and reach their full potential as they re-enter society.
Provide a convenient and fully transparent solution.
Provide support, resources and tools the homeless need in order to change their current situation and reach their full potential as they re-enter society.
The Wonder Humans platform provides its users a means to identify those in need, as well as a way to interact daily and contribute as often as desired. Our Wonder Humans help in many ways, from helping to geo-tag those in need, creating profiles that highlight skill sets and tell their stories, to making financial contributions to help homeless community members get back on their feet and into more stable living conditions.
We empower Wonder Humans to give, impact, and change the lives of those in need, with the only expectation being a smile in return.
We work together with all supporters and participants in order to succeed and carry out the Wonder Humans mission.
We create an impact and change lives by working together and following a proven tech-driven execution strategy paired with caring human touch.
Your project is very important to us.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/delayed.20calc.html ---
How hard would it be to have a version of calc
with delayed proofs? I can write
refine calc x ≤ y ↔ 0 ≤ y - x : _ ... ↔ -(y-x) ≤ 0 : _ ... ↔ x - y ≤ 0 : _,
and then Lean asks for three proofs but, for teaching purposes, I would like to have
calc ' x ≤ y ↔ 0 ≤ y - x ... ↔ -(y-x) ≤ 0 ... ↔ x - y ≤ 0,
and then see the same three goals. It's not very important but I'd be interested if this is not too hard (and I can use a non-standard Lean if needed).
we could make calc'
a tactic with a custom parser. This should be doable, but I'm not sure what the best way is
...
, and with some trickery so that it parses the expressions after the first one correctly...
(or a similar token) a infix notation so that the whole thing can be parsed as a single pre-expression.Last updated: Apr 24 2020 at 19:02 UTC


Title
Project Key
Secret Key
Category
{{category}}
Required
Project Description
Project Requirements
Project Requirements Summary
Project Documentation
Application
Smoothflow
Bundle
Back
Initiate your project by using a pre-built template.
Application Type
DuoWorld SDK Application
Custom HTML5 Application
Angular Material
Bootstrap
HTML5 Starter
Initiate your project by uploading a source file.
Back
Initiate your project by using a pre-built template.
Smoothfllow Type
Smoothflow Activity
Smoothflow Sample Activity
Initiate your project by uploading a source file.
Back
Select projects you wish to add to your bundle.
{{ application.name }}
Conclusion


Home
Listed below is a selection of my technical blog posts.
These are set out sprint by sprint and relates to the technical aspects of what has been covered by the course.


{% extends "base.html" %} {% spaceless %} {% block auxCSS %} {% endblock %} {% block mainTitle %} TorStatus -- About {% endblock %} {% block headerTitle %} TorStatus {% endblock %} {% block pageTitle %} How To Use TorStatus {% endblock %} {% block mainPage %}
| Layout |
| TorStatus is oriented around a
current result set of relays in the
Tor network. Other pages serve to provide an interface for
modifying how this result set is presented, such as
display options, and other
pages change the routers that appear in the result set
itself, such as the search bars on the splash
page or the
advanced search page. If a user wishes to undo any
provided search filters, clicking on
reset search filters
will remove all search filters. All of these results are
paginated, with 50 relays per page by default, but all
relays and data available about the relays is can be viewed
as an unpaged list of relays.
Other pages include the exit node query page, which enables searching for Tor relays by IP addresses and seeing if those relays would allow exiting to an IP address and port, and the network statistics page, which displays graphs consisting of current aggregate statistics about the network. |
| Sessions |
| TorStatus uses sessions to keep track of a user's search preferences as they are defined and continuously redefined. These sessions work by assigning a unique hash to the user that corresponds to an encrypted mapping of search preferences that is stored on the server. This is, in our view, more secure and private than using GETs or conventional cookies, as no extra unencrypted data is sent to TorStatus. However, many torified clients may have cookies disabled, which currently disables much of the functionality that TorStatus provides. In the future, we could include a workaround for this that passes session hashes as a GET rather than as a cookie for users that have cookies disabled, but this seems no more secure to us than simply allowing cookies for TorStatus. If you have any suggestions, let us know. |


Timmy James.
Graphic Design.
Wellington, NZ
2015—2018
Massey University
Bachelor of Design with Honours
Visual Communication
All fonts look the same.
Featuring work from over 100 type foundries, All fonts look the same was an exhibition of 260 fonts;celebrating uniquely restricted shapes with an almost endless amount of variation.
Exhibition. Posters. Brochure. Curation. Writing. Website.
In collaboration with Trent Kokich, Matilda Stein, Lili Lovell‑Wood & Giordano Zatta.
Bazooka.
A poster series exploring the noisy history of the word Bazooka.
Undertaken as part of the 2018 ISTD brief Mark My Words. An earlier version was a finalist in the 2018 Best Awards and the final work gained me membership to the International Society of Typographic Designers.
Analog — A loose interpretation
An unbound book exploring the value of analog processes in a digital time.
Focusing on 35mm photography, 12" vinyl, notebooks & potato stamped letters.
Diving deeper than the aesthetic surface that each medium provides to uncover the value of analog.


Snookes1516.github.io
Carolina Preserve is a Del Webb community in Cary, North Carolina. Located in the heart of the Triangle area between Raleigh, Durham and Chapel Hill, residents enjoy.
The undergraduate creative writing program at UNC–Chapel Hill is — and has long been — one of the best in the country. Its first-rate faculty and students. Unc Chapel Hill Creative Writing Scholarship - 346296 Step 1: Check Your Eligibility. Take a look at the eligibility requirements to see if you qualify for the scholarship. Step 2: Get the Details. Check out the about. McKenna Ritter awarded Thomas Wolfe Scholarship. Unc chapel hill creative writing scholarship - Colorificio. Search Committee Associate Dean/Director of the Honors. Norris wins UNC scholarship in creative writing - College. Scholarships Sorted By Deadline. The University of North Carolina Wilmington, the state's coastal university, is dedicated to the integration of teaching and mentoring with research and service. Technosociology our tools, ourselves.
Bridge Builders Scholarship: These need-based scholarships are named for those who helped fulfill . While students who apply to UNC-Chapel University of North Carolina at Greensboro - Wikipedia. Folt discusses the importance of universities and higher education affordability. Search; People Opens in new window; Places Opens in new window. Scholarships Sorted By Discipline. Four-year merit scholarship in creative writing at UNC-Chapel four-year merit scholarship in creative writing at UNC-Chapel Hill. The scholarship program. Search Committee Associate Dean/Director of the Honors College UNC Wilmington 601 S. College Road Wilmington NC 28403. Dear Search Committee, I am writing. Toggle navigation UNC English Comparative Literature. . Home / Creative Writing / Creative Nonfiction Track in Creative Writing. . Creative Nonfiction
Introducing the Morehead-Cain Class of 2022 - Morehead-Cain. Few updates: I’m now writing regularly (monthly) at the New York Times as a contributing opinion writer. My New York Times op-ed can be found.
University of North Carolina at Chapel Hill - Wikipedia. The University of North Carolina at Greensboro (UNCG), also known as UNC Greensboro, is a public coeducational and Research university in Greensboro, North Carolina. Our Team David Gernert. David is the President and Founder of The Gernert Company. He spent the first fourteen years of his publishing career at Doubleday Unc chapel hill creative writing scholarship. Job Listings – Arts North Carolina.  Unc Chapel Hill Creative Writing Scholarship. scholarship/tws — University of North Carolina. The Thomas Wolfe Scholarship (for writers) – UNC Chapel. Free Microsoft Office 2016 Product Key 100% Working You can find them in this article. University of North Carolina Wilmington.
Strengths of my essay in maths toefl independent essay years timed essay samples business and management a essay paper university technology of communication essay. UNC News release - University of North Carolina at Chapel. Free Microsoft Office 2016 Product Key 100% Working. Creative Writing Minor University of North Carolina. Mailing Address: UNC College of Arts Sciences Campus Box 3100 205 South Building Chapel Hill, NC 27599-3100.
Job Listings. Arts North Carolina maintains a comprehensive listing of job opportunities in the arts in North Carolina. Listings are included in Arts North Carolina.
Carolina Preserve by Del Webb Carolina Preserve Homes. The political science graduate program is small and very selective. Each year about 15 students enroll. Most graduate students pursue the doctor of philosophy.
36 Best Environmental Science Schools 2018 Rankings. The Thomas Wolfe Scholarship (for writers) – UNC Chapel Hill will be brought to the UNC-Chapel Hill campus for unc.edu/creative-writing. Hallie Q. Brown (Hallie Quinn), 1859-1949, compiled. Creative Nonfiction Track in Creative Writing. Scholarships Sorted By Discipline Scholarship Sources in red are scholarships local to WCPSS students.
The University of North Carolina at Chapel Hill, also known as UNC, UNC Chapel Hill, the University of North Carolina, or simply Carolina, is a public research. One-Hundred-and-Twenty-Sixth Annual Undergraduate Bulletin. Are you a 15-18 year old visual, literary, design or performing artist? Apply to YoungArts' national arts competition. One-Hundred-and-Twenty-Sixth Annual Undergraduate Bulletin 2017–18 The Undergraduate Bulletin is also available on the Web at uncg.edu.
Golden Key is the world's largest collegiate honor society. Membership into the Society is by invitation only and applies to the top 15% of college and university. Evika Sturdivant came to CPSC with 16 years experience teaching kindergarten and first grade in Durham and Chapel Hill-Carrboro Public Schools. Scholarships - University of North Carolina at Chapel. Scroll down to see the most affordable environmental science degrees, as well as info on the different types of environmental science degrees and environmental. The faculty and staff of The Hill School are truly inspirational. All of them are dedicated to Hill's educational philosophy and program. Golden Key Scholarship Recipients Winners.
The Morehead-Cain Foundation—home of the first merit scholarship program in the U.S.—is proud to announce what will be the largest class in its history.
Department of Political Science (GRAD) University. The electronic edition is a part of the UNC-CH digitization project, Documenting the American South. The text has been encoded using the recommendations.
Scholarships Sorted By Deadline Sorted by school year (August - July). Scholarships without specific.
Local angles: Charlotte. For photo information, see end of story. Charlotte’s Chan awarded Wolfe Scholarship in creative writing at UNC-Chapel. Meet Our Staff Central Park School for Children. UNC A to Z - The University of North Carolina at Chapel. Our Team — The Gernert Company. Faculty Staff The Hill School of Middleburg A B C D E F G H I J K L M N O P Q R S T U V W X Y Z. A. Cezarija Abartis. Cezarija Abartis’ Nice Girls and Other Stories was published by New Rivers Press.


About Me
Let me tell you a few things...
BIO
Hi! I am Mayank Pratap, a web developer focused on crafting great web experiences. Designing and Coding have been my passion since the days I started working with computers but I found myself into web design/development since 2018. I enjoy creating beautifully designed, intuitive and functional apps. For over past 2 years, I have worked for some of the best digital agencies and wonderful clients to create great work. And, I can make this happen for your business as well.
Proh2r-HRMS Software
Frontend Development
ProH2R is an innovative and intuitive HR Management software specifically targeted to cater to the needs and demands of businesses that strive to be process driven with the ultimate goal of creating a better employee experience within their organisation.
Designer
Front End Developer
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eveniet repellendus architecto distinctio aperiam. Tempora, accusantium iste rem accusamus quod saepe, earum quasi perferendis ducimus eaque esse non expedita quibusdam assumenda?
ABC Limited
Developer
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Eveniet repellendus architecto distinctio aperiam. Tempora, accusantium iste rem accusamus quod saepe, earum quasi perferendis ducimus eaque esse non expedita quibusdam assumenda?


hfw/shopify
Main Page
Related Pages
Class Hierarchy
Class List
Class Hierarchy
Go to the textual class hierarchy
https://github.com/hfw/shopify
| Generated by
1.8.17


Contact
Work
About
Hey I am Md Tausif Iqbal
a web developer
These are some of my projects
Tribute Page
Survey Form
Landing Page
Documentation Page
Show all >


{%extends "layout.html"%} {% set active_page = "effects" %} {% block scripts %} {% endblock scripts%} {%block content%}
| Causes | Effects |
|---|---|
| Global Ice Melting | Salinity change |
| Thermal expansion of water | Drinking water contamination |
| Interfere with farming | |
| Wildlife population | |
| Economic loss | |
| Land subsidence | |


Singleton is a common design pattern. It’s easy to understand and we can easily implement it with PHP:
<?php
class Foo
{
static private $instance = NULL;
static public function getInstance()
{
if (self::$instance == NULL) {
self::$instance = new static();
}
return self::$instance;
}
}
Maybe this pattern is not as useful as it is in J2EE world. With PHP everything dies within each request, so we cannot persist our instances between requests (without any persistent mechanism such as databases, memcached or external servers). But at least in PHP we can share the same instance, with this pattern, in our script. No matter were we are, we use Foo::getInstance() and we get our instance. It useful when we work, for example, with database connections and service containers.
If we work with TDD we most probably use PHPUnit. Imagine a simple script to test the instantiation of our Foo class
class FooTest extends PHPUnit_Framework_TestCase
{
public function testGetInstance()
{
$this->assertInstanceOf('Foo', Foo::getInstance());
}
}
All is green. It works.
Imagine now we want to “improve” our Foo class and we want to create a counter:
public function testCounter()
{
$foo = Foo::getInstance();
$this->assertEquals(0, $foo->getCounter());
$foo->incrementCounter();
$this->assertEquals(1, $foo->getCounter());
}
Now our test fails, So we change our implementation of the class to pass the test and we add to Foo class
private $counter = 0;
public function getCounter()
{
return $this->counter;
}
public function incrementCounter()
{
$this->counter++;
}
It’s green again. We are using a singleton pattern to get the instance of the class and we are using TDD, so what’s the problem? I will show you with an example. Imagine we need to improve our Foo class and we want a getter to say if counter is even or not. We add a new test:
public function testIsOdd()
{
$foo = Foo::getInstance();
$this->assertEquals(FALSE, $foo->counterIsOdd(), '0 is even');
$foo->incrementCounter();
$this->assertEquals(TRUE, $foo->counterIsOdd(), '1 is uneven');
}
And we implement the code to pass the test again:
public function counterIsOdd()
{
return $this->counter % 2 == 0 ? FALSE : TRUE;
}
But it doesn’t work. Our test is red now. Why? The answer is simple. We are sharing the same instance of Foo class in both tests, so in the first one our counter start with 0 (the default value) but with the second one it start with 1, because the first test has changed the state of the instance (and we are reusing it).
This is a trivial example, but real world problems with this issue are a bit nightmare. Imagine, for example, that we use singleton pattern to get the database connection (a common usage of this pattern). Suddenly we break one test (because we have created a wrong SQL statement). Imagine we have a test suite with 100 assertions. We have broken one assertion (the second one, for example), and our PHPUnit script will say that we have 99 errors (the second one and all the following ones). That happens because our script can’t reuse the database connection (it’s broken in the second test). Too much garbage in the output of the PHPUnit script and that’s not agile.
How to solve it? We have two possible solutions. The first one is avoid singletons as a plague. We have alternatives such as dependency injection, but if we really want to use them (they are not forbidden, indeed) we need to remember to write one static function in our class to reset all our static states and call after each test. PHPUnit allow to execute something at the end of each test with tearDown() function. So we add to our test:
class FooTest extends PHPUnit_Framework_TestCase
{
...
public function tearDown()
{
Foo::tearDown();
}
}
And now we implement the tearDown function in our Foo Class
public static function tearDown()
{
static::$instance = NULL;
}
And all works again. All is green and green is cool, isn’t it? :)
Note: Take into account that “problem” is between quotes in the title. That’s beacause singleton is not a “real” problem. We can use it, it isn’t forbiden, but we need to realize the collateral effects that its usage can throw to our code.


@composi/styler:
Styler
Styled Components
@composi/styler lets you create styles scoped to a component it. It does this by creating a virtual stylesheet for the comonent. Styler does not add any identifier to the stylesheet target like some solutions do. The specificity of the style you define is up to you. This means that if you want your styles to be specific to a component, give the component base an id and use that in the style declaration. Or if you want to be more generic, use a class on the component base and in your stylesheet. Also, using BEM can make this specificity a lot easier.
If you use Styler with more than one component, the rules all get added to the same virtual stylesheet. This means that if you create rules with the same selector, the last one created will overwrite the earlier ones. Let's look at an example:
addStyles('ul', {
li: {
color: 'red'
},
li: {
color: 'green'
}
})
The above code defines two rules for the same selector. The properties are identical, only the values differ. In normal CSS the cascade means the only the last rule will get applied. The previous one would be ignored. That's for a hand-crafted stylesheet. Because we are create the stylesheet with JavaScript, the first rule gets overwritten by the second rule. If we open the web inspector and examine the document's style sheet like this: document.styleSheets[1].cssRules[0].cssText
we'll get this:
cssText: "ul li { color: green; }"
Features
@composi/styler lets you nest selectors, somewhat like SASS and LESS:
addStyles('#list-contianer', {
ul: {
listStyle: 'none',
'boder': 'solid 1px #ccc',
margin: 0,
padding: 0,
// Child selector:
li: {
padding: '5px 10px',
borderBottom: 'solid 1px #ccc',
color: '#333',
backgroundColor: '#fff'
// pseudo-element:
':hover': {
color: '#fff',
backgroundColor: '#333'
}
}
}
})
Notice how we indicate that the li
tag is a child of the ul
tag. We also indicate the hover state for the list item as a child of the list item. pseudo-elements have to be in quotes because the begin with ":".
Use Sparingly
@composi/styler is not meant to be a replacement for external stylesheets. It should be used to encapsulate some component-specific styles independent of the regular stylesheets. Don't try to provide all styles for a component with Styler. Instead use it to work with whatever the default stylesheet provides.


This code segment is indented with a tab
#include <stdio.h>
This code segment is indented with four spaces


25 Jan 2015
Mex Coding I
Using Matlab for quite a long time, now Matlab 2014b has already equipped with various programming language support, such as C#, Python 2.7. However, it does not mean an easy job to stir fry them together.
For scientific programming, we consider the most common ones: C++, Python, Java(Scala) and Julia.
The lastest version of Matlab has already provided generic interfaces with C++, Python, Java. However, Python's support is limited to version 2.7 without some important types, which might be a huge problem for migrating codes from other platforms.
Limitations for Python support:
- Multidimensional arrays
- Structure arrays
- Complex, scalar integers or arrays
- Sparse arrays
- Logical vectors
- Categorical, table, containers.Map, datatime types
- Matlab objects
- Function handle
- meta.class
For Java, reference:
Since Matlab itself runs inside a JVM, it would provide most generic support for Java, with all access of Java API and can call Java object methods within Matlab, the most important one, passing data would be easy.
In return of easy integration, Java method called from Matlab could have very high overhead before each call, much higher than other approaches.
Another thing needs to be mentioned is Object Oriented Programming within Matlab, it is slow compared to other mainstream languages, and the overhead cannot be avoid.
For C/C++, Matlab 2014b has provided two ways for interacting.
loadlibrary
inside Matlab console, thencalllib
calls function from the library.- use
MEX
as bridge.
C-MEX interface as
void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
While C++ users may create C++ objects and reuse them later by implementing some wrapper. In that thread, there are tons of potential dangers with memory leaks. The best way found is to define a class inherits the handle class using classdef
and also implement constructor and destructor within the class.
A reasonable implementation can be found as mexplus.
However, when object is created and wants running its method with parfor
, Matlab needs to copy the object for each worker in the pool. The solution shows that marking the handle property as Transient will work and force calling loadobj
.
classdef myclass < handle
properties(SetAccess=protected, Transient=true)
cpp_handle
end
methods(Static=true)
function obj = loadobj(a)
a.cpp_handle = rand(1);
disp(['Load initialized encoder with handle: ' num2str(a.cpp_handle)]);
obj = a;
end
end
methods
function obj = myclass(val)
obj.cpp_handle = rand(1);
disp(['Initialized myclass with handle: ' num2str(obj.cpp_handle)]);
end
% destructor
function delete(obj)
disp(['Deleted myclass with handle: ' num2str(obj.cpp_handle)]);
end
% class method
function amethod(obj)
disp(['Class method called with handle: ' num2str(obj.cpp_handle)]);
end
end
end
Tested below :
cls = myclass();
parfor i = 1:10
cls.amethod()
end
Result :
Load initialized encoder with handle: 0.096779
Class method called with handle: 0.096779
Class method called with handle: 0.096779
Class method called with handle: 0.096779
Class method called with handle: 0.096779
Load initialized encoder with handle: 0.66182
Class method called with handle: 0.66182
Class method called with handle: 0.66182
Class method called with handle: 0.66182
Class method called with handle: 0.66182
Class method called with handle: 0.096779
Class method called with handle: 0.096779
Deleted myclass with handle: 0.096779
Deleted myclass with handle: 0.66182


oak-chunk-update --database=world --execute="DELETE FROM City WHERE Population < 10000000 AND OAK_CHUNK(City)"Same as above, provide fully qualified table names, use 100 rows chunk size:
oak-chunk-update --execute="DELETE FROM world.City WHERE Population < 10000000 AND OAK_CHUNK(world.City)" --chunk-size=100Same as above, sleep for 200 milliseconds between chunks, verbose:
oak-chunk-update --database=world --execute="DELETE FROM City WHERE Population < 10000000 AND OAK_CHUNK(City)" --chunk-size=100 --sleep=200 --verboseSame as above, quit when no rows are affected:
oak-chunk-update --database=world --execute="DELETE FROM City WHERE Population < 10000000 AND OAK_CHUNK(City)" --chunk-size=100 --sleep=200 --verbose --terminate-on-not-foundPerform a multi-table UPDATE operation, choose world.City as chunking table, sleep twice the query time:
oak-chunk-update --execute="UPDATE City, Country SET City.District = 'unknown' WHERE City.CountryCode = Country.Code AND Country.Continent = 'Africa' AND OAK_CHUNK(City)" --sleep-ratio=2Same as above, avoid using INFORMATION_SCHEMA by specifying chunk key:
oak-chunk-update --execute="UPDATE City, Country SET City.District = 'unknown' WHERE City.CountryCode = Country.Code AND Country.Continent = 'Africa' AND OAK_CHUNK(City)" --force-chunking-column=id:integerSame as above, specify constant start position and end position:
oak-chunk-update --execute="UPDATE City, Country SET City.District = 'unknown' WHERE City.CountryCode = Country.Code AND Country.Continent = 'Africa' AND OAK_CHUNK(City)" --force-chunking-column=id:integer --start-with=1074 --end-with=2990Same as above, specify query start position, skip locks:
oak-chunk-update --execute="UPDATE City, Country SET City.District = 'unknown' WHERE City.CountryCode = Country.Code AND Country.Continent = 'Africa' AND OAK_CHUNK(City)" --force-chunking-column=id:integer --start-with="SELECT MIN(id) FROM world.City WHERE District=''" --skip-lock-tablesProvide connection parameters. Prompt for password:
oak-chunk-update --user=root --ask-pass --socket=/tmp/mysql.sock --database=world --execute="DELETE FROM City WHERE Population < 10000000 AND OAK_CHUNK(City)"Use a defaults file for parameters.
oak-chunk-update --defaults-file=/home/myuser/.my-oak.cnf --database=world --execute="DELETE FROM City WHERE Population < 10000000 AND OAK_CHUNK(City)"
This utility allows for splitting long running or non-indexed UPDATE/DELETE oprations, optionally multi-table ones. Long running updating queries are often used. Some examples:
oak-chunk-update splits such long running tasks into small chunks. It also allows for sleep time between chunks. This allows for less lock time, better replication responsiveness (less lag) and less stress on system resources (CPU, IO). To perform, the utility uses a UNIQUE KEY on a given table, which is used for the splitting process. Note that the query may involve multiple tables (JOINed), in which case one of the tables must have a UNIQUE KEY. The utility requires, then:
The query must include a hint in the form OAK_CHUNK(table_name) or OAK_CHUNK(database_name.table_name). See SYNOPSIS for examples. The table indicated in the OAK_CHUNK clause is the table which must contain a UNIQUE KEY, which is used for splitting the query. The utility rewrites the query by iteratively replacing the OAK_CHUNK(...) clause with appropriate values from the UNIQUE KEY. In case more than one UNIQUE KEY is available on the table, the utility chooses in the following order:
The tool auto selects the chunking key by observing INFORMATION_SCHEMA. Reading from INFORMATION_SCHEMA is risky on large, busy servers. It is possible to instruct the tool to use a specific column, by adding --force-chunking-column.
Limiting the number of scanned rows is done via --start-with and --end-with. Neither, either or both can be specified, as constant or as a SELECT query returning a single integer value. In the latter case it is required that the chunking key is itself an integer. --terminate-on-not-found is another way of limiting scanned rows, by instructing the tool to quit the first time the query has no effect. This works well for monotonic columns, e.g. TIMESTAMP columns with increasing values.
Prompt for password.
-c CHUNK_SIZE, --chunk-size=CHUNK_SIZENumber of rows to act on in chunks (default: 1000). 0 means all rows updated in one operation The lower the number, the shorter any locks are held, but the more operations required and the more total running time. -d DATABASE, --database=DATABASE
Database name (required unless table is fully qualified)
--defaults-file=DEFAULTS_FILERead from MySQL configuration file. Overrides --user, --password, --socket, --port.
Configuration needs to be in the following format:
[client]
user=my_user
password=my_pass
socket=/tmp/mysql.sock
port=3306
Assuming chunking on numeric field (e.g. AUTO_INCREMENT), end chunking with this value. Either provide a constant or a query returning a single integer value.
-e EXECUTE_QUERY, --execute=EXECUTE_QUERYQuery to execute, which contains a chunk placeholder in the form of OAK_CHUNK(table_name) (required)
--force-chunking-column=FORCED_CHUNKING_COLUMNColumns to chunk by; avoids querying in INFORMATION_SCHEMA. Format: either column_name:type, where type is integer/text/temporal - for single column keys, or column1_name,column2_name,... for one or more column keys, with no type.
-H HOST, --host=HOSTMySQL host (default: localhost)
--no-log-binDo not log to binary log (actions will not replicate). This may be useful if the slave already finds it hard to replicate behind master. The utility may be spawned manually on slave machines, therefore utilizing more than one CPU core on those machines, making replication process faster due to parallelism.
-p PASSWORD, --password=PASSWORDMySQL password
-P PORT, --port=PORTTCP/IP port (default: 3306)
--print-progressShow number of affected rows during utility runtime
--sleep=SLEEP_MILLISNumber of milliseconds to sleep between chunks. Default: 0
--sleep-ratio=SLEEP_RATIORatio of sleep time to execution time. Default: 0
--skip-lock-tablesDo not issue a LOCK TABLES READ. May be required when using queries within --start-with or --end-with
--skip-retry-chunkAvoid retrying a chunk operation on error. Default: false
-S SOCKET, --socket=SOCKETMySQL socket file. Only applies when host is localhost
--start-with=START_WITHAssuming chunking on numeric field (e.g. AUTO_INCREMENT), start chunking from this value and onward. Either provide a constant or a query returning a single integer value.
--terminate-on-not-foundTerminate on first occurrence where chunking did not affect any rows (default: False)
-u USER, --user=USERMySQL user
-v, --verbosePrint user friendly messages
apt-get install python-mysqldbor
yum install mysql-python
oak-repeat-query
Copyright (c) 2008 - 2010, Shlomi Noach 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 the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.


A prototype for teaching coding with voice over Unlike a normal video, you can pause and resume at any time. You can also copy the code from the screen below Comments: hkpeterpeter@gmail.com


Instructions
Enter your Client ID:
Click
Authorize
to begin.
To use on a test domain, open an incognito window and log in to your test account.
In the popup window, log in to your administrator account (if you aren't already) and accept the API access prompt.
Once authorized, use the UI below to perform the different operations of the License Manager API.
License Manager
Complete authorization in Step 1 and 2 to continue
Target Domain
Action
Target User
Product
Current SKU
SKU
View Licenses for Product
View Licenses for Product and SKU
Assign License
Assign Licenses (Bulk)
Reassign License
Delete License
Delete Licenses (Bulk)
Google-Coordinate
Google-Drive-storage
Google-Coordinate
Google-Coordinate
Response
Make an API call to see the response here


April 12
I will praise thee, O Lord, with my whole heart; I will show forth all thy marvellous works. I
will be glad and rejoice in thee: I will sing praise to thy name, O thou most High. When mine enemies are turned back, they shall fall and perish at thy presence.
Psalm 9:1-3
Never underestimate the importance of praise. It's one of the most powerful spiritual weapons you have. Praise is more than a pleasant song or a few uplifting words about God. It does something. It releases the very presence of God Himself. And, when the presence of God comes on the scene, your enemies are turned back. Sickness and disease can't stay on your body. Poverty can't stay in your house.
Even physical weariness has to flee when it's faced with real joy-filled praise. I know that from experience. Years ago, when I first began conducting Healing School, I had a real battle with fatigue. I'd minister and lay my hands on the sick for so many hours at a time that by the time the meeting had ended, I was sometimes too physically weak even to close the service.
Then, in one particular meeting, I discovered the power of praise. I had just finished praying for those in the prayer line, and as usual, I was exhausted. But instead of rest, the Spirit of the Lord impressed on me that what I needed was to rejoice in the Lord. So, I did. I began to praise the Lord with my whole heart, mind and body. Do you know what happened? The tiredness left me. And I was energized with the presence of God!
The next time the devil tries to stifle your effectiveness, to drain you of the strength and wealth and victory that's yours in Jesus, turn him back with that powerful weapon. Lift your hands and your voice and whole heart to God. Praise!
Scripture Reading: 2 Chronicles 20:1-22


To recover your files, you must make a payment to the Bitcoin address provided to you on your computer.
If you have completed payment, enter your information (cp= wk=) below to obtain a tool to decrypt your files:


[gecode-users] Schedule serialized
Maity, Ashis K
ashis.k.maity at lmco.com
Tue Sep 22 15:21:50 CEST 2009
Hello,
Is there anything in Gecode library that is equivalent to Schedule.serialized of Mozart/Oz (i.e., choose resources across the tasks so that same resources are not chosen at the same time in two different tasks)? If not, can some one provide with a couple of pointers as to how to implement it?
Thanks,
Ashis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20090922/9ca3b474/attachment.htm>
More information about the gecode-users
mailing list


Dogs give you attention, provided you give them something to eat and drink!:)
Dogs are carnivorous, so give them enough quantites of meat, ensure it is properly washed.
Give your dogs a bath daily, trim their nails and give them a shave. Remember to take them to the vet occasionally.
Dogs basically need a place to sleep, if having a doghouse is too much. Ensure it is clean at all times, and is properly trained.
Back To Home Page


Crypto Explorer
Home
Check Balance
Contacts
Rank
Name
Market Cap
Price
Volume(24h)
Current Supply
Change(24h)


Your Getaway
Let us help you create a memorable getaway...
Beyond the Mountain View Inn lies the “picture postcard” Connecticut countryside of the Litchfield Hills. Beautiful scenery abounds year-round with several state parks and miles of hiking trails maintained by our local land trust. There are horse drawn carriage rides in the summer, hayrides in the fall and sleigh rides in the winter. Norfolk offers vintage, consignment and antique shops as well as restaurants for your enjoyment. A short stroll away guests can attend live musical performances year-round at Infinity Hall and the renowned Yale Chamber Music Festival during the summer. Other area musical venues include Music Mountain and Tanglewood. And there’s much more!
Whatever your pleasure, here is just a short sampling of some of our favorite local and nearby attractions.
NORFOLK ATTRACTIONS
- Infinity Hall
- Norfolk Music Festival
- Norfolk Library
- Norfolk Historical Society
- Norfolk Artisan’s Guild
- Norfolk Curling Club
- Loon Meadow Farm
- Joseph Stannard Antiques
OUTDOOR ACTIVITIES
- Hay Stack Mountain Park
- Campbell Falls Park
- Dennis Hill Park
- Bash Bish Falls
- Connecticut Outdoors
- Upcountry Sport Fishing
- White Flower Farm
- White Memorial Conservation Center
- Kent Falls
- Foliage Network
- Berkshire Botanical Garden
- Riverton Fair
WINTER SPORTS
RACING & HORSEBACK RIDING
MUSEUMS
- Norfolk Historical Society and Museum
- Norman Rockwell Museum
- Daniel French's "Chesterwood"
- Edith Wharton's "The Mount"
- Connecticut Antique Machinery Museum
- Hancock Shaker Village
ANTIQUES
- Berkshire Area Antique Shops
- Collinsville Antiques Co.
- Antiques on the Farmington
- Great Barrington Antiques Center
THEATRE & DANCE
- Shakespeare & Co.
- Berkshire Theatre Festival
- Barrington Stage Co.
- Warner Theatre Concerts & Shows
- Sharon Playhouse, Tri Arts
- Warner Theatre
- Mahaiwe Theatre
- Jacob’s Pillow Dance Festival
RESTAURANTS
We will gladly make reservations for you!
- Infinity Bistro
- Woodcreek Bar and Grill
- Old Inn on the Green
- Chatterley's
- Mizza's Pizza
- Sweet Pea's
- The Berkshire Cafe
- The Venetian Restaurant
- West Main
- Pastorale
- Bizen
- Baba Louie's
- Passiflora
- Woodland
- Siam Thai


tired out the informal practice of mindful conversation using the components of listening (giving the art of attention to the speaker), looping (closer the the loop of communication by demonstrating that you have really heard what the person is saying) and dipping (checking in with yourself, knowing how you are feeling about what you are hearing). I found these practises helped to retain the memory of the conversation a lot longer, for example, I didn’t have to ask again a few hows later what the other person’s plans where for later on that day, as I could recall the conversation.easily.
The first suggested technique to help sustain your practice is to have a buddy. This is because having a buddy can help you hold each other accountable and offer each other encouragement. The second technique is to ‘do less than you can’.This is stop mindfulness feeling like a chore or burden. If you do less formal practice the you are capable of it will make practice feel more enjoyable. The third technique is to ’take one breath a day’. The reason for this is that you can easily commit and fulfil to take one breath a day, and the practise encourages you to have an intention to do something kind and beneficial to yourself daily. The second and third techniques are something I am going to try to use to sustain my practice.


[gecode-users] About the different performance of two "apparently similar" Gecode models
Christian Schulte
cschulte at kth.se
Wed Jan 9 20:08:44 CET 2013
Hi,
Just two things completely off my head:
- How does your search control recomputation? Gecode is quite clever,
in particular during BAB.
- I saw that your variable domains are always from MIN_INT to
MAX_INT. Gecodes arent. This makes quite some difference for Golomb. Check
the MPG case study on Golomb.
Best
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Ignacio Castiñeiras
Sent: Wednesday, January 09, 2013 6:13 PM
To: users at gecode.org
Subject: [gecode-users] About the different performance of two "apparently
similar" Gecode models
Hi all,
We are obtaining a different performance in two apparently similar Gecode
models, and after performing some test we are blocked in finding out where
this different performance comes from.
CONTEXT:
We are performing a modelling and solving comparison of the Golomb Ruler
problem between Gecode and our Constraint Functional Logic Programming
system TOY(FDg) (which uses Gecode for finite domain constraint solving).
Our hypothesis is that, being Golomb an optimization combinatorial problem,
as soon as it scales, the time spent on search will be almost the 100% of
the total elapsed time (making the inherent surcharge of interfacing
TOY(FDg) to Gecode nearly negligible).
Unfortunately (at least for us J) this does not hold. For example, whereas
for Golomb-11 the Gocode model spends 28sec, the TOY(FDg) model spends 42sec
(a 50% of time more). This difference directly comes from the time they
spent on the search, which is strange, as both models are using the same
formulation (in the sense of a same number of variables with same domain, a
same set of constraints and a same search strategy). Of course the resulting
Gecode code of our TOY(FDg) interfaced model results to be less natural than
the one obtained when modelling directly over Gecode (in the sense of having
to use a single variable vector and devoted predicates for adding each new
variable and constraint arising in the TOY(FDg) goal, as some of its
drawbacks).
To find out the reason of such this difference we have performed some tests,
which I describe to you (all the files I talk about are attached to this
email). We are using Gecode 3.7.3 with Visual Studio 2008.
TEST 1.
The test uses:
- golomb_5_gist_natural.cpp (model using Gecode directly).
- golomb_5_gist_natural.res (log of the results from running the
model).
- golomb_5_gist_natural.pdf (gist tree obtained by running the model).
- golomb_5_gist_interfaced.cpp (simulation of the resulting Gecode
model obtained from TOY(FDg)).
- golomb_5_gist_interfaced.res (log of the results from running the
model).
- golomb_5_gist_interfaced.pdf (gist tree obtained by running the
model).
Both models solve Golomb-5, which contain:
- Variables: m[0,m0,m1,m2,m3]; d[d0,d1,d2,d3,d4,d5,d6,d7,d8,d9].
- Constraints: m[i] < m[i+1]; d represents the pairwise differences m;
all_different(d); d[0] < d[last].
- Search: Label m in textual order, minimizing m[last]
Conclusions:
1. The pdf files show that the Gist tree of the Gecode and TOY(FDg)
models are exactly the same.
2. The res files show that the propagation is the same in almost of
nodes, but not in the node remarked in grey in the pdf files. For this node
Gecode makes m = {0, 1, 6, 8, 10} and d = {1, 6, 8, 10, [5..6], [6..7], 9,
2, 4, 3} (lines 73-76 of golomb_5_gist_natural.res), but TOY(FDg) makes
varsSearch = {1, 6, 7, 10, 1, 6, 7, 10, 5, 6, 9, 2, 4, 3} (lines 60-62 of
golomb_5_gist_interfaced.res). As it is seen in the gist trees, both systems
fail in this node, but TOY(FDg) has to do more work to discover it).
TEST 2.
The test uses:
- golomb_5_bab_natural.cpp (model using Gecode directly).
- golomb_5_bab_natural.res (log of the results from running the model).
- golomb_5_bab_interfaced.cpp (simulation of the resulting Gecode model
obtained from TOY(FDg)).
- golomb_5_bab_interfaced.res (log of the results from running the
model).
Both models use a search engine (for obtaining statistics of the search) and
the user-defined constraint checkwhenpruned, which prints in the log each
modification in the domain of the variables. With that we can control how
the domains of the variables evolve during the search.
Conclusions:
1. The res files show that both models explore 19 nodes, with 8 fails.
However, whereas the number of propagators in Gecode is 542, for TOY(FDg) is
544 (possibly the two extra propagators of node remarked in grey in the pdf
files).
2. The res files show that there also two more kind of differences in
the propagation of Gecode and TOY(FDg). Lets focus in the lines 66-83 of
golomb_5_bab_natural.res and the lines 71-89 of golomb_5_bab_interfaced.res.
They represent the propagation performed in the node remarked in yellow in
the pdf files (initial state m = {0, 1, [3..11], [6..13], [10..15]} and d =
{1, [3..11], [6..13], [10..15], [2..10], [5..12], [9..14], [2..10], [3..12],
[2..9]} à final state m = {0, 1, 3, [7..11], [11..15]} and d = {1, 3,
[7..11], [11..15], 2, [6..10], [10..14], [4..8], [8..12], [4..8]}, thus
affecting to all the variables):
2.1. The order in which the variables see their domain pruned in different
in Gecode and TOY(FDg), which could come from a different order in which the
constraints are being propagated.
2.2. The number of prunnings is different. For example, in Gecode there are
18 variable notifications, but in TOY(FDg) there are 19 (the pruning d[5] =
[6..12] appears in TOY(FDg) but not in Gecode. As it is seen in the gist
trees, both systems success in propagation of this node, but TOY(FDg) has to
do more work to discover it).
TEST 3.
The test uses:
- golomb_11_bab_natural.cpp (model using Gecode directly).
- golomb_11_bab_natural.res (log of the results from running the
model).
- golomb_11_bab_interfaced.cpp (simulation of the resulting Gecode
model obtained from TOY(FDg)).
- golomb_11_bab_interfaced.res (log of the results from running the
model).
Both models use the computer clock to measure the elapsed time in running
the problem.
Conclusions:
1. Again, both models explore the same search tree (2968201 nodes and
1484086 fails). But, again, the number of propagators is different
(320150379 for Gecode and 295041321 for TOY(FDg)). Interestingly, for
Golomb-11 is Gecode the one that has (much) more propagators. For Golomb-5
it was TOY(FDg) the one that had (just) two more propagators).
2. Regarding the elapsed time for the search, Gecode (28sec) clearly
outperforms TOY(FDg) (42sec).
WE NEED HELP:
1. Do you think that the big performance difference of Test3 is because
of the reasons we have found in Test1 and Test2 (where TOY(FDg) always has
to work more than Gecode for obtaining the same propagation results)?
2. If you think this is not the case, do you have any insight of where
does the performance difference come from?
Thank you very much in advance for spend your time reading this (so long)
email and helping us.
Best regards,
Nacho Castiñeiras
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130109/032f3979/attachment-0001.html>
More information about the users
mailing list


To facilitate building custom dashboards on the Crunch data platform <http://crunch.io/>, the 'crunchy' package provides tools for working with 'shiny'. These tools include utilities to manage authentication and authorization automatically and custom stylesheets to help match the look and feel of the Crunch web application.
| Version: | 0.2.0 |
| Depends: | R (≥ 3.0.0), crunch, shiny |
| Suggests: | covr, testthat |
| Published: | 2017-05-05 |
| Author: | Neal Richardson [aut, cre] |
| Maintainer: | Neal Richardson <neal at crunch.io> |
| BugReports: | https://github.com/Crunch-io/crunchy/issues |
| License: | LGPL (≥ 3) |
| URL: | https://github.com/Crunch-io/crunchy |
| NeedsCompilation: | no |
| In views: | WebTechnologies |
| CRAN checks: | crunchy results |
| Reference manual: | crunchy.pdf |
| Package source: | crunchy_0.2.0.tar.gz |
| Windows binaries: | r-devel: crunchy_0.2.0.zip, r-release: crunchy_0.2.0.zip, r-oldrel: crunchy_0.2.0.zip |
| OS X binaries: | r-release: crunchy_0.2.0.tgz, r-oldrel: crunchy_0.2.0.tgz |
| Reverse suggests: | crunch |
Please use the canonical form https://CRAN.R-project.org/package=crunchy to link to this page.


MapCache
open class MapCache : MapCacheProtocol
This is the main implementation of the MapCacheProtocol, the actual cache
-
Cofiguration that will be used to set up the behavior of the
MapCache
instanceDeclaration
Swift
public var config: MapCacheConfig
-
It manages the physical storage of the tile images in the device
Declaration
Swift
public var diskCache: DiskCache
-
Manages the queue of network requests for retrieving the tiles
Declaration
Swift
let operationQueue: OperationQueue
-
Constructor. It sets the
config
variable and initializes thediskCache
with the name and capacity set in the config.Declaration
Swift
public init(withConfig config: MapCacheConfig)
-
Returns the URL for a tile.
Basically replaces in
config.urlTemplate
the substrings{z}
,{x}
,{y}
with the values of theforTilePath
If{s}
is defined in the template, it aplies the Round Robin algorithm.See also
MapCacheConfig.roundRoubinSubdomain()
Declaration
Swift
public func url(forTilePath path: MKTileOverlayPath) -> URL
Parameters
forTilePath
is the path for the tile in (x, y, z) tile coordinates.
-
For the path passed as argument it creates a unique key to be used in
DiskCache
.The output is a string that has the following format
{config.urlTemplate}-{x}-{y}-{z}
where:- config.urlTemplate is the template url template and
x, y and z are the coords of the path
Declaration
Swift
public func cacheKey(forPath path: MKTileOverlayPath) -> String
Parameters
forPath
is the path of the tile you want the cache
-
Fetches tile from server. It resolves the url for the tile at the path. Then it tries to download the tile image from the server. If everything goes ok it and updates the image in
diskCache
and returns the receivedData
through thesucess
closure. If something goes wrong it invokes thefailure
closure passing theerror
returned by the system.Declaration
Swift
public func fetchTileFromServer(at path: MKTileOverlayPath, failure fail: ((Error?) -> ())? = nil, success succeed: @escaping (Data) -> ())
Parameters
at
Path for the tile
failure
if the tile cannot be retrieved from the server this closure is called
success
if the image is downloaded
-
Returns the tile to be displayed on the overlay. The strategy used to retrieve the tile (i.e. from network or from the
diskCache
) depends on theconfig.loadTileMode
.See also
Declaration
Swift
public func loadTile(at path: MKTileOverlayPath, result: @escaping (Data?, Error?) -> Void)
-
Currently size of the cache
Declaration
Swift
public var diskSize: UInt64 { get }
-
Calculates the disk space allocated in dis for the cache
See also
DiskCacheDeclaration
Swift
public func calculateDiskSize() -> UInt64
-
Clears the cache. Removes all files in the
diskCache
As it may take some time to remove all files it calls the completition closure upon finishing the removal.Declaration
Swift
public func clear(completition: (() -> ())?)
Parameters
completition
code to run upon the cache is cleared.


Hand-Crafted Styles
Aloha Apparel Co. sells only the finest ready-to-travel clothing. Browse our current selection of products or sign-up for updates below.
Aloha Apparel Co. sells only the finest ready-to-travel clothing. Browse our current selection of products or sign-up for updates below.


Except Categories (Will not be Blocked)
Science & Technology
Documentary
Education
Film & Animation
Autos & Vehicles
Music
Pets & Animals
Sports
Short Movies
Travel & Events
Gaming
Videoblogging
People & Blogs
Comedy
Entertainment
News & Politics
Howto & Style
Nonprofits & Activism
Movies
Anime/Animation
Action/Adventure
Classics
Comedy
Drama
Family
Foreign
Horror
Sci-Fi/Fantasy
Thriller
Shorts
Shows
Trailers
Time Limit
Minutes
Save Settings


Upspeed
SoundCloud getting faster
Enter SoundCloud URL...
Make it go faster!
Song Name
by
artist
Current Speed:
0%


Plotting¶
The module qp.plot implements some basic plotting functions that can help analyse the performance of a quantification method.
All plotting functions receive as inputs the outcomes of some experiments and include, for each experiment, the following three main arguments:
method_names a list containing the names of the quantification methods
true_prevs a list containing matrices of true prevalences
estim_prevs a list containing matrices of estimated prevalences (should be of the same shape as the corresponding matrix in true_prevs)
Note that a method (as indicated by a name in method_names) can appear more than once. This could occur when various datasets are involved in the experiments. In this case, all experiments for the method will be merged and the plot will represent the method’s performance across various datasets.
This is a very simple example of a valid input for the plotting functions:
method_names = ['classify & count', 'EMQ', 'classify & count']
true_prevs = [
np.array([[0.5, 0.5], [0.25, 0.75]]),
np.array([[0.0, 1.0], [0.25, 0.75], [0.0, 0.1]]),
np.array([[0.0, 1.0], [0.25, 0.75], [0.0, 0.1]]),
]
estim_prevs = [
np.array([[0.45, 0.55], [0.6, 0.4]]),
np.array([[0.0, 1.0], [0.5, 0.5], [0.2, 0.8]]),
np.array([[0.1, 0.9], [0.3, 0.7], [0.0, 0.1]]),
]
in which the classify & count has been tested in two datasets and the EMQ method has been tested only in one dataset. For the first experiment, only two (binary) quantifications have been tested, while for the second and third experiments three instances have been tested.
In general, we would like to test the performance of the quantification methods across different scenarios showcasing the accuracy of the quantifier in predicting class prevalences for a wide range of prior distributions. This can easily be achieved by means of the artificial sampling protocol that is implemented in QuaPy.
The following code shows how to perform one simple experiment in which the 4 CC-variants, all equipped with a linear SVM, are applied to one binary dataset of reviews about Kindle devices and tested across the entire spectrum of class priors (taking 21 splits of the interval [0,1], i.e., using prevalence steps of 0.05, and generating 100 random samples at each prevalence).
import quapy as qp
from protocol import APP
from quapy.method.aggregative import CC, ACC, PCC, PACC
from sklearn.svm import LinearSVC
qp.environ['SAMPLE_SIZE'] = 500
def gen_data():
def base_classifier():
return LinearSVC(class_weight='balanced')
def models():
yield 'CC', CC(base_classifier())
yield 'ACC', ACC(base_classifier())
yield 'PCC', PCC(base_classifier())
yield 'PACC', PACC(base_classifier())
train, test = qp.datasets.fetch_reviews('kindle', tfidf=True, min_df=5).train_test
method_names, true_prevs, estim_prevs, tr_prevs = [], [], [], []
for method_name, model in models():
model.fit(train)
true_prev, estim_prev = qp.evaluation.prediction(model, APP(test, repeats=100, random_state=0))
method_names.append(method_name)
true_prevs.append(true_prev)
estim_prevs.append(estim_prev)
tr_prevs.append(train.prevalence())
return method_names, true_prevs, estim_prevs, tr_prevs
method_names, true_prevs, estim_prevs, tr_prevs = gen_data()
the plots that can be generated are explained below.
Diagonal Plot¶
The diagonal plot shows a very insightful view of the quantifier’s performance. It plots the predicted class prevalence (in the y-axis) against the true class prevalence (in the x-axis). Unfortunately, it is limited to binary quantification, although one can simply generate as many diagonal plots as classes there are by indicating which class should be considered the target of the plot.
The following call will produce the plot:
qp.plot.binary_diagonal(method_names, true_prevs, estim_prevs, train_prev=tr_prevs[0], savepath='./plots/bin_diag.png')
the last argument is optional, and indicates the path where to save the plot (the file extension will determine the format – typical extensions are ‘.png’ or ‘.pdf’). If this path is not provided, then the plot will be shown but not saved. The resulting plot should look like:
Note that in this case, we are also indicating the training prevalence, which is plotted in the diagonal a as cyan dot. The color bands indicate the standard deviations of the predictions, and can be hidden by setting the argument show_std=False (see the complete list of arguments in the documentation).
Finally, note how most quantifiers, and specially the “unadjusted” variants CC and PCC, are strongly biased towards the prevalence seen during training.
Quantification bias¶
This plot aims at evincing the bias that any quantifier displays with respect to the training prevalences by means of box plots. This plot can be generated by:
qp.plot.binary_bias_global(method_names, true_prevs, estim_prevs, savepath='./plots/bin_bias.png')
and should look like:
The box plots show some interesting facts:
all methods are biased towards the training prevalence but specially so CC and PCC (an unbiased quantifier would have a box centered at 0)
the bias is always positive, indicating that all methods tend to overestimate the positive class prevalence
CC and PCC have high variability while ACC and specially PACC exhibit lower variability.
Again, these plots could be generated for experiments ranging across different datasets, and the plot will merge all data accordingly.
Another illustrative example can be shown that consists of training different CC quantifiers trained at different (artificially sampled) training prevalences. For this example, we generate training samples of 5000 documents containing 10%, 20%, …, 90% of positives from the IMDb dataset, and generate the bias plot again. This example can be run by rewritting the gen_data() function like this:
def gen_data():
train, test = qp.datasets.fetch_reviews('imdb', tfidf=True, min_df=5).train_test
model = CC(LinearSVC())
method_data = []
for training_prevalence in np.linspace(0.1, 0.9, 9):
training_size = 5000
# since the problem is binary, it suffices to specify the negative prevalence, since the positive is constrained
train_sample = train.sampling(training_size, 1-training_prevalence)
model.fit(train_sample)
true_prev, estim_prev = qp.evaluation.prediction(model, APP(test, repeats=100, random_state=0))
method_name = 'CC$_{'+f'{int(100*training_prevalence)}' + '\%}$'
method_data.append((method_name, true_prev, estim_prev, train_sample.prevalence()))
return zip(*method_data)
and the plot should now look like:
which clearly shows a negative bias for CC variants trained on data containing more negatives (i.e., < 50%) and positive biases in cases containing more positives (i.e., >50%). The CC trained at 50% behaves as an unbiased estimator of the positive class prevalence.
The function qp.plot.binary_bias_bins allows the user to generate box plots broken down by bins of true test prevalence. To this aim, an argument nbins is passed which indicates how many isometric subintervals to take. For example the following plot is produced for nbins=3:
Interestingly enough, the seemingly unbiased estimator (CC at 50%) happens to display a positive bias (or a tendency to overestimate) in cases of low prevalence (i.e., when the true prevalence of the positive class is below 33%), and a negative bias (or a tendency to underestimate) in cases of high prevalence (i.e., when the true prevalence is beyond 67%).
Out of curiosity, the diagonal plot for this experiment looks like:
showing pretty clearly the dependency of CC on the prior probabilities of the labeled set it was trained on.
Error by Drift¶
Above discussed plots are useful for analyzing and comparing the performance of different quantification methods, but are limited to the binary case. The “error by drift” is a plot that shows the error in predictions as a function of the (prior probability) drift between each test sample and the training set. Interestingly, the error and drift can both be measured in terms of any evaluation measure for quantification (like the ones available in qp.error) and can thus be computed irrespectively of the number of classes.
The following shows how to generate the plot for the 4 CC variants, using 10 bins for the drift and absolute error as the measure of the error (the drift in the x-axis is always computed in terms of absolute error since other errors are harder to interpret):
qp.plot.error_by_drift(method_names, true_prevs, estim_prevs, tr_prevs,
error_name='ae', n_bins=10, savepath='./plots/err_drift.png')
Note that all methods work reasonably well in cases of low prevalence drift (i.e., any CC-variant is a good quantifier whenever the IID assumption is approximately preserved). The higher the drift, the worse those quantifiers tend to perform, although it is clear that PACC yields the lowest error for the most difficult cases.
Remember that any plot can be generated across many datasets, and that this would probably result in a more solid comparison. In those cases, however, it is likely that the variances of each method get higher, to the detriment of the visualization. We recommend to set show_std=False in those cases in order to hide the color bands.


Reform provides form objects that maintain validations for one or multiple models, where a model can be any kind of Ruby object. It is completely framework-agnostic and doesn’t care about your database.
A form doesn’t have to be a UI component, necessarily! It can be an intermediate validation before writing data to the persistence layer. While form objects may be used to render graphical web forms, Reform is used in many pure-API applications for deserialization and validation.
Forms are defined in separate classes. Often, these classes partially map to a model.
class AlbumForm < Reform::Form
property :title
validates :title, presence: true
end
Fields are declared using ::property
. Validations work almost exactly as you know it from Rails or other frameworks. Note that validations no longer go into the model.
Forms have a ridiculously simple API with only a handful of public methods.
#initialize
always requires a model that the form represents.#validate(params)
updates the form’s fields with the input data (only the form, not the model) and then runs all validations. The return value is the boolean result of the validations.#errors
returns validation messages in a classic ActiveModel style.#sync
writes form data back to the model. This will only use setter methods on the model(s).#save
(optional) will call #save
on the model and nested models. Note that this implies a #sync
call.#prepopulate!
(optional) will run pre-population hooks to “fill out” your form before rendering.In addition to the main API, forms expose accessors to the defined properties. This is used for rendering or manual operations.
In your controller or operation you create a form instance and pass in the models you want to work on.
class AlbumsController
def new
@form = AlbumForm.new(Album.new)
end
This will also work as an editing form with an existing album.
def edit
@form = AlbumForm.new(Album.find(1))
end
Reform will read property values from the model in setup. In our example, the AlbumForm
will call album.title
to populate the title
field.
Your @form
is now ready to be rendered, either do it yourself or use something like Rails’ #form_for
, simple_form
or formtastic
.
= form_for @form do |f|
= f.input :title
Nested forms and collections can be easily rendered with fields_for
, etc. Note that you no longer pass the model to the form builder, but the Reform instance.
Optionally, you might want to use the #prepopulate!
method to pre-populate fields and prepare the form for rendering.
After form submission, you need to validate the input.
class SongsController
def create
@form = SongForm.new(Song.new)
#=> params: {song: {title: "Rio", length: "366"}}
if @form.validate(params[:song])
The #validate
method first updates the values of the form - the underlying model is still treated as immutuable and remains unchanged. It then runs all validations you provided in the form.
It’s the only entry point for updating the form. This is per design, as separating writing and validation doesn’t make sense for a form.
This allows rendering the form after validate
with the data that has been submitted. However, don’t get confused, the model’s values are still the old, original values and are only changed after a #save
or #sync
operation.
After validation, you have two choices: either call #save
and let Reform sort out the rest. Or call #sync
, which will write all the properties back to the model. In a nested form, this works recursively, of course.
It’s then up to you what to do with the updated models - they’re still unsaved.
The easiest way to save the data is to call #save
on the form.
if @form.validate(params[:song])
@form.save #=> populates album with incoming data
# by calling @form.album.title=.
else
# handle validation errors.
end
This will sync the data to the model and then call album.save
.
Sometimes, you need to do saving manually.
Calling #save
with a block will provide a nested hash of the form’s properties and values. This does not call #save
on the models and allows you to implement the saving yourself.
The block parameter is a nested hash of the form input.
@form.save do |hash|
hash #=> {title: "Greatest Hits"}
Album.create(hash)
end
You can always access the form’s model. This is helpful when you were using populators to set up objects when validating.
@form.save do |hash|
album = @form.model
album.update_attributes(hash[:album])
end
While a form object will drastically improve your application architecture as a stand-alone object, forms work best in containers like Trailblazer’s operation.
Every form in Reform is a twin. Twins are non-persistent domain objects from the Disposable gem. All features of Disposable, like renaming fields, change tracking, etc. are available in Reform, too.
Reform provides support for nested objects. Let’s say the Album
model keeps some associations.
class Album < ActiveRecord::Base
has_one :artist
has_many :songs
end
The implementation details do not really matter here, as long as your album exposes readers and writes like Album#artist
and Album#songs
, this allows you to define nested forms.
class AlbumForm < Reform::Form
property :title
validates :title, presence: true
property :artist do
property :full_name
validates :full_name, presence: true
end
collection :songs do
property :name
end
end
You can also reuse an existing form from elsewhere using :form
.
property :artist, form: ArtistForm
Reform will wrap defined nested objects in their own forms. This happens automatically when instantiating the form.
album.songs #=> [<Song name:"Run To The Hills">]
form = AlbumForm.new(album)
form.songs[0] #=> <SongForm model: <Song name:"Run To The Hills">>
form.songs[0].name #=> "Run To The Hills"
When rendering a nested form you can use the form’s readers to access the nested forms.
= text_field :title, @form.title
= text_field "artist[name]", @form.artist.name
Or use something like #fields_for
in a Rails environment.
= form_for @form do |f|
= f.text_field :title
= f.fields_for :artist do |a|
= a.text_field :name
validate
will assign values to the nested forms. sync
and save
work analogue to the non-nested form, just in a recursive way.
The block form of #save
would give you the following data.
@form.save do |nested|
nested #=> {title: "Greatest Hits",
# artist: {name: "Duran Duran"},
# songs: [{title: "Hungry Like The Wolf"},
# {title: "Last Chance On The Stairways"}]
# }
end
The manual saving with block is not encouraged. You should rather check the Disposable docs to find out how to implement your manual tweak with the official API.
Very often, you need to give Reform some information how to create or find nested objects when validate
ing. This directive is called populator and documented here.
Add this line to your Gemfile:
gem 'reform'
Reform works fine with Rails 3.1-4.2. However, inheritance of validations with ActiveModel::Validations
is broken in Rails 3.2 and 4.0.
Since Reform 2.0 you need to specify which validation backend you want to use (unless you’re in a Rails environment where ActiveModel will be used).
To use ActiveModel (not recommended as it doesn’t support removing validations).
require "reform/form/active_model/validations"
Reform::Form.class_eval do
include Reform::Form::ActiveModel::Validations
end
To use dry-validation (recommended).
require "reform/form/dry"
Reform::Form.class_eval do
include Reform::Form::Dry
end
Put this in an initializer or on top of your script.
Use Reform-rails to automatically load and include Reform features for a standard Rails stack, e.g. ActiveModel::Validations
.
gem "reform"
gem "reform-rails"
Reform allows to map multiple models to one form. The complete documentation is here, however, this is how it works.
class AlbumTwin < Reform::Form
include Composition
property :id, on: :album
property :title, on: :album
property :songs, on: :cd
property :cd_id, on: :cd, from: :id
end
When initializing a composition, you have to pass a hash that contains the composees.
AlbumForm.new(album: album, cd: CD.find(1))
Reform comes many more optional features, like hash fields, coercion, virtual fields, and so on. Check the full documentation here.
=> rendering
=> sync with block
Reform can also handle deeply nested hash fields from serialized hash columns. This is documented here.
Luckily, this can be shortened as follows.
class SongForm < Reform::Form
property :title, validates: {presence: true}
property :length, validates: {numericality: true}
end
Use properties
to bulk-specify fields.
class SongForm < Reform::Form
properties :title, :length, validates: {presence: true} # both required!
validates :length, numericality: true
end
If the form wraps multiple models, via composition, you can access them like this:
@form.save do |nested|
song = @form.model[:song]
label = @form.model[:label]
end
Note that you can call #sync
and then call #save { |hsh| }
to save models yourself.
You can assign Reform to not call save
on a particular nested model (per default, it is called automatically on all nested models).
class AlbumForm < Reform::Form
# ...
collection :songs, save: false do
# ..
end
The :save
options set to false won’t save models.
Sometimes you might want to embrace two (or more) unrelated objects with a single form. While you could write a simple delegating composition yourself, reform comes with it built-in.
Say we were to edit a song and the label data the record was released from. Internally, this would imply working on the songs
table and the labels
table.
class SongWithLabelForm < Reform::Form
include Composition
property :title, on: :song
property :city, on: :label
model :song # only needed in ActiveModel context.
validates :title, :city, presence: true
end
Note that reform needs to know about the owner objects of properties. You can do so by using the on:
option.
Also, the form needs to have a main object configured. This is where ActiveModel-methods like #persisted?
or ‘#id’ are delegated to. Use ::model
to define the main object.
The constructor slightly differs.
@form = SongWithLabelForm.new(song: Song.new, label: Label.new)
After you configured your composition in the form, reform hides the fact that you’re actually showing two different objects.
= form_for @form do |f|
Song: = f.input :title
Label in: = f.input :city
When using `#save’ without a block reform will use writer methods on the different objects to push validated data to the properties.
Here’s what the block parameters look like.
@form.save do |nested|
nested #=> {
# song: {title: "Rio"}
# label: {city: "London"}
# }
end
To maximize reusability, you can also define forms in modules and include them in other modules or classes.
module SongsForm
include Reform::Form::Module
collection :songs do
property :title
validates :title, presence: true
end
end
This can now be included into a real form.
class AlbumForm < Reform::Form
property :title
include SongsForm
end
Note that you can also override properties using inheritance in Reform.
When using coercion, make sure the including form already contains the Coercion
module.
Forms can be derived from other forms and will inherit all properties and validations.
class AlbumForm < Reform::Form
property :title
collection :songs do
property :title
validates :title, presence: true
end
end
Now, a simple inheritance can add fields.
class CompilationForm < AlbumForm
property :composers do
property :name
end
end
This will add composers
to the existing fields.
You can also partially override fields using :inherit
.
class CompilationForm < AlbumForm
property :songs, inherit: true do
property :band_id
validates :band_id, presence: true
end
end
Using inherit:
here will extend the existing songs
form with the band_id
field. Note that this simply uses representable’s inheritance mechanism.
Often you want incoming form data to be converted to a type, like timestamps. Reform uses virtus for coercion, the DSL is seamlessly integrated into Reform with the :type
option.
Be sure to add virtus
to your Gemfile.
require 'reform/form/coercion'
class SongForm < Reform::Form
include Coercion
property :written_at, type: DateTime
end
form.validate("written_at" => "26 September")
Coercion only happens in #validate
.
form.written_at #=> <DateTime "2014 September 26 00:00">
If you need to filter values manually, you can override the setter in the form.
class SongForm < Reform::Form
property :title
def title=(value)
super sanitize(value) # value is raw form input.
end
end
As with the built-in coercion, this setter is only called in #validate
.
Virtual fields come in handy when there’s no direct mapping to a model attribute or when you plan on displaying but not processing a value.
Often, fields like password_confirmation
should neither be read from nor written back to the model. Reform comes with the :virtual
option to handle that case.
class PasswordForm < Reform::Form
property :password
property :password_confirmation, virtual: true
Here, the model won’t be queried for a password_confirmation
field when creating and rendering the form. When saving the form, the input value is not written to the decorated model. It is only readable in validations and when saving the form manually.
form.validate("password" => "123", "password_confirmation" => "321")
form.password_confirmation #=> "321"
The nested hash in the block-#save
provides the same value.
form.save do |nested|
nested[:password_confirmation] #=> "321"
When you want to show a value but skip processing it after submission the :writeable
option is your friend.
class ProfileForm < Reform::Form
property :country, writeable: false
This time reform will query the model for the value by calling model.country
.
You want to use this to display an initial value or to further process this field with JavaScript. However, after submission, the field is no longer considered: it won’t be written to the model when saving.
It is still readable in the nested hash and through the form itself.
form.save do |nested|
nested[:country] #=> "Australia"
A third alternative is to hide a field’s value but write it to the database when syncing. This can be achieved using the :readable
option.
property :credit_card_number, readable: false
Sometimes when you still keep validations in your models (which you shouldn’t) copying them to a form might not feel right. In that case, you can let Reform automatically copy them.
class SongForm < Reform::Form
property :title
extend ActiveModel::ModelValidations
copy_validations_from Song
end
Note how copy_validations_from
copies over the validations allowing you to stay DRY.
This also works with Composition.
class SongForm < Reform::Form
include Composition
# ...
extend ActiveModel::ModelValidations
copy_validations_from song: Song, band: Band
end
Reform doesn’t really know whether it’s working with a PORO, an ActiveRecord
instance or a Sequel
row.
When rendering the form, reform calls readers on the decorated model to retrieve the field data (Song#title
, Song#length
).
When syncing a submitted form, the same happens using writers. Reform simply calls Song#title=(value)
. No knowledge is required about the underlying database layer.
The same applies to saving: Reform will call #save
on the main model and nested models.
Nesting forms only requires readers for the nested properties as Album#songs
.
Rails and Reform work together out-of-the-box.
However, you should know about two things.
ActiveRecord
or Mongoid
and form builder: require reform/form
, only.Form::ActiveRecord
module is not loaded properly, usually triggering a NoMethodError
saying undefined method 'model'
. If that happened to you, require 'reform/rails'
manually at the bottom of your config/application.rb
.Mongoid
constant is defined.Reform provides the following ActiveRecord
specific features. They’re mixed in automatically in a Rails/AR setup.
validates_uniqueness_of
in your form.As mentioned in the Rails Integration section some Rails 4 setups do not properly load.
You may want to include the module manually then.
class SongForm < Reform::Form
include Reform::Form::ActiveRecord
Reform provides the following Mongoid
specific features. They’re mixed in automatically in a Rails/Mongoid setup.
validates_uniqueness_of
in your form.You may want to include the module manually then.
class SongForm < Reform::Form
include Reform::Form::Mongoid
Both ActiveRecord and Mongoid modules will support “native” uniqueness support from the model class when you use validates_uniqueness_of
. They will provide options like :scope
, etc.
You’re encouraged to use Reform’s non-writing unique: true
validation, though. Learn more
Forms in Reform can easily be made ActiveModel-compliant.
Note that this step is not necessary in a Rails environment.
class SongForm < Reform::Form
include Reform::Form::ActiveModel
end
If you’re not happy with the model_name
result, configure it manually via ::model
.
class CoverSongForm < Reform::Form
include Reform::Form::ActiveModel
model :song
end
::model
will configure ActiveModel’s naming logic. With Composition
, this configures the main model of the form and should be called once.
This is especially helpful when your framework tries to render cover_song_path
although you want to go with song_path
.
To make your forms work with all the form gems like simple_form
or Rails form_for
you need to include another module.
Again, this step is implicit in Rails and you don’t need to do it manually.
class SongForm < Reform::Form
include Reform::Form::ActiveModel
include Reform::Form::ActiveModel::FormBuilderMethods
end
If you want full support for simple_form
do as follows.
class SongForm < Reform::Form
include ActiveModel::ModelReflections
Including this module will add #column_for_attribute
and other methods need by form builders to automatically guess the type of a property.
In case you’re processing uploaded files with your form using CarrierWave, Paperclip, Dragonfly or Paperdragon we recommend using the awesome file_validators gem for file type and size validations.
class SongForm < Reform::Form
property :image
validates :image, file_size: {less_than: 2.megabytes},
file_content_type: {allow: ['image/jpeg', 'image/png', 'image/gif']}
Composed multi-parameter dates as created by the Rails date helper are processed automatically when multi_params: true
is set for the date property and the MultiParameterAttributes
feature is included. As soon as Reform detects an incoming release_date(i1)
or the like it is gonna be converted into a date.
class AlbumForm < Reform::Form
feature Reform::Form::ActiveModel::FormBuilderMethods
feature Reform::Form::MultiParameterAttributes
collection :songs do
feature Reform::Form::ActiveModel::FormBuilderMethods
property :title
property :release_date, :multi_params => true
validates :title, :presence => true
end
end
Note that the date will be nil
when one of the components (year/month/day) is missing.
By explicitely defining the form layout using ::property
there is no more need for protecting from unwanted input. strong_parameter
or attr_accessible
become obsolete. Reform will simply ignore undefined incoming parameters.
When nesting form, you usually use a so-called inline form doing property :song do .. end
.
Sometimes you want to specify an explicit form rather than using an inline form. Use the form:
option here.
property :song, form: SongForm
The nested SongForm
is a stand-alone form class you have to provide.
In case you want to change a value for presentation or provide a default value, override the reader. This is only considered when the form is rendered (e.g. in form_for
).
class SongForm < Reform::Form
property :genre
def genre
super || 'Punkrock'
end
end
This will now be used when rendering the view.
= f.input :genre # calls form.genre which provides default.
Every form tracks changes in #validate
and allows to check if a particular property value has changed using #changed?
.
form.title => "Button Up"
form.validate("title" => "Just Kiddin'")
form.changed?(:title) #=> true
When including Sync::SkipUnchanged
, the form won’t assign unchanged values anymore in #sync
.
A form object is just a twin. In validate
, a representer is used to deserialize the incoming hash and populate the form twin graph. This means, you can use any representer you like and process data like JSON or XML, too.
Representers can be inferred from the contract automatically using Disposable::Schema
. You may then extend your representer with hypermedia, etc. in order to render documents. Check out the Trailblazer book (chapter Hypermedia APIs) for a full explanation.
You can even write your own deserializer code in case you dislike Representable.
class AlbumForm < Reform::Form
# ..
def deserialize!(document)
hash = YAML.parse(document)
self.title = hash[:title]
self.artist = Artist.new if hash[:artist]
end
end
The decoupling of deserializer and form object is one of the main reasons I wrote Reform 2.
In #validate
, you can ignore properties now using :skip_if
for deserialization.
property :hit, skip_if: lambda { |fragment, *| fragment["title"].blank? }
This works for both properties and nested forms. The property will simply be ignored when deserializing, as if it had never been in the incoming hash/document.
For nested properties you can use :skip_if: :all_blank
as a macro to ignore a nested form if all values are blank.
Note that this still runs validations for the property, though.
Docs: http://trailblazer.to/gems/reform/prepopulator.html
You can also pass options to #prepopulate
.
Only do this for forms that are about to get rendered, though.
Collections and partial collection population is covered in chapter 5.
Docs: http://trailblazer.to/gems/reform/populator.html
When rendering a form you might need to access the options you provided to property
.
property :title, type: String
You can do this using #options_for
.
form.options_for(:title) # => {:readable=>true, :coercion_type=>String}
Note that Reform renames some options (e.g. :type
internally becomes :coercion_type
). Those names are private API and might be changed without deprecation. You better test rendering logic in a unit test to make sure you’re forward-compatible.
it’s like that: your form gets a minimal set of input, and then transforms that into an object graph. don’t add public properties just to satisfy AR, solve that in the form


System Architect Picture "Agent State Change"
Parent Diagram:
State Change Activity
(OMT Object Model)


Here is a selection of antique botanical prints held in our collection.
Helianthus
Passiflora
Nyctocalos
Polianthes
Ficus
Dendrobium


All of our stores are open from 6am to 8pm.
Locations:
825 Harrison St, Seattle, WA 98109
160-0021 Tokyo, Shinjuku City, Kabukicho
Hyatt Regency Dubai - 25th - Al Khaleej Rd - Dubai
Monnaie de Paris, 11 Quai de Conti, 75006 Paris, France
Esquina con, Calle San Martin 399, Miraflores 15074, Peru


We're using JavaScript to make a TV Series Idea Generator.
It will help you come up with great ideas for a TV series, like this:
A dance instructor and a rebellious teenager solve mysteries on a tropical island.
This activity is for people who've already done some basic HTML and CSS.
If you've never written HTML, please do our "make a page" activity instead.
Log in to Neocities.org. (If you don't have an account, create one. It's free.)
Make a new page:
Call it tvshow
Open a tab to edit the new page.
Open a tab to view the new page.
Delete all the default code
Copy and Paste this code instead:
<!DOCTYPE html>

<meta charset='utf-8'>
<title>TV Concept Generator</title>

TV concept generator

Click the button!

<button id="next-page-button">Next idea</button>

CHECK that you copied all the code. Save the page, then view it.
View the page. You'll see a blue page with a button.
Click on 'Next idea'. What happens? Try it lots of times.
Now you have your own copy of the TV show idea generator, and you can make changes to it.
In the code, find line number 44.
For now, we are only looking from line 44 to the end.
Can you see any connection between this code and what happens when you click 'Next idea'?
1. Add two new people ideas to the app.
2. Add two new job ideas to the app.
Clues:
This is the symbol for an empty list: []
This is the command to add something to a list: push
Remember, you only need to make changes from line 44 to the end.
I like shows that have two main characters.
Make it so when you click the button, it picks two people from the list.
You should include the words "and a" between the two people.
When it's working it should make ideas like this:
A school teacher and a time traveller who runs a hotel
A school teacher and a school teacher who solves mysteries
Clue:
Look for the word myConcept in 2 lines of code near the end. Take a close look at those two lines, and what happens when you click 'Next idea'.
We need to say what city the show is set in.
It should say in New York or in London at the end of each concept.
1. We will need a list of cities
2. We need to pick a random city, and display it somehow.
Clues:
¯\_(ツ)_/¯
Take a break from the JavaScript and improve the CSS.
Do you remember CSS from our HTML and CSS activity?
Use CSS to style each part of the app – the button, the h1, and the h2.
The CSS is near the top of the file. It probably starts on line 8.
Once your generator is looking cool, you're ready to show some people!


Anonymization Wizard
Restart
Source
Manage
Load From Local
Load From Zenodo
Anonymized
Manage
Hierarchy
Manage
Load from Local
Auto Generate
Algorithms
Solution Graph
Results
Anonymize Dataset
Save To Local
Save To Zenodo
Anonymized Dataset
Statistics - Queries