--- layout: main title: Handyman Services ---
Oscar has the tools and expertise for almost any odd job around your house. All job are fixed price, and they are based on a rate of $30/man-hour + materials. Oscar can do everything from small finishing work, to larger jobs that require a crew of workers.


- begin() - Method in class games.Checkers
-
Starts the game.
- begin() - Method in class games.Checkers2
-
- begin() - Method in class games.GameOfLife
-
Initiates the simulation
- begin() - Method in class games.LightsOut
-
Increments the total games played and starts a new round
- begin() - Method in class games.ReactionGame
-
Starts the game
- begin() - Method in class games.Simon
-
Increments the total games played and starts a new round
- begin() - Method in class games.Snake
-
Increments the total games played and starts a new round
- begin() - Method in class piano.Piano
-
Initiates the Piano Demo.
- begin() - Method in class tech_demo.IdleAnimations
-
Randomly generates an animation from the available programmed ones after
a delay between 1 second and 4 seconds
- begin() - Method in class tech_demo.ReactiveDemo
-
Increments the amount of Demos ran and initiates the Reactive demo.
- begin() - Method in class tech_demo.ScrollingText
-
Increments the total tech demos ran and starts the demo
- blackKeysColor - Static variable in class piano.Piano
-
- blackKeysIntensity - Static variable in class piano.Piano
-
- blink(int, int, String, int, int) - Static method in class launchpad_s_plus.Display
-
Blink a pad with 3 different colors
- blink(int, int, String, String, int, int, int) - Static method in class launchpad_s_plus.Display
-
Blink a pad with 3 different colors
- blink(int, int, String, String, String, int, int, int, int) - Static method in class launchpad_s_plus.Display
-
Blink a pad with 3 different colors
- blink(int, int, String, int, int) - Static method in class launchpad_s_plus.DisplayBlink
-
For all the blinking colors having the same INTENSITY value:
Starts blinking (on and off) a pad based on the given input parameters.
- blink(int, int, String, String, int, int, int) - Static method in class launchpad_s_plus.DisplayBlink
-
/** For all the blinking colors having different INTENSITY values:
Starts blinking (two colors) a pad based on the given input parameters.
- blink(int, int, String, String, String, int, int, int, int) - Static method in class launchpad_s_plus.DisplayBlink
-
For all the blinking colors having different INTENSITY values:
Starts blinking (three colors) a pad based on the given input parameters.
- blinking - Static variable in class launchpad_s_plus.DisplayBlink
-
- blinkoff(int, int) - Static method in class launchpad_s_plus.Display
-
Stop blinking a pad
- blinkPlayer(int, boolean) - Method in class games.Checkers2
-
- blockX - Static variable in class games.ReactionGame
-
- blockY - Static variable in class games.ReactionGame
-
- boardColorSpeed - Static variable in class games.Checkers
-
- boardColorSpeed - Static variable in class games.Checkers2
-
- boardWait - Static variable in class games.Checkers
-
- boardWait - Static variable in class games.Checkers2
-
- bounceDelay - Static variable in class games.Simon
-
- bounceTime - Static variable in class games.ReactionGame
-
- bUseDefaultSynthesizer - Static variable in class midiInDump.MidiInDump
-
- buttonsPanel - Static variable in class gui.AnimationGUI
-
- buttonsPanel - Static variable in class gui.ReactiveDemoGUI
-
- buttonsPanel2 - Static variable in class gui.AnimationGUI
-


blazed
“Waking up this morning, I smile. Twenty-four brand new hours are before me. I vow to live fully in each moment and to look at all beings with eyes of compassion.” ― Thich Nhat Hanh
“Waking up this morning, I smile. Twenty-four brand new hours are before me. I vow to live fully in each moment and to look at all beings with eyes of compassion.” ― Thich Nhat Hanh
“Every thought, every word, and every action that adds to the positive and the wholesome is a contribution to peace. Each and every one of us is capable of making such a contribution.” ― Aung San Suu Kyi
“The meaning of life is just to be alive. It is so plain and so obvious and so simple. And yet, everybody rushes around in a great panic as if it were necessary to achieve something beyond themselves.” ― Alan W. Watts
“We’re in such a hurry most of the time we never get much chance to talk. The result is a kind of endless day-to-day shallowness, a monotony that leaves a person wondering years later where all the time went and sorry that it’s all gone.” — Robert M. Pirsig
“To escape from the world means that one's mind is not concerned with the opinions of the world.” ― Koso Joyo Daishi


Business Name
Phone Number Email
About
Contact
Portfolio
Request an Estimate:
Please include your name, address, phone number and email.
Name :
Email :
Message :


Interface: RootControl
interface RootControl Controls whether the current node is a root of the tree
- Author:
-
Rodrigo Fonseca
- Date:
-
$Date: 2006-12-12 18:23:29 $
Commands
Commands - Details
isRoot
command bool isRoot()
setRoot
command error_t setRoot()
unsetRoot
command error_t unsetRoot()


A highly customized lollipop chart showing how the office movies are rated. Build with R and the tidyverse. It shows how to use custom fonts, and this and that..
This page showcases the work of Cedric Sherer, built for the TidyTuesday initiative. You can find the original code on his github repository here. Thanks to him for accepting sharinig his work here! 🙏🙏
About the dataset. A bit of explanation of what the dataset is about. A link to the dataset on the tidyTuesday.
As always several packages are needed in order to build the figure.
## packages
library(tidyverse)
library(cowplot)
library(showtext)
font_add_google("Roboto Mono", "Roboto Mono")
font_add_google("Open Sans", "Open Sans")
font_add_google("Special Elite", "Special Elite")
## ggplot theme
theme_set(theme_minimal(base_family = "Roboto Mono"))
theme_update(plot.background = element_rect(fill = "#fafaf5", color = "#fafaf5"),
panel.background = element_rect(fill = NA, color = NA),
panel.border = element_rect(fill = NA, color = NA),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_text(size = 10),
axis.ticks = element_blank(),
axis.title.y = element_text(size = 13,
margin = margin(r = 10)),
legend.title = element_text(size = 9),
plot.caption = element_text(family = "Special Elite",
size = 10,
color = "grey70",
face = "bold",
hjust = .5,
margin = margin(5, 0, 20, 0)),
plot.margin = margin(10, 25, 10, 25))
About the dataset. Explain a bit what the columns are and which ones are gonna be used. What needs to be done to wrangle thee dataset
df_office <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-17/office_ratings.csv')
head(df_office)
Prepare the data
df_office_avg <-
df_office %>%
arrange(season, episode) %>%
mutate(episode_id = row_number()) %>%
group_by(season) %>%
mutate(
avg = mean(imdb_rating),
episode_mod = episode_id + (9 * season),
mid = mean(episode_mod)
) %>%
ungroup() %>%
mutate(season = factor(season))
df_lines <-
df_office_avg %>%
group_by(season) %>%
summarize(
start_x = min(episode_mod) - 5,
end_x = max(episode_mod) + 5,
y = unique(avg)
) %>%
pivot_longer(
cols = c(start_x, end_x),
names_to = "type",
values_to = "x"
) %>%
mutate(
x_group = if_else(type == "start_x", x + .1, x - .1),
x_group = if_else(type == "start_x" & x == min(x), x_group - .1, x_group),
x_group = if_else(type == "end_x" & x == max(x), x_group + .1, x_group)
)
Now let’s build the chart
p <- df_office_avg %>%
ggplot(aes(episode_mod, imdb_rating)) +
geom_hline(data = tibble(y = 7:10),
aes(yintercept = y),
color = "grey82",
size = .5) +
geom_segment(aes(xend = episode_mod,
yend = avg,
color = season,
color = after_scale(colorspace::lighten(color, .2)))) +
geom_line(data = df_lines,
aes(x, y),
color = "grey40") +
geom_line(data = df_lines,
aes(x_group, y,
color = season,
color = after_scale(colorspace::darken(color, .2))),
size = 2.5) +
geom_point(aes(size = total_votes,
color = season)) +
geom_label(aes(mid, 10.12,
label = glue::glue(" Season {season} "),
color = season,
color = after_scale(colorspace::darken(color, .2))),
fill = NA,
family = "Special Elite",
fontface = "bold",
label.padding = unit(.2, "lines"),
label.r = unit(.25, "lines"),
label.size = .5) +
scale_x_continuous(expand = c(.015, .015)) +
scale_y_continuous(expand = c(.03, .03),
limits = c(6.5, 10.2),
breaks = seq(6.5, 10, by = .5),
sec.axis = dup_axis(name = NULL)) +
scale_color_manual(values = c("#486090", "#D7BFA6", "#6078A8", "#9CCCCC",
"#7890A8", "#C7B0C1", "#B5C9C9", "#90A8C0", "#A8A890"),
guide = F) +
scale_size_binned(name = "Votes per Episode",
range = c(.3, 3)) +
labs(x = NULL, y = "IMDb Rating",
caption = "Visualization by Cédric Scherer • Data by IMDb via data.world • Fanart Logo by ArieS") +
guides(size = guide_bins(show.limits = T,
direction = "horizontal",
title.position = "top",
title.hjust = .5)) +
theme(legend.position = c(.5, .085),
legend.key.width = unit(2, "lines"))
Now we’re gonna add a logo
# This does not work yet.
# Need to store the office image locally. It is available here: https://github.com/z3tt/TidyTuesday/blob/master/img/the-office.png
# And then call it here and store it as web-loollipop-plot-with-R-the-office.png
#logo <- png::readPNG(here::here("img", "the-office.png"))
#ggdraw(p) +
# draw_image(logo, x = -.35, y = -.34, scale = .12)
#ggsave(here::here("plots", "2020_12", "2020_12_TheOffice.pdf"),
#width = 15, height = 9, device = cairo_pdf)
#Once the chart is saved, use Markdown to include the png in the page.


Fluid libraries have components with two ports that store neither mass nor energy and fulfill the momentum equation between their two ports, e.g., a short pipe. In most cases this means that an equation is present relating the pressure drop between the two ports and the mass flow rate from one to the other port. Since no mass or energy is stored, no differential equations for thermodynamic variables are present. A component model of this type has therefore usually the following structure (see also the implementation in Modelica.Media.Examples.Utilities.ShortPipe):
model ShortPipe import SI=Modelica.SIunits; import Modelica.Media.Examples.Utilities; // parameters defining the pressure drop equation replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model" annotation (choicesAllMatching = true); Utilities.FluidPort_a port_a (redeclare package Medium = Medium); Utilities.FluidPort_b port_b (redeclare package Medium = Medium); SI.Pressure dp = port_a.p - port_b.p "Pressure drop"; Medium.BaseProperties medium_a "Medium properties in port_a"; Medium.BaseProperties medium_b "Medium properties in port_b"; equation // define media models of the ports medium_a.p = port_a.p; medium_a.h = port_a.h; medium_a.Xi = port_a.Xi; medium_b.p = port_b.p; medium_b.h = port_b.h; medium_b.Xi = port_b.Xi; // Handle reverse and zero flow (semiLinear is a built-in Modelica operator) port_a.H_flow = semiLinear(port_a.m_flow, port_a.h, port_b.h); port_a.mXi_flow = semiLinear(port_a.m_flow, port_a.Xi, port_b.Xi); // Energy, mass and substance mass balance port_a.H_flow + port_b.H_flow = 0; port_a.m_flow + port_b.m_flow = 0; port_a.mXi_flow + port_b.mXi_flow = zeros(Medium.nXi); // Provide equation: port_a.m_flow = f(dp) end ShortPipe;
The semiLinear(..) operator is basically defined as:
semiLinear(m_flow, ha, hb) = if m_flow ≥ 0 then m_flow*ha else m_flow*hb;
that is, it computes the enthalpy flow rate either from the port_a or from the port_b properties, depending on flow direction. The exact details of this operator are given in ModelicaReference.Operators.'semiLinear()'. Especially, rules are defined in the Modelica specification that m_flow = 0 can be treated in a "meaningful way". Especially, if n fluid components (such as pipes) are connected together and the fluid connector from above is used, a linear system of equations appear between medium1.h, medium2.h, medium3.h, ..., port1.h, port2.h, port3.h, ..., port1.H_flow, port2.H_flow, port3.H_flow, .... The rules for the semiLinear(..) operator allow the following solution of this linear system of equations:
medium1.h = medium2.h = port1.h = port2.h 0 = port1.H_flow + port2.H_flowTherefore, no problems with zero mass flow rate are present.


To see alphascroll navigation make sure browser window's width is less than 792px as it's basic idea is to be visible on mobile devices.
Make window narrower to see columns get combined into one.


findGeneDeletions Deletes genes, optimizes the model, and keeps track of the resulting fluxes. This is used for identifying gene deletion targets. model a model structure testType single/double gene deletions/over expressions. Over expression only available if using MOMA 'sgd' single gene deletion 'dgd' double gene deletion 'sgo' singel gene over expression 'dgo' double gene over expression analysisType determines whether to use FBA ('fba') or MOMA ('moma') in the optimization refModel MOMA works by fitting the flux distributions of two models to be as similar as possible. The most common application is where you have a reference model where some of the fluxes are constrained from experimental data. This model is required when using MOMA oeFactor a factor by which the fluxes should be increased if a gene is overexpressed (opt, default 10) genes a matrix with the genes that were deleted in each optimization (the gene indexes in originalGenes). Each row corresponds to a column in fluxes fluxes a matrix with the resulting fluxes. Double deletions that result in an unsolvable problem have all zero flux. Single deletions that result in an unsolvable problem are indicated in details instead originalGenes simply the genes in the input model. Included for simple presentation of the output details not all genes will be deleted in all analyses. It is for example not necessary to delete genes for dead end reactions. This is a vector with details about each gene in originalGenes and why or why not it was deleted 1: Was deleted 2: Proved lethal in SGD 3: Only involved in reactions with too many iso-enzymes 4: Involved in dead-end reaction NOTE: This function disregards complexes. Any one gene can encode a reaction even if parts of the complex is deleted. Usage: [genes fluxes]=findGeneDeletions(model,testType,analysisType,... refModel,oeFactor) Rasmus Agren, 2014-01-08
0001 function [genes, fluxes, originalGenes, details]=findGeneDeletions(model,testType,analysisType,refModel,oeFactor) 0002 % findGeneDeletions 0003 % Deletes genes, optimizes the model, and keeps track of the resulting 0004 % fluxes. This is used for identifying gene deletion targets. 0005 % 0006 % model a model structure 0007 % testType single/double gene deletions/over expressions. Over 0008 % expression only available if using MOMA 0009 % 'sgd' single gene deletion 0010 % 'dgd' double gene deletion 0011 % 'sgo' singel gene over expression 0012 % 'dgo' double gene over expression 0013 % analysisType determines whether to use FBA ('fba') or MOMA ('moma') 0014 % in the optimization 0015 % refModel MOMA works by fitting the flux distributions of two 0016 % models to be as similar as possible. The most common 0017 % application is where you have a reference model where 0018 % some of the fluxes are constrained from experimental 0019 % data. This model is required when using MOMA 0020 % oeFactor a factor by which the fluxes should be increased if a 0021 % gene is overexpressed (opt, default 10) 0022 % 0023 % genes a matrix with the genes that were deleted in each 0024 % optimization (the gene indexes in originalGenes). Each 0025 % row corresponds to a column in fluxes 0026 % fluxes a matrix with the resulting fluxes. Double deletions 0027 % that result in an unsolvable problem have all zero 0028 % flux. Single deletions that result in an unsolvable 0029 % problem are indicated in details instead 0030 % originalGenes simply the genes in the input model. Included for 0031 % simple presentation of the output 0032 % details not all genes will be deleted in all analyses. It is 0033 % for example not necessary to delete genes for dead end 0034 % reactions. This is a vector with details about 0035 % each gene in originalGenes and why or why not it was 0036 % deleted 0037 % 1: Was deleted 0038 % 2: Proved lethal in SGD 0039 % 3: Only involved in reactions with too many iso-enzymes 0040 % 4: Involved in dead-end reaction 0041 % 0042 % NOTE: This function disregards complexes. Any one gene can encode a 0043 % reaction even if parts of the complex is deleted. 0044 % 0045 % Usage: [genes fluxes]=findGeneDeletions(model,testType,analysisType,... 0046 % refModel,oeFactor) 0047 % 0048 % Rasmus Agren, 2014-01-08 0049 % 0050 originalModel=model; 0051 0052 if nargin<5 0053 oeFactor=10; 0054 end 0055 0056 %Check that the test type is correct 0057 if ~strcmpi(testType,'sgd') && ~strcmpi(testType,'dgd') && ~strcmpi(testType,'sgo') && ~strcmpi(testType,'dgo') 0058 EM='Incorrect test type'; 0059 dispEM(EM); 0060 end 0061 0062 %Check that the analysis type is correct 0063 if ~strcmpi(analysisType,'fba') && ~strcmpi(analysisType,'moma') 0064 EM='Incorrect analysis type'; 0065 dispEM(EM); 0066 end 0067 0068 if (strcmpi(testType,'sgo') || strcmpi(testType,'dgo')) && strcmpi(analysisType,'fba') 0069 EM='Over expression is only available when using MOMA'; 0070 dispEM(EM); 0071 end 0072 0073 if strcmpi(analysisType,'moma') && nargin<4 0074 EM='A reference model must be supplied when using MOMA'; 0075 dispEM(EM); 0076 end 0077 0078 originalGenes=model.genes; 0079 details=zeros(numel(model.genes),1); 0080 0081 %First simplify the model to reduce the size 0082 model=simplifyModel(model,true,false,true,true); 0083 model=removeReactions(model,{},true,true); %Removes unused genes 0084 details(~ismember(originalGenes,model.genes))=4; 0085 0086 [~, geneMapping]=ismember(model.genes,originalGenes); 0087 0088 %Get the genes that should be deleted. Not all genes are deleted in all 0089 %optimizations. For example, if all reactions involving a gene have 0090 %iso-enzymes a single deletion of that gene will never have an effect. 0091 %FBA and SGD: All genes that encode reactions on their own 0092 %FBA and DGD: All genes that have at most one other gene encoding for at 0093 % least one of its reactions and doesn't participate 0094 % exclusively in reactions where a single deletion results in 0095 % an unsolvable problem 0096 %MOMA and SGD: All genes that encode reactions on their own 0097 %MOMA and DGD: All combinations of genes that have at most one other gene 0098 % encoding for at east one of its reactions and doesn't 0099 % participate exclusively in reactions where a single 0100 % deletion results in an unsolvable problem 0101 %MOMA and SGO: All genes 0102 %MOMA and DGO: All combinations of genes 0103 genesForSGD=[]; 0104 if strcmpi(testType,'sgd') || strcmpi(testType,'dgd') 0105 if strcmpi(testType,'sgd') 0106 I=sum(model.rxnGeneMat,2)>1; %Reactions with iso-enzymes 0107 else 0108 I=sum(model.rxnGeneMat,2)>2; %Reactions with more than one iso-enzyme 0109 end 0110 0111 %Find genes involved only in these reactions 0112 [~, inIsoRxns]=find(model.rxnGeneMat(I,:)); 0113 [~, inNonIsoRxns]=find(model.rxnGeneMat(~I,:)); 0114 genesForSGD=unique(inNonIsoRxns); 0115 details(geneMapping(setdiff(inIsoRxns,inNonIsoRxns)))=3; 0116 end 0117 0118 %Get the genes that should be deleted in a SGD 0119 if strcmpi(testType,'sgd') || strcmpi(testType,'dgd') 0120 genesToModify=genesForSGD; 0121 end 0122 0123 %Get the genes that should be deleted in SGO 0124 if strcmpi(testType,'sgo') 0125 genesToModify=1:numel(model.genes); 0126 genesToModify=genesToModify(:); 0127 end 0128 0129 %Do single deletion/over expression. This is done here since the double 0130 %deletion depends on which single deletions prove lethal 0131 %(to reduce the size of the system) 0132 if strcmpi(testType,'sgd') || strcmpi(testType,'sgo') || strcmpi(testType,'dgd') 0133 fluxes=zeros(numel(model.rxns),numel(genesToModify)); 0134 solvable=true(numel(genesToModify),1); 0135 for i=1:numel(genesToModify) 0136 I=find(model.rxnGeneMat(:,genesToModify(i))); 0137 if strcmpi(testType,'sgd') || strcmpi(testType,'dgd') 0138 %Constrain all reactions involving the gene to 0 0139 tempModel=setParam(model,'eq',model.rxns(I),0); 0140 else 0141 %To over express a gene, the stoichiometry of the corresponding 0142 %reactions are changed so that the same flux leads to a higher 0143 %production 0144 tempModel=model; 0145 tempModel.S(:,I)=tempModel.S(:,I).*oeFactor; 0146 end 0147 if strcmpi(analysisType,'fba') || strcmpi(testType,'dgd') 0148 sol=solveLP(tempModel); 0149 else 0150 [fluxA, ~, flag]=qMOMA(tempModel,refModel); 0151 sol.x=fluxA; 0152 sol.stat=flag; 0153 end 0154 0155 %If the optimization terminated successfully 0156 if sol.stat==1 0157 fluxes(:,i)=sol.x; 0158 details(geneMapping(genesToModify(i)))=1; 0159 else 0160 solvable(i)=false; 0161 details(geneMapping(genesToModify(i)))=2; 0162 end 0163 end 0164 0165 fluxes=fluxes(:,solvable); 0166 genes=geneMapping(genesToModify(solvable)); 0167 end 0168 0169 %Now do for DGO. This is rather straight forward since it is always 0170 %solvable and it doesn't matter if there are iso-enzymes 0171 if strcmpi(testType,'dgo') 0172 genesToModify=nchoosek(1:numel(model.genes),2); 0173 genes=geneMapping(genesToModify); 0174 %Since I assume that this is never lethal I set the details already 0175 details(geneMapping)=1; 0176 0177 fluxes=sparse(numel(model.rxns),size(genesToModify,1)); 0178 for i=1:size(genesToModify,1) 0179 [I, ~]=find(model.rxnGeneMat(:,genesToModify(i,:))); 0180 %To over express a gene, the stoichiometry of the corresponding 0181 %reactions are changed so that the same flux leads to a higher 0182 %production 0183 tempModel=model; 0184 tempModel.S(:,I)=tempModel.S(:,I).*oeFactor; 0185 fluxA=qMOMA(tempModel,refModel); 0186 fluxes(:,i)=fluxA; 0187 end 0188 end 0189 0190 %For double deletions FBA or MOMA 0191 if strcmpi(testType,'dgd') 0192 %This is a little lazy but it's fine. Check which genes that have 0193 %already been labled as either ony with too many iso-enzymes or 0194 %non-solveable as a single deletion. 0195 [~, I]=ismember(originalGenes(details==1),model.genes); 0196 genesToModify=nchoosek(I,2); 0197 genes=geneMapping(genesToModify); 0198 0199 fluxes=sparse(numel(model.rxns),size(genesToModify,1)); 0200 for i=1:size(genesToModify,1) 0201 [I, ~]=find(model.rxnGeneMat(:,genesToModify(i,:))); 0202 0203 %Constrain all reactions involving the gene to 0 0204 tempModel=setParam(model,'eq',model.rxns(I),0); 0205 0206 if strcmpi(analysisType,'fba') 0207 sol=solveLP(tempModel); 0208 else 0209 [fluxA, ~, flag]=qMOMA(tempModel,refModel); 0210 sol.x=fluxA; 0211 sol.stat=flag; 0212 end 0213 0214 if sol.stat==1 0215 fluxes(:,i)=sol.x; 0216 end 0217 end 0218 end 0219 0220 %Map back to the old model 0221 [~, I]=ismember(model.rxns,originalModel.rxns); 0222 temp=fluxes; 0223 fluxes=sparse(numel(originalModel.rxns),size(temp,2)); 0224 fluxes(I,:)=temp; 0225 end


HARSHITH
DESAMSETTI
857 Spiros Court, Apt#102, DeKalb,IL,USA
+1(312)-536-5336 ||<EMAIL_ADDRESS>I am a Masters Degree student in Computer Science at Northern Illinois University. I am currently working as Graduate Teaching Assistant for Introduction to C++ course. I am also a huge fan and follower of both Steve Jobs and Bill Gates. They are my inspiration and made me took up the Computer Science area.


Week 4 - Compass of Shame
Discuss a time you had an emotional conflict with someone. What was it about? What happened? Once, while awaiting my BART train, I ran into a rather unhappy person, also waiting. As I took my place in line the individual in question sprung to his feet (he had been sitting on one of the stone benches) to confront me. It would seem that I had been standing too close to him. He proceeded to verbally assault me for at least 45 seconds while I stood there, mouth agape. I couldn't believe this man was losing his mind in this way. What was the source of the conflict? Since this incident, I have had the benefit of observing this individual (on two seperate occasions) initiating conflict such as this with other BART-goers. As a result, I have determined he is simply looking for confrontation. However, at the time I was completely thrown off as to why he was so upset. Going with the facts he provided in his verbal assault, I was standing too close to him and (according to his assessment) I was trying to "make [him] gay." How did you handle that conflict? I dislike phsyical confrontation. I grew up being the biggest kid in my peer group, and for certain people I was deemed a "trophy" of sorts. To eleaborate, the attitude was often, "If I can fight and win against Brian it will elevate my street cred" (lol, I grew up in the smallest farming community - we did have a couple of streets though). Fortunately my father taught me to be clever and I am typically able to diffuse heated situations. I attempted to rationalize with this particular individual at BART and convince him that there was no issue - all of this was just a misunderstanding. Did your actions make the conflict better or worse? Worse. Much worse. He was not interested in my assessment of the situation. I even had assistance from another BART patron who attempted to explain that there really wasn't a situation if he would simply cease to persist in his efforts to create one. He squared up to me and put his fists at the ready. I laughed. If you could go back, what would you do differently, if anything? Nothing, honestly. I exited that confrontation without becoming phsically engaged and I feel that I explained my stance to him well enough to suit me. He was not in a state to be receptive to constructive conversation and I would not have been able to alter his stance in the slightest. What did you learn from this experience? No amount of prevention can fully sheild you from the badness this world has to offer. The lesson I continue to gain from these types of interactions is that it is up to me to set the tone for my life. Some men just want to watch the world burn...


This package provides functions to analyze FRET binding data.
Given raw fluorescence data from a FRET titration experiment's donor,
acceptor and FRET channels, it allows to: (1) plot all channels to visually
inspect raw data; (2) correct FRET signal; (3) estimate parameters of the
quadratic binding equation (Kd, signal_min, signal_max); (4) fit the
quadratic binding equation to the data; (5) report Kd; and (6) plot the
corrected FRET and resulting binding curve.
Introduction
The rfret package allows the user to efficiently analyze fluorescence resonance energy transfer (FRET) binding data. FRET is a commonly used fluorescence binding assay to quantify protein-protein interactions. One challenge often encountered in analyzing FRET data is the amount of manual work. Although the assay can be automated using pipetting robots, the data analysis is often conducted manually in spreadsheets. The rfret package automates the analysis of FRET data, providing the user a faster end result as well as higher confidence by removing the manual data analysis step. Given raw fluorescence data, rfret will plot the donor, acceptor, and FRET channels. The data will then be corrected based on the donor bleed-through and acceptor direct excitation controls. Finally, the data will be fit to a binding model equation, which will allow the dissociation constant, Kd, to be determined.
Methods
The graphic above represents the functionality of this tool in 4 different stages.
1. The input of this tool expects the files to be in a specific file format (.csv) where all of the files are in one directory or all of the tests are in one continuous csv file. The proper formats for the csv files can be referenced in the manual.
2. Pre-Processing / Initial Values
      a. Average Technical Replication Values
          i. Take the average values of the technical replicates for more accurate binding data. This helps reduce individual sample noise, but doesn’t account for sample to sample variation.
      b. Guess Initial Parameters
          i. Calculate initial guesses for kd, fret_min, and fret_max. These are naive guesses based on observable values in the data but are close enough to the actual value to make the fit converge properly most of the time. If the fitting procedure fails, one can visually find a better approximation of kd by plotting the corrected FRET data as a function of the titration series. Alternatively, failure to fit the data can reveal data quality problems.
3. Choose whether you want to filter out some samples or not. We’ll see if we get this far.
4. Bind this buizness to a curve.
Results
Given raw fluorescence data from a FRET binding experiment, you can:
1. Plot all channels (donor, acceptor, FRET) to visually inspect raw data and find possible outliers;
2. Average fluorescence values of technical replicates of a same experiment (currently limited to two replicates);
3. Correct FRET signal by subtracting signal from a blank experiment;
4. Guess initial values for the parameters of the binding model equation (kd, fret_min, fret_max);
5. Fit a binding model equation to the data;
6. Report the value of Kd;
7. Plot the corrected FRET signal and the binding curve obtained by fitting the data.
Example Binding Curve
References
GitHub Page


So far I've really enjoyed all of my pairing sessions. I find that I learn much more during these sessions that last an hour to two hours than I do days by myself. Being able to talk with other people and ask questions is immensely helpful and has been a huge support to me so far. I was definetly timid to pair at first but I've recently noticed the benefits and how they greatly outweigh the nerves of pairing.
Being open and not being scared of making mistakes is a huge part of pairing. I've found that when I make a mistake or am forced to ask questions is when I learn the most. While pairing weak spots become obvious and it is clear to me and my partner where there is the most room for improvement. While this sounds like a negative, often times the areas where one has a weak understanding their partner is very comfortable. In this way, partners can alternate explaning and answering eachothers questions until they have the same levels of understanding.
Vulnerability is a key emotion that arises while pairing. There any many moments when one will feel clueless and wont know the next step. It is definetly scary to be in this position but it is important to remain composed. In many of my past pairing sessions we have spent time researching on the internet and looking through ruby docs for methods and solutions. It is important to remember that your partner will also have questions, and that youre not the only one who is learning.
Kind, actionable, and specific feedback is constructive criticism that should allow the reciever to better themselves as a participant in pairing. It doesnt need to all be positive, it only needs to be stated in a way that suggests change or a move in a positive direction. It needs to be something the reciever can read and better themselves by responding to it. It is important that the feedback is specific so that the reciever can know exactly where they need improvement and how.


#assign n0_support="active">
For help post questions and issues to the Ebean google group.
| Quality | Issues posted to Github of insufficient quality will be removed. |
|---|---|
| No protracted discussions | Issues likely to result in protracted discussion must be posted to the Ebean google group. |
| No questions | Do not post questions as Github issues. These will be removed and you will be asked to post questions to the Ebean google group instead. |
People register to watch
the github issues register to keep track of changes to the
project. As such protracted discussions effectively spam all these people watching the project
and we don't want that.
We want to be able to search the github issues now and in the long term and we want those searches to result in high quality results. As such we want issues to relate closely to actual commits.
We want to avoid low quality issues with protracted discussions as these become much more difficult to read and understand
Post questions or issues to the Ebean google group. This is monitored by Ebean developers and it's most experienced users and here you will get the best help.
You can alternatively post questions on Stack
Overflow
tagged with ebean
. Note that stackoverflow is more casually monitored due to time constraints.
It
is fine if you want to post first to stackoverflow and then if you don't get an answer to post onto the
google
group.
For this project we want to use Github issues for Bugs
, Enhancements
and
Refactoring
changes. That is, things that mostly tie back to a specific commit change in code.
The ebean-orm-examples group contains several example applications from absolute minimal, spring-boot to jax-rs web apps so you can look at those for example code.
Checkout of the videos for a quick view on how certain features work.


Luxbi was founded with the intention of sustaining the learning of people in STEM (Science, Technology, Engineering and Mathematics). Our mission is to provide people involved in the STEM fields with the right tools to enable them to be more engaged with their educational and research goals.
We have so far created a growing repository of assorted open resources and freeware for scientific research and learning. We want to direct people to the right resources, and to give them an exposure to the individual efforts in the sciences
Our efforts focus on continuing to grow this repository and to develop new resources that anybody can use to become a more active scientist, educator, or student. We are active in our social media, specially Instagram, where we are growing a community of people with career or personal interests in science.
Luxbi, Inc. is a nonprofit public benefit corporation qualified under Section 501(c)(3) of the Internal Revenue Code as a tax-exempt organization for scientific, educational, and charitable purposes.
NAICS code 5417
Contribute to Luxbi by giving us feedback and by sharing learning tools with us


The mtx-grid is an powerful material table component. It supports cell selectable, row selectable, multiple row selectable, row expandable, column hiding, column moving and so on.
mtx-grid


Lessons:
QUIZ - Score: /
If you cannot hear the sound, your computer or browser doesn't support the sound format.


Here you can search for movie being played in parks in Chicago in the beautiful time of summer.
Created by Kunj Patel
The City Of Chicago offers the data which parks offers this shows and where, Teaser gives you the user a platform to search for movies you like in a park near you!
You can find the source code in the direct link to our repo provided below. You can also Jump to link by clicking here.
Learn MoreAs we give a glimpse of the details about the movies offered in public parks you would like to see, so the name Teaser.
Learn MoreIt's a Joint Venture!


Goutham
Pacha Ravi
~ Clemson Tiger · Software Engineer · Open Source contributor · Hobby Teacher · Animal Lover ~


Engineering Portfolio
In this page you will find information about the work, skills and achievements of the Engineer Javier Sánchez Ramírez. As well as contact details and social links.
About meAbout Me
Constantly improving.
Ever since I was a child I’ve always wondered how things worked, what things were made of and how they were built. As I grew up I continued developing this interest, which inspired me to study science related topics to finally become my career when I joined university.
At University…
I enhanced my skills and acquired a deeper knowledge on different engineering fields. By tackling lots of problems, lab tests and projects. Building the foundation of my studies.
Internship abroad…
In 2020 I worked at Norsk Hydro in Norway, mainly with technical drawings and 3D models but also I got the chance to solve real world engineering problems.
The next steps…
Currently I am looking forward to join new exciting projects. I am eager to apply everything I have learnt to actual issues.
I love engineering…
Because it gives us the possibility of understanding and controlling nature to our advantage.
Projects
Positive feedback
Projects completed
Hours of training
Cups of Coffee
Skills
Achievements
Honor Roll
Got a honor roll on bachillerato wich are two separated years of high school which are preparatory for university. Equivalent to A-levels.
Internship Abroad
I succesfully completed an Engineering Internship in Norway pushing me forward in my career by adquiring lots of knowledge and breaking cultural barriers.
Bachelor Degree
Finished my bachelor degree on Mechanical Engineering in the University of Huelva. With a motorcycle lift as final project and 2:1 grades.
"If you look at how little time he had to learn our internal systems, culture changes, etc. We are very impressed how far he has reached. We can give the best recommendations as he could perfectly fit into any project and development team."
Contact Me
Contact Details
Feel free to contact me by filling the form or using any of my social network’s links at the end of the page. I am looking forward to hearing from you!
"Javier has been a big resource for us, executing 3D models, drawings and discussions around engineering problems. Helping us by implementing improved solutions in several places in our plant."


Kyiv's court extends ex-MP Pashynsky's arrest for two months
Pashynsky and his lawyers said they would appeal.
Judge of Kyiv's Pechersky district court Oleksiy Sokolov has refused to release former Member of Parliament Serhiy Pashynsky on bail and extended his detention for another 60 days, until January 29, 2020.
The judge granted the petition of the prosecutors of the Prosecutor General's Office to extend Pashynsky's detention, according to an UNIAN correspondent.
Thus, Pashynsky will be held at the pretrial detention center at least until January 29 if the appeal court does not cancel this decision.
The court refused to satisfy the motions of a number of persons to release Pashynsky on personal recognizance.
Pashynsky and his lawyers said they would file an appeal against today's court ruling.
As UNIAN reported earlier, Kyiv's Pechersky district court on October 7 ruled to arrest Pashynsky, who is being suspected of inflicting a severe bodily injury to a victim in a shooting incident.
An incident involving Pashynsky and Viacheslav Khimikus, a local resident of Kyiv region's Vasylkivsky district, took place on December 31, 2016, when, after a verbal dispute, the then Member of Parliament used his firearm.
The victim received a bodily injury – a gunshot-induced fracture of the thigh bone of the left leg.
The police shortly opened criminal proceedings under Article 296 of the Criminal Code (hooligan actions). However, in July 2017, the Prosecutor General's Office closed the Pashynsky case.


I'm available for new projects, click here.
Web Developper
I love create unique, successful web sites & web apps. My clients range from developers and small startups, to industry leading brands. I'm regularly involved with startups from the likes of Webeuz and Quick2ouch.
I'm available for new projects, click here.
Get in touch for more :)
If you have a project for me, I would love to chat about it. I am always looking for new connections, so don't be shy. I don't bite!


UP AT THE VILLA A film review by Christopher Null Copyright 2000 filmcritic.com filmcritic.com
Hey, who hasn't been clamoring for a Kristin Scott Thomas-Sean Penn romantic drama? At long last, Up at the Villa is the answer to all those unspoken dreams.
Up at the Villa reunites the director of Angels and Insects, Philip Haas, with Thomas, his former star. And true to most re-pairings, the film feels oddly familiar -- as if we've seen Thomas doing this before: In pre-WWII Italy, a high-society (though penniless, natch) widow named Mary (Thomas) is being wooed by an older man of some wealth (James Fox). He proposes, then promptly jaunts off for a few days so she can consider.
Naturally, the world opens up to Mary as she deliberates, and she soon finds romance in the arms of an Austrian refugee (Jeremy Davies), which culminates in a lone night of wild monkey love (in an era where lone nights of wild monkey love are frowned upon). Mary finds herself in a jam when the refugee gets a little clingy, and Sean Penn's roguish Rowley has to come in to help her out.
All the while, Mary faces the budding turmoil of pre-war Europe and the shenanigans of her friend Princess (Anne Bancroft, truly living up to her character's name)... and you are somehow supposed to care about all of this.
Up at the Villa's prime flaw is that Mary is hardly a sympathetic creature. Her beauty is espoused by all when she actually looks quite plain. Her kindness is talked about when she's actually quite duplicitous. She throws her affections around on a whim. Hardly a role model.
That said, Penn is lots of fun as Rowley, but he actually has far less screen time than one would think. And Bancroft is entertaining in that Great Expectations sort of way.
Acting is one thing, but ultimately, Up at the Villa falls flat because the "intrigue" of this little drama is sorely lacking.  Il Duce would have been sorely disappointed. The cover-up that comprises the latter half of the movie feels treadworn, at best, pedestrian, at worst. Pokemon has more thrills.
Lastly, the romance is neither very believable nor very torrid. Penn and Thomas have absolutely no chemistry. For that matter, neither do any of Thomas's other romantic entanglements in the film. In other words: This is not The English Patient. It's more of a cadaver.
 --- Christopher Null -<EMAIL_ADDRESS>- http://www.filmcritic.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


I am more passionate about the technology and love learning new things about it, majorly into the developing and programming section and would definately meet the expectations.
Creating beautiful websites suitable for both business and personal uses.
Adding new features to the existing simple website.
Being an active and successful coordinator leading to one of the part of success in the fest.
Collaboratively participating in the cleanliness drive programming leading to spread awareness about cleanliness and Swatch Bharath Abhyan among the localities.
GPA: 7.2
GPA: 8.3
GPA: 8.8
Apart from being a web developer, I enjoy most of my time being outdoors. I enjoy mountain biking, free climbing, exploring nearby places, take my dog out for a walk and training him.
When forced indoors, I follow a number of sci-fi and fantasy genre movies and television shows, play with the Rubik's cube, and I spend a large amount of my free time exploring the latest technology advancements in the front-end web development world and other fields too.


Toggle navigation
Log out »
Admin Home »
Emerson Fire - Adminstrator Portal
Client Profile
First name:
Last name:
Email:
Submit »
Buildings
Current
Horowhenua Masonic Village
Add new building »


Problem Transformation Methods¶
Problem transformation methods reduce the problem of multi-label classification into a number of easier problems, for example binary or multi-class classification.
-
class
skml.problem_transformation.
LabelPowerset
(estimator)[source]¶ Implements the label powerset problem transformation strategy, where for each possible subset of the label powerset a classifier is trained, which classifies whether or not the label subset should be assigned to the given instance or not.
Methods
fit
(X, y)Fit underlying estimators. get_params
([deep])Get parameters for this estimator. predict
(X)Predicts the labels for the given instances. score
(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params
(**params)Set the parameters of this estimator. -
__init__
(estimator)[source]¶ Creates label powersets for the given labels. Each powerset is transformed into a single label, resulting in a multi-class classification problem. For labels, this meta estimator generates labels.
Note, that rare label combinations result in a small number of samples for a given label after the transformation. This might result in rather bad learning effects for the combination given by the label powerset. Also, the computational complexity is exponential, hence for many labels the label powerset increases notably, and might result in computational problems.
Parameters: estimator : scikit-learn compatible classifier instance
Will be copied (with all hyperparameters) before use, hence original will be left untouched.
Returns: label powerset transformed multi-class meta estimator
-
-
class
skml.problem_transformation.
BinaryRelevance
(estimator)[source]¶ Implements the binary relevance problem transformation strategy, where for each label a distinct binary classifier is trained to classify whether label should be assigned to an instance or not.
Methods
fit
(X, y)Fit underlying estimators. get_params
([deep])Get parameters for this estimator. predict
(X)Predicts the labels for the given instances. score
(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params
(**params)Set the parameters of this estimator. -
__init__
(estimator)[source]¶ Constructs a classifier for each single label, thus having n_labels estimators predicting a single label for an instance.
Parameters: estimator :
scikit-learn compatible classifier instance. Will be copied (with all hyperparameters) before use, hence original will be left untouched.
Returns: Binary relevance problem transformed MLC classifier
-
-
class
skml.problem_transformation.
ClassifierChain
(estimator)[source]¶ This classifier constructs a chain of classifiers for multi-label classification (MLC). For each label (which ought to be given as a binary label indicator vector, where 0 stands for “instance does not have label, 1 otherwise”) a classifier is trained. The classifier predicts one label, and one only (called binary relevance). The first classifier predicts the first label of the label vector (which outputs 0 or 1), whereas the second predicts the second label, but the first label is appended to the feature vector (X[i]). The n-th classifier predicts the n-th label given the feature vector, where the (n-1)-th labels are appended to.
Methods
fit
(X, y)Fit underlying estimators. get_params
([deep])Get parameters for this estimator. predict
(X)Predicts the labels for the given instances. score
(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params
(**params)Set the parameters of this estimator. -
__init__
(estimator)[source]¶ Classifer Chain multi-label strategy
Builds a new classifier chain using the given classifier, which is copied times (L is the set of labels).
Parameters: estimator : scikit-learn compatible classifier instance
The classifier used to build a chain of classifiers. Will be copied, hence the original will be left untouched.
-
-
class
skml.problem_transformation.
ProbabilisticClassifierChain
(estimator)[source]¶ Learns a chain of classifiers. If the input data is given as , and the target data as a set , then classifiers are learned as follows:
So each classifier is trained on an augmented input space . NB: it is implied that the classifier predicts the probability of , so it has to support predict_proba(X).
The inference of the most probable label set is then determined via:
where is given as:
For each label combination in a posterior probability estimate has to be calculated, so the original paper [3] notes feasibility for settings with a label space bounded by .
Methods
fit
(X, y)Fit underlying estimators. get_params
([deep])Get parameters for this estimator. predict
(X)Predicts the labels for the given instances. score
(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params
(**params)Set the parameters of this estimator. -
__init__
(estimator)[source]¶ Probabilistic Classifer Chain multi-label strategy
Builds a new probabilistic classifier chain using the given classifier, which is copied times (L is the set of labels).
Parameters: estimator : scikit-learn compatible classifier instance
The classifier used to build a chain of classifiers. Will be copied, hence the original will be left untouched.
-


public class Expression
extends java.lang.Object
implements java.lang.Cloneable
scarpet
programming language.Scarpet (a.k.a. Carpet Script, or Script for Carpet) is a programming language designed to provide the ability to write custom programs to run within Minecraft and interact with the world.
The project was initially built based on the EvalEx project, however it now diverged so far away from the original implementation, it would be hard to tell it without this mention. EvalEx is a handy expression evaluator for Java, that allows to evaluate simple mathematical and boolean expressions. For more information, see: EvalEx GitHub repository
This specification is divided into two sections: this one is agnostic to any Minecraft related features and could function on its own, and CarpetExpression for Minecraft specific routines and world manipulation functions.
script run print('Hello World!')
or an overly complex example:
/script run block_check(x1, y1, z1, x2, y2, z2, block_to_check) -> ( l(minx, maxx) = sort(l(x1, x2)); l(miny, maxy) = sort(l(y1, y2)); l(minz, maxz) = sort(l(z1, z2)); 'Need to compute the size of the area of course'; 'Cause this language doesn\'t support comments'; xsize = maxx - minx + 1; ysize = maxy - miny + 1; zsize = maxz - minz + 1; total_count = 0; loop(xsize, xx = minx + _ ; loop(ysize, yy = miny + _ ; loop(zsize, zz = minz + _ ; if ( block(xx,yy,zz) == block_to_check, total_count += ceil(rand(1)) ) ) ) ); total_count ); check_area_around_closest_player_for_block(block_to_check) -> ( closest_player = player(); l(posx, posy, posz) = query(closest_player, 'pos'); total_count = block_check( posx-8,1,posz-8, posx+8,17,posz+8, block_to_check); print('There is '+total_count+' of '+block_to_check+' around you') ) /script invoke check_area_around_closest_player_for_block 'diamond_ore'
or simply
script run print('There is'+for(rect(x,9,z,8,8,8), _ == 'diamond_ore')+' diamond ore around you')
It definitely pays to check what higher level scarpet
functions have to offer.
You can think of an program like a mathematical expression, like
"2.4*sin(45)/(2-4)"
or "sin(y)>0 & max(z, 3)>3"
Writing a program, is like writing a 2+3
, just a bit longer
Programs consist of constants, like 2
, 3.14
, pi
, or 'foo'
,
operators like +
, /
, ->
, variables which you can define, like foo
or special ones that will be defined for you, like _x
, or _
, which I specific to
a each built in function, and functions with name, and arguments in the form of f(a,b,c)
, where
f
is the function name, and a, b, c
are the arguments which can be any other expression.
And that's all the parts of the language, so all in all - sounds quite simple.
Like any other proper programming language, scarpet
needs brackets, basically to identify
where stuff begins and where it ends. In the languages that uses much more complicated constructs, like Java,
they tend to use all sort of them, round ones to indicate function calls, curly to indicate section of code,
square to access lists, pointy for generic types etc... I mean - there is no etc, cause they have exhausted
all the bracket options...
Scarpet
is different, since it runs everything based on functions (although its not per se a functional language like lisp)
only needs the round brackets for everything, and it is up to the programmer to organize its code so its readable,
as adding more brackets does not have any effect on the performance of the programs as they are compiled before they are executed.
Look at the following example usage of if()
function:
if(x<y+6,set(x,8+y,z,'air');plop(x,top('surface',x,z),z,'birch'),sin(query(player(),'yaw'))>0.5,plop(0,0,0,'boulder'),particle('fire',x,y,z))
Would you prefer to read
if( x<y+6, set(x,8+y,z,'air'); plop(x,top('surface',x,z),z,'birch'), sin(query(player(),'yaw'))>0.5, plop(0,0,0,'boulder'), particle('fire',x,y,z) )
Or rather:
if ( x<y+6, ( set(x,8+y,z,'air'); plop(x,top('surface',x,z),z,'birch') ), sin(query(player(),'yaw'))>0.5, ( plop(0,0,0,'boulder') ), particle('fire',x,y,z) )
Whichever style you prefer it doesn't matter. It typically depends on the situation and the complexity of the subcomponents. No matter how many whitespaces and extra brackets you add - the code will evaluate to exactly the same expression, and will run exactly the same, so make sure your programs are nice and clean so others don't have problems with them
Users can define functions in the form fun(args....) -> expression
and they are compiled and saved
for further execution in this but also subsequent calls of /script command. This means that once defined functions
are saved with the world for further use. There are two types of variables,
global - which are shared anywhere in the code, and those are all which name starts with 'global_', and
local variables which is everything else and those are only visible inside each function.
This also means that all the parameters in functions are passed 'by value', not 'by reference'.
Functions can still 'borrow' variables from the outer scope,
by adding them to the function signature wrapped around built-in function outer
. What this does is
it borrows the reference to that variable from the outer scope to be used inside the function and any modifications to that outer
variable would result in changes of that value in the outer scope as well. Its like passing the parameters by reference,
except the calling function itself decides what variables its borrowing and what its name. This can be used to
return more than one result from a function call, although its a very ugly way of doing it -
I would still recommend returning a list of values instead.
Variables from outer scopes have a similar behaviour to, for example, nonlocal
variables from python.
Note that this should only apply to pasting your code to execute with commandblock. Scarpet recommends placing your
code in packages (files with .sc
extension that can be placed inside "/scripts" folder in the world files
and loaded as a module with command /script load [package_name]
. Scarpet modules loaded from disk should only
contain code, no need to start with "/script run" prefix
Since the maximum command that can be input to the chat is limited in length, you will be probably inserting your
programs by pasting them to command blocks or reading from world files, however pasting to command blocks will remove some whitespaces and squish
your newlines making the code not readable. If you are pasting a program that is perfect and will never cause an error,
I salute you, but for the most part it is quite likely that your program might break, either at compile time, when
its initially analyzed, or at execute time, when you suddenly attempt to divide something by zero. In these cases
you would want to get a meaningful error message, but for that you would need to indicate for the compiler where
did you put these new lines, since command block would squish them. For that, place at the beginning
of the line to let the compiler know where are you. This makes so that $
is the only character that is
illegal in programs, since it will be replaced with new lines. As far as I know, $
is not used
anywhere inside Minecraft identifiers, so this shouldn't hinder the abilities of your programs.
Consider the following program executed as command block command:
/script run run_program() -> ( loop( 10, foo = floor(rand(10)); check_not_zero(foo); print(_+' - foo: '+foo); print(' reciprocal: '+ _/foo ) ) ); check_not_zero(foo) -> ( if (foo==0, foo = 1) )
Lets say that the intention was to check if the bar is zero and prevent division by zero in print,
but because the foo
is passed as a variable, it never changes the original foo value.
Because of the inevitable division by zero, we get the following message:
Your math is wrong, Incorrect number format for Infinity at pos 112 run_program() -> ( loop( 10, foo = floor(rand(10)); check_not_zero(foo); print(_+' - foo: '+foo); HERE>> print(' reciprocal: '+ _/foo ) )); check_not_zero(foo) -> ( if (foo==0, foo = 1))As we can see, we got our problem where the result of the mathematical operation was not a number (
Infinity
, so not a number),
however by pasting our program
into the command made it squish the newlines so while it is clear where the error happened and we still can track the error down,
the position of the error (112) is not very helpful and wouldn't be useful if the program gets significantly longer.
To combat this issue we can precede every line of the script with dollar signs $
:
/script run $run_program() -> ( $ loop( 10, $ foo = floor(rand(10)); $ check_not_zero(foo); $ print(_+' - foo: '+foo); $ print(' reciprocal: '+ _/foo ) $ ) $); $check_not_zero(foo) -> ( $ if (foo==0, foo = 1) $)
Then we get the following error message
Your math is wrong, Incorrect number format for Infinity at line 7, pos 5 print(_+' - foo: '+foo); HERE>> print(' reciprocal: '+ _/foo ) )
As we can note not only we get much more concise snippet, but also information about the line number and position, so means its way easier to locate the potential problems problem
Obviously that's not the way we intended this program to work. To get it foo
modified via
a function call, we would either return it as a result and assign it to the new variable:
foo = check_not_zero(foo); ... check_not_zero(foo) -> if(foo == 0, 1, foo)
.. or convert it to a global variable, which in this case passing as an argument is not required
global_foo = floor(rand(10)); check_foo_not_zero(); ... check_foo_not_zero() -> if(global_foo == 0, global_foo = 1)
.. or scope foo from the outer function - in this case the inner function has to determine what it is accessing
foo = floor(rand(10)); check_foo_not_zero(); ... check_foo_not_zero(outer(foo)) -> if(foo == 0, foo = 1)
outer
scope can only be used in
function signatures to indicate outer variables. They are not arguments, but still you would want to use
locally without affecting other uses of foo in your program.
For the most part - passing arguments as values, and using returned values .
The main usecase of Scarpet
would rather be simpler scripts, default scope for all variables is global, unless variable
is declared with local
scope explicitly.
| Constructor and Description |
|---|
Expression(java.lang.String expression) |
| Modifier and Type | Method and Description |
|---|---|
void |
ArithmeticOperations()
Arithmetic operations
|
void |
ListsLoopsAndHigherOrderFunctions()
Lists, loops, and higher order functions
|
void |
Operators()
Operators
|
void |
SystemFunctions()
System functions
|
void |
UserDefinedFunctionsAndControlFlow()
User-defined functions and program control flow
|
void |
VariablesAndConstants()
Variables and Constants
|
public Expression(java.lang.String expression)
expression
- .public void ArithmeticOperations()
There is bunch of them - they require a number and spit out a number, doing what you would expect them to do.
fact(n)
Factorial of a number, a.k.a n!
, just not in scarpet
. Gets big... quick...
sqrt(n)
Square root. For other fancy roots, use ^
, math and yo noggin. Imagine square roots on a tree...
abs(n)
Absolut value.
round(n)
Closest integer value. Did you know the earth is also round?
floor(n)
Highest integer that is still no larger then n
. Insert a floor pun here.
ceil(n)
First lucky integer that is not smalller than n
. As you would expect, ceiling is typically
right above the floor.
ln(n)
Natural logarithm of n
. Naturally.
ln1p(n)
Natural logarithm of n+1
. Very optimistic.
log10(n)
Decimal logarithm of n
. Its ceiling is the length of its floor.
log(n)
Binary logarithm of n
. Finally, a proper one, not like the other 100.
log1p(n)
Binary logarithm of n+1
. Also always positive.
mandelbrot(a, b, limit)
Computes the value of the mandelbrot set, for set a
and b
spot.
Spot the beetle. Why not.
min(arg, ...), min(list), max(arg, ...), max(list)
Compute minimum or maximum of supplied arguments assuming default sortraphical order.
Interesting bit - min
and max
don't remove variable associations from arguments, which
means can be used as LHS of assignments (obvious case), or argument spec in function definitions (far less obvious).
a = 1; b = 2; min(a,b) = 3; l(a,b) => [3, 2] a = 1; b = 2; fun(x, min(a,b)) -> l(a,b); fun(3,5) => [5, 0]
Absolutely no idea, how the latter might be useful in practice. But since it compiles, can ship it.
relu(n)
Linear rectifier of n
. 0 below 0, n above. Why not. max(0,n)
with less moral repercussions.
sin(x)
cos(x)
tan(x)
asin(x)
acos(x)
atan(x)
atan2(x,y)
sinh(x)
cosh(x)
tanh(x)
sec(x)
csc(x)
sech(x)
csch(x)
cot(x)
acot(x)
coth(x)
asinh(x)
acosh(x)
atanh(x)
rad(deg)
deg(rad)
Use as you wish
public void ListsLoopsAndHigherOrderFunctions()
Efficient use of these functions cangreatly simplify your programs and speed them up, as these functions will internalize most of the operations that need to be applied on multiple values at the same time
l(values ...), l(iterator)
Creates a list of values of the expressions passed as parameters. It can be used as an L-value and if all
elements are variables, you coujld use it to return multiple results from one function call, if that function returns
a list of results with the same size as the l
call uses. In case there is only one argument and it is
an iterator (vanilla expression specification has range
, but Minecraft API implements
a bunch of them, like diamond
), it will convert it to a proper list. Iterators can only be used in
high order functions, and are treated as empty lists, unless unrolled with l
l(1,2,'foo') => [1, 2, foo] l() => [] (empty list) l(range(10)) => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] l(1, 2) = l(3, 4) => Error: l is not a variable l(foo, bar) = l(3,4); foo==3 && bar==4 => 1 l(foo, bar, baz) = l(2, 4, 6); l(min(foo, bar), baz) = l(3, 5); l(foo, bar, baz) => [3, 4, 5]
In the last example l(min(foo, bar), baz)
creates a valid L-value, as min(foo, bar) finds the
lower of the variables (in this case foo
) creating a valid assignable L-list of [foo, baz], and these
values will be assigned new values
join(delim, list), join(delim, values ...)
Returns a string that contains joined elements of the list, iterator, or all values, concatenated with delim
delimiter
join('-',range(10)) => 0-1-2-3-4-5-6-7-8-9 join('-','foo') => foo join('-', 'foo', 'bar') => foo-bar
split(delim, expr)
Splits a string undr expr
by delim
which can be a regular expression
split('',foo) => [f, o, o] split('.','foo.bar') => [] split('\\.','foo.bar') => [foo, bar]
slice(expr, from, to?)
extracts a substring, or sublist (based on the type of the result of the expression under expr with starting index
of from
, and ending at to
if provided, or the end, if omitted
slice(l(0,1,2,3,4,5), 1, 3) => [1, 2, 3] slice('foobar', 0, 1) => 'f' slice('foobar', 3) => 'bar' slice(range(10), 3, 5) => [3, 4, 5] slice(range(10), 5) => [5, 6, 7, 8, 9]
sort(list), sort(values ...)
Sorts in the default sortographical order either all arguments, or a list if its the only argument. It returns a new sorted list, not affecting the list passed to the argument
sort(3,2,1) => [1, 2, 3] sort('a',3,11,1) => [1, 3, 11, 'a'] list = l(4,3,2,1); sort(list) => [1, 2, 3, 4]
sort_key(list, key_expr)
Sorts a copy of the list in the order or keys as defined by the key_expr
for each element
sort_key([1,3,2],_) => [1, 2, 3] sort_key([1,3,2],-_) => [3, 2, 1] sort_key(l(range(10)),rand(1)) => [1, 0, 9, 6, 8, 2, 4, 5, 7, 3] sort_key(l(range(20)),str(_)) => [0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 3, 4, 5, 6, 7, 8, 9]
range(to), range(from, to), range(from, to, step)
Creates a range of numbers from from
, no greater/larger than to
.
The step
parameter dictates not only the increment size, but also direction (can be negative).
The returned value is not a proper list, just the iterator
but if for whatever reason you need a proper list with all items evaluated, use l(range(to))
.
Primarily to be used in higher order functions
range(10) => [...] l(range(10)) => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] map(range(10),_*_) => [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] reduce(range(10),_a+_, 0) => 45 range(5,10) => [5, 6, 7, 8, 9] range(20, 10, -2) => [20, 18, 16, 14, 12]
get(value, address), element(value, address)(deprecated)
Returns the value at address
element from the value
.
For lists it indicates an index, use negative numbers to reach elements from the end of the list. get
call will always be able to find the index. In case there is few items, it will loop over
[Minecraft specific usecase]: In case value
is of nbt
type, uses addess as the nbt path to query,
returning null, if path is not found, one value if there was one match, or list of values if result is a list.
Returned elements can be of numerical type, string texts, or another compound nbt tags
get(l(range(10)), 5) => 5 get(l(range(10)), -1) => 9 get(l(range(10)), 10) => 0 get(l(range(10)), 93) => 3 get(player() ~ 'nbt', 'Health') => 20 // inefficient way to get player health
put(list, index, values ...), put(list, null, values ...)
Modifies the list by replacing values starting from index
with values
.
use negative numbers to reach elements from the end of the list. put
call will always be able to find the index. In case there is few items, it will loop over. In case end
of the list is reached before values
run out, list is extended to accomodate for more values. in case you
want to append at the end of the list, use null
as index. returns number of elements inserted.
a = l(1, 2, 3); put(a, 1, 4); a => [1, 4, 3] a = l(1, 2, 3); put(a, null, 4, 5, 6); a => [1, 2, 3, 4, 5, 6] a = l(l(0,0,0),l(0,0,0),l(0,0,0)); put(element(a, 1), 1, 1); a => [[0, 0, 0], [0, 1, 0], [0, 0, 0]]
while(cond, limit, expr)
Evaluates expression expr
repeatedly until condition cond
becomes false,
but not more than limit
times. Returns the result of the last expr
evaluation,
or null
if nothing was successful. both expr
and cond
will recveived a
bound variable _
indicating current iteration, so its a number
while(a<100,10,a=_*_) => 81 // loop exhausted via limit while(a<100,20,a=_*_) => 100 // loop stopped at condition, but a has already been assigned while(_*_<100,20,a=_*_) => 81 // loop stopped at condition, before a was assigned a value
loop(num,expr(_),exit(_)?)
Evaluates expression expr
, num
number of times. Optionally,
if exit
condition is present, stops the execution if the condition becomes true.
Both expr
and exit
receive _
system variable indicating the iteration
loop(5, tick()) => repeat tick 5 times list = l(); loop(5, x = _; loop(5, list += l(x, _) ) ); list // double loop, produces: [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [1, 0], [1, 1], ... , [4, 2], [4, 3], [4, 4]]
In this small example we will search for first 10 primes, apparently including 0:
check_prime(n) -> !first( range(2, sqrt(n)+1), !(n % _) ); primes = l(); loop(10000, if(check_prime(_), primes += _), length(primes) >= 10 ); primes // outputs: [0, 1, 2, 3, 5, 7, 11, 13, 17, 19]
map(list,expr(_,_i), exit(_,_i)?)
Converts a list
of values, to another list where each value is result of an expression
v = expr(_, _i)
where _
is passed as each element of the list, and _i
is
the index of such element, optional exit
condition is evaluated after each mapping and if it is false,
the map is terminated and returned whatever got collected so far
map(range(10), _*_) => [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] map(players('*'), _+' is stupid') [gnembon is stupid, herobrine is stupid]
filter(list,expr(_,_i),exit(_,_i))
filters list
elements returning only these that return positive result of the expr
.
Like with map
if the optional condition exit
gets true, the list is returned up to this point
filter(range(100), !(_%5), _*_>1000) => [0, 5, 10, 15, 20, 25, 30] map(filter(entities_list('all'),_=='Witch'), query(_,'pos') ) => [[1082.5, 57, 1243.5]]
first(list,expr(_,_i))
Finds and returns the first item in the list that satisfies expr
. It sets _
for current element value,
and _i
for index of that element
first(range(1000,10000), n=_; !first( range(2, sqrt(n)+1), !(n % _) ) ) => 1009 // first prime after 1000
Notice in the example above, that we needed to rename the outer _
to be albe to use in in the inner
first
call
all(list,expr(_,_i))
Returns true
if all elements on the list satisfy the condition. Its roughly equivalent to
all(list,expr) <=> for(list,expr)==length(list)
, but works with generators. expr
also receives bound _
and _i
variables
all([1,2,3], check_prime(_)) => 1 all(neighbours(x,y,z), _=='stone') => 1 // if all neighbours of [x, y, z] are stone map(filter(rect(0,4,0,1000,0,1000), l(x,y,z)=pos(_); all(rect(x,y,z,1,0,1),_=='bedrock') ), pos(_) ) => [[-298, 4, -703], [-287, 4, -156], [-269, 4, 104], [242, 4, 250], [-159, 4, 335], [-208, 4, 416], [-510, 4, 546], [376, 4, 806]] // find all 3x3 bedrock structures in the top bedrock layer map( filter( rect(0,4,0,1000,1,1000,1000,0,1000), l(x,y,z)=pos(_); all(rect(x,y,z,1,0,1),_=='bedrock') && for(rect(x,y-1,z,1,1,1,1,0,1),_=='bedrock')<8), pos(_) ) => [[343, 3, -642], [153, 3, -285], [674, 3, 167], [-710, 3, 398]] // ditto, but requiring at most 7 bedrock block in the 18 blocks below them
for(list,expr(_,_i),exit(_,_i)?)
Evaluates expression over list of items from the list
, and can optionally stop early if
exit
expression is specified and evaluates true
for a given iteration. Supplies
_
(value) and _i
(iteration number) to both expr
and exit
.
Returns the number of times expr
was successful
check_prime(n) -> !first( range(2, sqrt(n)+1), !(n % _) ); for(range(1000000,1100000),check_prime(_)) => 7216
From which we can learn that there is 7216 primes between 1M and 1.1M
reduce(list,expr(_a,_,_i), initial)
Applies expr
for each element of the list and saves the result in _a
accumulator.
Consecutive calls to expr
can access that value to apply more values. You also need to specify
the initial value to apply for the accumulator
reduce([1,2,3,4],_a+_,0) => 10 reduce([1,2,3,4],_a*_,1) => 24
public void Operators()
There is a number of operators you can use inside the expressions. Those could be considered
generic type operators that apply to most data types. They also follow standard operator
precedence, i.e. 2+2*2
is understood as 2+(2*2)
,
not (2+2)*2
, otherwise they are applied from left to right, i.e.
2+4-3
is interpreted as (2+4)-3
, which in case of numbers
doesn't matter, but since scarpet
allows for mixing all value types
the associativity would matter, and may lead to unintended effects:
Important operator is function definition ->
operator. It will be covered
in UserDefinedFunctionsAndControlFlow()
'123'+4-2 => ('123'+4)-2 => '1234'-2 => '134' '123'+(4-2) => '123'+2 => '1232' 3*'foo' => 'foofoofoo' 1357-5 => 1352 1357-'5' => 137 3*'foo'-'o' => 'fff' l(1,3,5)+7 => l(8,10,12)
As you can see, values can behave differently when mixed with other types
in the same expression. in case values are of the same types, the result
tends to be obvious, but Scarpet
tries to make sense of whatever it
has to deal with
Here is the complete list of operators in scarpet
including control flow operators.
note, that commas and brackets are not operators, but behave like them:
+ - !
^
* / %
+ -
== != > >= <= < ~
&&
||
= += <>
->
;
,
( )
Basic Arithmetic Operators + - * /
Allows to add the results of two expressions. If the operands resolve to numbers, the result is
arithmetic operation.
In case of strings, adding or subtracting from a string results in string concatenation and
removal of substrings from that string. Multiplication of strings and numbers results in repeating the
string N times and division results in taking the first k'th part of the string, so that str*n/n ~ str
In case first operand is a list, either it results in a new list
with all elements modified one by one with the other operand, or if the operand is a list with the same number of
items - elementwise addition/subtraction
Examples:
2+3 => 5 'foo'+3+2 => 'foo32' 'foo'+(3+2) => 'foo5' 3+2+'bar' => '5bar' 'foo'*3 => 'foofoofoo' 'foofoofoo' / 3 => 'foo' 'foofoofoo'-'o' => 'fff' l(1,2,3)+1 => l(2,3,4) b = l(100,63,100); b+l(10,0,10) => l(110,63,110)
Just Operators % ^
The modulo and exponent (power) operators work only if both operands are numbers
pi^pi%euler => 1.124.... -9 % 4 => -1 9 % -4 => 0 ¯\_(ツ)_/¯ Java -3 ^ 2 => 9 -3 ^ pi => // Error
Comparison Operators == != < > <= >=
Allows to compare the results of two expressions.
For numbers it is considers arithmetic order of numbers, for strings - lexicographical,
nulls are always 'less' than everything else, and lists check their elements - if the sizes
are different, the size matters, otherwise, pairwise comparisons for each elements are performed.
The same order rules than with all these operators are used with the default sortographical order as
used by sort
function. All of these are true:
null == null null != false 0 == false 1 == true null < 0 null < -1000 1000 < 'a' 'bar' < 'foo' 3 == 3.0
Logical Operators && ||
These operator compute respective boolean operation on the operands. What it important is that if calculating
of the second operand is not necessary, it won't be evaluated, which means one can use them as conditional
statements. In case of success returns first positive operand (||
) or last one (&&
).
true || false => 1 null || false => 0 null != false || run('kill gnembon') => 1 // gnembon survives null != false && run('kill gnembon') => 0 // when cheats not allowed null != false && run('kill gnembon') => 1 // gnembon dies, cheats allowed
Matching Operator ~
This operator should be understood as 'matches', or 'in'. For strings it matches the right operand as a regular
expression to the left one, returning the first match. This can be used to extract information from unparsed nbt's
in a more efficient way. For lists it checks if an element is in the list, and returns the index of that element,
or null
if no such element was found, especially that the use of first
function will not
return the index. Currently it doesn't have any special behaviour for numbers - it checks for existence of characters
in string representation of the left operand with respect of the regular expression on the right hand side.
string
in Minecraft API portion entity ~ feature
is a shortcode for query(entity,feature)
for queries that do not take any extra arguments.
l(1,2,3) ~ 2 => 1 l(1,2,3) ~ 4 => null 'foobar' ~ '.b' => 'ob' player('*') ~ 'gnembon' // null unless player gnembon is logged in (better to use player('gnembon') instead p ~ 'sneaking' // if p is an entity returns whether p is sneaking
Or a longer example of an ineffective way to searching for a squid
entities = entities_area('all',x,y,z,100,10,100); sid = entities ~ 'Squid'; if(sid != null, run('execute as '+query(element(entities,sid),'id')+' run say I am here '+query(element(entities,sid),'pos') ) )
Or an example to find if a player has specific enchantment on a held axe (either hand) and get its level (despite obvious lack of support for json NBT's):
global_get_enchantment(p, ench) -> ( $ for(l('main','offhand'), $ holds = query(p, 'holds', _); $ if( holds, $ l(what, count, nbt) = holds; $ if( what ~ '_axe' && nbt ~ ench, $ lvl = max(lvl, number(nbt ~ '(?<=lvl:)\\d') ) $ ) $ ) $ ); $ lvl $); /script run global_get_enchantment(players(), 'sharpness')
Assignment Operators = <> +=
A set of assignment operators. All require bounded variable on the LHS, <>
requires
bounded arguments on the right hand side as well (bounded, meaning being variables). Additionally they can also
handle list constructors with all bounded variables, and work then as list assignment operators.
When +=
is used on a list, it extends that list of that element, and returns the list (old == new).
scarpet
doesn't support currently removal of items. Removal of items can be obtaine via
filter
command, and reassigning it fo the same variable. Both operations would require rewriting of the
array anyways.
a = 5 => a == 5 l(a,b,c) = l(3,4,5) => a==3, b==4, c==5 l(minx,maxx) = sort(xi,xj); // minx assumes min(xi, xj) and maxx, max(xi, xj) l(a,b,c,d,e,f) = l(range(6)); l(a,b,c) <> l(d,e,f); l(a,b,c,d,e,f) => [3,4,5,0,1,2] a = l(1,2,3); a += 4 => [1,2,3,4] a = l(1,2,3,4); a = filter(a,_!=2) => [1,3,4]
Unary Operators - +
Require a number, flips the sign. One way to assert it's a number is by crashing the script. gg.
-4 => -4 +4 => 4 +'4' // Error message
Negation Operator !
flips boolean condition of the expression. Equivalent of bool(expr)==false
!true => 0 !false => 1 !null => 1 !5 => 0 !l() => 1 !l(null) => 0
public void SystemFunctions()
type(expr)
Returns the string value indicating type of the expression. Possible outcomes are
null, number, string, list, iterator
, as well as minecraft related concepts like
block, entity, nbt
bool(expr)
Returns a boolean context of the expression. Note that there are no true/false values in
scarpet. true
is alias of 1, and false
is 0. Bool is also interpreting
string values as boolean, which is different from other places where boolean context can be used.
This can be used in places where API functions return string values to represent binary values
bool(pi) => 1 bool(false) => 0 bool('') => 0 bool(l()) => 0 bool(l('')) => 1 bool('foo') => 1 bool('false') => 0 bool('nulL') => 0 if('false',1,0) => 1
number(expr)
Returns a numeric context of the expression. Can be used to read numbers from strings
number(null) => null number(false) => 0 number('') => null number('3.14') => 3.14 number(l()) => 0 number(l('')) => 1 number('foo') => null number('3bar') => null number('2')+number('2') => 4
str(expr, params? ... ), str(expr, param_list)
Returns a formatted string representing expression.
Accepts formatting style accepted by String.format
.
Supported types (with "%?"
syntax):
str(null) => null str(false) => 0 str('') => null str('3.14') => 3.14 str(l()) => 0 str(l('')) => 1 str('foo') => null str('3bar') => null str(2)+str(2) => 22 str('pi: %.2f',pi) => 'pi: 3.14' str('player at: %d %d %d',pos(player())) => 'player at: 567, -2423, 124'
length(expr)
Returns length of the expression, the length of the string, the length of the integer part of the number, or length of the list
length(pi) => 1 length(pi*pi) => 1 length(pi^pi) => 2 length(l()) => 0 length(l(1,2,3)) => 3 length('') => 0 length('foo') => 3
rand(expr)
returns a random number from 0.0
(inclusive) to expr
(exclusive).
In boolean context (in conditions, boolean functions, or bool
), returns
false if the randomly selected value is less than 1. This means that rand(2)
returns true half
of the time and rand(5)
returns true for 80% (4/5) of the time
map(range(10), floor(rand(10))) => [5, 8, 0, 6, 9, 3, 9, 9, 1, 8] map(range(10), bool(rand(2))) => [1, 1, 1, 0, 0, 1, 1, 0, 0, 0] map(range(10), str('%.1f',rand(_))) => [0.0, 0.4, 0.6, 1.9, 2.8, 3.8, 5.3, 2.2, 1.6, 5.6]
print(expr)
prints the value of the expression to chat.
Passes the result of the argument to the output unchanged, so print
-statements can
be weaved in code to debug programming issues
print('foo') => results in foo, prints: foo a = 1; print(a = 5) => results in 5, prints: 5 a = 1; print(a) = 5 => results in 5, prints: 1 print('pi = '+pi) => prints: pi = 3.141592653589793 print(str('pi = %.2f',pi)) => prints: pi = 3.14
sleep(expr)
Halts the execution of the program (and the game itself) for expr
milliseconds.
All in all, its better to use tick(expr)
to let the game do its job while the program waits
sleep(50)
time()
Returns the number of milliseconds since 'some point',
like Java's System.nanoTime()
. It returns a float, which has 1 microsecond precision
(0.001 ms)
start_time = time(); flip_my_world_upside_down(); print(str('this took %d milliseconds',time()-start_time))
var(expr)
Returns the variable under the name of the string value of the expression. Allows to manipulate variables in more programmatic manner, which allows to use local variable set with a hash map type key-value access, can also be used with global variables
a = 1; var('a') = 'foo'; a => a == 'foo'
undef(expr)
Removes all bindings of a variable with a name of expr
.
Removes also all function definitions with that name. It can affect global variable pool, and local variable set
for a particular function which will become invalid ........,
inc(i) -> i+1; foo = 5; inc(foo) => 6 inc(i) -> i+1; foo = 5; undef('foo'); inc(foo) => 1 inc(i) -> i+1; foo = 5; undef('inc'); undef('foo'); inc(foo) => Error: Function inc is not defined yet at pos 53 undef('pi') => bad idea - removes hidden variable holding the pi value undef('true') => even worse idea, unbinds global true value, all references to true would now refer to the default 0
vars(prefix)
It returns all names of variables from local scope (if prefix does not start with 'global')
or global variables (otherwise).
Here is a larger example that uses combination of vars
and var
functions to
be used for object counting
/script run $ count_blocks(ent) -> ( $ l(cx, cy, cz) = query(ent, 'pos'); $ scan(cx, cy, cz, 16, 16, 16, var('count_'+_) += 1); $ for ( sort_key( vars('count_'), -var(_)), $ print(str( '%s: %d', slice(_,6), var(_) )) $ ) $ ) /script run count_blocks(player())
public void UserDefinedFunctionsAndControlFlow()
Operator ;
To effectively write programs that have more than one line, a programmer needs way to specify a sequence of
commands that execute one after another. In scarpet
this can be achieved with ;
. Its an operator,
and by separating statements with semicolons. And since whitespaces and $
signs are all treats as
whitespaces, how you layout your code doesn't matter, as long as it is readable to everyone involved. The
usefulness of preceding all the lines of the script with $
is explained in the preamble
expr; expr; expr; expr
Notice that the last expression is not followed by a semicolon. Since instruction separation is functional
in scarpet
, and not barely an instruction delimiter,
terminating the code with a dangling operator wouldn't be valid.
In general expr; expr; expr; expr
is equivalent to
(((expr ; expr) ; expr) ; expr)
. In case the programmer forgets that it should be warned with a
helpful error at compile time.
Result of the evaluated expression is the same as the result of the second expression, but first expression is also evaluated for sideeffects
expr1 ; expr2 => expr2 // with expr1 as a sideeffect
All defined functions are compiled, stored persistently, and available globally -
accessible to all other scripts. Functions can only be undefined via call to undef('fun')
, which
would erase global entry for function fun
. Since all variables have local scope inside each function,
one way to share large objects is via global variables
Any variable that is used with a name that starts with 'global_'
will be stored and accessible globally,
not, inside current scope. It will also persist across scripts, so if a procedure needs to use its own construct, it needs to
define it, or initialize it explicitly, or undefine it via undef
a() -> global_list+=1; global_list = l(1,2,3); a(); a(); global_list // => [1,2,3,1,1]
Operator ->
To organize code better than a flat sequence of operations, one can define functions. Definition is correct if has the following form
fun(args, ...) -> expr
Where fun(args, ...)
is a function signature indicating function name, number of arguments,
and their names, and expr is an expression (can be complex) that is evaluated when fun
is called.
Names in the signature don't need to be used anywhere else, other occurrences of these names
will be masked in this function scope.
Function call creates new scope for variables inside expr
, so all non-global variables are not
visible from the caller scope. All parameters are passed by value to the new scope, including lists
a(lst) -> lst+=1; list = l(1,2,3); a(list); a(list); list // => [1,2,3]
In case the inner function wants to operate and modify larger objects, lists from the outer
scope, but not global, it needs to use outer
function in function signature
outer(arg)
outer
function can only be used in the function signature, and it will
cause an error everywhere else. It borrows the reference to that variable from the outer scope and allows
its modification in the inner scope. Any modification of outer variable will result in change of them in
the outer function. In case the variable was not set yet in the outer scope - it will be created. This construct
is similar to nonlocal
scoping from python
a(outer(list)) -> list+=1; list = l(1,2,3); a(); a(); list // => [1,2,3,1,1]
The return value of a function is the value of the last expression. This as the same effect as using outer or global lists, but is more expensive
a(lst) -> lst+=1; list = l(1,2,3); list=a(list); list=a(list); list // => [1,2,3,1,1]
Ability to combine more statements into one expression, with functions, passing parameters, and global and outer scoping allow to organize even larger scripts
return(expr?)
Sometimes its convenient to break the organized control flow, or it is not practical to pass the final result value of a function to the last statement, in this case a return statement can be used
If no argument is provided - returns null value.
def() -> ( expr1; expr2; return(expr3); // function terminates returning expr3 expr4; // skipped expr5 // skipped )
In general its cheaper to leave the last expression as a return value, rather than calling returns everywhere, but it would often lead to a messy code.
exit(expr?)
It terminates entire program passing expr
as the result of the program execution, or null if omitted.
try(expr, catch_expr(_)?) ... throw(value?)
try
function evaluates expression, and continues further unless throw
function is called
anywhere inside expr
. In that case the catch_expr
is evaluates with _
set
to the argument throw
was called with.
This mechanic accepts skipping thrown value - it throws null instead, and catch expression - then try returns null as well
This mechanism allows to terminate large portion of a convoluted
call stack and continue program execution. There is only one level of exceptions currently in carpet, so if the inner
function also defines the try
catchment area, it will received the exception first, but it can technically
rethrow the value its getting for the outer scope. Unhandled throw acts like an exit statement.
if(cond, expr, cond?, expr?, ..., default?)
If statement is a function that takes a number of conditions that are evaluated one after another and if
any of them turns out true, its expr
gets returned, otherwise, if all conditions fail, the return value is
default
expression, or null
if default is skipped
if
function is equivalent to if (cond) expr; else if (cond) expr; else default;
from Java, just in a functional form
public void VariablesAndConstants()
scarpet
provides a number of constants that can be used literally in scripts
null
: nothing, zilch, not even falsetrue
: pure true, or just 1 (one)false
: false truth, or true falsth, 0 (zero) actuallypi
: for the fans of perimeters, its a perimeter of an apple pi of diameter 1. About 3.14euler
: clever guy. Derivative of its exponent is goto 1. About 2.72Apart from that, there is a bunch of system variables, that start with _
that are set by
scarpet
built-ins, like _
, typically each consecutive value in loops,
_i
indicating iteration, or _a
like an accumulator for reduce
function. Certain calls to Minecraft specific calls would also set _x
,
_y
, _z
, indicating block positions. All variables starting with
_
are read-only, and cannot be declared and modified in client code.
scarpet
accepts numeric and string liters constants.
Numbers look like 1, 2.5, -3e-7, 0xff,
and are internally represented as Java's double
but scarpet
will try to trim trailing zeros as much as possible so if you need to use them as intergers,
you can. Strings using single quoting, for multiple reasons, but primarily to allow for easier use of strings inside
doubly quoted command arguments (when passing a script as a parameter of /script fill
for example,
or when typing in jsons inside scarpet to feed back into a /data merge
command for example. Strings also
use backslashes \
for quoting special characters, in both plain strings and regular expressions
'foo' print('This doesn\'t work') nbt ~ '\\.foo' // matching '.' as a '.', not 'any character match'


| 1 |
| Quiz07 |
| CS16 S18 |
| Name: | ||||
|---|---|---|---|---|
| (as it would appear on official course roster) | ||||
| Umail address: | @umail.ucsb.edu | section |
||
| Optional: name you wish to be called if different from name above. | ||||
| Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
Quiz07: Chapter 7 and 10: Pointers
| ready? | assigned | due | points |
|---|---|---|---|
| false | Fri 05/11 10:00AM | Fri 05/18 11:59PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)
Please:
- No Staples.
- No Paperclips.
- No folded down corners.
Read Chapter 7.1 - 7.2 up to page 397 (If you do not have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”).
PLEASE MARK YOUR HOMEWORK CLEARLY, REGARDLESS OF IF YOU WRITE IT OUT IN INK OR PENCIL!
FOR BEST RESULTS, PRINT THIS PAGE AS A PDF, THEN PRINT THE PDF
1.(5 pts) What is the output of the following code? If there’s an error that will not allow an output, point it out. Briefly justify your answer.
int arr[5];
for (int i = 0; i < 5; i++) {
if (i < 3) arr[i] = 'a';
else arr[i] = 'z';
cout << arr[i] << endl; }
2.(5 pts) What is the output of the following code? If there’s an error that will not allow an output, point it out.
int arr[7] = {5};
for (int i = 0; i < 7; i++)
cout << arr[i] + i <<" ";
3.(5 pts) What is the output of the following code? If there’s an error that will not allow an output, point it out.
int codes[] = {44, 66, 83, 973, -977};
for (int count : codes) {
if ( (count/2) < 50 )
cout << count << endl;
else cout << "invalid" << endl; }
4.(5 pts) Draw a diagram to show how the content of the array ‘nums’ changes in memory after every line of the following code is executed. Start by showing the elements of the array in memory when the array is initialized. Every time the element of an array changes, you may indicate the change by crossing out the old value and writing in the new value.
int nums[] = {44, 66, 83};
int tmp = nums[0];
nums[0] = nums[1];
nums[1] = nums[2];
nums[2]= tmp;
5.(5 pts) Describe in your own words what the code in the previous question does. Your description of the code should be as abstract as possible. For example..”the above code sorts the elements of the array in ascending order…”
6.(10 pts) Write the definition of a function named ‘reverse’ that takes two parameters: an integer array and the number of elements of the array. The function should reverse the order of elements of the array. The function should not return anything. See below for an example of expected outcome when the reverse function is called:
int nums[] = {10,20,30,40,50};
reverse(nums, 5);// The order of elements should be reversed after this
for(int i=0;i<5;i++)
cout<< nums[i]<<" "
The output of the above code should be: 50 40 30 20 10
7.(4 pts) List two reasons why you might choose to pass parameters to a function by address or reference, rather than by value in your C++ programs.
8.(6 pts) Draw a pointer diagram to demonstrate how the state of memory changes as the following code is executed. Cross out old values/arrows and draw new ones. Is this program likely to result in a segmentation fault? If so, why?
int num = 10, *ptr1 = &num, *ptr2=0;
if (ptr2) ptr1 = ptr2;
else if(ptr1) ptr2 = ptr1;
(*ptr1)++;
9.(8 pts) On page 14 of the “Pointers and Memory” handout there is a reference to the “Amperand (&)” Bug in the TAB() function. Draw a trace of the local variables of the functions Victim() and TAB() on the run-time stack as these functions are executed. Your diagram should be similar to the one provided on page 13. Your diagram should depict exactly three instances in program execution - T1: Right after the first statement of Victim(), T2: right before the return statement in TAB(), T3: Right after the call to TAB(). Use your diagram to explain the “Amperand (&)” bug and why it is likely to lead to a runtime error when the last line of the Victim() is executed?
10.(8 pts) Write the definition of a structure type called UndergradStudents. This structure should contain student ID numbers, first and last names, major, and GPA scores for each undergraduate year.
11.(14 pts) Write a program that uses the definition of the structure UndergradStudents from the previous question to declare and then initialize an array of 3 objects of this structure (hint: you can do this with the same approach you define/initialize an array of any other type). You must initialize the values in the program, not by user input. The initial values are shown in the table below. Then write the definition of a function with the signature void printRecords(struct UndergradStudents *records, int numrecords);
The function should print out the values of the array of objects passed to it as shown in the sample below, along with each student’s AVERAGE GPA score (calculated to a precision of 2 decimal places). You must use a loop to print the output. Your program should appropriately call the printRecords() function to print the student records and the average GPA.
| ID | First name | Last Name | Major | GPA Yr1 | GPA Yr2 | GPA Yr3 | GPA Yr4 |
| 1 | Joe | Shmoe | EE | 3.8 | 3.3 | 3.4 | 3.9 |
| 2 | Macy | Chen | CS | 3.9 | 3.9 | 4.0 | 4.0 |
| 3 | Peter | Patrick | ME | 3.8 | 3.0 | 2.4 | 1.9 |
OUTPUT:
These are the student records:
ID# 1, Shmoe, Joe, Major: EE, Average GPA: 3.60
ID# 2, Chen, Macy, Major: CS, Average GPA: 3.95
ID# 3, Peter, Patrick, Major: ME, Average GPA: 2.77


{% extends 'base.html'%} {% load static%}
Rate according To:
Posted {{ project_item.posted_time|timesince }} ago.
Project Description:{{project_item.project_description}}
Technologies Used:{{project_item.technologies_used}}
Project_url:{{project_item.project_url}}
Get started:rating Project


Autonomous robot feeding for upper-extremity mobility impaired people: Integrating sensing, perception, learning, motion planning, and robot control.
T. Bhattacharjee, D. Gallenberger, D. Dubois, L. L'Écuyer-Lapiere, Y. Kim, A. Mandalika, R. Scalise, R. Qu, H. Song, E. Gordon, and S.S. Srinivasa.
Conference on Neural Information Processing Systems, 2018
Best Demo Award Winner
Outreach
- TTI/Vanguard Visit and Demo
- March 2, 2020
- UW: Robotics Lab
- American Association for the Advancement of Science (AAAS) Demo
- February 14-15, 2020
- Washington Convention Center
- Computing Open House 2019
- December 7, 2019
- UW: Gates Center
- Clive Thompson Video Shoot
- October 23, 2019
- UW: Robotics Lab
- Photography by Ariana McLaughlin
- Toyota Research Institute Demo
- October 2, 2019
- UW: Robotics Lab
- US Patent Office Demo
- July 16, 2019
- UW: Wallace Hall, AMP Lab
- Engineering Discover Days 2019
- April 26, 2019
- UW: Robotics Lab
- Puget Sound Business Journal Demo
- April 25, 2019; Published May 3, 2019
- UW: Robotics Lab
- NeurIPS 2018 Demonstration
- December 5, 2018
- Computing Open House 2018
- December 2, 2018
- UW: Allen Center
- CSE Woman’s Day Demo
- April 6, 2018
- UW: Robotics Lab


| |
- Method resolution order:
- Collector
- threading.Thread
- threading._Verbose
Methods defined here:
- __init__(self, port, debug=0)
- getMessage(self)
- run(self)
Data and non-method functions defined here:
- __doc__ = None
- __module__ = 'collector'
- debug = 0
- ibLock = <thread.lock object>
- A lock object is a synchronization primitive. To create a lock,
call the PyThread_allocate_lock() function. Methods are:
acquire() -- lock the lock, possibly blocking until it can be obtained
release() -- unlock of the lock
locked() -- test whether the lock is currently locked
A lock is not owned by the thread that locked it; another thread may
unlock it. A thread attempting to lock a lock that it has already locked
will block until another thread unlocks it. Deadlocks may ensue.
- inbox = []
- running = 1
Methods inherited from threading.Thread:
- _Thread__bootstrap = __bootstrap(self)
- _Thread__delete = __delete(self)
- _Thread__stop = __stop(self)
- __repr__(self)
- _set_daemon(self)
- getName(self)
- isAlive(self)
- isDaemon(self)
- join(self, timeout=None)
- setDaemon(self, daemonic)
- setName(self, name)
- start(self)
Data and non-method functions inherited from threading.Thread:
- _Thread__initialized = 0
Methods inherited from threading._Verbose:
- _note(self, format, *args)
|