5.1 : The Hardware
HARDware more like CARDware
The CARDIAC is made completely out of cardboard. In fact, one might even say that the CARDIAC is made of cardstock, which is even cheaper than cardboard. The main idea is that there is no big fancy graphics card. There is no face recognition camera. The CARDIAC is a functional computer made out of cardboard, or cardstock if you want to get technical. A main thing to realize is that a computer doesn't always mean a desktop, or a laptop, or a smart phone. When I refer to hardware, I'm referring to what makes up this computer. What are the pieces we put together to make computer, specifically the CARDIAC. I'll give you a hint, it's not just cardboard (or cardstock either).
Organization
There are four major elements to the organization of a computer. We have the Input devices. There are output devices. There's the CPU, or the Central Processing Unit. Lastly, there's the memory. I'll explain each item and then how they each relate to the CARDIAC.
Input
When thinking of a typical desktop computer, what types of devices do we use to input to the computer. Of course there's the keyboard and the mouse. These are preprogrammed devices that automatically translate simple button presses into code that the computer understands. These can include storage devices like disks, tapes and USB flash drives.
In the CARDIAC, the input is a deck. The deck is a deck of cards full of commands and variables and numbers. Back before verbose programming languages, the way humans interacted with computers was very different. People couldn't just talk to a computer. Programmers punched holes in each card to specify a specific command. So for example a 400 line program would be a stack of 400 cards. Below you can see two punchcards. One is from Bell Labs, the people that created the CARDIAC. The other is a FORTRAN puch card from CERN, a European Center for Nuclear Research. As you can see, the punch cards have lines of numbers and letters. For each line of code or command you'd punch in each value and move onto the next card. From there you'd put your deck of cards into the computer and the code would run. The deck of the CARDIAC is a deck of numbers the user inputs. These numbers can be variables or commands or memory locations. The most important thing to recognize is that this deck is just all numbers.
Output
Output devices are plain and simple. It's a device that outputs something for a user. On your typical commercial desktop computer an output device is the moniter or a screen. An output device could also be a printer. On the CARDIAC let's also consider our output device to be a printer. There's no fancy colors or toner you have to buy. All the CARDIAC's "printer" does is print out numbers when it comes across the output operand. That's all it is. There's no fun history behind outputs. Life is full of disappointments.
Memory
Memory is where everything is stored in the computer.
Everything is stored as 1s and 0s.
It's an array of bytes. There are memory locations 0 through 2n-1.
So if n=8 I have 256 memory locations labelled 0-255.
In the case of the CARDIAC, we have 100 memory locations numbered 00-99.
The CARDIAC is a little different as 100 does not follow the power of two rule.
We'll choose to ignore this minor inconvenience.
A more pressing problem is the fact is the CARDIAC is cardstock not cardboard.
That's my own personal vendetta.
I used to work at a craft store.
A big thing to note about memory is how variables interact with memory.

Variables are NOT what is stored at that memory point.
Consider it like mailboxes or PO boxes.
There's lots of mailboxes each with their own number and address.
If my wonderful mother sends me a letter, it is put inside my mailbox.
When I go to retrieve my letter I go to my mailbox, and I get the letter from inside it.
I do NOT rip the mailbox from the ground.
I do NOT take my mailbox into my house.
My mailbox is not the letter.
My mailbox is where the letter from my wonderful mother is.
The contents of my mailbox can change.
Let's say my beautiful boyfriend sends me a equally beautiful letter.
Once again this is put in my mailbox.
The letter from my mother is no longer inside the mailbox.
Now the letter from my boyfriend is in my mailbox.
My mailbox is not tied to a specific letter or package.
It is free to contain whatever.
Now let's look at variables from a mathmatical standpoint.
Variables in math typically hold numbers.
Look at the following problem.
It's a very simple algebra just to understand how variables work.
It is important to know that math is a big part of computer science.
x = 5
x + 2 = y
y = 7
x + y = 12
So above, x is "equal to" 5.
I use the words equal to in quotes.
Remember, x is not 5, x is where 5 is stored.
On a TI-84 calculator, there's a way to make programs.
It uses the language TI-BASIC.
In TI-BASIC, the way to assign a variable a value, you use the STORE function.
It's much easier to remember that variables do not equal it's value this way.
So anyway, as you can see, when we add x and y, we do not add the letters and create some mutant xy letter.
We refer back to 5 and we refer back to 7 and then we get the answer of 12.
It's also important to differentiate between the fact that x + y is equal to 12.
12 is NOT stored in x + y.
There is a very big difference between equating two objects and storing a variable.
In many programming languages, storing a variable uses the = operator and comparing and equating two
values uses the == operator.
This is a very common error when programming.
TL;DR Variables are not equal to a variable, they are the alias to where the variable is stored.
CPU
CPU stand for Central Processing Unit. On the CARDIAC there are a few major components
- ALU: Arithmetic Logic Unit
- Registers
- GPR: General Purpose Register or Accumulator
- IR: Instruction Register
- PC: Program Counter or Intruction Pointer
- ID: Instruction Decoder
Depending on different instructions in the CARDIAC, different processes will happen. However, there is a general idea that the CARDIAC goes through when it runs programs. The general process goes as follows:
- The
Data From Memory is sent to theProgram Counter and theInstruction Register - The
PC keeps everything on track. It keeps the flow of the program and makes sure that we are in the right place at the right time. - After each iteration the
PC increments. - The
IR has a list of instructions within it. It actually tells the computer what to do. TheIR translates what we coded into something the computer can understand. - The
ID decodes theIR 's instructions. It decodes the instructions into the controls for theALU - The
ALU is the sameALU as in the last tutorial that adds and subtracts binary - The
GPR is also called the accumulator. This is like a memory point where addition and subtraction occur. - The
ALU and theGPR use the controls and instructions to do what they're supposed to. - Finally the output is written to the
Memory
Punch Card Image credit: Douglas W. Jones's collection of punched cards with logos


