The Killers of Two Kingdoms
问题描述 :
In this game, there are four kinds of card:
1.Kill: make the enemy loss one unit of life
2.Evade: evade the hurt of “Kill” from enemy, i.e. no loss of life
3.Snitch: steal one card from the enemy if he/she has
4.Defend: stay yourself away from “Snitch” of enemy, i.e. no loss of card
The game is played by only two players; all own three units of life in the beginning. At first, there are N cards in the original pile. Before the rounds begin, the first player takes four cards, then then second player take four cards, and both them will always keep the cards exactly in the order they get them, including the snitched card. There is no limit of card’s number for the players.
While playing the game, two players make an operation in turn, from the first player.
The one who is in his round will act in this order:
1.Get min {2, the number of left cards} cards first
2.Check if he/she still has “Snitch” Card, use it until none left or can’t use, and try to snitch the first card of the enemy
3.Check if he/she has “Kill” Card, use the first “Kill” card if exists, he/she can use at most one “Kill” in each round
The other one will response in this way:
1.If the enemy play “Snitch” and he/she has “Defend”, use the first one
2.If the enemy play “Kill” and he/she has “Evade”, use the first one
The game ends when one of the played is dead, means own zero unit of life, or when no more cards in the original pile and both of the players can’t play card any more. Once a card had been played, it won’t be used again.
After inventing the rule, iSea find the game is extraordinary boring to play, so he don’t want to play it even only once, try to simulate the game and show him who is the winner or just a tie.
输入:
Each test case begins with an integer N, indicating the number of cards.
Then N Cards’ description following, each of them will be one of the four kinds of cards according to the rules, short for “K”, “E”, “S” and “D”.
Technical Specification
1. 1 <= T <= 50
2. 8 <= N <= 100
输出:
Each test case begins with an integer N, indicating the number of cards.
Then N Cards’ description following, each of them will be one of the four kinds of cards according to the rules, short for “K”, “E”, “S” and “D”.
Technical Specification
1. 1 <= T <= 50
2. 8 <= N <= 100
样例输入:
2 8 K K K E K K S S 10 K K S S K K D D E E
样例输出:
Case 1: The winner is the second. Case 2: Just a tie.
#include<string.h> #include<stdio.h> char ch[201]; int xue[3] , sta[201] , n , flag = 1; void init() { int i; char t; scanf("%d\n", &n); for (i=1;i<=n;i++) { scanf("%c ", &ch[i]); sta[i] = 0; } for (i=1;i<=4;i++) sta[i] = 1; for (i=5;i<=8;i++) sta[i] = 2; xue[1] = 3; xue[2] = 3; } int find_need(char now , int x) { int i; for (i=1;i<=n;i++) if (ch[i] == now && sta[i] == x) return i; return 0; } int find(int x) { int i; for (i=1;i<=n;i++) if (sta[i] == x) return i; return 0; } void deal() { int i , j , t , x , tail , m , now = 0; flag = 1; tail = 8; m = n; while (1) { now++; if (now > m+1) break; if (tail + 1 <= m) sta[tail+1] = flag; if (tail + 2 <= m) sta[tail+2] = flag; if (tail+2 <= m) tail = tail + 2; else tail = m; for (j=1;j<=n;j++) if (ch[j] == 'S' && sta[j] == flag) { sta[j] = 3; t = find_need('D' , 3-flag); if (t == 0) { x = find(3-flag); if (x == 0) continue; sta[x] = 3; n++; sta[n] = flag; ch[n] = ch[x]; } else sta[t] = 3; } for (j=1;j<=n;j++) if (ch[j] == 'K' && sta[j] == flag) { sta[j] = 3; t = find_need('E' , 3-flag); if (t == 0) { xue[3-flag] --; if (xue[3-flag] < 1) { if (flag == 1) printf("The winner is the first.\n"); else printf("The winner is the second.\n"); return; } } else sta[t] = 3; break; } flag = 3-flag; } printf("Just a tie.\n"); } int main() { int i , tot; scanf("%d", &tot); for (i = 1; i<= tot;i++) { printf("Case %d: " , i); init(); deal(); } //while(1); }
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
总有一天大家都会归零的……
因为要修改链表头(指针)，所以要用指针的指针
嗯 分析得很到位，确实用模板编程能让面试官对你的印象更好。在设置辅助栈的时候可以这样：push时，比较要push的elem和辅助栈的栈顶，elem<=min.top()，则min.push(elem).否则只要push（elem）就好。在pop的时候，比较stack.top()与min.top(),if(stack.top()<=min.top()),则{stack.pop();min.pop();}，否则{stack.pop();}.
看似简单，还是不少坑的
第15行代码，/n/n，应该改为\n\n
第36行，struct node **head_ref，怎么理解，那个函数感觉不是很懂啊！？？弱渣求助
非常好，初学者就应该先理解递归
remove没有实现
第二种解法如果数组有重复元素 就不正确
题目和代码都不一样好吗！！！搞错了
代码不对，仔细对比一下输入输出， 怎么会有‘‘printf("The winning moves are:");’’这种输出呢？
程序员会算法，等于一个古惑仔带了zhi抢啊
从数学角度确实是C(n,r)，能给个递推关系式吗，从分治的角度不好理解
都是一些基础题啊
懂了，谢谢啦


Front End development using React, Angular, ES6 JavaScript, HTML5, CSS
(LESS, SASS)
Server-side development using Node.js, Python, Java, *C#, MVC
frameworks, *GraphQL
SQL and NoSQL database development, MSSQLServer Management Studio
Experienced teacher, leader, and communicator
Cross-disciplinary skills in music, languages, and graphic design
Education
.Net Programming Certificate
Bellevue College - Expected March 2020
Teaching English as a Foreign Language Certificate
International TEFL Academy, Online - 2018
Full-stack Web Development Bootcamp
Coding Dojo, Bellevue WA - 2017
M.M in Music Education
Arizona State University, Tempe AZ - 2010
B.A. in Music Education
Seattle Pacific University, Seattle WA - 2005
Experience
Software Developer
Dragonchain, Inc. - 2018
Created and updated company homepage components in one week, using
responsive web design principles, in time for release of the company’s
new marketing campaign.
Collaborated with marketing and design teams to ensure design elements
and copy were implemented consistently and free of errors.
Software Design Engineer I
SAP Concur - 2018
Contributed to significant code updates and debugging in legacy codebase
to meet deadline for GDPR compliance, improving protection of sensitive
personal data.
Developed new User Interface form component and unit test for Express
Checkout feature, reducing time and number of steps for product users to
complete flight reservations.
Created technical documentation for text internationalization procedure,
enabling all team members to participate in the process for future text
additions.
Overload Music Teacher
Issaquah School District - 2016-2017
Private Piano and Voice Instructor
Music with April, Inc. - 2013-2017
Music Teacher, Substitute Teacher, & Adult ESL Teacher
2012-2015 Campbell Elementary School District
Additional Experience
2003-2012 - Music Teacher with Saddle Mountain Unified School District
(Tonopah, AZ), Graduate Teaching Assistant in Music History (Arizona State
University, Tempe, AZ), Music Teacher with Stanwood-Camano School District
(Stanwood, WA), Circulation and Interlibrary Loan Assistant (Seattle Pacific
University Library, Seattle, WA), and more.
Established a thriving piano and voice studio, teaching child and adult
students in their homes and online. Developed methodology based on
students’ preferred learning styles.
Established and directed successful choirs and music programs,
increasing student engagement and participation in individual and group
music learning and performance.
Wrote grant proposals to obtain funding for a school lacking musical
instruments, technology, and teaching resources. Expanded musical
resource options at other schools.
Solved problems involving technology limitations, classroom space and
layout, logistics of movement, instrument storage and access, volume
levels of sound, student interactions, student challenges and special
needs, time limitations, quantities of instruments and sharing
procedures, and more.
Coordinated parent volunteers and other teachers to produce 2 – 9
successful performances per year and collaborated with music colleagues
district-wide to share knowledge and provide additional opportunities
for students to experience music.
Created or supplemented existing music curriculum to teach concepts
effectively, planned lessons for multiple grade levels, prepared
students for performances and tests, managed deadlines, maintained
effective communication, and pursued ongoing professional development.
Taught English to adult students from a variety of cultures, improving
pronunciation and other language skills while providing a supportive
environment for cultural exchange.