Timer fixture is intended to be used as library.
All times reported are in milliseconds, resume can only be done after pause. After stopping a timer it is no longer available.
We can start and use a timer without a name.
| script | timer fixture | |
| start timer | ||
| wait | 5 | milliseconds |
| check | time on timer | 5>= 5 |
| $elapsed<-[5] | time on timer | |
| wait | 1 | milliseconds |
| check | stop timer | 7>$elapsed->[5] |
We can start and use a timer with a name.
| script | timer fixture | ||
| start timer | test | ||
| wait | 1 | seconds | |
| check | time on timer | test | 1001>= 1000 |
| $elapsed<-[1001] | time on timer | test | |
| check | stop timer | test | 1001>=$elapsed->[1001] |
| start timer | test2 |
We can use a timer with a name started in another script table.
| script | timer fixture | ||
| wait | 1 | milliseconds | |
| check | time on timer | test2 | 2> 0 |
| $elapsed<-[2] | time on timer | test2 | |
| check | stop timer | test2 | 2>=$elapsed->[2] |
We pause and resume timers
| script | timer fixture | ||
| start timer | to Pause | ||
| wait | 1 | milliseconds | |
| check | pause timer | to Pause | 1>=1 |
| $paused<-[1] | time on timer | to Pause | |
| wait | 1 | milliseconds | |
| check | time on timer | to Pause | $paused->[1] |
| resume timer | to Pause | ||
| wait | 1 | milliseconds | |
| check | time on timer | to Pause | 2>$paused->[1] |
We can get information on all timers.
| script | timer fixture | |||||||||
| start timer | ||||||||||
| start timer | test 8 | |||||||||
| start timer | test 9 | |||||||||
| show | all timer times |
| ||||||||
| show | stop all timers |
|
We can get the current system time, possibly specifying a format (the format is the format string used by Java's SimpleDateFormat, also used by '!today') to use.
The difference between these methods and !today is that the latter is evaluated when the test is started, these methods return the time at the moment the test executes them.
| script | timer fixture | ||||
| show | current system time | 08:30:29.014 | |||
| show | current system time as | HH:MM:ss.SSS | 08:05:29.014 | ||
| show | current system time as | E dd-MMM-yy HH:mm:ss.SSS | Mon 13-May-19 08:30:29.014 | ||
| show | current system time as | E dd-MMM-yy HH:mm:ss.SSS | in | ja-JP-x-lvariant-JP | 月 13-5-31 08:30:29.016 |


Police appeal to public for help in search for missing Aberdeen man
The 53-year-old was last seen on Long Walk place at around 3.30pm on Sunday 3 November
by Tim McNultyPolice have appealed for information this afternoon in the search for missing Aberdeen man Darren Sadler.
The 53-year-old was last seen on Long Walk Place at around 3.30pm on Sunday afternoon.
Darren is believed to have driven away from Long Walk Place in a navy blue Audi A6 , registration E2 DBS.
He is described as 6ft 4in tall with short grey/white hair and was wearing a t-shirt, grey trousers and black Sketcher trainers.
Sergeant Michael Stobie, of Mastrick community policing team, said: "Darren has never gone missing before so his disappearance is out of character for him.
"We have been carrying out enquiries however we're now appealing for the public's help to trace him.
"Similarly if Darren reads our appeal, please contact us or your family to let people know you are okay."
If anyone has seen Darren, his car or has any information about his disappearance, please call 101 quoting incident number 3399 of 3 November 2019.


Enumerations | |
| enum | BXLogLevel { kBXLogLevelOff = 0, kBXLogLevelFatal, kBXLogLevelError, kBXLogLevelWarning, kBXLogLevelInfo, kBXLogLevelDebug } |
Functions | |
| BX_EXPORT void | BXAssertionDebug () BX_ANALYZER_NORETURN |
| BX_EXPORT void | BXDeprecationWarning () |
| BX_EXPORT void | BXLogSetAbortsOnAssertionFailure (BOOL) |
| BX_EXPORT void | BXLogSetLevel (enum BXLogLevel level) |
Logging and assertion functions used by BaseTen.
| enum BXLogLevel |
| BX_EXPORT void BXAssertionDebug | ( | ) |
A debugging helper.
This function provides a convenient breakpoint. It will be called when an assertion fails. The reason might be a bug in either BaseTen or in user code.
| BX_EXPORT void BXDeprecationWarning | ( | ) |
A debugging helper.
This function provides a convenient breakpoint. It will be called when deprecated functionality is invoked, presently when relationships with deprecated names are used.
| BX_EXPORT void BXLogSetAbortsOnAssertionFailure | ( | BOOL | ) |
Set whether the logger should call abort() on assertion failure.
| BX_EXPORT void BXLogSetLevel | ( | enum BXLogLevel | level | ) |
Set the logging level.


--- layout: post status: publish published: true title: World Series Game 3 Post-Game - Episode 8.72 author: display_name: Corey Fineran login: Corey email<EMAIL_ADDRESS>url: '' author_login: Corey author_email<EMAIL_ADDRESS>wordpress_id: 12184 wordpress_url: http://ivyenvy.com/?p=12184 date: '2016-10-29 00:35:30 +0000' date_gmt: '2016-10-29 05:35:30 +0000' categories: - Podcast tags: [] comments: [] ---
Well, the Cubs dropped Game 3 of the 2016 World Series. It was the first World Series game at Wrigley in 71 years and although the wind was whipping out, Cleveland was able to beat the Cubs, 1-0.
On this episode, we share our thoughts on the game. We also play listener voicemail that we've received over the last few days.


Keys This is an example reference-style link. This is key-a reference-style link. This is Markdown reference-style link. This is Markdown reference-style link. This is an example reference-style link. This is reference-style link.


List of all members.
Public Member Functions |
|
| GConf () |
| | constructor
|
|
virtual | ~GConf () |
| | destructor
|
| bool | convert (const std::string &enc, ConvertableList::iterator begin, ConvertableList::iterator end) const |
| | convert lyrics to phonemes
|
| virtual std::string | getSilStr () const |
| | get sil str
|
| bool | read (const std::string &lexicon, const std::string &phones, const std::string &mapfilen) |
| | read lexicon, vowels and German-Japanese mapping. Filenames are defined in GConf.h
|
| void | removechar (std::string *word, char rchar) |
| | remove char from string
|
|
void | erasechar (std::string *word, char rchar) |
| | remove char from string
|
Member Function Documentation
| bool GConf::convert |
( |
const std::string & |
enc, |
|
|
ConvertableList::iterator |
begin, |
|
|
ConvertableList::iterator |
end |
|
) |
| const [virtual] |
convert lyrics to phonemes
- Parameters:
-
| enc | encoding |
| begin | begin of vector of IConvertable elements that have to be converted to German |
| end | end of the vector |
- Returns:
- true if success
Implements sinsy::IConf.
| bool GConf::read |
( |
const std::string & |
lexiconn, |
|
|
const std::string & |
vowelsn, |
|
|
const std::string & |
mapfilen |
|
) |
| |
read lexicon, vowels and German-Japanese mapping. Filenames are defined in GConf.h
- Parameters:
-
| lexiconn | name of lexicon file |
| vowelsn | name of vowels file |
| mapfilen | mapping between German and Japanese vowels |
- Returns:
- true if success
remove char from string
- Parameters:
-
| word | string to remove from |
| rchar | char to remvoe |
The documentation for this class was generated from the following files:
- lib/german/GConf.h
- lib/german/GConf.cpp


Jane Street
Based outside Philadelphia, PA, USA
rae at richarde.dev
Twitter: @RaeHaskell
GitHub: @goldfirere
(a.k.a. rae or goldfire or goldfirere on some sites)
I am a language designer and compiler engineer at Jane Street, where I work on improvements to the OCaml functional programming language. In addition, Jane Street supports my work on Haskell and its primary compiler, GHC. In both languages, my goal is to make these statically typed functional programming languages an excellent first choice of language for the implementation of enterprise systems.
My background is in functional programming and type systems research. My research aim is to reduce the occurrence of bugs in computer code through enhanced static checks. I am interested in type systems and how they can help a programmer to avoid logical fallacies and erroneous programs. In particular, I believe that clever use of dependent types can encourage a programmer to write only correct code. A long-term goal of mine is to bring dependent types to a wider audience, both into industry and into education. On a more basic level, I also love the formalisms and proofs involved in programming language research!
I completed my doctorate in 2016 at the University of Pennsylvania; my thesis advisor was Stephanie Weirich.
This source for this web site is public. Suggestions and improvements are welcome.


|
Scheduler
|
#include <priorityDiscipline.h>
Public Types | |
| typedef bool(* | ComparatorPointer) (std::shared_ptr< Process >, std::shared_ptr< Process >) |
Public Member Functions | |
| PriorityDiscipline (std::shared_ptr< SchedulerConfiguration > c) | |
| virtual | ~PriorityDiscipline () |
| std::shared_ptr< Process > | selectNextTask (Queue *readyQueue, std::shared_ptr< Process > running, unsigned int) |
| select the best task to run at this point. More... | |
| virtual bool | preempts (TriggeringEvent trigger) |
| returns true if the argument is a scheduling trigger for this specific discipline More... | |
| virtual std::string | getName ()=0 |
| returns the name of that discipline More... | |
| Public Member Functions inherited from Scheduler::SchedulingDiscipline | |
| virtual | ~SchedulingDiscipline () |
| SchedulingDiscipline (std::shared_ptr< SchedulerConfiguration > c) | |
| virtual void | end () |
Protected Member Functions | |
| virtual void | updatePriorities (Queue *readyQueue, std::shared_ptr< Process > running) |
| sets the correct priorities to the tasks, especially if dynamic priorities are used. More... | |
| virtual ComparatorPointer | getComparator () |
| return a function pointer to a function that provides comparison of tasks' priorities More... | |
Additional Inherited Members | |
| Protected Attributes inherited from Scheduler::SchedulingDiscipline | |
| std::shared_ptr< SchedulerConfiguration > | conf {nullptr} |
Definition at line 19 of file priorityDiscipline.h.
| typedef bool(* Scheduler::PriorityDiscipline::ComparatorPointer) (std::shared_ptr< Process >, std::shared_ptr< Process >) |
Definition at line 25 of file priorityDiscipline.h.
|
inline |
Definition at line 22 of file priorityDiscipline.h.
|
inlinevirtual |
Definition at line 23 of file priorityDiscipline.h.
|
protectedvirtual |
return a function pointer to a function that provides comparison of tasks' priorities
Reimplemented in Scheduler::RmsDiscipline, and Scheduler::EdfDiscipline.
Definition at line 62 of file priorityDiscipline.cpp.
|
pure virtual |
returns the name of that discipline
Implements Scheduler::SchedulingDiscipline.
Implemented in Scheduler::RmsDiscipline, Scheduler::EdfDiscipline, and Scheduler::FixedPriorityDiscipline.
|
virtual |
returns true if the argument is a scheduling trigger for this specific discipline
| trigger | the type of the event that triggered the scheduling invokation |
Implements Scheduler::SchedulingDiscipline.
Definition at line 40 of file priorityDiscipline.cpp.
|
virtual |
select the best task to run at this point.
| readyQueue | the ready queue |
| running | the currently running task |
| deadlineMisses |
Implements Scheduler::SchedulingDiscipline.
Definition at line 21 of file priorityDiscipline.cpp.
|
protectedvirtual |
sets the correct priorities to the tasks, especially if dynamic priorities are used.
Reimplemented in Scheduler::FixedPriorityDiscipline.
Definition at line 46 of file priorityDiscipline.cpp.


Tile5 is currently structured to provide general layered drawing and tiling support in the core, while mapping and GIS functionality is implemented in the Tile5 Geo extension. In time, it is expected that additionally extensions will be created (such as a 2d tiling game extension).
At the core of Tile5 we have the central building blocks of a T5.View and a T5.ViewLayer and these two classes handle most of the generic work for displaying a layered visual interface. These are discussed in more detail in Tile5 Views.
As Tile5 is primarily built to support the creation of tiling interfaces, the T5.Tiler class and T5.TileGrid also play a critical role. While it is possible to use Tile5 to build non-tiling interfaces and abstract directly from a T5.View there are other HTML5 canvas related libraries that also provide this functionality and in some cases these may be better suited to your needs. The section on Tile5 Tiling provides more information on tiling.


University of California San Diego La Jolla, CA
Bachelors of Science: Computer Science
Business Minor
September 2012 -- June 2016
Lund Universitet Lund, Sweden
Semester Study Abroad
July 2015 -- January 2016


Stop the Pity
Unlock the potential
The project came to us by way of ReAllocate and we jumped at the chance to fulfill a giveback opportunity. The site was nearing completion when it was handed off, but needed a strong team to close it out and give it some needed mobile optimization love.
Stop the Pity refers to themselves as a movement that tells a new story about poverty. A story about potential — the potential that every person has, regardless of circumstance, to create an amazing life for themselves and their community. Is that powerful or what?
You were able to build an entire website with acute professionalism. Your generous contribution will help to further the important work of our organization by opening up our brand to millions of new supporters.
This past weekend the project was showcased as an official partner of the Life is Beautiful Festival along side some large organizations like Charity Water. It took a strong push to get it completed for the festival, but we worked it out. We hope the resulting site will help Stop The Pity spread word of the great work it is doing and encourage many more to support and join the movement.
It shouldn’t go without mention the other do gooders who partnered to bring the project together: Mama Hope, ReAllocate, Hope Phones, Architecture for Humanity, Journey of Action, RYOT, CTC International, and The Adventure Project.


Squares on the map that have no color indicate that we don't have any data for that area. This is different than areas for which we know that no crimes have occurred -- these areas are rendered in blue.
All reported crimes from January 1 2014 - January 1 2015.
This is most likely because CrimeDB doesn't know how to collect data from your local police department. Send mail to<EMAIL_ADDRESS>or tweet at @pgriess to tell me what's missing and I'll try to get it added.
Our data is automatically compiled from police jurisdictions from around the country. It is made available to anyone for use using the CrimeDB API.
Get in touch with me and we'll figure something out. There are a ton of things that I could use help with, including both technical and non-technical work.
Send mail to<EMAIL_ADDRESS>or tweet at @pgriess.


freeCodeCamp
Survey Form
Thank you for taking the time to help us improve the platform
Name:
Email:
Age:
What is your favorite feature of freeCodeCamp?
Select an option
Challenges
Projects
Community
Open source
Would you recommend freeCodeCamp to a friend?
Definitely
Maybe
Not sure
What would you like to see improved?
Front-end Projects
Back-end Projects
Data Visualization
Challenges
Open Source Community
Gitter help rooms
Videos
City Meetups
Wiki
Forum
Additional Courses
Any comments or suggestions?
Enter your comment here ...
Submit


| Sparallax | link to this page • new search |
|
faceted browsing interface for SPARQL endpoints,based on Freebase Parallax —
send comments to Giovanni Tummarello &bullNishant Jain ; •
get source code
|
debug: activate |


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ws.jaxme.xs.types.AbstractBuiltinType org.apache.ws.jaxme.xs.types.XSAnyType
public class XSAnyType
The "anyType" is a type with arbitrary content.
| Method Summary | |
|---|---|
XSAttributable[] |
getAttributes()
Returns the complex types attributes. |
XsComplexContentType |
getComplexContentType()
If the element hasn't simple content: Returns the element contents type. |
XSComplexType |
getComplexType()
Returns the complex types information. |
XSType |
getExtendedType()
If the element is an extension: Returns the extended type. |
static XSAnyType |
getInstance()
|
XsQName |
getName()
If the type is global: Returns the types name. |
XSObject |
getParentObject()
Returns either of the following: If the object is the schema itself, returns null. |
XSParticle |
getParticle()
If the element hasn't simple content: Returns the complex elements particle. |
XSType |
getRestrictedType()
If the element is an restriction: Returns the restricted type. |
XSSimpleContentType |
getSimpleContent()
If the complex type has simple content, returns the contents type. |
XSSimpleType |
getSimpleType()
Returns the simple types information. |
boolean |
hasSimpleContent()
Returns whether the complex type has simple content. |
boolean |
isBuiltin()
Returns whether the type is a builtin type of XML Schema. |
boolean |
isElementOnly()
If the element hasn't simple content: Returns whether the elements content is elementOnly. |
boolean |
isEmpty()
If the element hasn't simple content: Returns whether the elements content is empty. |
boolean |
isExtension()
Returns whether the element is a extension of another element. |
boolean |
isMixed()
If the element hasn't simple content: Returns whether the elements content is mixed. |
boolean |
isRestriction()
Returns whether the element is a restriction of another element. |
boolean |
isSimple()
Returns whether the type is simple or not. |
boolean |
isTopLevelObject()
Returns whether the object is a top-level object. |
| Methods inherited from class org.apache.ws.jaxme.xs.types.AbstractBuiltinType |
|---|
getAnnotations, getLocator, getOpenAttributes, getSchemaHeader, getXSSchema, isGlobal, setGlobal, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final XSAnyType getInstance()
public boolean isSimple()
XSType
Returns whether the type is simple or not.
isSimple
in interface XSType
public XSSimpleType getSimpleType() throws org.xml.sax.SAXException
XSType
Returns the simple types information.
getSimpleType
in interface XSType
org.xml.sax.SAXException
public XSComplexType getComplexType() throws org.xml.sax.SAXException
XSType
Returns the complex types information.
getComplexType
in interface XSType
org.xml.sax.SAXException
public XsQName getName()
XSType
If the type is global: Returns the types name. Otherwise returns null.
getName
in interface XSType
public boolean isTopLevelObject()
XSObject
Returns whether the object is a top-level object. This is the case for the XsESchema itself and for all its childs only.
isTopLevelObject
in interface XSObject
public XSObject getParentObject()
XSObject
Returns either of the following:
getParentObject
in interface XSObject
public boolean hasSimpleContent()
XSComplexType
Returns whether the complex type has simple content. If so,
you may use the method XSComplexType.getSimpleContent()
to fetch the
simple contents type. If not, you may use
XSComplexType.getComplexContentType()
, XSComplexType.isEmpty()
,
XSComplexType.isElementOnly()
, XSComplexType.isMixed()
, and
XSComplexType.getParticle()
. The method XSComplexType.getAttributes()
is always valid.
hasSimpleContent
in interface XSComplexType
public boolean isEmpty()
XSComplexType
If the element hasn't simple content: Returns whether the
elements content is empty. Shortcut for
getComplexContentType().equals(EMPTY)
.
isEmpty
in interface XSComplexType
XsComplexContentType.EMPTY
public boolean isElementOnly()
XSComplexType
If the element hasn't simple content: Returns whether the
elements content is elementOnly. Shortcut for
getComplexContentType().equals(ELEMENT_ONLY)
.
isElementOnly
in interface XSComplexType
XsComplexContentType.ELEMENT_ONLY
public boolean isMixed()
XSComplexType
If the element hasn't simple content: Returns whether the
elements content is mixed. Shortcut for
getComplexContentType().equals(MIXED)
.
isMixed
in interface XSComplexType
XsComplexContentType.MIXED
public XSParticle getParticle()
XSComplexType
If the element hasn't simple content: Returns the complex elements particle.
getParticle
in interface XSComplexType
public XSAttributable[] getAttributes()
XSComplexType
Returns the complex types attributes.
getAttributes
in interface XSComplexType
public boolean isExtension()
XSComplexType
Returns whether the element is a extension of another element.
isExtension
in interface XSComplexType
public XSType getExtendedType()
XSComplexType
If the element is an extension: Returns the extended type.
getExtendedType
in interface XSComplexType
public boolean isRestriction()
XSComplexType
Returns whether the element is a restriction of another element.
isRestriction
in interface XSComplexType
public XSType getRestrictedType()
XSComplexType
If the element is an restriction: Returns the restricted type.
getRestrictedType
in interface XSComplexType
public XsComplexContentType getComplexContentType()
XSComplexType
If the element hasn't simple content: Returns the element contents type.
getComplexContentType
in interface XSComplexType
XsComplexContentType.EMPTY
,
XsComplexContentType.ELEMENT_ONLY
,
XsComplexContentType.MIXED
,
XSComplexType.isEmpty()
,
XSComplexType.isElementOnly()
,
XSComplexType.isMixed()
public XSSimpleContentType getSimpleContent()
XSComplexType
If the complex type has simple content, returns the contents type. This is, of course, a simple type.
getSimpleContent
in interface XSComplexType
public boolean isBuiltin()
XSType
Returns whether the type is a builtin type of XML Schema.
isBuiltin
in interface XSType
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Yake is an Unsupervised, Corpus-Independent, Domain and Language-Independent and Single-Document keyword extraction algorithm.
Yake is an Unsupervised, Corpus-Independent, Domain and Language-Independent and Single-Document keyword extraction algorithm.
Extracting keywords from texts has become a challenge for individuals and organizations as the information grows in complexity and size. The need to automate this task so that text can be processed in a timely and adequate manner has led to the emergence of automatic keyword extraction tools. Yake is a novel feature-based system for multi-lingual keyword extraction, which supports texts of different sizes, domain or languages. Unlike other approaches, Yake does not rely on dictionaries nor thesauri, neither is trained against any corpora. Instead, it follows an unsupervised approach which builds upon features extracted from the text, making it thus applicable to documents written in different languages without the need for further knowledge. This can be beneficial for a large number of tasks and a plethora of situations where access to training corpora is either limited or restricted.
The algorithm makes use of the position of a sentence and token. Therefore, to use the annotator, the text should be first sent through a Sentence Boundary Detector and then a tokenizer.
You can tweak the following parameters to get the best result from the annotator.
setMinNGrams(int) Select the minimum length of a extracted keyword
setMaxNGrams(int) Select the maximum length of a extracted keyword
setNKeywords(int) Extract the top N keywords
setStopWords(list) Set the list of stop words
setThreshold(float) Each keyword will be given a keyword score greater than 0. (Lower the score better the keyword) Set an upper bound for the keyword score from this method.
setWindowSize(int) Yake will construct a co-occurence matrix. You can set the window size for the cooccurence matrix construction from this method. ex: windowSize=2 will look at two words to both left and right of a candidate word.
Paper abstract
As the amount of generated information grows, reading and summarizing texts of large collections turns into a challenging task. Many documents do not come with descriptive terms,
thus requiring humans to generate keywords on-the-fly. The need to automate this kind of task demands the development of keyword extraction systems with the ability to automatically
identify keywords within the text. One approach is to resort to machine-learning algorithms. These, however, depend on large annotated text corpora, which are not always available.
An alternative solution is to consider an unsupervised approach. In this article, we describe YAKE!, a light-weight unsupervised automatic keyword extraction method which rests on
statistical text features extracted from single documents to select the most relevant keywords of a text. Our system does not need to be trained on a particular set of documents,
nor does it depend on dictionaries, external corpora, text size, language, or domain. To demonstrate the merits and significance of YAKE!, we compare it against ten state-of-the-art
unsupervised approaches and one supervised method. Experimental results carried out on top of twenty datasets show that YAKE! significantly outperforms other unsupervised methods on
texts of different sizes, languages, and domains.
Yake is an Unsupervised, Corpus-Independent, Domain and Language-Independent and Single-Document keyword extraction algorithm. Extracting keywords from texts has become a challenge for individuals and organizations as the information grows in complexity and size. The need to automate this task so that text can be processed in a timely and adequate manner has led to the emergence of automatic keyword extraction tools. Yake is a novel feature-based system for multi-lingual keyword extraction, which supports texts of different sizes, domain or languages. Unlike other approaches, Yake does not rely on dictionaries nor thesauri, neither is trained against any corpora. Instead, it follows an unsupervised approach which builds upon features extracted from the text, making it thus applicable to documents written in different languages without the need for further knowledge. This can be beneficial for a large number of tasks and a plethora of situations where access to training corpora is either limited or restricted. The algorithm makes use of the position of a sentence and token. Therefore, to use the annotator, the text should be first sent through a Sentence Boundary Detector and then a tokenizer. You can tweak the following parameters to get the best result from the annotator.
setMinNGrams(int) Select the minimum length of a extracted keyword setMaxNGrams(int) Select the maximum length of a extracted keyword setNKeywords(int) Extract the top N keywords setStopWords(list) Set the list of stop words setThreshold(float) Each keyword will be given a keyword score greater than 0. (Lower the score better the keyword) Set an upper bound for the keyword score from this method. setWindowSize(int) Yake will construct a co-occurence matrix. You can set the window size for the cooccurence matrix construction from this method. ex: windowSize=2 will look at two words to both left and right of a candidate word.
See Campos, R., Mangaravite, V., Pasquali, A., Jatowt, A., Jorge, A., Nunes, C. and Jatowt, A. (2020). YAKE! Keyword Extraction from Single Documents using Multiple Local Features. In Information Sciences Journal. Elsevier, Vol 509, pp 257-289. https://github.com/JohnSnowLabs/spark-nlp/blob/master/src/test/scala/com/johnsnowlabs/nlp/annotators/keyword/yake/YakeTestSpec.scala for further reference on how to use this API. Sources:
Sources :
https://www.sciencedirect.com/science/article/pii/S0020025519308588
Paper abstract As the amount of generated information grows, reading and summarizing texts of large collections turns into a challenging task. Many documents do not come with descriptive terms, thus requiring humans to generate keywords on-the-fly. The need to automate this kind of task demands the development of keyword extraction systems with the ability to automatically identify keywords within the text. One approach is to resort to machine-learning algorithms. These, however, depend on large annotated text corpora, which are not always available. An alternative solution is to consider an unsupervised approach. In this article, we describe YAKE!, a light-weight unsupervised automatic keyword extraction method which rests on statistical text features extracted from single documents to select the most relevant keywords of a text. Our system does not need to be trained on a particular set of documents, nor does it depend on dictionaries, external corpora, text size, language, or domain. To demonstrate the merits and significance of YAKE!, we compare it against ten state-of-the-art unsupervised approaches and one supervised method. Experimental results carried out on top of twenty datasets show that YAKE! significantly outperforms other unsupervised methods on texts of different sizes, languages, and domains.


Click the buttons below to showcase some fantabulous gifs featuring your favorite TV shows.
Don't see a gif you like? Add one yourself!


Note
Click here to download the full example code
SkopeRules example¶
An example using SkopeRules for imbalanced classification.
SkopeRules find logical rules with high precision and fuse them. Finding good rules is done by fitting classification and regression trees to sub-samples. A fitted tree defines a set of rules (each tree node defines a rule); rules are then tested out of the bag, and the ones with higher precision are selected and merged. This produces a real-valued decision function, reflecting for each new sample how many rules (each weighted by respective precision) have found it abnormal.
import numpy as np
import matplotlib.pyplot as plt
from skrules import SkopeRules
print(__doc__)
rng = np.random.RandomState(42)
n_inliers = 1000
n_outliers = 50
# Generate train data
I = 0.5 * rng.randn(int(n_inliers / 2), 2)
X_inliers = np.r_[I + 2, I - 2]
O = 0.5 * rng.randn(n_outliers, 2)
X_outliers = O # np.r_[O, O + [2, -2]]
X_train = np.r_[X_inliers, X_outliers]
y_train = [0] * n_inliers + [1] * n_outliers
Training the SkopeRules classifier¶
# fit the model
clf = SkopeRules(random_state=rng, n_estimators=10)
clf.fit(X_train, y_train)
# plot the line, the samples, and the nearest vectors to the plane
xx, yy = np.meshgrid(np.linspace(-5, 5, 50), np.linspace(-5, 5, 50))
Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
plt.title("Skope Rules, value of the decision_function method")
plt.contourf(xx, yy, Z, cmap=plt.cm.Blues)
a = plt.scatter(X_inliers[:, 0], X_inliers[:, 1], c='white',
s=20, edgecolor='k')
b = plt.scatter(X_outliers[:, 0], X_outliers[:, 1], c='red',
s=20, edgecolor='k')
plt.axis('tight')
plt.xlim((-5, 5))
plt.ylim((-5, 5))
plt.legend([a, b],
["inliers", "outliers"],
loc="upper left")
plt.show()
Extracting top rules¶
On the 4 following figures, the predict_top_rules method is used with several values of n_rules. n_rules = 2 means that the prediction is done using only the 2 best rules.
print('The 4 most precise rules are the following:')
for rule in clf.rules_[:4]:
print(rule[0])
fig, axes = plt.subplots(2, 2, figsize=(12, 5),
sharex=True, sharey=True)
for i_ax, ax in enumerate(np.ravel(axes)):
Z = clf.predict_top_rules(np.c_[xx.ravel(), yy.ravel()], i_ax+1)
Z = Z.reshape(xx.shape)
ax.set_title("Prediction with predict_top_rules, n_rules="+str(i_ax+1))
ax.contourf(xx, yy, Z, cmap=plt.cm.Blues)
a = ax.scatter(X_inliers[:, 0], X_inliers[:, 1], c='white',
s=20, edgecolor='k')
b = ax.scatter(X_outliers[:, 0], X_outliers[:, 1], c='red',
s=20, edgecolor='k')
ax.axis('tight')
plt.xlim((-5, 5))
plt.ylim((-5, 5))
plt.legend([a, b],
["inliers", "outliers"],
loc="upper left")
plt.show()
Out:
The 4 most precise rules are the following:
__C__0 <= 1.0391224026679993 and __C__0 > -0.6836492121219635 and __C__1 <= 1.279470682144165
__C__0 <= 1.0391224026679993 and __C__0 > -0.6803303956985474 and __C__1 <= 1.2835460305213928
__C__0 > -0.8104808330535889 and __C__1 <= 0.7875268459320068 and __C__1 > -1.4322419166564941
__C__0 <= 1.156811773777008 and __C__0 > -0.6803303956985474 and __C__1 <= 1.0843470692634583
Total running time of the script: ( 0 minutes 0.870 seconds)


{% extends "base.html" %} {% block page_title %}{{ _('You’ve reached the end of this service') }} - {{ super() }}{% endblock %} {% block inner_content %}
{{ _('For your security, the information you’ve entered has automatically been deleted.') }}
{{ _('You can start again below.') }}
{% endblock %}


Ready for more U.S. prisoner swaps: Iran
by ReutersIran’s Foreign Minister Mohammad Javad Zarif said on Monday the Islamic republic is ready for a full prisoner exchange with the U.S..
“The ball is in the U.S.’ court”, he said in a tweet.
The United States and Iran on Saturday swapped prisoners — American graduate student Xiyue Wang, detained for three years on spying charges, and imprisoned Iranian stem-cell researcher Massoud Soleimani, accused of sanction violations — in a rare act of cooperation between two longtime foes.


Destiny C++ | Overview | Reference
Class and Object Design | Sorting | R_D
| rsl2D | Martin's Questions
Class and Object Design
all updated Dec 15, 1998
- Object Basics
- Composites
- DO_Acct example
- composition
- R_D: working with RSL
- DR_Acct
- Method invocation
- Collections - updated 24 Sept (new enumeration example)
- overview
- insertion
- deletion
- enumeration
- sorting
- creating new collection classes
- Streaming
All instance variables and objects in a design should be represented by DO_Object classes, classified either as DO_Atom, DO_Collection, or DO_Composite as is most appropriate. However, they are used by their companion DRef classes, or by DRef itself. This allows data to be efficiently manipulated both in C++ and in RSL without data copying, and it allows very complex object relationships to be available both in RSL and C++.
Basic DR_Object - DO_Object Relationship
The DRef class contains a pointer to a D; but usually, this is too high level. Primarily we are concerned with the two subclasses DR_Object and DO_Object; as strongly-typed smart pointers, is the job of every DRef (or DR_Object) subclass to safely manage this pointer. It must provide
operator->()
safe_get()
- safe_set()
- New()
- and any operator methods, as necessary, since they can't conveniently be called through
operator->()
.The basic relationship between a DRef and a DO_Object is quite simple, and looks like this:
A Composite Example: DO_Acct
Composite objects (those composed of other objects) inherit from the class DO_Composite, and are essentially as simple as this example account class with two instance variables, Name and Num:
the class
an instance
class DO_Acct : public DO_Composite { DR_String Name, Num; init() { Name.New(); Num.New(); } // ... };It is important to keep these kinds of pictures in mind when thinking about DRef and DO_Object relationships. The semantics of object copying, equality, assignment can be complex at times. For example, there is a clear difference between copying a DRef and copying a DO_Object! These issues are discussed in depth elsewhere.
Comments and observations
- Why doesn't DO_Acct declare DO_String objects, instead of the DR_String as here? Two reasons, primarily. DO_Object classes are always managed by DRef objects so that they can be shared between C++ and RSL, so they can be effectively recycled, and so they can efficiently be copied.
- The
init()
method above is analogous to a C++ constructor. The D system has memory management; DO_Objects are reclaimed and recycled when no longer referenced any more. There are free lists of DO_Objects that are not in use, and conseqently, they are not actually destroyed.- A DRef, like the DR_String declarations in the class DO_Acct above, are initially "null". Like the declaration of a C pointer, they point to nothing. Unlike the declaration of a C pointer, they are initialized to the object
DNULL
; the C++ expressionif (Name == DNULL)
will initially yieldtrue
.- To be most useful, the DO_Acct needs a DRef class -- DR_Acct. We'll implement it in a moment. First, more details.
Abstract Composition
Now, one of the reasons for the existence of this system is so the objects may be efficiently shared with RSL in Foundation. RSL needs to do things like ask an object for an instance variable by name. RSL needs, also, to iterate over the instance variables of such objects, regardless of their class, for efficient object streaming, equality, assignment, etc. For this purpose, the superclass DO_Composite implements an instance variable lookup table, so that the picture expands to be this:
the class
an instance
class DO_Acct : public DO_Composite { DR_String Name, Num; void init() { add("Name", Name.New()); add("Num", Num.New()); } // ... };By doing this, anyone can ask for the object "Name" and get DRef to the DO_String. Anyone, including RSL. This is exactly how RSL and C++ will share information efficiently.
- It's not clear whether this collection is necessary in all cases, since clearly it can be constructed as necessary.
Working with RSL: R_D
The Foundation 2.5 Resource R_D is introduced to solve the problem in the Resource/RSL side of things. It contains a DRef, also, and it is a mighty morphin' power Resource, which takes on the characteristics of the particular DO_Object it points to. For example, in the picture below, the DO_Acct object is available in RSL, and by asking it for "Name", one can use this DO_String in both C++ and RSL:The coloring in this diagram of the R_D instances reflects the fact that the "character" of an R_D instance changes according to the specific kind of DO_Object they point to. R_D1, for example, takes on the appearance of being an "account" from RSL's perspective.
DR_Acct
Now, as we have seen, to be most useful DO_Objects need companion DRef objects. Let's see what these actually look like by implementing the DR_Acct class, and we'll add more details to the DO_Acct as well.
class
instance
class DR_Acct : public DR_Object { DR_Acct(const DRef& ref); DO_Object *operator->(); }; class DO_Acct : public DO_Composite { DR_String Name, Num; void init() { add("Name", Name.New()); add("Num", Num.New()); } void destroy() { Name.dump(); Num.dump(); } };Comments
- The DR_Acct constructor is implemented as:
DR_Acct::DR_Acct(const DRef& ref) : DR_Object(ref) { }The superclass DR_Object manages setting the pointer - which is what DR_ subclasses are, anyway: smart pointers which do safe type casting.
- The method operator->() allows DR_Acct to pass-through to DO_Acct underneath it, safely. (see Method Invocation for details)
- The
destroy
()
method is analogous to a C++ destructor. Note in the picture that there are two references to each of the DO_Acct instance DO_Objects; only one of them, in the DO_Collection, can be automatically freed. The other must be done, explicitly, in thedestroy
()
method.Method Invocation
This standard sees dramatic improvements in the use of C++ from within both C++ and RSL. The only way to do this smoothly is to allow the same behavior to be invoked from both environments - with native function calling or message passing semantics in each environment. Continuing the above example, if we add a method doit(DR_String, DR_Int) to the DO_Account class, it might look like the code below. For the purposes of example, the doit() method is not very complex or interesting, and not something that an "Account" would necessarily want to do.
class DR_Acct : public DRef { DR_Acct(const DRef& ref); DO_bject *operator->(); }; class DO_Acct : public DO_Composite { DR_String Name, Num; DR_List doit(DR_String s, DR_Int i) { i++; // change the argument DR_List l(); // declare reference object and instantiate l->append(i); // add to the list return l; // send this new list out } DRef route(DR_Message m) { switch(m.method_id) { case _hdoit: return doit( DR_String(m[0]), // cast from DRef to DR_String DR_Int(m[1]) ); // cast from DRef to DR_Int default: return DO_Composite::route(m); } } void init() { add("Name", Name.New()); add("Num", Num.New()); } void destroy() { Name.dump(); Num.dump(); } };The method route is the transaction-oriented messaging interface which is used by RSL. From within C++, most often the use will be through the operator->() method of DR_Acct, such as
DR_Acct acct; acct->getStatements(...);By structuring the system this way, the C++ function getStatements(DR_DateRange dates) is exposed to RSL, literally, in a way that is type-safe from the perspective of C++, without data copying or translation of any kind.
rsl2D
In Foundaton 2.2 and prior, the tool rsl2c++ was used to generate a C++ Resource from an RSL class. Its primary drawback was that it was not smart enough to allow the C++ resources to use "regular" C++ function call semantics.rsl2D is this system's analogue to rsl2c++. Actually, rsl2D is a facade on top of a new more general tool that is the center of rsl2D, autodoc, and in the future, rsl2java, rsl2resource, ....
Collections
A collection is a class whose sole purpose is to group objects. Lists, arrays, hash tables, binary trees are all collections. These classes are all subclasses of DO_Collection.
All collections store DRef objects; the interface to collection objects speak in terms of DRef objects. Insertion, deletion, iteration, and sorting are described below and refer to the following example:
DR_List thelist = DR_List::New(); DR_String s1 = "a";Because there can be wide variation among collections classes, their interfaces also vary widely. Adding an element to a list requires less information than a hash table, but the elements of both classes can be enumerated.
Generally done via the methods
add
(const DRef&)
, although subclasses such as DO_Dictionary require a key for each element and so provide additional insertion methods.thelist->add(s1);Let's analyze this seemingly simple statement. First, note that it was mentioned earlier that every collection contains DRef objects explicity, not sublcasses. Yet here, we're asking it to insert a DR_String object, explicitly. What is going on? The following diagram shows the details.
Both variables s1 and thelist are
DRef
objects and so point to their respectiveDO_Object
s. This picture disregards the internal implementation of DO_List - other than the fact that there is a DRef object.If we were to add the same object again, that is if we repeated the statement thelist->add(s1); we would have this:
We could also add a string to the list this way:
thelist->add( DR_String("a string") );...
Enumeration
Each collection class has a companion enumerator class, subclass of DO_Enumerator. As much as possible, enumeration semantics are the same as in Java. Here is how we do something to every string in a list:DR_String s; DR_Enumerator en(thelist); // this has a bug, use the below while (en->hasMoreElements()) { s = en->nextElement(); } DR_String s; if (thelist.isValid()) { DR_Enumerator en = thelist->elements(); // works while (en->hasMoreElements()) { s = en->nextElement(); } } // if
All this example does is change the DRef s to point to every DO_Object in thelist. For a real example, consider the toString() method of DO_Collection, which translates any subclass instance into a string:DR_String DO_Collection::toString() { DR_Enumerator dre(elements()); DR_String s; while (dre->hasMoreElements()) { s += dre->nextElement()->toString(); } return s; }In the first example, the DR_Enumerator object is constructed with the collection object; in the second, it is constructed with the result of the method elements(). These are the same; in the first, the call to elements() is implicit. This method actually creates a DO_Enumerator object - the implementation side of the DR_Enumerator. In fact, any specific DO_Enumerator will do -- and in this case, it is actually a DO_ListEnumerator.
Because DO_Composite objects maintain a collection of their instance variables, it is possible to write a completely generic sort in which we can compare and order possibly heterogeneous objects on multiple "keys". This requires comparator objects, and the most direct interface is DO_List::sort(), which uses SortedBinaryTree. This has been done and its details may be found in the Sorting and Comparison section.
Creating new collection classes
In general, collections are actually implemented by Rogue Wave collection classes. The one essential unifying detail is that they store, by value, DRef objects. No collections by C++ pointer! It is the DRef classes which maintain pointers. So, for example, the DO_List class uses the Rogue Wave collection class RWTValSlist<DRef>. Now, because C++ requires objects to be a certain exact size in memory, we cannot have a collection of hetereogeneous types by value; DRef serves this purpose by being able to point to any DO_Object, and safe (dynamic) casting to specific classes allows one to use a heterogeneous (by DO_Object) collection to store objects of a specific type and still ensure C++-style type saftey.
Implementation-wise, the second example given above in Insertion looks like this:
Streaming
There are two ways objects may be streamed: via the toString() method and using an instance of classes derived from OStream. These produce String objects rather than being streams in the sense of the C++ iostream class for the most flexibility. The OStream hierarchy is, at the moment:
- OStream
- ECI_OStream
- XML_OStream
As usual, this hierarchy is deceptively simple. In reality, there are eight C++ classes here...
What is the difference? toString() is simple and not extensible; OStream is very flexible. One example is that toString() of String just returns itself, whereas ECI requires that strings be quoted and control characters translated (eg newline, etc). ECI_OStream will do this.
Examples
DR_List l; // ... populate l ... cout << l->toString() << endl; DR_List l; // ... populate l ... DR_ECI_OStream eciout; cout << eciout->stream(l) << endl;How does it work?
There are two basic kinds of objects: atoms and collections. Collections are divided into those whose elements have a key and those that aren't. Collections, including Composite, are collections of either other collections or atoms, so the question comes down to dealing with each individual kind of atom, and then how these atoms come together to form a stream. Because collections are abstract containers which can be enumerated, a general streaming mechanism can be implemented provided that the atoms can be streamed intelligently. In the case of the ECI_OStream, the special cases are keyed collections (and thus composite), for which a key is required to be associated with each element, and String which is quoted; other atoms are simply toString()'d.


class Tree
Binary Search Tree
class
Attributes
Public Class Methods
Initializes a new Binary Search Tree
with values from array
.
array
-
The array containing the values for the tree.
_sorted
-
Whether or not the array is sorted.
# File lib/tree.rb, line 17 def initialize(array = [], sorted = false) raise TypeError, 'Tree requires an array to initialize.' unless array.is_a? Array # Extract unique elements for sorting build_array = array.uniq # Requires a sorted array to properly build the tree. build_array.sort! unless sorted @root = build_tree(build_array) end
Public Instance Methods
Returns whether the tree is balanced or not. To be balanced, the difference of the heghts between each left and right subtree of every noide is not more than 1.
# File lib/tree.rb, line 162 def balanced<EMAIL_ADDRESS>- height(root.right)).between?(-1, 1) end
Deletes the node with value
passed in. Returns true
if it was successfully removed, false
if no such node exists.
value
-
The value sought after to delete.
current_node
-
The current node the method is looking at.
# File lib/tree.rb, line 71 def delete(value, current_node = @root) # Base case: We did not find the node return current_node if current_node.nil? if value < current_node.value current_node.left = delete(value, current_node.left) elsif value > current_node.value current_node.right = delete(value, current_node.right) else # equality if current_node.left.nil? temp = current_node.right current_node = nil return temp elsif current_node.right.nil? temp = current_node.left current_node = nil return temp else # Node has 2 children. successor = find_inorder_successor(current_node.right) current_node.value = successor.value current_node.right = delete(successor.value, current_node.right) end end current_node end
Returns the depth of node
, or the number of edges in the path from node
to the root
.
sought_node
-
The node to find the depth of.
current_node
-
The current node in the breadth first search.
# File lib/tree.rb, line 146 def depth(sought_node, current_node = @root) # Base case we've reached beyond a leaf node. return -1 if current_node.nil? # Base case: We've reached the node. return 0 if current_node == sought_node # Otherwise, return the minimum of the depths 1 + [depth(sought_node, current_node.left), depth(sought_node, current_node.right)].max end
iter_method
-
The method with which to iterate through.
vals_only
-
Whether or not the iteration should be of the values only or the nodes.
- +&block+
-
The block to apply each node value.
# File lib/tree.rb, line 333 def each(iter_method = '', vals_only: true, &block) return unless block_given? order_arr = case iter_method when 'inorder' inorder(vals_only: vals_only) when 'preorder' preorder(vals_only: vals_only) when 'postorder' postorder(vals_only: vals_only) else # Use level order. level_order(vals_only: vals_only) end order_arr.each { |node_val, *args| block.call(node_val, *args) } # Return the array used order_arr end
Finds and returns a node with value
as its value. Returns nil if no such node exists in the tree.
value
-
The value that is sought.
current_node
-
The current node to compare
value
to.
# File lib/tree.rb, line 118 def find(value, current_node = @root) # Base case: We found the node or past a leaf node return current_node if current_node.nil? || current_node.value == value return find(value, current_node.left) if value < current_node.value find(value, current_node.right) end
Finds the inorder sucessor of node
by finding the node with the smallest value in the right subtree of node
.
node
-
The node to find the inroder successor of.
# File lib/tree.rb, line 105 def find_inorder_successor(node) current_node = node current_node = current_node.left until current_node.left.nil? current_node end
Returns the height of node
, or the number of edges in the longest path from node
to a leaf node.
node
-
The node to find the height of.
# File lib/tree.rb, line 132 def height(node) # Base case: We've reached past a leaf node (stop incrementing) return -1 if node.nil? # Otherwise, return the max of the left and right subtree heights. 1 + [height(node.left), height(node.right)].max end
Returns an array of elements in the tree traversed using inorder. Acts as a wrapper for inorder_traverse
to make the return array more flexible.
# File lib/tree.rb, line 236 def inorder(only_vals: true) inorder_array = inorder_traverse.compact # Return only values or array of node objects. only_vals ? inorder_array.map(&:value).compact : inorder_array.compact end
Returns an array of elements using inorder.
current_node
-
The current node whose children are being looked at. This node is added to inorder_array after its left child.
# File lib/tree.rb, line 247 def inorder_traverse(current_node = @root) inorder_array = [] # Base case: reached child of a leaf node (nil) return [] if current_node.nil? inorder_array += inorder_traverse(current_node.left) inorder_array << current_node inorder_array += inorder_traverse(current_node.right) inorder_array end
Inserts a new node with value
into its appropriate place in the tree. Returns true
if insertion was successful and false if a node of that value already exists in the tree.
value
-
The value of the new node to insert.
current_node
-
The current node the method is looking at.
# File lib/tree.rb, line 43 def insert(value, current_node = @root) value = value.value if value.is_a? Node case value <=> current_node.value when 0 # Value already exists in the tree false when -1 # Left subtree if current_node.left.nil? current_node.left = Node.new(value) true else insert(value, current_node.left) end else # Right subtree if current_node.right.nil? current_node.right = Node.new(value) true else insert(value, current_node.right) end end end
Shorthand warpper for level_order_iter
# File lib/tree.rb, line 177 def level_order(only_vals: true) level_order_iter(only_vals: only_vals).compact end
Returns an array of the nodes in level order iteratively.
only_vals
-
Return an array of just the values if true. Otherwise, return an array of
Node
objects.
# File lib/tree.rb, line 186 def level_order_iter(only_vals: true) level_order_array = [@root] children_queue =<EMAIL_ADDRESS>@root.right] until children_queue.all?(&:nil?) # Dequeue the next child current_node = children_queue.shift next if current_node.nil? level_order_array << current_node # Queue up the left and rode nodes as children children_queue << current_node.left unless current_node.left.nil? children_queue << current_node.right unless current_node.right.nil? end # Return array of just the values if only_vals is true. only_vals ? level_order_array.map(&:value) : level_order_array end
Returns an array of the nodes in level order recursively.
level_order_array
-
The array of
Node
objects to return. children_queue
-
The queue of children who haven't been visited yet.
# File lib/tree.rb, line 211 def level_order_rec(level_order_array = [@root], children_queue =<EMAIL_ADDRESS>@root.right], only_vals: true) new_level_queue = [] children_queue.each do |node| next if node.nil? new_level_queue << node.left unless node.left.nil? new_level_queue << node.right unless node.right.nil? level_order_array << node end # Base case is the new_level_queue is all nil. level_order_rec(level_order_array, new_level_queue, only_vals: only_vals) unless new_level_queue.all?(&:nil?) # Return array of just the values if only_vals is true. only_vals ? level_order_array.map(&:value).compact : level_order_array.compact end
Returns an array of elements in the tree traversed using postorder. Acts as a wrapper for postorder_traverse
to make the return array more flexible.
# File lib/tree.rb, line 298 def postorder(only_vals: true) postorder_array = postorder_traverse # Return only values or array of node objects. only_vals ? postorder_array.map(&:value).compact : postorder_array.compact end
Returns an array of elements using postorder.
current_node
-
The current node whose children are being looked at. This node is added to inorder_array after its children.
# File lib/tree.rb, line 309 def postorder_traverse(current_node = @root) postorder_array = [] # Base case: reached child of a leaf node (nil) return [] if current_node.nil? postorder_array += postorder_traverse(current_node.left) postorder_array += postorder_traverse(current_node.right) postorder_array << current_node postorder_array end
Returns an array of elements in the tree traversed using preorder. Acts as a wrapper for preorder_traverse
to make the return array more flexible.
# File lib/tree.rb, line 267 def preorder(only_vals: true) preorder_array = preorder_traverse.compact # Return only values or array of node objects. only_vals ? preorder_array.map(&:value).compact : preorder_array.compact end
Returns an array of elements using preorder.
current_node
-
The current node whose children are being looked at. This node is added to inorder_array before its children.
# File lib/tree.rb, line 278 def preorder_traverse(current_node = @root) preorder_array = [] # Base case: reached child of a leaf node (nil) return [] if current_node.nil? preorder_array << current_node preorder_array += preorder_traverse(current_node.left) preorder_array += preorder_traverse(current_node.right) preorder_array end
Balances an unbalanced tree.
# File lib/tree.rb, line 168 def rebalance # Short-circut if already balanced. return @root if balanced? @root = build_tree(self.inorder) end
Alias for pretty_print
# File lib/tree.rb, line 31 def to_s pretty_print end
Protected Instance Methods
Builds a binary search tree using values in a sorted array.
sorted_array
-
A sorted array to turn into a BST.
# File lib/tree.rb, line 369 def build_tree(sorted_array) return Node.new(sorted_array[0]) if sorted_array.length <= 1 midpoint = sorted_array.length / 2 subtree_root = Node.new(sorted_array[midpoint]) # Don't include the root in the left subtree. subtree_root.left = build_tree(sorted_array[0...(sorted_array.length.even? ? midpoint - 1 : midpoint)]) subtree_root.right = build_tree(sorted_array[midpoint + 1..]) subtree_root end
Visualization of the binary tree, written by a community member of The Odin Project. Mainly used for debugging, so the spec file doesn't include any tests for this.
# File lib/tree.rb, line 359 def pretty_print(node = @root, prefix = '', is_left = true) pretty_print(node.right, "#{prefix}#{is_left ? '│ ' : ' '}", false) if node.right puts "#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}" pretty_print(node.left, "#{prefix}#{is_left ? ' ' : '│ '}", true) if node.left end


This is image content. This is image content. This is image content. This is image content. This is image content.

This is a paragraph
Bangladesh
India

Pakistan
Japan

This is a paragraph
Bangladesh
India

Pakistan
Japan

x=x+xy
Ctrl+p
Ctrl+k


--- title: How to annotate frames with CVAT keywords: fastai sidebar: home_sidebar nb_path: "nbs/Tutorials/11_tutorial.CVAT.ipynb" ---
Follow the quick annotation guide to install untill docker-compose up
(if you did make sure you have stopped all the containers by docker-compose down
before proceding).
Follow this guide.
Once the container has started, go to localhost:8080. Login and create a new task.
You can see the container status from docker ps
.
Follow creating an annotation task to do this.
The dashboard should look like this once you have uploaded the video.


--- layout: page title: "CoffeeScript (for jay muratore)" prev: f_0002.html next: f_0004.html book_path: books/coffeescript-accelerated-javascript-development-pragmatic--_oeb/ --- {% include JB/setup %} {% raw %}
JavaScript is born free, but until recently, everywhere it was in chains.
JavaScript had never been a very pleasant language to work in: terribly slow, implemented with different quirks in different browsers, stuck fast in the amber of time since the late 1990s. Perhaps you used it in the past to implement a dropdown menu or a reorderable list, but you probably didn’t enjoy the experience.
Fortunately for us, the JavaScript of today is enjoying a well-deserved renaissance. Thanks to the tireless efforts of browser implementers, it’s now the fastest mainstream dynamic language; it’s present everywhere, from servers to Photoshop, and it’s the only possible language you can use to program all angles of the web.
CoffeeScript is a little language that aims to give you easy access to the good parts of JavaScript: the first-class functions, the hash-like objects, even the much-misunderstood prototype chain. If we do our job right, you’ll end up writing one-third less code in order to generate much the same JavaScript you would have written in the first place.
CoffeeScript places a high value on the readability of code and the elimination of syntactic clutter. At the same time, there’s a fairly one-to-one correspondence between CoffeeScript and JavaScript, which means that there should be no performance penalty—in fact, many JavaScript libraries end up running faster after being ported to CoffeeScript due to some of the optimizations the compiler can perform.
You’re fortunate to have picked up this book, because Trevor has been an enthusiastic contributor to CoffeeScript since the early days. Few people know more about the ins and outs of the language or the history of the debate behind language features and omissions than he does. This book is a gentle introduction to CoffeeScript led by an expert guide.
I’m looking forward to hearing about all of the exciting projects that I’m sure will come out of it, and—who knows—perhaps you’ll be inspired to create a little language of your very own.


Neighborhood Revitalization
• history
• pride
Code for America Fellowship Experience
Bridging The Gap
how do we help city to preserve history and
homeowners to be proud of their houses
Code for America Fellowship Experience
I want a better home and better community.
How? Through fixing up my home with
REPAIRS
Code for America Fellowship Experience
We want to make sure it's done right
... and help.
How? By administering
PERMITS
Code for America Fellowship Experience
The goals are aligned, but we've still got a
DISCONNECT
Code for America Fellowship Experience
We want to make the system seem less
COMPLEX
and help it move
FASTER
Code for America Fellowship Experience
Build and Test
and iterate
Code for America Fellowship Experience
Homebase
Your one-stop shop to fix up your house.
Code for America Fellowship Experience
Apply for the
PERMITS
Code for America Fellowship Experience
Technology
• Ruby on Rails
• Minimal Javascript
• PostgreSQL Database with PostGIS Extension
• Heroku
• Travis-CI
Code for America Fellowship Experience
Door Hangers
Making Code Enforcement tickets make sense.
Code for America Fellowship Experience
Share and Deliver
Leaving our legacy
Code for America Fellowship Experience
Showing the product to agency
• impress them with something concrete
• tell them how it will save time for their staffs
• show them how it will help the people they serve
• work together to roll out the product
• keep them in the loop at all times
Code for America Fellowship Experience
Not just hand the product to IT staffs, hold their hands
• teach them user-centered design
• work with them to understand and use agile development
• have them practice
• continue to coach them until they get it
• get their managers excited
Code for America Fellowship Experience
Foster the
new relationships
Guide agency and IT staffs on how they can work together after we leave
Code for America Fellowship Experience
Lessons Learned
doing and sustaining something different is always hard
Code for America Fellowship Experience
Don't create new project to learn new concepts, add changes to their current assignment instead
• competing priority
• out of sight out of mind
• other departments do not understand
Code for America Fellowship Experience
Most of the time it is not about the technology
• use of words and languages are more important
• ordering of choices can make a big difference
• make the process more efficient and effective
Code for America Fellowship Experience
We may not see the changes yet, but we have planned the seed
• they have seen what's possible
• it takes a long time for governement to make changes
• be patient and don't get discourage
Code for America Fellowship Experience
Thanks
Code for America Fellowship Experience


Choose from the latest titles, with new movies added every day.
Start watching on one device, and pick up where you left off on another device.


Search
Welcome to Bus Mall
New
Session
As products appear, please select your favorite of the three.
Results will appear below after your session is complete.
Please click on any to start


Start a Group
Starting a Neighbourhood Support group is as easy as talking to the people on your street. Forming a group is a great way to promote regular communication, support one another and bring people closer together.
How to form a group:
- Contact your local Neighbourhood Support Coordinator to express your interest to get started.
- Your local coordinator will help you to contact people to join your group, organise an initial meeting and identify a Street Contact. Your Street Contact acts as the ongoing liaison with your coordinator.
- At the first meeting, your local coordinator or street contact will talk about Neighbourhood Support, distribute information and create a contact list.
- Your Street Contact then continues to distribute information to keep you informed.


--- title: Instantiates a NASNet model. type: docs repo: https://github.com/rstudio/keras menu: main: name: Instantiates a NASNet model. - keras parent: keras-reference aliases: - /reference/keras/application_nasnet.html - /keras/reference/application_nasnet.html - /guide/keras/reference/application_nasnet.html - /tools/tools/keras/reference/application_nasnet.html - /installation/keras/reference/application_nasnet.html - /tutorials/keras/reference/application_nasnet.html - /guide/tools/keras/reference/application_nasnet.html - /deploy/keras/reference/application_nasnet.html - /tools/keras/reference/application_nasnet.html - /tutorials/tools/keras/reference/application_nasnet.html ---
Note that only TensorFlow is supported for now,
therefore it only works with the data format
image_data_format='channels_last'
in your Keras config
at ~/.keras/keras.json
.
application_nasnet(
input_shape = NULL,
penultimate_filters = 4032L,
num_blocks = 6L,
stem_block_filters = 96L,
skip_reduction = TRUE,
filter_multiplier = 2L,
include_top = TRUE,
weights = NULL,
input_tensor = NULL,
pooling = NULL,
classes = 1000,
default_size = NULL
)
application_nasnetlarge(
input_shape = NULL,
include_top = TRUE,
weights = NULL,
input_tensor = NULL,
pooling = NULL,
classes = 1000
)
application_nasnetmobile(
input_shape = NULL,
include_top = TRUE,
weights = NULL,
input_tensor = NULL,
pooling = NULL,
classes = 1000
)
nasnet_preprocess_input(x)
| input_shape | Optional shape list, the input shape is by default |
| penultimate_filters | Number of filters in the penultimate layer.
NASNet models use the notation |
| num_blocks | Number of repeated blocks of the NASNet model. NASNet
models use the notation |
| stem_block_filters | Number of filters in the initial stem block |
| skip_reduction | Whether to skip the reduction step at the tail end
of the network. Set to |
| filter_multiplier | Controls the width of the network.
|
| include_top | Whether to include the fully-connected layer at the top of the network. |
| weights |
|
| input_tensor | Optional Keras tensor (i.e. output of |
| pooling | Optional pooling mode for feature extraction when
|
| classes | Optional number of classes to classify images into, only to be
specified if |
| default_size | Specifies the default image size of the model |
| x | a 4D array consists of RGB values within |


M_framework__journal(3fm) - [M_framework__journal::INTRO] write program messages to stdout and/or a log file (LICENSE:PD)
Synopsis
Description
Examples
Author
License
use, M_framework__journal , only : journal
For interactive programs in particular it is useful if all messages go thru the JOURNAL(3f) routine. This makes it easy to write messages to a log file as well as standard output; to toggle time prefixes on and off; to turn on and off debug-mode messages; control output paging and create replayable input journals.
The primary use of JOURNAL(3f) is to create journal files for interactive programs that can be replayed and/or be used to verify program executions. Typically, you would echo what the user typed to the trail file as-is, and write output you write to stdout as comments to the trail file so that the trail file can easily be read back in (by ignoring comments). So usually things that are read from user input are using output with WHERE=T and output that usually goes to stdout is written with WHERE=SC in the JOURNAL(3f) call.
> : > : > character(len=256) userline, output > call journal(O,my_trail_file) ! open trail file > : > : > do > read(*,(a),iostat=ios) userline ! read user input > if(ios /= 0)exit > ! echo user input to trail file > call journal(T,userline) > ! assume user input causes values i1, i2, and i3 to be calculated > write(output,(i0,1x,i0,1x))i1,i2,i3 ! build an output line > ! write output to stdout and as comment to trail file > call journal(output) > !or you can specify the WHERE parameter and up to ten scalar values > call journal(SC,i1=,i1,i2=,i2,i3=,i3) > enddoIn this example an output line was built with an internal write; but calls to journal(3f) with numeric values with and without advancing I/O turned on are often used for simpler output:
I=10 R=20.3 ! write to stdout and trail file without advancing I/O call journal(+SC,I=,i) call journal(SC,AND R=,r)writes to the trail file are ignored unless a trail file was opened with
CALL JOURNAL(O,filename)So that routines that do their output via JOURNAL(3f) can be used with and without programs generating trail files. That is, destinations
With no parameters, the trail file is flushed.
The man(1) page for journal(3f) describes all the options for the
Sample program for debug messages:
WHERE field.  Other useful time formats: ! %E -- Unix Epoch time ! %e -- integer value of Unix Epoch time ! %C -- number of times this format is used ! %c -- CPU_time(3f) output !


Site: Right arm Left arm Basilic vein Brachial vein Cephalic vein
Catheter: Single-lumen Double-lumen Triple-lumen
Peripherally placed PICC line. The arm was prepped and draped in sterile fashion. Lidocaine 1% was used for local anesthetic. Under fluoroscopic and ultrasound guidance, the vein was patent and accessed with a micropuncture needle. A guide wire was then advanced into the vein. A vascular sheath was then advanced over a guide wire, and a PICC line was trimmed. The PICC line was then advanced into the central venous system. After confirmation of the catheter position, the catheter was sutured in place at the skin entry site.
None.
Position:
Complications:
Fluoroscopy time: min
PICC insertion.


array_replace (PHP 5 >= 5.3.0, PHP 7) array_replace — 使用传递的数组替换第一个数组的元素 说明 array array_replace ( array $array1 , array $array2 [, array $... ] ) array_replace() 函数使用后面数组元素相同 key 的值替换 array1 数组的值。如果一个 键存在于第一个数组同时也存在于第二个数组，它的值将被第二个数组中的值替换。如果 一个键存在于第二个数组，但是不存在于第一个数组，则会在第一个数组中创建这个元素 。如果一个键仅存在于第一个数组，它将保持不变。 array_replace() 是非递归的：它将第一个数组的值进行替换而不管第二个数组中是什么 类型。 参数 array1 替换该数组的值。 array2 从此数组中提取替换值。 ... 包含要提取元素的更多数组。后面的数组里的值会覆盖前面的值。 返回值 返回一个数组。如果发生错误，将返回 NULL。 范例 Example #1 array_replace() 范例 "pineapple", 4 => "cherry"); $replacements2 = array(0 => "grape"); $basket = array_replace($base, $replacements, $replacements2); print_r($basket); ?> 以上例程会输出： Array ( [0] => grape [1] => banana [2] => apple [3] => raspberry [4] => cherry ) 参见 • array_replace_recursive() - 使用传递的数组递归替换第一个数组的元素 • array_merge() - 合并一个或多个数组 User Contributed Notes 13 notes =============================================================================== '24497', 'Type'=>'LED', 'Socket'=>'E27', 'Dimmable'=>'', 'Wattage'=>'10W' ); $keys = array_fill_keys(array('Article','Wattage','Dimmable','Type','Foobar'), ''); // wanted array with empty value $allkeys = array_replace($keys, array_intersect_key($values, $keys)); // replace only the wanted keys $notempty = array_filter($allkeys, 'strlen'); // strlen used as the callback-function with 0==false print '
'; print_r($allkeys); print_r($notempty); /* Array ( [Article] => 24497 [Wattage] => 10W [Dimmable] => [Type] => LED [Foobar] => ) Array ( [Article] => 24497 [Wattage] => 10W [Type] => LED ) */ ?> =============================================================================== If the arrays are associative (that is, their keys are strings), then I believe this function is identical to (the older) array_merge. =============================================================================== I got hit with a noob mistake. :) When the function was called more than once, it threw a function redeclare error of course. The enviroment I was coding in never called it more than once but I caught it in testing and here is the fully working revision. A simple logical step was all that was needed. With PHP 5.3 still unstable for Debian Lenny at this time and not knowing if array_replace would work with multi-dimensional arrays, I wrote my own. Since this site has helped me so much, I felt the need to return the favor. :) $v2) { if (is_array($t_array2[$k2])) { tier_parse($t_array1[$k2], $t_array2[$k2]); } else { $t_array1[$k2] = $t_array2[$k2]; } } return $t_array1; } } foreach ($array2 as $key => $val) { if (is_array($array2[$key])) { tier_parse($array1[$key], $array2[$key]); } else { $array1[$key] = $array2[$key]; } } return $array1; } ?> [I would also like to note] that if you want to add a single dimensional array to a multi, all you must do is pass the matching internal array key from the multi as the initial argument as such: array( "strawberry" => array( "color" => "red", "food" => "desserts"), "dewberry" = array( "color" => "dark violet", "food" => "pies"), ); $array2 = array( "food" => "wine"); $array1["berries"]["dewberry"] = polecat_array_replace($array1["berries"][ "dewberry"], $array2); ?> This is will replace the value for "food" for "dewberry" with "wine". The function will also do the reverse and add a multi to a single dimensional array or even a 2 tier array to a 5 tier as long as the heirarchy tree is identical. I hope this helps atleast one person for all that I've gained from this site. =============================================================================== In some cases you might have a structured array from the database and one of its nodes goes like this; 'some name', 'key2' => 'value2', 'title' => 'some title', 'key4' => 4, 'json' => '[1,0,1,1,0]' ); # capture these keys values into given order $keys = array( 'name', 'json', 'title' ); ?> Now consider that you want to capture $arr values from $keys. Assuming that you have a limitation to display the content into given keys order, i.e. use it with a vsprintf, you could use the following name: %s, json: %s, title: %s"; # flip keys once, we will use this twice $keys = array_flip( $keys ); # get values from $arr $test = array_intersect_key( $arr, $keys ); # still not good enough echo vsprintf( $string, $test ); // output --> name: some name, json: some title, title: [1,0,1,1,0] # usage of array_replace to get exact order and save the day $test = array_replace( $keys, $test ); # exact output echo vsprintf( $string, $test ); // output --> name: some name, json: [1,0,1,1,0], title: some title ?> I hope that this will save someone's time. =============================================================================== Simple function to replace array keys. Note you have to manually select wether existing keys will be overrided. /** * @param array $array * @param array $replacements * @param boolean $override * @return array */ function array_replace_keys(array $array, array $replacements, $override = false) { foreach ($replacements as $old => $new) { if(is_int($new) || is_string($new)){ if(array_key_exists($old, $array)){ if(array_key_exists($new, $array) && $override === false){ continue; } $array[$new] = $array[$old]; unset($array[$old]); } } } return $array; } =============================================================================== You can also use: "Banana", "omg" => "Chili", "nevermind" => "mango" ]; $myarray[0] = "NO-Orange"; $myarray["572"] = "BANANAPHONE!!!"; $myarray["omg"] = "NO-Chili"; print_r($myarray); ?> RESULT: Array ( [0] => NO-Orange [572] => BANANAPHONE!!! [omg] => NO-Chili [nevermind] => mango ) with regards =============================================================================== The documentation is wrongly phrased: "array_replace() replaces the values of array1" No replacing is done. A new array is created which looks like the one that would have resulted from the described replacement. If you want to augment the set of indices in an array, use array_to_be_modified += array_with_indices_to_add; =============================================================================== To get exactly same result like in PHP 5.3, the foreach loop in your code should look like: Check on this code: NULL, 'login' => NULL, 'credit' => NULL); $arr1 = array('id' => 2, 'login' => NULL, 'credit' => 5); $arr2 = array('id' => NULL, 'login' => 'john.doe', 'credit' => 100); $result = array_replace($base, $arr1, $arr2); /* correct output: array(3) { "id" => NULL "login" => string(8) "john.doe" "credit" => int(100) } your output: array(3) { "id" => int(2) "login" => NULL "credit" => int(5) } */ ?> Function array_replace "replaces elements from passed arrays into the first array" -- this means replace from top-right to first, then from top-right - 1 to first, etc, etc... =============================================================================== if(!function_exists('array_replace')) { function array_replace() { $args = func_get_args(); $num_args = func_num_args(); $res = array(); for($i=0; $i<$num_args; $i++) { if(is_array($args[$i])) { foreach($args[$i] as $key => $val) { $res[$key] = $val; } } else { trigger_error(__FUNCTION__ .'(): Argument #'.($i+1).' is not an array', E_USER_WARNING); return NULL; } } return $res; } } =============================================================================== Instead of calling this function, it's often faster and simpler to do this instead: If you need references to stay intact: =============================================================================== I would like to add to my previous note about my polecat_array_replace function that if you want to add a single dimensional array to a multi, all you must do is pass the matching internal array key from the multi as the initial argument as such: $array1 = array( "berries" => array( "strawberry" => array( "color" => "red", "food" => "desserts"), "dewberry" = array( "color" => "dark violet", "food" => "pies"), ); $array2 = array( "food" => "wine"); $array1["berries"]["dewberry"] = polecat_array_replace($array1["berries"] ["dewberry"], $array2); This is will replace the value for "food" for "dewberry" with "wine". The function will also do the reverse and add a multi to a single dimensional array or even a 2 tier array to a 5 tier as long as the heirarchy tree is identical. I hope this helps atleast one person for all that I've gained from this site. =============================================================================== Here is a simple array_replace_keys function: /** * This function replaces the keys of an associate array by those supplied in the keys array * * @param $array target associative array in which the keys are intended to be replaced * @param $keys associate array where search key => replace by key, for replacing respective keys * @return array with replaced keys */ private function array_replace_keys($array, $keys) { foreach ($keys as $search => $replace) { if ( isset($array[$search])) { $array[$replace] = $array[$search]; unset($array[$search]); } } return $array; } // Test Drive print_r(array_replace_keys(['one'=>'apple', 'two'=>'orange'], ['one'=>'ett', 'two'=>'tvo']); // Output array( 'ett'=>'apple', 'tvo'=>'orange' ) =============================================================================== a little enhancement to dyer85 at gmail dot com's function below: $val) { if ($filterEmpty && empty($val)) continue; $array[$key] = $val; } } else { trigger_error( __FUNCTION__ . '(): Argument #' . ($i+1) . ' is not an array', E_USER_WARNING ); return NULL; } } return $array; } } ?> this will allow you to "tetris-like" merge arrays: "foo", 1 => "", 2 => "baz" ); $b= array( 0 => "", 1 => "bar", 2 => "" ); print_r(array_replace($a,$b, true)); ?> results in: Array ( [0] => foo [1] => bar [2] => baz )


Business
IT/Telecommunications Consulting
Re-design, deployment, implementation, moves and installation of
Voice and Data Systems, CRM (Customer Relationship Management,
ACD (Automatic Call Distribution), CDR (Call Detail Recording) solutions and Call Centers.
Martial Arts
Black Belt


The tasks you have added are listed below. The name of the task, the frequency, as well as all of the people who are assigned to the task will be listed. When a task is first added it will be red to indicate it isn't completed yet. It will also be red on the 'Your Tasks' page. Once the task has been completed, click the task's name to turn it green.


A new study has shown that levels of key white blood cells, which are responsible for fighting off infections, become lower in men as they get older compared to women.
The average life expectancy for men in the UK is 79 years old, while for women it is 82 years old. In some parts of the world, such as Japan, the gap is even larger, with women living on average nearly six years longer.
There have been a number of theories for why this may be, including a recent finding that the tiny “power cells” that produce energy for their cells tend to have fewer faults than in men.
Scientists in Japan have now uncovered another reason after finding that the levels of white blood cells and other parts of the immune system called cytokines decline faster in men.
They believe this might be because female sex hormones such as oestrogen can boost the immune system’s response to infections.
The work could now help scientists predict the "biological age" of people based on the state of their immune system.
Professor Katsuiku Hirokawa, who led the research at Tokyo Medical & Dental University, said: "Because people age at different rates, a person's immunological parameters could be used to provide an indication of their true biological age."
The scientists, whose research is published in the journal Immunity and Ageing, examined the blood of 356 men and women aged between 20 and 90 years old.
They looked at levels of white blood cells and cytokines, which help to carry messages in the immune system.
In both sexes the number of white blood cells decreased with age, but two key elements – known as the T-cell and B-cell lymphocytes, declined faster in men.
Both of these white blood cells are involved in fighting off bacterial infections.
They also found that another type of cell that tackles viruses and tumours increased with age, with women having a higher rate of increase than men.
They also found that men showed a decline in two types of cytokines that help to keep the immune system under control and prevent inflammation from damaging surrounding tissue.
Professor Hirokawa added: “It is well known that ageing is associated with a decline in the normal function of the immune system, leading to increased susceptibility to various diseases and shortened longevity.
“However, specific dysfunctions in the immune system directly responsible for this have yet to be identified.
“Among the important factors, T cells are central to the immune response, and their function is significantly altered with increasing age."


Base texture view class.
More...
|
| | TextureView_ (const TextureStore &texture, const native::HImageView_ &view) |
| | INTERNAL. Use context->createTextureView or utils::textureUpload More...
|
| |
| | TextureView_ (const TextureStore &texture=TextureStore()) |
| | INTERNAL. Use context->createTextureView or utils::textureUpload More...
|
| |
| virtual | ~TextureView_ () |
| | Destructor (virtual) More...
|
| |
| IGraphicsContext & | getContext () |
| | Get the context that owns this object More...
|
| |
| const IGraphicsContext & | getContext () const |
| | Get the context that owns this object More...
|
| |
| const TextureStore & | getResource () const |
| | Get the underlying TextureStore object. More...
|
| |
| TextureStore & | getResource () |
| | Get the underlying TextureStore object. More...
|
| |
| types::ImageViewType | getViewType () const |
| | Get the dimensionality (1D/2D/3D) of this texture. More...
|
| |
| bool | isAllocated () |
| | Query if this object contains a valid reference to an actual Texture. More...
|
| |
|
|
TextureStore | resource |
| | Texture view implementations access the underlying texture through this.
|
| |
| virtual pvr::api::impl::TextureView_::~TextureView_ |
( |
| ) |
|
|
inlinevirtual |
| pvr::api::impl::TextureView_::TextureView_ |
( |
const TextureStore & |
texture, |
|
|
const native::HImageView_ & |
view |
|
) |
| |
INTERNAL. Use context->createTextureView or utils::textureUpload
| pvr::api::impl::TextureView_::TextureView_ |
( |
const TextureStore & |
texture = TextureStore() | ) |
|
INTERNAL. Use context->createTextureView or utils::textureUpload
| IGraphicsContext& pvr::api::impl::TextureView_::getContext |
( |
| ) |
|
|
inline |
Get the context that owns this object
- Returns
- The context which owns this object
| const IGraphicsContext& pvr::api::impl::TextureView_::getContext |
( |
| ) |
const |
|
inline |
Get the context that owns this object
- Returns
- The context which owns this object
| const TextureStore& pvr::api::impl::TextureView_::getResource |
( |
| ) |
const |
|
inline |
Get the underlying TextureStore object.
- Returns
- The underlying TextureStore object.
| TextureStore& pvr::api::impl::TextureView_::getResource |
( |
| ) |
|
|
inline |
Get the underlying TextureStore object.
- Returns
- The underlying TextureStore object.
| types::ImageViewType pvr::api::impl::TextureView_::getViewType |
( |
| ) |
const |
|
inline |
Get the dimensionality (1D/2D/3D) of this texture.
- Returns
- The dimensionality of this texture
| bool pvr::api::impl::TextureView_::isAllocated |
( |
| ) |
|
|
inline |
Query if this object contains a valid reference to an actual Texture.
- Returns
- true if the texture is allocated (has an underlying image object), false otherwise.
The documentation for this class was generated from the following file:
- /usr/buildxl/buildroot/sdk/branch/Framework/PVRApi/ApiObjects/Texture.h


Qt Location QML API changes since 5.4
This page lists the QtLocation QML API changes since the first Qt Location Technology Preview in Qt 5.4. Since Qt 5.6 this API is considered to be final and subsequent releases will not break the given API anymore.
Note: The public C++ API remained binary compatible since Qt 5.4.
Map Component
- removed wheelAngleChanged() signal
- added error property
- added errorString property
- added copyrightLinkActivated signal
- removed toScreenPosition() method
- added fromCoordinate() method
- replaced cameraStopped() method with prefetchData method
- replaced fitViewportToGeoShape() method with visibleRegion property
- added color property
- added clearData method
MapGestureArea Component
- removed movementStopped() signal
- replaced isPanActive and isPinchActive properties with panActive and pinchActive properties
- replaced activeGestures with acceptedGestures
- replaced MapGestureArea.ZoomGesture with MapGestureArea.PinchGesture
- removed properties panEnabled and pinchEnabled, please use acceptedGestures instead
MapPolyline Component
- added containsCoordinate method
- added coordinateAt method
- added insertCoordinate method
- added replaceCoordinate method
- added removeCoordinate method
Geoservice's plugin parameters


About
Home Makeover
Rhondda Recovery Centre
The Shipping Container
House Makeover
Images of when I first moved into this house and after I redisgned and redecorated the interior
>
<
s


IND vs BAN 1st Test, Day 1: India 86/1 at stumps; Bangla bundled for 150
Mayank Agarwal and Cheteshwar Pujara were unbeaten on 37 and 43, respectively, at the close of play
by Press Trust of IndiaIndia raced to 86 for one at stumps after bowling out Bangladesh for 150 on the first day of the opening Test here on Thursday.
Opting to bat, Bangladesh were bundled out in 58.3 overs at the Holkar Cricket Stadium.
Mayank Agarwal and Cheteshwar Pujara were unbeaten on 37 and 43, respectively, at the close of play.
Brief scores:
Bangladesh: 150 all out in 58.3 overs (Mushfiqur Rahim 43, Mominul Haque 37; Mohammed Shami 3/27, Ishant Sharma 2/20, Umesh Yadav 2/47, R Ashwin 2/43)
India: 86/1 in 26 overs (Mayank Agarwal 37 batting, Cheteshwar Pujara 43 batting).


Exodus 12:50
Thus did all the children of Israel; as the LORD commanded Moses and Aaron, so did they.


Tests for RDF download and docu
http://localhost/ontology/rvl/rvl.ttl
http://localhost/ontology/rvl/rvl-docu.ttl
http://localhost/ontology/viso/graphic/viso-graphic.ttl
http://localhost/docu/rvl/
http://localhost/docu/rvl/docu/
http://localhost/docu/viso/graphic/
curl http://localhost/docu/rvl/docu/
See Other
The answer to your request is located
here
.
curl http://localhost/docu/rvl/docu/
See Other
The answer to your request is located
here
.


Lift is a measure of the effectiveness of a predictive model calculated as the ratio between the results obtained with and without the predictive model. (Hamilton 2019)
这句话提纲挈领，就是比较有模型和没有模型的效果。 ROC 曲线也适用这句话。
The greater the area between the lift curve and the baseline, the better the model. (Hamilton 2019)
这种直观判断类似于 AUC 和 KS 的判断。
参考 Goldschmidt (2016a), Goldschmidt (2016b)
You can use this lift chart to verify that your model is doing what you expect from it.
相对于 KS 图等，参考 pyks，lift 图更能直观地向业务解释模型效果。
The basic idea of lift analysis is as follows:
group data based on the predicted churn probability (value between 0.0 and 1.0). Typically, you look at deciles, so you’d have 10 groups: 0.0 - 0.1, 0.1 - 0.2, …, 0.9 - 1.0 calculate the true churn rate per group. That is, you count how many people in each group churned and divide this by the total number of customers per group.
将预测值等值分到10份，计算每份中的真正 y 均值，查看单调性。
\[\operatorname{lift}=\frac{\text { predicted rate }}{\text { average rate }}\]
\(\text { average rate }\)指的是分组内的真实值的平均值。
Looking back at our example chart, the highest group would have a lift of 0.97 / 0.2 = 4.85 and the second-highest group of 1.8. That means, if you only target users with a score higher than 0.9, you can expect to catch nearly five times more churning users than you would by targeting the same number of people randomly.
因此通过观测图，我们可以发现，
最后一个组的 lift 值为 0.97 / 0.2 = 4.85，表示这组内某一个人，比随机抽一个人，流失率高达5倍左右。
具体实际例子参考 3.1 lift curve https://jiaxiangli.netlify.com/2018/06/03/kaggle-house-prices/#lift-curve
参考 Keating (2019)
The bars show the factor by which our model outperforms a random assignment of 0’s and 1’s. Reading the first bar on the left, we see that taking the 10% of the records that are ranked by the model as “the most probable 1’s” yields twice as many 1’s as would a random selection of 10% of the records.
It is convenient to look at the cumulative lift chart (sometimes called a gains chart) (Keating 2019)
Gain 图 和 Lift 图的术语常常混淆，这里以**Cumulative Gains Chart为主。
参考 Hamilton (2019)
| Cost ($) | Total Customers Contacted | Positive Responses |
|---|---|---|
| 10000 | 10000 | 6000 |
| 20000 | 20000 | 10000 |
| 30000 | 30000 | 13000 |
| 40000 | 40000 | 15800 |
| 50000 | 50000 | 17000 |
| 60000 | 60000 | 18000 |
| 70000 | 70000 | 18800 |
| 80000 | 80000 | 19400 |
| 90000 | 90000 | 19800 |
| 100000 | 100000 | 20000 |
相比较于随机模型(如下)，Cum Gain 是不同的。但是注意上面的图是累计状态的。
| Cost ($) | Total Customers Contacted | Positive Responses |
|---|---|---|
| 100000 | 100000 | 20000 |
Vuk and Curk (2006) 定义为 TP 和 Obs 的关系。
The graph is constructed with the cumulative number of cases (in descending order of probability) on the x-axis and the cumulative number of true positives on the y-axis as shown below. (Keating 2019)
计算逻辑显示是累计状态。
参考 Hamilton (2019), Lasek (2017)
For example, by contacting only 10% of customers based on the predictive model we will reach 3 times as many respondents as if we use no model. (Hamilton 2019)
三倍的效果，就是在没有做 AB test 的效果预测。
同时 % 可以估计份额，我们就可以估计 P * V = R，非常符合业务逻辑。
两条线在 100% 累计样本处汇合。
Goldschmidt, Andy. 2016a. “Lift Analysis – a Data Scientist’s Secret Weapon.” KDnuggets. 2016. https://www.kdnuggets.com/2016/03/lift-analysis-data-scientist-secret-weapon.html.
———. 2016b. “Lift Analysis – a Data Scientist’s Secret Weapon.” Data Life Balance. 2016. http://blog.datalifebalance.com/lift-charts-a-data-scientists-secret-weapon/.
Hamilton, Howard. 2019. Computer Science 831: Knowledge Discovery in Databases. http://www2.cs.uregina.ca/~dbd/cs831/notes/lift_chart/lift_chart.html.
Keating, Barry. 2019. Business Forecasting & Predictive Analytics: Data Mining. https://www3.nd.edu/~busiforc/handouts/DataMining/Lift%20Charts.html.
Lasek, Jan. 2017. “Training Xgboost with R and Neptune.” Big Data Zone. 2017. https://dzone.com/articles/training-xgboost-with-r-and-neptune.
Vuk, Miha, and Tomaz Curk. 2006. “ROC Curve, Lift Chart and Calibration Plot.” Metodoloski zvezki. 2006. http://mrvar.fdv.uni-lj.si/pub/mz/mz3.1/vuk.pdf.