Lists in @Formula, especially @Member and @IsNotMember
Let us asume we have these lists:
list1 := "red":"yellow":"green"
list2 := "yellow":"red"
list3 := "black":"blue"
list4 := "red":"white"
list5 := "yellow"
| Comparison | Effect | Matches for @true | Examples | Result |
|---|---|---|---|---|
| = | Compares every single value with the same position in the other list. If one list has less elements than the other list, then the shorter list is padded with the last value. In a list of one, that one element is compared with all others. If there is ONE match true is returned. | one match, same position | list1 = list2 list2 = list5 list5 = list1 |
@false @true @true |
| *= | Compares every member of the first with every member of the second list. If there is a single match true is returned. In difference to = the position doesn't play a role and there is no padding (needed) | one match, any position | list1 *= list2 list2*= list5 |
@true @true |
| ! [Expression] | Turns the expression into the opposite. Very clean. Should be always in front. For readability you might want to use brackets | depends on expression | !list1 = list2 !(list1 = list2) !(list2 *= list5) |
@true @true @false |
| != | not equal operator. Compares element by element, padds a shorter list with the last element (same as =). Returns true if one match pair is different. In other words: only returns false if both list have the same members in the same sequence. | one mismatch, any position | list1 != list2 | @true |
| *!= | Compared every element from both lists and returns true if it finds one difference. It only will return false if both lists only contain one value (which can be there multiple times, that wouldn't matter) | if one list has 2 different values | "red":"red" *!= "red":"red":"red" list1*!= list2 |
@false @true |
| @IsMember | Checks that all members of the first list are available in the second list. The sequence doesn't matter. If there is one element in the first list, that is not in the second list it returns false. | all, any position | @isMember(list2;list1) @isMember(list4;list1) @isMember(list5;list1) |
@true @false @true |
| !@IsMember | reversal of @isMember. If there is just one element in the first list that is not in the second list it returns true. | one mismatch, any position | !@isMember(list2;list1) !@isMember(list4;list1) |
@false @true |
| @isNotMember | Checks that none of the elements in the first list is in the second list. If just one element is there, but not others it already returns false. So you can't replace !@IsMember with @IsNotMember for lists arguments. | all mismatches, any position | @isNotMember(list2;list1) @isNotMember(list4;list1) |
@false @false |
| !@isNotMember | Double negation to make your head spin <g>. Needs only a single match to return true. Equivalent to *= | one match, any position | @isNotMember(list2;list1) @isNotMember(list4;list1) |
@true @true |
Does your head spin now?
Posted by Stephan H Wissel on 30 June 2007 | Comments (4) | categories: Show-N-Tell Thursday


Arules¶
-
pycaret.arules.
setup
(data, transaction_id, item_id, ignore_items=None, session_id=None)¶ This function initializes the environment in pycaret. setup() must called before executing any other function in pycaret. It takes three mandatory parameters: (i) data, (ii) transaction_id param identifying basket and (iii) item_id param used to create rules. These three params are normally found in any transactional dataset. pycaret will internally convert the pandas.DataFrame into a sparse matrix which is required for association rules mining.
Example
>>> from pycaret.datasets import get_data >>> france = get_data('france') >>> experiment_name = setup(data = data, transaction_id = 'InvoiceNo', item_id = 'ProductName')
- Parameters
data (pandas.DataFrame) – Shape (n_samples, n_features) where n_samples is the number of samples and n_features is the number of features.
transaction_id (string) – Name of column representing transaction id. This will be used to pivot the matrix.
item_id (string) – Name of column used for creation of rules. Normally, this will be the variable of interest.
ignore_items (list, default = None) – List of strings to be ignored when considering rule mining.
session_id (int, default = None) – If None, a random seed is generated and returned in the Information grid. The unique number is then distributed as a seed in all functions used during the experiment. This can be used for later reproducibility of the entire experiment.
- Returns
info_grid – Information grid is printed.
environment – This function returns various outputs that are stored in variable as tuple. They are used by other functions in pycaret.
-
pycaret.arules.
create_model
(metric='confidence', threshold=0.5, min_support=0.05, round=4)¶ This function creates an association rules model using data and identifiers passed at setup stage. This function internally transforms the data for association rule mining.
setup() function must be called before using create_model()
Example
>>> from pycaret.datasets import get_data >>> france = get_data('france') >>> experiment_name = setup(data = data, transaction_id = 'InvoiceNo', item_id = 'ProductName')
This will return pandas.DataFrame containing rules sorted by metric param.
- Parameters
metric (string, default = 'confidence') –
Metric to evaluate if a rule is of interest. Default is set to confidence. Other available metrics include ‘support’, ‘lift’, ‘leverage’, ‘conviction’. These metrics are computed as follows:
support(A->C) = support(A+C) [aka ‘support’], range: [0, 1]
confidence(A->C) = support(A+C) / support(A), range: [0, 1]
lift(A->C) = confidence(A->C) / support(C), range: [0, inf]
leverage(A->C) = support(A->C) - support(A)*support(C), range: [-1, 1]
conviction = [1 - support(C)] / [1 - confidence(A->C)], range: [0, inf]
threshold (float, default = 0.5) – Minimal threshold for the evaluation metric, via the metric parameter, to decide whether a candidate rule is of interest.
min_support (float, default = 0.05) – A float between 0 and 1 for minumum support of the itemsets returned. The support is computed as the fraction transactions_where_item(s)_occur / total_transactions.
round (integer, default = 4) – Number of decimal places metrics in score grid will be rounded to.
- Returns
Dataframe containing rules of interest with all metrics including antecedents, consequents, antecedent support, consequent support, support, confidence, lift, leverage, conviction.
- Return type
pandas.DataFrame
Warning
Setting low values for min_support may increase training time.
-
pycaret.arules.
plot_model
(model, plot='2d', scale=1)¶ This function takes a model dataframe returned by create_model() function. ‘2d’ and ‘3d’ plots are available.
Example
>>> rule1 = create_model(metric='confidence', threshold=0.7, min_support=0.05) >>> plot_model(rule1, plot='2d') >>> plot_model(rule1, plot='3d')
- Parameters
model (pandas.DataFrame, default = none) – pandas.DataFrame returned by trained model using create_model().
plot (string, default = '2d') –
Enter abbreviation of type of plot. The current list of plots supported are (Name - Abbreviated String):
Support, Confidence and Lift (2d) - ‘2d’
Support, Confidence and Lift (3d) - ‘3d’
scale (float, default = 1) – The resolution scale of the figure.
- Returns
Prints the visual plot.
- Return type
Visual_Plot
-
pycaret.arules.
get_rules
(data, transaction_id, item_id, ignore_items=None, metric='confidence', threshold=0.5, min_support=0.05)¶ Magic function to get Association Rules in Power Query / Power BI.


Web Developer
Developer & Computer Technician based in California
Hello, My name is Gabriel Juarez. I'm currently a student at Bay Valley Code Academy learning Full Stack web development.I'm working on developing my skills in these languages, frameworks and technologies.
I have a Technical Education Associate in Arts with Honors from San Joaquin Delta College with a focus in Electronics and Electrical technologies. I've always enjoyed learning new tech or tinkering in the garage. The image over to end of this section is my first solder job on PS4 hdmi port. I did freelance Computer Technician and Electronics work while also working as a caregiver for almost 10 years. I moved to web development with the learning opportunity from Bay Valley Code Academy.


Practical-4:- Create a website having list of all practicals and thier individual practical Page links.
This is Live Practical Book for the subject Fullstack Web Development-1. In this book we are performing all the practicals related to Frot-end web development including topics from HTML, CSS, JS and Bootstrap. This book is hosted on Github cloud platform. You can view all the practicals form this book.
1. Create a Web page including HTML basic skeleton using offline HTML editor and Online Sandbox Environment. Practical-1
2. Create a web page showing a basic HTM structure using character entities and span tag. Practical-2
3. Live your first web page on Github. Practical-3
4. Create a website having list of all practical and their individual practical page links. Practical-4
5. Create a Web-Page showing the use of Image-Map in the Web Application. Practical-5
6. Create a Card Layout using CSS layout properties. Practical-6
7. Create a Web Page Layout using div tags. Practical-7
8. Create a Web Page having Fixed Navigation Bar with the given content. Practical-8


| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| src/ | 100% | 1/1 | 100% | 0/0 | 100% | 0/0 | 100% | 1/1 | |
| src/affix/ | 83.19% | 99/119 | 59.21% | 45/76 | 94.44% | 17/18 | 83.62% | 97/116 | |
| src/alert/ | 88.64% | 39/44 | 83.33% | 20/24 | 84.62% | 11/13 | 88.1% | 37/42 | |
| src/aside/ | 96.97% | 32/33 | 88.89% | 16/18 | 100% | 11/11 | 96.77% | 30/31 | |
| src/button/ | 98.59% | 70/71 | 96.43% | 27/28 | 100% | 24/24 | 98.55% | 68/69 | |
| src/collapse/ | 98.26% | 113/115 | 88.89% | 48/54 | 100% | 30/30 | 98.25% | 112/114 | |
| src/datepicker/ | 89.23% | 323/362 | 80.99% | 196/242 | 92.31% | 60/65 | 89.85% | 292/325 | |
| src/dropdown/ | 73.75% | 59/80 | 59.38% | 38/64 | 82.35% | 14/17 | 79.1% | 53/67 | |
| src/helpers/ | 89.54% | 334/373 | 80.34% | 188/234 | 91.95% | 80/87 | 90.14% | 320/355 | |
| src/modal/ | 95.35% | 164/172 | 87.38% | 90/103 | 92.5% | 37/40 | 95.76% | 158/165 | |
| src/navbar/ | 95.45% | 21/22 | 83.33% | 5/6 | 100% | 8/8 | 95.24% | 20/21 | |
| src/popover/ | 84.62% | 44/52 | 69.57% | 32/46 | 86.67% | 13/15 | 85.11% | 40/47 | |
| src/scrollspy/ | 65.63% | 84/128 | 25% | 16/64 | 56% | 14/25 | 67.5% | 81/120 | |
| src/select/ | 89.69% | 174/194 | 79.23% | 103/130 | 90% | 36/40 | 91.21% | 166/182 | |
| src/tab/ | 100% | 80/80 | 96.88% | 31/32 | 100% | 24/24 | 100% | 79/79 | |
| src/timepicker/ | 86.24% | 282/327 | 78.35% | 181/231 | 90.48% | 38/42 | 87.58% | 268/306 | |
| src/tooltip/ | 92.33% | 349/378 | 85.99% | 270/314 | 90.77% | 59/65 | 92.72% | 331/357 | |
| src/typeahead/ | 85.35% | 134/157 | 67.54% | 77/114 | 88.24% | 30/34 | 87.14% | 122/140 |


This prototype assumes pretty good HTML5 compliance. Seems to only work properly in Chrome right now.
Using the fields on the left, weight each criterion based on how important you feel they are relative to each other.
Score each solution compared against each criterion from 0 to 10, where 0 is meets criterion not at all, and 10 meets criterion fully.
| Total available weight: {{getMaxWeight()}} | {{header}} | |||
|---|---|---|---|---|
| Total | {{columnTotal()}} |


Bulk issue
{{if not $hasSMSConfig}}
No SMS provider is configured for this realm.
Please contact a realm administrator to enable this feature.
{{end}}
| Phone number | Test date |
|---|
Errors
| Line | Phone# | Test date | Error message |
|---|


I like programming. I will feel a sense of accomplishment after solving an algorithm problems or after seeing the project's outcome I've been developing. And that's the thing that keeps me going.
Also, I learn fast and I'm not afraid of challenge. Every time I faced a challenge, I always made plans to solve them, bit by bit, steps by steps.
What's next for me? I want to immerse myself into the world of coding and develop something that is helpful to people, as well as gaining the experience to be a professional developer.
|
|
|
|
Click the icons above to show detail of my experience. |
|
New York University Major in Telecommunication Networks, GPA: 3.58, 2013-2015 →
|
|||||||
|
National PingTung University of Education Major in Computer Science, GPA: 3.48, 2004-2008 →
|


Web Video Player
Implementing MediaElement.js for HLS and RTMP Live Streaming for a good friend!
HLS Stream
RTMP Stream
Flash Reqd.
Made with ❤ and
MediaElement.js
#iamshouvikmitra


My Movie List
New movie
Name
Image
Action
Adventure
Animation
Comedy
Detective
Fantasy
History
Horror
Musical
Pirate
Romantic
SCI-FI
War
Western
Release
Save
Clear LS


Inputs
- disabled
- Set disabled state
- icon
- Icon name to be used. Button text will be hidden but accessible by screen reader.
- iconSize
-
Set the size of the icon: small | medium | large.
(default: medium)
- iconAndText
-
Display icon and text together
(default: false)
- kind
-
primary | secondary | destructive | inverted
(default: secondary)
- size
-
small | medium | large
(default: medium)
. By default, icons in small buttons have a medium size, but you can override this behaviour by setting iconSize
attribute.
- type
-
button | submit | reset
(default: button)
- aspect
-
solid | basic
(default: solid)


About
Home
Sign Up
Blog
Dev
Contact
Hey learner, let's have a look at the contents
Laser
Dielectrics
Maxwell's Equations
Mechanics
Oscillations
Maxwell's Equations
Quantum Theory
Quantum Mechanics
Statistical Mechanics


Connecting to Device
Device is Ready
X
GPS coordinates
Get GPS
Watch
Stop watching GPS
Clear
Links in App
self
blank
system
Info about device
Device
Clear
Info about connection
Network
Clear
Vibration
Single
Multiple
Stop
Modal dialogs
Alerts
No msg - Error
Only MSG
MSG & CB
Custom
Confirms
MSG & CB
Custom
Beep
Beep 1
Beep 2
Toasts
Top
Center
Bottom
Audio
Play
Play
Stop


LIGHTgreat for small business
$5
MONTHLY
- 12/24 Tech Support
- Advanced Options
- 100GB Storage
- 1GB Bandwidth
Known locally as “SoMa”, this neighborhood was home to thd dot.com boom and boasts.
RUNgreat for small business
$959
MONTHLY
- 12/24 Tech Support
- Advanced Options
- 100GB Storage
- 1GB Bandwidth
Known locally as “SoMa”, this neighborhood was home to thd dot.com boom and boasts.
FLYgreat for small business
$12
MONTHLY
- 12/24 Tech Support
- Advanced Options
- 100GB Storage
- 1GB Bandwidth
Known locally as “SoMa”, this neighborhood was home to thd dot.com boom and boasts.


The PLSDAGUI module provides the graphical user interface for classes DataSet and PLSDAModel. The classes subfolder contains auxiliary classes used by the GUI.
The GUI main window is separated into 3 tabs: Data, Model and Prediction. Their availability depends on the user's actions.
On the Data tab user can create and modify the DataSet objects, which can be used for model building, validation and prediction. The functionality provided by the Data tab also includes visual means of Principal Component Analysis.
On the Model tab user can employ one of the previously created DataSet objects to build a Soft or Hard PLS-DA model.
On the Prediction tab user can apply the model to a new or test DataSet.


all handles with config id `substances`
all handles with config id `controls`
all handles with config id `hshifter`
all handles with config id `truck`
all handles with config id `trailer`
all handles with config id `job`
contains the length of the handle config arrays
| bool handleCfg( |
| ) |
call the correct handle of the scs_config event
| info const scs_named_value_t* | scs_config event value + name |
| type const configType | type (id) of the scs_config event, <configType> |
| trailer_id const unsigned int | trailer id if needed to handle the event (0-9) |
true if event was handled
Handle the Substances Id and write it to the space in memory. It write up to SUBSTANCE_SIZE substances into the memory
handle the Controls ShifterType and write it to the memory
handle the HShifter SelectorCount and write it to the memory
handle the HSifter Resulting and write it to the memory


Use the filter side bar on the right to filter and search your settings.
Manage your multilingual site contents.


TRANSITIONS & JQUERY
Transitions
Introducing This & That, two very spoilt cats.
Another Module of stuff


< return to staff Education
|
|
| Biography | |
Lenson majored in materials science and engineering at Brown University, where he studied water on carbon coatings with Prof. Sheldon’s group. The coolest thing he ever did was to fly in NASA’s C9-B with the Brown Space Club, attempting acoustic control of water droplets in zero gravity. He worked for two years in optoelectronics at NIST Boulder Labs, where he developed models for design of multilayer optical devices and processes for fabrication and characterization of superconducting alloys for use in single-photon detectors.
Publications Pellouchoud, L. A., Reed, E. J., Optical Characterization of Chemistry in Shocked Nitromethane with Time-Dependent Density Functional Theory. Journal of Physical Chemistry A, 117, 12288-12298, doi:10.1021/jp406877g (2013). |


Additionally, we can represent the biases and activations as layer-wise column vectors \( \vec{b}_l \) and \( \vec{y}_l \), so that the \( i \)-th element of each vector is the bias \( b_i^l \) and activation \( y_i^l \) of node \( i \) in layer \( l \) respectively.
We have that \( \mathrm{W}_l \) is a \( N_{l-1} \times N_l \) matrix, while \( \vec{b}_l \) and \( \vec{y}_l \) are \( N_l \times 1 \) column vectors. With this notation, the sum in becomes a matrix-vector multiplication, and we can write the equation for the activations of hidden layer 2 in $$ \begin{equation} \vec{y}_2 = f_2(\mathrm{W}_2 \vec{y}_{1} + \vec{b}_{2}) = f_2\left(\left[\begin{array}{ccc} w^2_{11} &w^2_{12} &w^2_{13} \\ w^2_{21} &w^2_{22} &w^2_{23} \\ w^2_{31} &w^2_{32} &w^2_{33} \\ \end{array} \right] \cdot \left[\begin{array}{c} y^1_1 \\ y^1_2 \\ y^1_3 \\ \end{array}\right] + \left[\begin{array}{c} b^2_1 \\ b^2_2 \\ b^2_3 \\ \end{array}\right]\right) \tag{13} \end{equation} $$ and we see that the activation of node \( i \) in layer 2 is $$ \begin{equation} y^2_i = f_2\Bigr(w^2_{i1}y^1_1 + w^2_{i2}y^1_2 + w^2_{i3}y^1_3 + b^2_i\Bigr) = f_2\left(\sum_{j=1}^3 w^2_{ij} y_j^1 + b^2_i\right) \tag{14} \end{equation} $$ which is in accordance with. Note that This is not just a convenient and compact notation, but also a useful and intuitive way to think about MLPs: The output is calculated by a series of matrix-vector multiplications and vector additions that are used as input to the activation functions. For each operation \( \mathrm{W}_l \vec{y}_{l-1} \) we move forward one layer.


|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<E> java.util.AbstractSequentialList<E> java.util.LinkedList<E>
E
- the type of elements held in this collectionpublic class LinkedList<E>
Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque).
The class implements the Queue interface, providing first-in-first-out queue operations for add, poll, etc. Other stack and deque operations could be easily recast in terms of the standard list operations. They're included here primarily for convenience, though they may run slightly faster than the equivalent List operations.
All of the operations perform as could be expected for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.
Note that this implementation is not synchronized. If multiple threads access a list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList method. This is best done at creation time, to prevent accidental unsynchronized access to the list:
List list = Collections.synchronizedList(new LinkedList(...));
The iterators returned by the this class's iterator and listIterator methods are fail-fast: if the list is structurally modified at any time after the iterator is created, in any way except through the Iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.
This class is a member of the Java Collections Framework.
List
,
ArrayList
,
Vector
,
Collections.synchronizedList(List)
,
Serialized Form| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
LinkedList()
Constructs an empty list. |
|
LinkedList(Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
| Method Summary | ||
|---|---|---|
boolean |
add(E o)
Appends the specified element to the end of this list. |
|
void |
add(int index,
E element)
Inserts the specified element at the specified position in this list. |
|
boolean |
addAll(Collection<? extends E> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator. |
|
boolean |
addAll(int index,
Collection<? extends E> c)
Inserts all of the elements in the specified collection into this list, starting at the specified position. |
|
void |
addFirst(E o)
Inserts the given element at the beginning of this list. |
|
void |
addLast(E o)
Appends the given element to the end of this list. |
|
void |
clear()
Removes all of the elements from this list. |
|
Object |
clone()
Returns a shallow copy of this LinkedList. |
|
boolean |
contains(Object o)
Returns true if this list contains the specified element. |
|
E |
element()
Retrieves, but does not remove, the head (first element) of this list. |
|
E |
get(int index)
Returns the element at the specified position in this list. |
|
E |
getFirst()
Returns the first element in this list. |
|
E |
getLast()
Returns the last element in this list. |
|
int |
indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element. |
|
int |
lastIndexOf(Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element. |
|
ListIterator<E> |
listIterator(int index)
Returns a list-iterator of the elements in this list (in proper sequence), starting at the specified position in the list. |
|
boolean |
offer(E o)
Adds the specified element as the tail (last element) of this list. |
|
E |
peek()
Retrieves, but does not remove, the head (first element) of this list. |
|
E |
poll()
Retrieves and removes the head (first element) of this list. |
|
E |
remove()
Retrieves and removes the head (first element) of this list. |
|
E |
remove(int index)
Removes the element at the specified position in this list. |
|
boolean |
remove(Object o)
Removes the first occurrence of the specified element in this list. |
|
E |
removeFirst()
Removes and returns the first element from this list. |
|
E |
removeLast()
Removes and returns the last element from this list. |
|
E |
set(int index,
E element)
Replaces the element at the specified position in this list with the specified element. |
|
int |
size()
Returns the number of elements in this list. |
|
Object[] |
toArray()
Returns an array containing all of the elements in this list in the correct order. |
|
|
toArray(T[] a)
Returns an array containing all of the elements in this list in the correct order; the runtime type of the returned array is that of the specified array. |
| Methods inherited from class java.util.AbstractSequentialList |
|---|
iterator |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, isEmpty, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList |
| Constructor Detail |
|---|
public LinkedList()
public LinkedList(Collection<? extends E> c)
c
- the collection whose elements are to be placed into this list.
NullPointerException
- if the specified collection is null.| Method Detail |
|---|
public E getFirst()
NoSuchElementException
- if this list is empty.public E getLast()
NoSuchElementException
- if this list is empty.public E removeFirst()
NoSuchElementException
- if this list is empty.public E removeLast()
NoSuchElementException
- if this list is empty.public void addFirst(E o)
o
- the element to be inserted at the beginning of this list.public void addLast(E o)
o
- the element to be inserted at the end of this list.public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface List<E>
contains
in class AbstractCollection<E>
o
- element whose presence in this list is to be tested.
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public boolean add(E o)
add
in interface Collection<E>
add
in interface List<E>
add
in class AbstractList<E>
o
- element to be appended to this list.
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface List<E>
remove
in class AbstractCollection<E>
o
- element to be removed from this list, if present.
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface List<E>
addAll
in class AbstractCollection<E>
c
- the elements to be inserted into this list.
NullPointerException
- if the specified collection is null.AbstractCollection.add(Object)
public boolean addAll(int index, Collection<? extends E> c)
addAll
in interface List<E>
addAll
in class AbstractSequentialList<E>
index
- index at which to insert first element
from the specified collection.c
- elements to be inserted into this list.
IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index > size()).
NullPointerException
- if the specified collection is null.public void clear()
clear
in interface Collection<E>
clear
in interface List<E>
clear
in class AbstractList<E>
public E get(int index)
get
in interface List<E>
get
in class AbstractSequentialList<E>
index
- index of element to return.
IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public E set(int index, E element)
set
in interface List<E>
set
in class AbstractSequentialList<E>
index
- index of element to replace.element
- element to be stored at the specified position.
IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public void add(int index, E element)
add
in interface List<E>
add
in class AbstractSequentialList<E>
index
- index at which the specified element is to be inserted.element
- element to be inserted.
IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index > size()).public E remove(int index)
remove
in interface List<E>
remove
in class AbstractSequentialList<E>
index
- the index of the element to removed.
IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public int indexOf(Object o)
indexOf
in interface List<E>
indexOf
in class AbstractList<E>
o
- element to search for.
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
lastIndexOf
in class AbstractList<E>
o
- element to search for.
public E peek()
peek
in interface Queue<E>
public E element()
element
in interface Queue<E>
NoSuchElementException
- if this queue is empty.public E poll()
poll
in interface Queue<E>
public E remove()
remove
in interface Queue<E>
NoSuchElementException
- if this queue is empty.public boolean offer(E o)
offer
in interface Queue<E>
o
- the element to add.
public ListIterator<E> listIterator(int index)
The list-iterator is fail-fast: if the list is structurally modified at any time after the Iterator is created, in any way except through the list-iterator's own remove or add methods, the list-iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
listIterator
in interface List<E>
listIterator
in class AbstractSequentialList<E>
index
- index of first element to be returned from the
list-iterator (by a call to next).
IndexOutOfBoundsException
- if index is out of range
(index < 0 || index > size()).List.listIterator(int)
public Object clone()
clone
in class Object
Cloneable
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
Arrays.asList(Object[])
public <T> T[] toArray(T[] a)
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.
toArray
in interface Collection<E>
toArray
in interface List<E>
toArray
in class AbstractCollection<E>
a
- the array into which the elements of the list are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.
ArrayStoreException
- if the runtime type of a is not a
supertype of the runtime type of every element in this list.
NullPointerException
- if the specified array is null.
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


Chapter 11 Text Mining Software Engineering Data
In software engineering, there is a lot of information in plain text such as requirements, bug reports, mails, reviews from applicatons, etc. Typically that information can be extracted from Software Configuration Management Systems (SCM), Bug Tracking Systems (BTS) such as Bugzilla or application stores such as Google Play or Apple’s AppStore, etc. can be mined to extract relevant information. Here we briefly explain the text mining process and how this can be done with R.
A well-known package for text mining is tm
Feinerer, Hornik, and Meyer (2008). Another popular package is wordcloud
.
11.1 Terminology
The workflow that we follow for analyzing a set of text documents are:
- Importing data. A Corpus is a collection of text documents, implemented as VCorpus (corpora are R object held in memory). The
tm
provides several corpus constructors:DirSource
,VectorSource
, orDataframeSource
(getSources()
).
There are several parameters that control the creation of a Corpus. ((The parameter readerControl of the corpus constructor has to be a list with the named components reader and language))
Preprocessing: in this step we may remove common words, punctuation and we may perform other operations. We may do this operations after creating the DocumentTermMatrix.
Inspecting and exploring data: Individual documents can be accessed via [[
Transformations: Transformations are done via the
tm_map()
function. +tm_map(_____, stripWhitespace)
+tm_map(_____, content_transformer(tolower))
+tm_map(_____, removeWords, stopwords("english"))
+tm_map(_____, stemDocument)
Creating
Term-Document
Matrices: TermDocumentMatrix and DocumentTermMatrix + A document term matrix is a matrix with documents as the rows and terms as the columns. Each cell of the matrix contains the count of the frequency of words. We use DocumentTermMatrix() to create the matrix. +inspect(DocumentTermMatrix( newsreuters, list(dictionary = c("term1", "term2", "term3"))))
. It displays detailed information on a corpus or a term-document matrix.Relationships between terms. +
findFreqTerms(_____, anumber)
+findAssocs(Mydtm, "aterm", anumbercorrelation)
+ A dictionary is a (multi-)set of strings. It is often used to denote relevant terms in text mining.Clustering and Classification
11.2 Example of classifying bugs from Bugzilla
Bugzilla is Issue Tracking System that allow us to follow the evolution of a project.
The following example shows how to work with entries from Bugzilla. It is assumed that the data has been extracted and we have the records in a flat file (this can be done using Web crawlers or directly using the SQL database).
library(foreign)
# path_name <- file.path("C:", "datasets", "textMining")
# path_name
# dir(path_name)
#Import data
options(stringsAsFactors = FALSE)
<- read.arff("./datasets/textMining/reviewsBugs.arff" )
d str(d) #print out information about d
## 'data.frame': 789 obs. of 2 variables:
## $ revContent: chr "Can't see traffic colors now With latest updates I can't see the traffic green/red/yellow - I have to pull over"| __truncated__ "Google Map I like it so far, it has not steered me wrong." "Could be 100X better Google should start listening to customers then they'd actually build a proper product." "I like that! Easily more helpful than the map app that comes with your phone." ...
## $ revBug : Factor w/ 2 levels "N","Y": 2 1 1 1 1 1 2 1 2 1 ...
head(d,2) # the first two rows of d.
## revContent
## 1 Can't see traffic colors now With latest updates I can't see the traffic green/red/yellow - I have to pull over and zoom in the map so that one road fills the entire screen. Traffic checks are (were) the only reason I use google maps!
## 2 Google Map I like it so far, it has not steered me wrong.
## revBug
## 1 Y
## 2 N
# fifth entry
$revContent[5] d
## [1] "Just deleted No I don't want to sign in or sign up for anything stop asking"
$revBug[5] d
## [1] N
## Levels: N Y
Creating a Document-Term Matrix (DTM)
Now, we can explore things such as “which words are associated with”feature”?”
# which words are associated with "bug"?
findAssocs(dtm, 'bug', .3) # minimum correlation of 0.3. Change accordingly.
## $bug
## it? mini major users causing ipad
## 1.00 0.92 0.91 0.80 0.62 0.57
And find frequent terms.
findFreqTerms(dtm, 15) #terms that appear 15 or more times, in this case
## [1] "google" "map" "like" "app" "just" "good"
## [7] "crashes" "maps" "time" "get" "much" "really"
## [13] "update" "great" "nice" "best" "ever" "fun"
## [19] "review" "love" "awesome" "cool" "amazing" "game"
## [25] "clans" "clash" "game." "game!" "addicting" "play"
## [31] "playing" "addictive"
Remove some terms
<- 0.90 # will make the matrix 90% empty space, maximum. Change this, as you like.
sparseparam <- removeSparseTerms(dtm,sparse=sparseparam)
dtm_sprs inspect(dtm_sprs)
## <<DocumentTermMatrix (documents: 789, terms: 9)>>
## Non-/sparse entries: 1233/5868
## Sparsity : 83%
## Maximal term length: 7
## Weighting : term frequency - inverse document frequency (normalized) (tf-idf)
## Sample :
## Terms
## Docs app awesome best clash fun game good great love
## 159 0 0.00 0 1.6 0 0 0.0 0 1.46
## 163 0 3.12 0 0.0 0 0 0.0 0 0.00
## 178 0 3.12 0 0.0 0 0 0.0 0 0.00
## 400 0 0.00 0 0.0 0 0 3.1 0 0.00
## 421 0 0.00 0 0.0 0 0 3.1 0 0.00
## 472 0 0.00 0 0.0 0 0 3.1 0 0.00
## 50 0 0.00 0 0.0 0 0 3.1 0 0.00
## 525 0 1.56 0 0.0 0 0 0.0 0 1.46
## 527 0 0.00 0 0.0 0 0 3.1 0 0.00
## 532 0 0.00 0 1.6 0 0 0.0 0 1.46
<-paste0("Most frequent terms (sparseness=" ,sparseparam , " )")
maintitle barplot(as.matrix(dtm_sprs),xlab="terms",ylab="number of occurrences", main=maintitle)
# organize terms by their frequency
<- colSums(as.matrix(dtm_sprs))
freq_dtm_sprs length(freq_dtm_sprs)
## [1] 9
<- sort(freq_dtm_sprs, decreasing = TRUE)
sorted_freq_dtm_sprs sorted_freq_dtm_sprs
## good great game awesome fun best love clash app
## 77.8 68.8 68.7 64.6 55.8 54.1 45.4 42.5 31.3
Create a data frame that will be the input to the classifier. Last column will be the label.
As data frame:
#dtmdf <- as.data.frame(dtm.90)
#dtmdf <- as.data.frame(inspect(dtm_sprs))
<- as.data.frame(as.matrix(dtm_sprs))
dtmdf # rownames(dtm)<- 1:nrow(dtm)
<- d$revBug
class <- cbind(dtmdf,class)
dtmdf head(dtmdf, 3)
Use any classifier now: - split the dataframe into training and testing - Build the classification model using the training subset - apply the model to the testing subset and obtain the Confusion Matrix - Analise the results
library(caret)
library(randomForest)
<- createDataPartition(dtmdf$class, p = .75, list = FALSE)
inTraining <- dtmdf[ inTraining,]
training <- dtmdf[-inTraining,]
testing
<- trainControl(## 5-fold CV
fitControl method = "repeatedcv",
number = 5,
## repeated ten times
repeats = 5)
<- train(class ~ ., data = training,
gbmFit1 method = "gbm",
trControl = fitControl,
## This last option is actually one
## for gbm() that passes through
verbose = FALSE)
gbmFit1
## Stochastic Gradient Boosting
##
## 593 samples
## 9 predictor
## 2 classes: 'N', 'Y'
##
## No pre-processing
## Resampling: Cross-Validated (5 fold, repeated 5 times)
## Summary of sample sizes: 475, 474, 474, 474, 475, 475, ...
## Resampling results across tuning parameters:
##
## interaction.depth n.trees Accuracy Kappa
## 1 50 0.798 0.000
## 1 100 0.801 0.081
## 1 150 0.806 0.189
## 2 50 0.805 0.149
## 2 100 0.802 0.219
## 2 150 0.798 0.211
## 3 50 0.806 0.215
## 3 100 0.802 0.236
## 3 150 0.801 0.233
##
## Tuning parameter 'shrinkage' was held constant at a value of 0.1
##
## Tuning parameter 'n.minobsinnode' was held constant at a value of 10
## Accuracy was used to select the optimal model using the largest value.
## The final values used for the model were n.trees = 50, interaction.depth =
## 3, shrinkage = 0.1 and n.minobsinnode = 10.
# trellis.par.set(caretTheme())
# plot(gbmFit1)
#
# trellis.par.set(caretTheme())
# plot(gbmFit1, metric = "Kappa")
head(predict(gbmFit1, testing, type = "prob"))
## N Y
## 1 0.690 0.3105
## 2 0.583 0.4166
## 3 0.690 0.3105
## 4 0.908 0.0919
## 5 0.353 0.6472
## 6 0.690 0.3105
<- confusionMatrix(testing$class, predict(gbmFit1, testing))
conf_mat conf_mat
## Confusion Matrix and Statistics
##
## Reference
## Prediction N Y
## N 152 5
## Y 27 12
##
## Accuracy : 0.837
## 95% CI : (0.777, 0.886)
## No Information Rate : 0.913
## P-Value [Acc > NIR] : 0.999819
##
## Kappa : 0.35
##
## Mcnemar's Test P-Value : 0.000205
##
## Sensitivity : 0.849
## Specificity : 0.706
## Pos Pred Value : 0.968
## Neg Pred Value : 0.308
## Prevalence : 0.913
## Detection Rate : 0.776
## Detection Prevalence : 0.801
## Balanced Accuracy : 0.778
##
## 'Positive' Class : N
##
We may compute manually all derived variables from the Confusion Matrix. See Section – with the description of the Confusion Matrix
# str(conf_mat)
<- conf_mat$table[1,1]
TruePositive TruePositive
## [1] 152
<- conf_mat$table[1,2]
FalsePositive FalsePositive
## [1] 5
<- conf_mat$table[2,1]
FalseNegative FalseNegative
## [1] 27
<- conf_mat$table[2,2]
TrueNegative TrueNegative
## [1] 12
# Sum columns in the confusion matrix
<- TruePositive + FalseNegative
ConditionPositive <- FalsePositive + TrueNegative
ConditionNegative <- ConditionPositive + ConditionNegative
TotalPopulation TotalPopulation
## [1] 196
#Sum rows in the confusion matrix
<- TruePositive + FalsePositive
PredictedPositive <- FalseNegative + TrueNegative
PredictedNegative # Total Predicted must be equal to the total population
+PredictedNegative PredictedPositive
## [1] 196
<- TruePositive / ConditionPositive
SensitivityRecall_TPR SensitivityRecall_TPR
## [1] 0.849
<- TrueNegative / ConditionNegative
Specificity_TNR_SPC Specificity_TNR_SPC
## [1] 0.706
<- TruePositive / PredictedPositive
Precision_PPV Precision_PPV
## [1] 0.968
<- TrueNegative / PredictedNegative
NegativePredictedValue_NPV NegativePredictedValue_NPV
## [1] 0.308
<- ConditionPositive / TotalPopulation
Prevalence Prevalence
## [1] 0.913
<- (TruePositive + TrueNegative) / TotalPopulation
Accuracy_ACC Accuracy_ACC
## [1] 0.837
<- FalsePositive / PredictedPositive
FalseDiscoveryRate_FDR FalseDiscoveryRate_FDR
## [1] 0.0318
<- FalseNegative / PredictedNegative
FalseOmisionRate_FOR FalseOmisionRate_FOR
## [1] 0.692
<- FalsePositive / ConditionNegative
FallOut_FPR FallOut_FPR
## [1] 0.294
<- FalseNegative / ConditionPositive
MissRate_FNR MissRate_FNR
## [1] 0.151
And finally, a word cloud as an example that appears everywhere these days.
library(wordcloud)
# calculate the frequency of words and sort in descending order.
=sort(colSums(as.matrix(dtm_sprs)),decreasing=TRUE)
wordFreqs
wordcloud(words=names(wordFreqs),freq=wordFreqs)
11.3 Extracting data from Twitter
The hardest bit is to link with Twitter. Using the TwitteR package is explained following this example.


| # | Month | Basic: | HRA: | Total income: | Rent paid: |
|---|
| Actual HRA received from employer | |
| Actual rent paid diff 10% of salary | |
| 50% (since metro city) of basic salary | |
| Exemption (Least of above) |
| Bracket (Lakhs) | Percentage (%) | Taxable amount | Tax |
|---|---|---|---|
| 0 - 2.5 | 0 | ||
| 2.5 - 5 | 5 | ||
| 5 - 10 | 20 | ||
| 10+ | 30 | ||
| Total | |||
| CESS (3%) |


Timezone is the base class of all timezones. It provides a factory method, 'get', to access timezones by identifier. Once a specific Timezone has been retrieved, DateTimes, Times and timestamps can be converted between the UTC and the local time for the zone. For example:
tz = TZInfo::Timezone.get('America/New_York') puts tz.utc_to_local(DateTime.new(2005,8,29,15,35,0)).to_s puts tz.local_to_utc(Time.utc(2005,8,29,11,35,0)).to_s puts tz.utc_to_local(1125315300).to_s
Each time conversion method returns an object of the same type it was passed.
The Timezone class is thread-safe. It is safe to use class and instance methods of Timezone in concurrently executing threads. Instances of Timezone can be shared across thread boundaries.
Loads a marshalled Timezone.
# File lib/tzinfo/timezone.rb, line 610 def self._load(data) Timezone.get(data) end
Returns an array containing all the available Timezones.
Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required.
# File lib/tzinfo/timezone.rb, line 123 def self.all get_proxies(all_identifiers) end
Returns all the zone identifiers defined for all Countries. This is not the complete set of zone identifiers as some are not country specific (e.g. 'Etc/GMT'). You can obtain a Timezone instance for a given identifier with the get method.
# File lib/tzinfo/timezone.rb, line 179 def self.all_country_zone_identifiers Country.all_codes.inject([]) do |zones,country| zones += Country.get(country).zone_identifiers end.uniq end
Returns all the Timezones defined for all Countries. This is not the complete set of Timezones as some are not country specific (e.g. 'Etc/GMT').
Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required.
# File lib/tzinfo/timezone.rb, line 169 def self.all_country_zones Country.all_codes.inject([]) do |zones,country| zones += Country.get(country).zones end.uniq end
Returns an array containing the identifiers of all the available Timezones that are based on data (are not links to other Timezones)..
# File lib/tzinfo/timezone.rb, line 144 def self.all_data_zone_identifiers data_source.data_timezone_identifiers end
Returns an array containing all the available Timezones that are based on data (are not links to other Timezones).
Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required.
# File lib/tzinfo/timezone.rb, line 138 def self.all_data_zones get_proxies(all_data_zone_identifiers) end
Returns an array containing the identifiers of all the available Timezones.
# File lib/tzinfo/timezone.rb, line 129 def self.all_identifiers data_source.timezone_identifiers end
Returns an array containing the identifiers of all the available Timezones that are links to other Timezones.
# File lib/tzinfo/timezone.rb, line 159 def self.all_linked_zone_identifiers data_source.linked_timezone_identifiers end
Returns an array containing all the available Timezones that are links to other Timezones.
Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required.
# File lib/tzinfo/timezone.rb, line 153 def self.all_linked_zones get_proxies(all_linked_zone_identifiers) end
Gets the default value of the optional dst parameter of the #local_to_utc and #period_for_local methods. Can be set to nil, true or false.
# File lib/tzinfo/timezone.rb, line 73 def self.default_dst @@default_dst end
Sets the default value of the optional dst parameter of the #local_to_utc and #period_for_local methods. Can be set to nil, true or false.
The value of ::default_dst defaults to nil if unset.
# File lib/tzinfo/timezone.rb, line 66 def self.default_dst=(value) @@default_dst = value.nil? ? nil : !!value end
Returns a timezone by its identifier (e.g. “Europe/London”, “America/Chicago” or “UTC”).
Raises InvalidTimezoneIdentifier if the timezone couldn't be found.
# File lib/tzinfo/timezone.rb, line 81 def self.get(identifier) instance = @@loaded_zones[identifier] unless instance # Thread-safety: It is possible that multiple equivalent Timezone # instances could be created here in concurrently executing threads. # The consequences of this are that the data may be loaded more than # once (depending on the data source) and memoized calculations could # be discarded. The performance benefit of ensuring that only a single # instance is created is unlikely to be worth the overhead of only # allowing one Timezone to be loaded at a time. info = data_source.load_timezone_info(identifier) instance = info.create_timezone @@loaded_zones[instance.identifier] = instance end instance end
Returns a proxy for the Timezone with the given identifier. The proxy will cause the real timezone to be loaded when an attempt is made to find a period or convert a time. ::get_proxy will not validate the identifier. If an invalid identifier is specified, no exception will be raised until the proxy is used.
# File lib/tzinfo/timezone.rb, line 105 def self.get_proxy(identifier) TimezoneProxy.new(identifier) end
If identifier is nil calls super(), otherwise calls get. An identfier should always be passed in when called externally.
# File lib/tzinfo/timezone.rb, line 111 def self.new(identifier = nil) if identifier get(identifier) else super() end end
Returns all US zone identifiers. A shortcut for TZInfo::Country.get('US').zone_identifiers.
# File lib/tzinfo/timezone.rb, line 196 def self.us_zone_identifiers Country.get('US').zone_identifiers end
Returns all US Timezone instances. A shortcut for TZInfo::Country.get('US').zones.
Returns TimezoneProxy objects to avoid the overhead of loading Timezone definitions until a conversion is actually required.
# File lib/tzinfo/timezone.rb, line 190 def self.us_zones Country.get('US').zones end
Returns the current DataSource.
# File lib/tzinfo/timezone.rb, line 628 def self.data_source DataSource.get end
Returns an array of proxies corresponding to the given array of identifiers.
# File lib/tzinfo/timezone.rb, line 623 def self.get_proxies(identifiers) identifiers.collect {|identifier| get_proxy(identifier)} end
Initializes @@loaded_zones.
# File lib/tzinfo/timezone.rb, line 616 def self.init_loaded_zones @@loaded_zones = ThreadSafe::Cache.new end
Compares two Timezones based on their identifier. Returns -1 if tz is less than self, 0 if tz is equal to self and +1 if tz is greater than self.
Returns nil if tz is not comparable with Timezone instances.
# File lib/tzinfo/timezone.rb, line 588 def <=>(tz) return nil unless tz.is_a?(Timezone) identifier <=> tz.identifier end
Dumps this Timezone for marshalling.
# File lib/tzinfo/timezone.rb, line 605 def _dump(limit) identifier end
Returns the canonical identifier for this Timezone.
This is a shortcut for calling canonical_zone.identifier. Please refer to the #canonical_zone documentation for further information.
# File lib/tzinfo/timezone.rb, line 538 def canonical_identifier canonical_zone.identifier end
Returns the canonical Timezone instance for this Timezone.
The IANA Time Zone database contains two types of definition: Zones and Links. Zones are defined by rules that set out when transitions occur. Links are just references to fully defined Zone, creating an alias for that Zone.
Links are commonly used where a time zone has been renamed in a release of the Time Zone database. For example, the Zone US/Eastern was renamed as America/New_York. A US/Eastern Link was added in its place, linking to (and creating an alias for) for America/New_York.
Links are also used for time zones that are currently identical to a full Zone, but that are administered seperately. For example, Europe/Vatican is a Link to (and alias for) Europe/Rome.
For a full Zone, #canonical_zone returns self.
For a Link, #canonical_zone returns a Timezone instance representing the full Zone that the link targets.
TZInfo can be used with different data sources (see the documentation for TZInfo::DataSource). Please note that some DataSource implementations may not support distinguishing between full Zones and Links and will treat all time zones as full Zones. In this case, the #canonical_zone will always return self.
There are two built-in DataSource implementations. RubyDataSource (which will be used if the tzinfo-data gem is available) supports Link zones. ZoneinfoDataSource returns Link zones as if they were full Zones. If the #canonical_zone or #canonical_identifier methods are required, the tzinfo-data gem should be installed.
The TZInfo::DataSource.get method can be used to check which DataSource implementation is being used.
# File lib/tzinfo/timezone.rb, line 343 def canonical_zone raise_unknown_timezone end
Returns the TimezonePeriod for the current time.
# File lib/tzinfo/timezone.rb, line 548 def current_period period_for_utc(Time.now.utc) end
Returns the current Time and TimezonePeriod as an array. The first element is the time, the second element is the period.
# File lib/tzinfo/timezone.rb, line 554 def current_period_and_time utc = Time.now.utc period = period_for_utc(utc) [period.to_local(utc), period] end
Returns true if and only if the identifier of tz is equal to the identifier of this Timezone.
# File lib/tzinfo/timezone.rb, line 595 def eql?(tz) self == tz end
Returns a friendlier version of the identifier. Set skip_first_part to omit the first part of the identifier (typically a region name) where there is more than one part.
For example:
Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana"
# File lib/tzinfo/timezone.rb, line 231 def friendly_identifier(skip_first_part = false) parts = identifier.split('/') if parts.empty? # shouldn't happen identifier elsif parts.length == 1 parts[0] else if skip_first_part result = '' else result = parts[0] + ' - ' end parts[1, parts.length - 1].reverse_each {|part| part.gsub!(/_/, ' ') if part.index(/[a-z]/) # Missing a space if a lower case followed by an upper case and the # name isn't McXxxx. part.gsub!(/([^M][a-z])([A-Z])/, '\1 \2') part.gsub!(/([M][a-bd-z])([A-Z])/, '\1 \2') # Missing an apostrophe if two consecutive upper case characters. part.gsub!(/([A-Z])([A-Z])/, '\1\\2') end result << part result << ', ' } result.slice!(result.length - 2, 2) result end end
Returns a hash of this Timezone.
# File lib/tzinfo/timezone.rb, line 600 def hash identifier.hash end
The identifier of the timezone, e.g. “Europe/Paris”.
# File lib/tzinfo/timezone.rb, line 201 def identifier raise_unknown_timezone end
Returns internal object state as a programmer-readable string.
# File lib/tzinfo/timezone.rb, line 217 def inspect "#<#{self.class}: #{identifier}>" end
Converts a time in the local timezone to UTC. local can either be a DateTime, Time or timestamp (Time.to_i). The returned time has the same type as local. Any timezone information in local is ignored (it is treated as a local time).
Warning: There are local times that have no equivalent UTC times (e.g. in the transition from standard time to daylight savings time). There are also local times that have more than one UTC equivalent (e.g. in the transition from daylight savings time to standard time).
In the first case (no equivalent UTC time), a PeriodNotFound exception will be raised.
In the second case (more than one equivalent UTC time), an AmbiguousTime exception will be raised unless the optional dst parameter or block handles the ambiguity.
If the ambiguity is due to a transition from daylight savings time to standard time, the dst parameter can be used to select whether the daylight savings time or local time is used. For example,
Timezone.get('America/New_York').local_to_utc(DateTime.new(2004,10,31,1,30,0))
would raise an AmbiguousTime exception.
Specifying dst=true would return 2004-10-31 5:30:00. Specifying dst=false would return 2004-10-31 6:30:00.
If the dst parameter does not resolve the ambiguity, and a block is specified, it is called. The block must take a single parameter - an array of the periods that need to be resolved. The block can return a single period to use to convert the time or return nil or an empty array to cause an AmbiguousTime exception to be raised.
The default value of the dst parameter can be specified by setting ::default_dst. If ::default_dst is not set, or is set to nil, then an AmbiguousTime exception will be raised in ambiguous situations unless a block is given to resolve the ambiguity.
# File lib/tzinfo/timezone.rb, line 469 def local_to_utc(local, dst = Timezone.default_dst) TimeOrDateTime.wrap(local) {|wrapped| if block_given? period = period_for_local(wrapped, dst) {|periods| yield periods } else period = period_for_local(wrapped, dst) end period.to_utc(wrapped) } end
An alias for identifier.
# File lib/tzinfo/timezone.rb, line 206 def name # Don't use alias, as identifier gets overridden. identifier end
Returns the current time in the timezone as a Time.
# File lib/tzinfo/timezone.rb, line 543 def now utc_to_local(Time.now.utc) end
Returns information about offsets used by the Timezone up to a given date and time, specified using UTC (utc_to). The information is returned as an Array of TimezoneOffset instances.
A from date and time may also be supplied using the utc_from parameter (also specified in UTC). If utc_from is not nil, only offsets used from that date and time forward will be returned.
Comparisons with utc_to are exclusive. Comparisons with utc_from are inclusive.
Offsets may be returned in any order.
utc_to and utc_from can be specified using either DateTime, Time or integer timestamps (Time.to_i).
If utc_from is specified and utc_to is not greater than utc_from, then #offsets_up_to raises an ArgumentError exception.
# File lib/tzinfo/timezone.rb, line 499 def offsets_up_to(utc_to, utc_from = nil) utc_to = TimeOrDateTime.wrap(utc_to) transitions = transitions_up_to(utc_to, utc_from) if transitions.empty? # No transitions in the range, find the period that covers it. if utc_from # Use the from date as it is inclusive. period = period_for_utc(utc_from) else # utc_to is exclusive, so this can't be used with period_for_utc. # However, any time earlier than utc_to can be used. # Subtract 1 hour (since this is one of the cached OffsetRationals). # Use add_with_convert so that conversion to DateTime is performed if # required. period = period_for_utc(utc_to.add_with_convert(-3600)) end [period.offset] else result = Set.new first = transitions.first result << first.previous_offset unless utc_from && first.at == utc_from transitions.each do |t| result << t.offset end result.to_a end end
Returns the TimezonePeriod for the given local time. local can either be a DateTime, Time or integer timestamp (Time.to_i). Any timezone information in local is ignored (it is treated as a time in the current timezone).
Warning: There are local times that have no equivalent UTC times (e.g. in the transition from standard time to daylight savings time). There are also local times that have more than one UTC equivalent (e.g. in the transition from daylight savings time to standard time).
In the first case (no equivalent UTC time), a PeriodNotFound exception will be raised.
In the second case (more than one equivalent UTC time), an AmbiguousTime exception will be raised unless the optional dst parameter or block handles the ambiguity.
If the ambiguity is due to a transition from daylight savings time to standard time, the dst parameter can be used to select whether the daylight savings time or local time is used. For example,
Timezone.get('America/New_York').period_for_local(DateTime.new(2004,10,31,1,30,0))
would raise an AmbiguousTime exception.
Specifying dst=true would the daylight savings period from April to October 2004. Specifying dst=false would return the standard period from October 2004 to April 2005.
If the dst parameter does not resolve the ambiguity, and a block is specified, it is called. The block must take a single parameter - an array of the periods that need to be resolved. The block can select and return a single period or return nil or an empty array to cause an AmbiguousTime exception to be raised.
The default value of the dst parameter can be specified by setting ::default_dst. If ::default_dst is not set, or is set to nil, then an AmbiguousTime exception will be raised in ambiguous situations unless a block is given to resolve the ambiguity.
# File lib/tzinfo/timezone.rb, line 386 def period_for_local(local, dst = Timezone.default_dst) results = periods_for_local(local) if results.empty? raise PeriodNotFound elsif results.size < 2 results.first else # ambiguous result try to resolve if !dst.nil? matches = results.find_all {|period| period.dst? == dst} results = matches if !matches.empty? end if results.size < 2 results.first else # still ambiguous, try the block if block_given? results = yield results end if results.is_a?(TimezonePeriod) results elsif results && results.size == 1 results.first else raise AmbiguousTime, "#{local} is an ambiguous local time." end end end end
Returns the TimezonePeriod for the given UTC time. utc can either be a DateTime, Time or integer timestamp (Time.to_i). Any timezone information in utc is ignored (it is treated as a UTC time).
# File lib/tzinfo/timezone.rb, line 270 def period_for_utc(utc) raise_unknown_timezone end
Returns the set of TimezonePeriod instances that are valid for the given local time as an array. If you just want a single period, use #period_for_local instead and specify how ambiguities should be resolved. Returns an empty array if no periods are found for the given time.
# File lib/tzinfo/timezone.rb, line 278 def periods_for_local(local) raise_unknown_timezone end
Converts a time in UTC to local time and returns it as a string according to the given format. The formatting is identical to Time.strftime and DateTime.strftime, except %Z is replaced with the timezone abbreviation for the specified time (for example, EST or EDT).
# File lib/tzinfo/timezone.rb, line 566 def strftime(format, utc = Time.now.utc) period = period_for_utc(utc) local = period.to_local(utc) local = Time.at(local).utc unless local.kind_of?(Time) || local.kind_of?(DateTime) abbreviation = period.abbreviation.to_s.gsub(/%/, '%%') format = format.gsub(/(.?)%Z/) do if $1 == '%' # return %%Z so the real strftime treats it as a literal %Z too '%%Z' else "#$1#{abbreviation}" end end local.strftime(format) end
Returns a friendlier version of the identifier.
# File lib/tzinfo/timezone.rb, line 212 def to_s friendly_identifier end
Returns an Array of TimezoneTransition instances representing the times where the UTC offset of the timezone changes.
Transitions are returned up to a given date and time up to a given date and time, specified in UTC (utc_to).
A from date and time may also be supplied using the utc_from parameter (also specified in UTC). If utc_from is not nil, only transitions from that date and time onwards will be returned.
Comparisons with utc_to are exclusive. Comparisons with utc_from are inclusive. If a transition falls precisely on utc_to, it will be excluded. If a transition falls on utc_from, it will be included.
Transitions returned are ordered by when they occur, from earliest to latest.
utc_to and utc_from can be specified using either DateTime, Time or integer timestamps (Time.to_i).
If utc_from is specified and utc_to is not greater than utc_from, then #transitions_up_to raises an ArgumentError exception.
# File lib/tzinfo/timezone.rb, line 304 def transitions_up_to(utc_to, utc_from = nil) raise_unknown_timezone end
Converts a time in UTC to the local timezone. utc can either be a DateTime, Time or timestamp (Time.to_i). The returned time has the same type as utc. Any timezone information in utc is ignored (it is treated as a UTC time).
# File lib/tzinfo/timezone.rb, line 425 def utc_to_local(utc) TimeOrDateTime.wrap(utc) {|wrapped| period_for_utc(wrapped).to_local(wrapped) } end
Raises an UnknownTimezone exception.
# File lib/tzinfo/timezone.rb, line 633 def raise_unknown_timezone raise UnknownTimezone, 'TZInfo::Timezone constructed directly' end


The competition is entirely organized and run by undergraduate and graduate students affiliated with Princeton University. It was launched by
Pavel Shibayev '15 in 2014 and coordinated jointly with
Luca Iliesiu '15. The Organizing Team of the first edition of this competition is listed
here.
The following individuals are organizing PUPC-2015:
Permanent Board |
| Pavel Shibayev, Ming-Yee Tsang, Luca Iliesiu, Roberta Raileanu; PUPC-2015 Organizing Committee members |
For any inquiries about the Princeton University Physics Competition, please e-mail us at
<EMAIL_ADDRESS>with your questions or comments. We will do our best to get back to you ASAP. Thank you!


Yellow weather warning for heavy rain to hit Scotland this weekend
Flooding of a few homes and businesses is likely and bus and train services will be affected with journey times taking longer.
by Jennifer Russell, https://www.dailyrecord.co.uk/authors/jennifer-russell/Scotland is set to be battered with heavy rain this weekend as a yellow weather warning from the Met Office has been issued.
Persistent and heavy rain on Saturday and into Sunday is likely to bring some disruption from flooding in the north east of the country.
Angus, Aberdeen , Moray. and the Highlands will all be affected with rainfall of up to 80mm expected in some places.
A Met Office spokesperson said: Persistent and occasionally heavy rain is expected to develop across northeastern Scotland on Saturday.
"Rainfall accumulations of 25 to 40 mm are likely through Aberdeenshire, eastern Moray and northern Angus and as much as 60-80 mm across Easter Ross and Caithness, perhaps a little more over high ground. Rain will lose intensity through Sunday.
"Flooding of a few homes and businesses is likely. Bus and train services probably affected with journey times taking longer, and spray and flooding on roads probably making journey times longer."
The yellow weather warning will be in place from 6am on Saturday morning until noon on Sunday.
It comes as the Met Office issues "danger to life warnings" for wind and gales for parts of down south. However, Scotland will miss the worst of it.


_Wild_Wild_West_ (PG-13) ** (out of ****)
Every summer has one: a film that, from early indications, appears to be a surefire blockbuster, but finds itself under a billowing cloud of bad buzz as its release date approaches. Last year, it was TriStar's _Godzilla_; this year's whipping boy has been Warner Bros.'s _Wild_Wild_West_, which arrives on screens in time for the July 4th weekend amid a flurry of talk of budget overruns and poor insider screenings. The good news: the adaptation of the 1960s television series is far from the excrutiating embarrassment the studio had last year with the similarly-conceived _The_Avengers_. The bad news: that fact doesn't necessarily make this shockingly flat comedy-adventure much better a movie.
The parts certainly appeared to be in place. Independence day box office king Will Smith and another consistently entertaining star, Kevin Kline, team up as 19th century U.S. government agents James West and Artemus Gordon, respectively, for Smith's _Men_in_Black_ director, Barry Sonnenfeld. Providing the villainy as Arliss Loveless, the wheelchair-bound, arachnid-obsessed mad genius determined to seize control of the country, is no less than multiple Oscar nominee Kenneth Branagh. And as a final dash of spice, Salma Hayek is on hand to lend her sexy screen presence as lingerie-clad saloon entertainer Rita Escobar.
Oddly enough, like a botched chemical equation, these seemingly perfect ingredients combine into a fizzle. Together, live wires Smith and Kline should combust in theory. But while they do have a couple of moments of spirited repartee, their overall lukewarm rapport won't make anyone forget Smith's sterling bond with Tommy Lee Jones in _MiB_. In fact, despite his ever-magnetic screen presence, Smith is an ill fit for the part of West. He is a versatile performer able to adequately tackle both drama and comedy, but his limits are tested as a largely deadpan tough guy.  For example, following the disposal of a blade-wielding villain, West not-so-wisely cracks, "No more Mr. Knife Guy."
The other two above-the-title stars don't fare much better. The casting of Shakespearean Branagh as a legless baddie should be a hoot, but he, like Sean Connery in _The_Avengers_, strains too hard to be outrageously over-the-top that he drains the character of any sense of fun. Hayek's bubbly playfulness could have compensated--that is, if she had anything remotely resembling an actual character to play. In her scant screen time, Hayek is called on to lavish compliments on either Gordon or (especially) West, model revealing outfits, and flash her buttocks. What a progressive role for a woman.
Sonnenfeld was obviously too busy paying attention to _Wild_Wild_West_'s technical aspects to notice what was going on with his actors. The digital effects used to depict Loveless's signature machine of destruction, the Tarantula, are spectacular and blend seamlessly with the real-life footage. Bo Welch's production design imaginatively blends period Western touches with more modern innovation, particularly in West and Gordon's specially-equipped train car, the Wanderer. As lackluster as many of the lines get, other details in the production keep the film watchable.
In the end, that's all _Wild_Wild_West_ is--watchable; not necessarily awful, yet certainly not good, either. But mere watchability isn't exactly what moviegoers are looking for when buying a ticket for _Wild_Wild_West_; they want some plain old summer movie fun and excitement. Unfortunately, Smith isn't the man to give it to them--at least not this summer.
Michael Dequina
<EMAIL_ADDRESS>|<EMAIL_ADDRESS>Mr. Brown's Movie Site: http://welcome.to/mrbrown
CompuServe Hollywood Hotline: http://www.HollywoodHotline.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


This week with my DBC work, we finally delved into Ruby. I was pretty both excited and terrified as we're now entering territory that I have no familiarity with at all. And somehow I made it through and I've even got a bit of knowledge to show for it. In the world of programming, learning the different languages is surprisingly similar to learning human language. There's nouns (well, objects, really) and even verbs or, in this case, methods. I'm happy to introduce two different objects I met this week: Arrays and Hashes. Each host many different objects, but how they host them is the key to understanding the differences.
Arrays are the hub of storing data, like say, a list of your peers from high school...
Of course, you can combine multiple arrays into one...
You can even do things like see how many people you graduated (count how many things are in the array, which could also be numbers)
But what if I wanted to attach valuable information to each of these people in the Class of 2008? Arrays are great for lists of people, numbers, anything really, but if we want to link each item to another piece a data, flash the Hash signal in the sky!
Hashes are fantastic things that have keys (must be a unique name or object) linked to values (can be the same as other values). In our example thus far, your name would be a key. Let's create a hash for everyone's GPA's...
You'll notice that I named that hash "north_shore_gpas" and each student was linked to their GPA with this combination of symbols: => And all of that was wonderfully wrapped up in curly brackets.


Toggle navigation
TREY
ROBINSON
Home
About
Articles
Contact
Message sent! I will respond as soon as possible.
There was a problem sending your message!
Send me a message
Your name
Email address
Message
Send your email


Styleguide - v.2 2015/6/5
Small
Medium
Large
Full
Menu
Menu
Introduction
Colors
Typography
Buttons
Lists
Forms
Tables
Templates


FESTIVAL DATES
FESTIVAL NAME
MONTH
HOLI
MARCH
ID
AUGUST
JANMASTAMI
AUGUST
DURGA PUJA
OCTOBER
DIWALI
NOVEMBER
CHRISTMAS
DECEMBER


Class: Setting
- Inherits:
-
Object
- Object
- Setting
- Includes:
- DataMapper::Resource, Facet::DataMapper::Resource
- Defined in:
- app/models/setting.rb
Overview
This allows for storing and retrieving settings across Yogo Applications
Constant Summary
- @@cache =
{}
Class Method Summary (collapse)
-
+ (Object or nil) [](key)
Used to query the settings basied on a key.
-
+ (Boolean) []=(key, value)
Used to set a value for a particular key.
-
+ (Array) names
Used to get the keys of the current setting.
Methods included from Facet::DataMapper::Resource
Class Method Details
+ (Object or nil) [](key)
Used to query the settings basied on a key
40 41 42 43 44 45 46 47 48 49 |
# File 'app/models/setting.rb', line 40 def self.[](key) key = key.to_s if key.is_a? Symbol setting = if @@cache.has_key?(key) @@cache[key] else temp = first(:name => key) @@cache[key] = temp.nil? ? nil : temp.value end setting.nil? ? false : setting end |
+ (Boolean) []=(key, value)
Used to set a value for a particular key
67 68 69 70 71 72 73 |
# File 'app/models/setting.rb', line 67 def self.[]=(key,value) key = key.to_s if key.is_a? Symbol @@cache[key] = value setting = first_or_create(:name => key) setting.value = value setting.save end |
+ (Array) names
Used to get the keys of the current setting
86 87 88 |
# File 'app/models/setting.rb', line 86 def self.names all.map { |setting| setting.name.to_s } end |


Work Day Scheduler
A simple calendar app for scheduling your work day
9am
Save
10am
Save
11am
Save
12pm
Save
1pm
Save
2pm
Save
3pm
Save
4pm
Save
5pm
Save


At this moment I am looking at my Harmine HCL crystals growing on a plate... I saw this extraction somewhere else on the net, and didn't know If anyone had tried it, but it works...  I hadn't cleaned all my glass properly, and I didn't have what I needed at that time....
Now I have seen harmine hcl for sale online and in can cost as much as $100 a gram, and you can buy a pound of seeds for less than half that and do your own extraction.... hmmmm
Anyway, here is the process I used to get the beautiful 1-4 mm long crystals growing on my plate...
Step one:
Take your harmala seeds and boil 'em ( you can add an acid or not. I always add a little vinegar, never measure though). When they have boiled for about 30 mins, strain the water with a tea strainer into a pyrex measuring cup/mixing bowl thing you can get from a grocery store. Boil 'em again... strain into the same container. Boil 'em again... strain into the same container.
Step two:
Dump the seeds and wash the pot you were using. Boil some water and add rock salt (important to use rock salt because there is noting add to it, regular table salt fas stuff add to it. If you have to use table salt, make sure it doesn't have Iodine in it). Keep adding rock salt to your booiling water 'till No more disolves, so now you have a super saturated salt-water solution....
Step three:
Strain the hot salt water into you hamarla boilings to keep out the salt rocks, Only adding enough salt water so that you have 2 or 3 parts harmala-water and 1 part Salt-water. I try to make sure that I have 3 times as much harmala solution as I have salt water.
Step four:
Stir it all up, then add a little bit of cold water to aid in the cooling of the mixture...SOMETHING should precipitate out. That's a good thing: the crystals form when the temp of the solution drops. Put it in the freezer for an hour. After that put it in the fridge for a few hours (longer if ya like, but three of four hours is what I did).
Step five:
There should be a whole bunch of crystals and grunge at the bottom of your container It doesn't matter how big the crystals are just yet.... I could hardly notice that they were actually crystals, the just happened to be about 1 mm little needles. Now it should be strained again...I used a bandanna to strain, but a t-shirt will work...
Step six:
It should look like you have extracted sparkling dirt from the seeds...  The sparkles dissolve and the crunge doesn't... strain again through a t-shirt and into your a flat Pyrex baking dish or onto a clear plate. Place under a fan or somewhere with adequate ventilation and wait and watch....
Beautiful crystals
This is what Legal highs has to say about harmine
HARMINE -- 7-methoxy-1-methyl-9H-pyrido (3,4-b) indole.
Material: Indole-based alkaloid found in several places including
_Banisteriopsis caapi_ (from which the South American hallucinogenic
brew yage is prepared), _Peganum harmala_ (Syrian rue), _Zygophyllum
fabago_ and _Passiflora incarnata._
Usage: 25-750 mg harmine (see effects) is ingested on an empty
stomach. In its hydrochloride form harmine may be snorted (20-200
mg). Injection dosges are smaller: SC 40-70 mg, IV 10-30 mg.
Absorbed poorly through stomach. Small doses (20-200 mg) effective
intrabuccally and sublingually.
Effects: Harmine and related alkaloids are serotonin antagonists,
hallucinogen, CNS stimulants, and short-term MAO inhibitors (100 x MAO
inhibition of improniazid but lasting only several hours). Small
doses (25-50 mg) act as mild and therapeutic cerebral stimulant,
sometimes producing drowsy or dreamy state for 1-2 hours. Larger
doses up to 750 mg may have hallucinogenic effect, the intensity of
which varies widely with the individual. Doses of 25-250 mg taken
with LSD or psiolcybin alter the quality of the experience of the
latter. Telepathic experiences have been reported with this
combination.
Contraindications: Harmine is a brief MAO inhibitor. It should
not be used with alcohol and certain foods and drugs (see list). When
snuffed, harmine may be slightly irritating to nasal passages. Large
amounts may depress CNS. Since individual sensitivity varies this may
occur with 250-750 mg.
Supplier: CS.
Note: Notes on other harmala alkaloids: Different harmala
alkaloids vary in potency. The equivalent of 10 mg harmine is 50 mg
harmaline, 35 mg tetrahydraharman, 25 mg harmalol or harmol, 4 mg
methoxyharmalan. Harmal alkaloids are synergistic (mutually
potentiating) and are therefore most effective when combined in an
appropriate balance. Tropines (belladonna alkaloids) also potentiate
harmals. Harmol and harmalol (phenols) in overdoses can cause
progressive CNS paralysis.
I have snorted it.... it gives good dreams.... makes my mind work in an interesting way (and faster)... Seemes to be an aphrodisiac for me (very interesting effects here).  It doesn't cause me anywhere near the nausea that regular Harmala brews and extracts do, and I have not tried it as a MAOI for tryptamines.
I hope this will be somewhat helpful for others.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


CONVERSATIONS WITHOUT BORDERS
Free, quality audio calls to anywhere around the world
using peer-to-peer technology.
'd on from /mikeal/roll-call
icon by Mackenzie Child
ohmega


{{challenge.title}}
{{challenge.description}}
Example
{{challenge.example}}
Time remaining:
{{clock}}
{{#entries}} {{^game.running}}
{{/game.running}}
{{team}}
{{strokes}}
strokes
{{^game.running}}
{{/game.running}} {{/entries}}
{{#showaddentry}}
{{#game.running}}
Add Entry
{{#err}}
Oops, your entry is incorrect
{{err}}
{{/err}}
{{/game.running}} {{^game.running}}
Game over
You can now view other solutions by clicking on them.
{{/game.running}}
View the
rules
{{/showaddentry}}


ngTouch
The $swipe service is a service that abstracts the messier details of hold-and-drag swipe behavior, to make implementing swipe-related directives more convenient.
$swipe


Information visualised in this software is based on the VicRoads “CrashStats” data set about motor vehicle accidents, which has been drawn from data.vic.gov.au. It includes over 100,000 records collected between 2006 and 2013 and has been released under Creative Commons Attribution 3.0 Australia as “Open Data” for educational purposes. For more details see the link:
http://www.data.vic.gov.au/data/dataset/crash-stats-data-extract


{{ partial "footer-widgets.html" . }} {{ partial "footer-wtf.html" . }} Top {{ partial "footer-end-scripts.html" . }} {{ partial "footer--custom-js.html" . }}


The Birdcage A Film Review By Michael Redman Copyright 1998 By Michael Redman
*** (out of ****)
This remake of "La Cage aux Folles" features a gay couple pretending to be straight in order to pull the wool over the eyes of their son's future in-laws. The couple (Robin Williams and Nathan Lane) are about as archetypal, or as the less kind might put it – stereotypical, gays possible. Williams owns a nightclub featuring drag queens where his partner performs as the featured star. They live above the club in what could not possibly be mistaken as a heterosexual abode.
Williams is excellent as should be no surprise. Gene Hackman as right-wing potential father-in-law is refreshing in one of his few comedic roles. The real star is Lane. His attempted transformation from one of the most obviously gay men in the world to the straight-shooting uncle is hilarious.
Perhaps it is a personal failing on my part, but the crying and screaming drag queen faux high drama just grates on my nerves and the first few minutes of this film are filled with it. Luckily (for me at least), it doesn't last long and the rest of the story focuses on the relationship between the men, their son and the deception.
The question of stereotypes is a touchy one.  You can almost hear the swishing. If you think that they are supposed to be representative of every gay man in the world, you'll be outraged. But if you can accept the view is that this is a movie about gay individuals, you'll love it. Your choice.
[This appeared in the 4/25/96 "Bloomington Voice", Bloomington, Indiana. Michael Redman can be contacted at<EMAIL_ADDRESS>--<EMAIL_ADDRESS>This week's film review at http://www.bvoice.com/ Film reviews archive at http://us.imdb.com/M/reviews_by?Michael%20Redman
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


System Dashboard
Power
Sign out
Shutdown
Reboot
Overview
Load
Network
Storage
Users
Processes
System Logs
Overview
Operating System
Uptime
Hostname
IP Address
Kernel
CPU(s)
Load
CPU History
Memory History
Load Average
Sensors
Device
Temperature
Network
Listening Processes
Process
User
Port
Service
Network Radar
Connections
Service
Remote Host
Network Traffic
Storage
Disk Reads/Writes
Disk Temperature
Device
Temperature
Users
Logged in Users
User
TTY
Host
Process
Recent Logins
User
Time
Host
Processes
PID
Process
User
Priority
CPU Usage
Top CPU Utilisation
PID
Process
User
Memory Usage
Top Memory Utilisation
Logs
dmesg
syslog
apache-errorlog
apache-accesslog


DACO - plot module¶
Todo
- plotting/smart plotting, i.e. show only anomalies
- pull plots based on the output from pd.dataframe.describe
- allow setting range, density, binning, etc. for each variable manually?
-
class
daco_plot.
plot
[source]¶ Class for plotting the metrics found in
daco
.-
__weakref__
¶ list of weak references to the object (if defined)
-
plotCanvas
(filename_suffix='')[source]¶ Plotting canvas of histograms for all variables in the two datasets. In order to let plots stay readable a canvas will contain maximum nine plots, if there are more than nine variables you will get several canvases.
Parameters: filename_suffix (str) – suffix in filename
-
plotCorrelation
(xlabel='', ylabel='', title='', filename='correlations')[source]¶ Plotting correlations between columns in a dataframe and saving as PNG-file.
Parameters: - xlabel (str) – label på x-aksen
- ylabel (str) – label på y-aksen
- title (str) – plottittel
- filename (str) – name of plot file
-
plotCorrelationDiff
(xlabel='', ylabel='', title='', filename='correlations')[source]¶ Plotting diff of correlations between columns in two dataframes and saving result as PNG-file.
Parameters: - xlabel (str) – label på x-aksen
- ylabel (str) – label på y-aksen
- title (str) – plottittel
- filename (str) – name of plot file
-
plotDistanceMetrics
()[source]¶ Plot boxplot of the distance metrics Kullback-Leibler, Bhattacharyya, and Hellinger for all numerical variables.
-
plotDistributionsOfVariable
(variable, filename_prefix='')[source]¶ Plotting distributions for numerical and categorical variables in dataframes. Plots are saved in
file_dir
. The plots include error bars and visualization of deviation from the real dataset.Parameters: - variable (str) – name of variable plotting histogram for
- filename_prefix (str) – prefix in filename
-
plotDistributionsOfVariableCategoricalVariables
(variable, ax1=None, ax2=None)[source]¶ Helper function for
plotDistributionsOfVariable
plotting the categorical variables in dataframe.Note
When plotting a canvas with all histograms
ax2
should not be used due to layout problems.Parameters: - variable (str) – name of variable plotting histogram for
- ax1 (obj) – axis-object for main-histogram for the variable
- ax2 (obj) – axis-object for error-histogram placed below main histogram
-
plotDistributionsOfVariableNumericalVariables
(variable, ax1=None, ax2=None)[source]¶ Helper function for
plotDistributionsOfVariable
plotting the numerical variables in dataframe.Note
When plotting a canvas with all histograms
ax2
should not be used due to layout problems.Todo
Legge inn boxplot av hellinger et.al.
Parameters: - variable (str) – name of variable plotting histogram for
- ax1 (obj) – axis-object for main-histogram for the variable
- ax2 (obj) – axis-object for error-histogram placed below main histogram
-
-
daco_plot.
sum_diff
(diff_compare, identificators)[source]¶ Returning the sum of the elements in the diff correlations matrices.
Parameters: - diff_compare (dict) – dict with the absolute difference between the correlation matrices.
- identificators (list) – list of strings which indicates what is different from one diff to the next.
Returns: diff_sum – dictionary with the sum of all elements in the correlation matrices as floats.
Return type: dict


--- title: Workshops author: '' date: '2020-05-12' slug: workshops categories: [] tags: [] description: '' topics: [] ---
Workshop sponsered by the American Sociological Association, August 10th, 11:30 AM - 1:30 PM. Click here to register for the conference. Specific details about how to register for the workshop should be available by the week of July 20.
American Statistical Association Conference on Statistical Practice (CSP2021), Feb 18th. 9 AM - 1 PM EST, 2021. Click here to register for the conference.


What is Blockchain?
Blockchain seems complicated, and it definitely can be, but its core concept is really quite simple. A blockchain is a type of database. To be able to understand blockchain, it helps to first understand what a database actually is.
 Information, or data, in databases is typically structured in table format to allow for easier searching and filtering for specific information. What is the difference between someone using a spreadsheet to store information rather than a database?
Spreadsheets are designed for one person, or a small group of people, to store and access limited amounts of information. In contrast, a database is designed to house significantly larger amounts of information that can be accessed, filtered, and manipulated quickly and easily by any number of users at once.


This controls the Digital Chroma's panel {_tapper}. It has three settings: "off" to disable it; "switches" to enable it only for switch presses; and "on" to enable it for switch presses and for changes in the value of {_selector_parameter selector parameters}.
This is contained in the {Global_parameters} section of the {Tools_screen}.
This is accessed in {_program_select_mode PROGRAM SELECT mode} using the following global parameter number:
| {sw-set-split.png height=48} {sw-9.png height=48} |
This appears in the display as Tapper Mode.
This is accessed via {_NRPN} 15,9.
| MIDI | display | ||
| 0 | off | ||
| 1 | switches | ||
| 2 | on |


Method: replace()
replace() replaces the matched pattern or patterns in the string with a replacement string. It works very similarly to JavaScript's String.replace(regex, string|function).
Syntax
var exp = new ApgExp(pattern[, flags]); var result = exp.replace(str, replacement);
Parameters
• str: string: The string to match pattern in.
• replacement: string/function
- string: The matched patterns are replaced with this string.
The string can contain the following special characters:
Pattern Inserts $$ Inserts the character "$". $` Inserts the portion of the string preceding the matched pattern. $& Inserts the matched pattern. $' Inserts the portion of the string following the matched pattern. ${name} Inserts the sub-string last matched by rule "name" or undefined if none. - function: A function with the prototype:
var func = function(result, exp){ var replacement; /* construct replacement possibly using the values */ /* in result and/or exp */ return replacement; }
Return
Returns a copy of str with the matched pattern or patterns replaced with replacement.
If the flags argument is absent or empty, only the first match in str is replaced. If flags is "g" or "y", all matches in str are replaced.
Example 1
The global flag is set, so all matches are replaced.
var pattern, str, exp, result; pattern = 'pattern = A / X\n'; pattern += 'A = "abc"\n'; pattern += 'X = "xyz"\n'; str = "---abc---xyz---ABC---XYZ---"; exp = new ApgExp(pattern, "g"); result = exp.replace(str, "555"); console.log(" str: " + str); console.log("result: " + result); /* returns */ str: ---abc---xyz---ABC---XYZ--- result: ---555---555---555---555---
Example 2
The global flag is not set, so only the first match is replaced. The replacement string contains special characters indicating a replacement string of "$-|||-$" since ||| is the prefix ($`) to the match.
var pattern, str, exp, result; pattern = 'pattern = A / X\n'; pattern += 'A = "abc"\n'; pattern += 'X = "xyz"\n'; str = "|||abc---xyz---ABC---XYZ---"; exp = new ApgExp(pattern, ""); result = exp.replace(str, "$$-$`-$$"); console.log(" str: " + str); console.log("result: " + result); /* returns */ str: |||abc---xyz---ABC---XYZ--- result: |||$-|||-$---xyz---ABC---XYZ---
Example 3
The replacement function will examine result and replace with "555" if rule A is matched or with "666" if rule X is matched.
var pattern, str, exp, result; var rfunc = function(result, exp){ var str = "???"; if(result.rules.A){ str = "555"; }else if(result.rules.X){ str = "666"; } return str; } pattern = 'pattern = A / X\n'; pattern += 'A = "abc"\n'; pattern += 'X = "xyz"\n'; str = "---abc---xyz---ABC---XYZ---"; exp = new ApgExp(pattern, "g"); result = exp.replace(str, rfunc); console.log(" str: " + str); console.log("result: " + result); /* returns */ str: ---abc---xyz---ABC---XYZ--- result: ---555---666---555---666---