--- title: Low Birth Weights summary: 'A brief analysis of the birth weight dataset in R' author: 'Robert Underwood' date: '2017-03-12' slug: low-birth-weights categories: ['data analysis', 'predictive analytics'] tags: ['data analysis', 'predictive analytics'] slides: "" comments: no showcomments: yes showpagemeta: yes ---
Health care providers, governments, and parents want children to grow up to be healthy, productive citizens. As a result, billions of dollars have been plunged into helping families from birth through adulthood. The first step in this process is to ensure that children are born healthy. In 1986, Baystate Medical Center in Springfield, MA collected data on the birth weights of 189 children. The goal is to use this data to create a few models to determine what factors go into determining whether a child is born at a healthy weight or not. These models can then be used to provide potential mothers with the best information possible for keeping their children healthy.
This dataset is in the MASS package in R. Some of the variables include the mother’s age and weight and whether the mother smoked during the pregnancy.
library(MASS)
data(birthwt)
head(birthwt)
## low age lwt race smoke ptl ht ui ftv bwt
## 85 0 19 182 2 0 0 0 1 0 2523
## 86 0 33 155 3 0 0 0 0 3 2551
## 87 0 20 105 1 1 0 0 0 1 2557
## 88 0 21 108 1 1 0 0 1 2 2594
## 89 0 18 107 1 1 0 0 1 0 2600
## 91 0 21 124 3 0 0 0 0 0 2622
Of these 189 women, the ages ranged from 14 to 45 and the mothers had a pre-pregnancy weight between 80 and 250 lbs. 96 where white, 26 where black, and 67 had another ethnicity. 74 smoked during the pregnancy while 30 had a history of premature labors. 12 had high blood pressure. 28 had a presence of uterine irritability. 100 did not visit a physician during the first trimester. Low birth weight is determined if a child’s birth weight is under 2500 or 2.5 kg. There were 59 children out of 189 which had a low birth weight. It appears that the numerical birth weight data is somewhat normal.
table(birthwt$low)
##
## 0 1
## 130 59
barplot(table(birthwt$low), col="green", main="Birth Weight Barplot")
hist(birthwt$bwt, col="red", main="Birth Weight Histogram", xlab="Birth Weight (g)")
qqnorm(birthwt$bwt)
qqline(birthwt$bwt, col="red")
There are two fortunate things about this dataset. None of the predictor variables are highly correlated and there are no missing data points.
cor(birthwt, use="complete.obs")
## low age lwt race smoke
## low 1.00000000 -0.11893928 -0.16962694 0.137792751 0.16140431
## age -0.11893928 1.00000000 0.18007315 -0.172817953 -0.04434618
## lwt -0.16962694 0.18007315 1.00000000 -0.165048544 -0.04417908
## race 0.13779275 -0.17281795 -0.16504854 1.000000000 -0.33903074
## smoke 0.16140431 -0.04434618 -0.04417908 -0.339030745 1.00000000
## ptl 0.19608727 0.07160639 -0.14002900 0.007951293 0.18755706
## ht 0.15237025 -0.01583700 0.23636040 0.019929917 0.01340704
## ui 0.16904283 -0.07515558 -0.15276317 0.053602088 0.06215900
## ftv -0.06296026 0.21539394 0.14052746 -0.098336254 -0.02801314
## bwt -0.78480516 0.09031781 0.18573328 -0.194713487 -0.19044806
## ptl ht ui ftv bwt
## low 0.196087267 0.15237025 0.16904283 -0.06296026 -0.78480516
## age 0.071606386 -0.01583700 -0.07515558 0.21539394 0.09031781
## lwt -0.140029003 0.23636040 -0.15276317 0.14052746 0.18573328
## race 0.007951293 0.01992992 0.05360209 -0.09833625 -0.19471349
## smoke 0.187557063 0.01340704 0.06215900 -0.02801314 -0.19044806
## ptl 1.000000000 -0.01539958 0.22758534 -0.04442966 -0.15465339
## ht -0.015399579 1.00000000 -0.10858506 -0.07237255 -0.14598189
## ui 0.227585340 -0.10858506 1.00000000 -0.05952341 -0.28392741
## ftv -0.044429660 -0.07237255 -0.05952341 1.00000000 0.05831777
## bwt -0.154653390 -0.14598189 -0.28392741 0.05831777 1.00000000
missing.data = 0
for (i in 1:length(birthwt))
{
for (j in 1:length(birthwt[i,]))
{
if (is.na(birthwt[i,j])==TRUE){missing.data=missing.data+1}
}
}
missing.data
## [1] 0
There are two options for creating a model: attempt to predict the numerical birth weights or attempt to predict which children would have a low birth weight. However, there are a few categorical variables that require a transformation into dummy variables. A sample of 126 points were used to build the models while 63 were set aside.
race1 = factor(birthwt$race, labels = c("white", "black", "other"))
race1=relevel(race1, ref="white")
low1 = factor(birthwt$low, labels = c("no", "yes"))
low1=relevel(low1, ref="no")
smoke1=factor(birthwt$smoke, labels = c("no", "yes"))
smoke1=relevel(smoke1, ref="no")
ht1= factor(birthwt$ht, labels = c("no", "yes"))
ht1=relevel(ht1, ref="no")
ui1= factor(birthwt$ui, labels = c("no", "yes"))
ui1=relevel(ui1, ref="no")
birthwt1 = cbind(birthwt, low1, race1, smoke1, ht1, ui1)
set.seed(1)
train = sample(1:nrow(birthwt1), 126) #The test set is 63 which plays nice with 189
To attempt to predict the birth weights, an OLS model was used.
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 636.3 on 120 degrees of freedom
## Multiple R-squared: 0.2967, Adjusted R-squared: 0.2674
## F-statistic: 10.12 on 5 and 120 DF, p-value: 4.166e-08
anova(OLS.full, OLS.reduced)
## Analysis of Variance Table
##
## Model 1: bwt ~ age + lwt + race1 + smoke1 + ptl + ht1 + ui1 + ftv
## Model 2: bwt ~ race1 + smoke1 + ui1 + lwt
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1<PHONE_NUMBER>2
## 2<PHONE_NUMBER>4 -4 -1023532 0.624 0.6463
vif(OLS.reduced)
## GVIF Df GVIF^(1/(2*Df))
## race1 1.246028 2 1.056530
## smoke1 1.145375 1 1.070222
## ui1 1.039183 1 1.019403
## lwt 1.134997 1 1.065362
library(lmtest)
## Warning: package 'lmtest' was built under R version 3.5.2
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 3.5.2
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
bptest(OLS.reduced, data=birthwt1)
##
## studentized Breusch-Pagan test
##
## data: OLS.reduced
## BP = 2.1088, df = 5, p-value = 0.8339
plot(OLS.reduced, which=1)
Based on the resiudal plot and the Breusch-Pagan Test being insignificant, heteroscedasticity does not appear to be a concern. The variance inflation factors indicate that multicollinearity is not a concern either.
Interestingly, non-whites, smokers, and those with a history of UI have smaller children than their counterparts. For each additional pound a mother weighs, the child is 44.5 grams heavier. While the OLS model with all of the variables had more predictive power according to the ANOVA test, and R-squared, the reduced model was selected due to less variables being used. Neither of these models do a decent job of predicting the birth weight. Additional models, including interactive models, did not add any valuable information.
To show how ineffective this model is at prediction, it was used against the test data to show how well it can predict if a child has a low birth weight.
reg.pred = predict(OLS.reduced, birthwt1[-train,])
reg.low=ifelse(reg.pred>2500, 0, 1)
reg.table=table(reg.low, birthwt1$low[-train])
reg.table
##
## reg.low 0 1
## 0 33 19
## 1 5 6
true.negatives.reg = reg.table[1,1]
true.positives.reg = reg.table[2,2]
false.positives.reg = reg.table[2,1]
false.negatives.reg = reg.table[1,2]
all.positives.reg = true.positives.reg+false.negatives.reg
all.negatives.reg = true.negatives.reg+false.positives.reg
all.obs.reg = all.positives.reg+all.negatives.reg
error.rate.reg = (false.positives.reg+false.negatives.reg)/all.obs.reg
sensitivity.reg=true.positives.reg/all.positives.reg
specificity.reg=true.negatives.reg/all.negatives.reg
results.reg = c(error.rate.reg, sensitivity.reg, specificity.reg)
names(results.reg) = c("Error Rate", "Sensitivity", "Specificity")
results.reg
## Error Rate Sensitivity Specificity
## 0.3809524 0.2400000 0.8684211
There is an acceptable error rate of 38%, but the sensitivity rate is only 16%, meaning it doesn’t do a good job of prediciting which children have a low birth weight.
A better attempt at creating a model was done using binomial logistic regression. The goal is to predict if a child is born with a low birth weight. Similar to the OLS model, Race, weight, smoking, and UI showed to be significant.
bi.log = glm(low1~lwt+race1+smoke1+ui1, data=birthwt1, subset=train,
family=binomial(link="logit"))
summary(bi.log)
##
## Call:
## glm(formula = low1 ~ lwt + race1 + smoke1 + ui1, family = binomial(link = "logit"),
## data = birthwt1, subset = train)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.5312 -0.7353 -0.4968 0.7137 2.2064
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.58035 1.18819 -0.488 0.62525
## lwt -0.01602 0.00865 -1.852 0.06406 .
## race1black 1.77052 0.65778 2.692 0.00711 **
## race1other 1.06012 0.59395 1.785 0.07428 .
## smoke1yes 1.54959 0.52750 2.938 0.00331 **
## ui1yes 1.25122 0.56594 2.211 0.02705 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 146.94 on 125 degrees of freedom
## Residual deviance: 122.28 on 120 degrees of freedom
## AIC: 134.28
##
## Number of Fisher Scoring iterations: 5
log.odds = coef(bi.log)
odds <- exp(log.odds)
prob = odds/(1+odds)
cbind(log.odds, odds, prob)
## log.odds odds prob
## (Intercept) -0.58034936 0.5597028 0.3588522
## lwt -0.01601724 0.9841103 0.4959958
## race1black 1.77052381 5.8739294 0.8545228
## race1other 1.06011723 2.8867094 0.7427129
## smoke1yes 1.54959202 4.7095484 0.8248548
## ui1yes 1.25121618 3.4945904 0.7775103
Non-whites, smokers, or those with a history of UI are more likely to have children with a low birth weight than their respective counterparts while heavier women are not. To further evaluate how this model does at prediction, a classification matrix was creatred.
log.pred = predict(bi.log, birthwt1[-train,], type="response")
pred.log.low = ifelse(log.pred>0.5, 1, 0)
log.table=table(pred.log.low, birthwt1$low[-train])
true.negatives = log.table[1,1]
true.positives = log.table[2,2]
false.positives = log.table[2,1]
false.negatives = log.table[1,2]
all.positives = true.positives+false.negatives
all.negatives = true.negatives+false.positives
all.obs = all.positives+all.negatives
error.rate.log = (false.positives+false.negatives)/all.obs
sensitivity.log=true.positives/all.positives
specificity.log=true.negatives/all.negatives
results.log = c(error.rate.log, sensitivity.log, specificity.log)
names(results.log) = c("Error Rate", "Sensitivity", "Specificity")
results.log
## Error Rate Sensitivity Specificity
## 0.4126984 0.2000000 0.8421053
rbind(results.reg, results.log)
## Error Rate Sensitivity Specificity
## results.reg 0.3809524 0.24 0.8684211
## results.log 0.4126984 0.20 0.8421053
In comparison to the OLS model, this appears to be a worse job of prediction overall. The error rate is higher while both the sensitivity and specificity rates are lower.
Another attempt involving a classification tree was used to determine if a child had a low birth weight. The full tree indicated an entire node where the results were “no” regardless of the path. As a result, the tree was pruned.
library(tree)
## Warning: package 'tree' was built under R version 3.5.2
class.tree = tree(low1~age+lwt+race1+smoke1+ptl+ht1+ui1+ftv, data=birthwt1, subset=train)
plot(class.tree)
text(class.tree,pretty=0)
prune.classtree.fit= prune.misclass(class.tree,best=5)
plot(prune.classtree.fit)
text(prune.classtree.fit, pretty=0)
Compared to the previous models, the most important variable appears to be the number of premature labors followed by pre-pregnancy weight then age and a history of UI. Interestingly, race and smoking doesn’t appear to have an effect. Using the pruned tree, an attempt was made to predict if a child has a low birth weight.
prune.predict=predict(prune.classtree.fit, birthwt1[-train,], type="class")
prune.predict.table=table(prune.predict, birthwt1$low[-train])
prune.predict.table
##
## prune.predict 0 1
## no 37 17
## yes 1 8
true.negatives.prune.predict = prune.predict.table[1,1]
true.positives.prune.predict = prune.predict.table[2,2]
false.positives.prune.predict = prune.predict.table[2,1]
false.negatives.prune.predict = prune.predict.table[1,2]
all.positives.prune.predict = true.negatives.prune.predict+false.negatives.prune.predict
all.negatives.prune.predict = true.negatives.prune.predict+false.positives.prune.predict
all.obs.prune.predict = all.positives.prune.predict+all.negatives.prune.predict
error.rate.prune.predict = (false.positives.prune.predict+false.negatives.prune.predict)/all.obs.prune.predict
sensitivity.prune.predict=true.positives.prune.predict/all.positives.prune.predict
specificity.prune.predict=true.negatives.prune.predict/all.negatives.prune.predict
results.prune.predict = c(error.rate.prune.predict, sensitivity.prune.predict, specificity.prune.predict)
names(results.prune.predict) = c("Error Rate", "Sensitivity", "Specificity")
results.prune.predict
## Error Rate Sensitivity Specificity
## 0.1956522 0.1481481 0.9736842
rbind(results.reg, results.log, results.prune.predict)
## Error Rate Sensitivity Specificity
## results.reg 0.3809524 0.2400000 0.8684211
## results.log 0.4126984 0.2000000 0.8421053
## results.prune.predict 0.1956522 0.1481481 0.9736842
While the predictions overall are very accurate and it does a great job of predicting which children won’t have a low birth weight, it does a poor job of indicating which children do have a low birth weight. Boosting and bagging trees were also attempted, but lead to similar results.
Based on most of the models, race, smoking, and UI presence are useful predictors for if a child is born with a low birth rate. As initially anticipated, there are other factors which can determine a child’s weight that was not presented in the data. For as bad as smoking is, alcohol and illegal drugs are more harmful to fetal development. Another interesting variable would have been household income to determine if there is a disparity between poorer and wealthier households. It is unknown how many of these women were married or single.
hist(birthwt$age, col="cyan", main="Age Histogram", xlab="Mother's Age")
One somewhat shocking surprise was that age was not significant in most of the models. Typically, younger women have to be more viligant on prenatal car because their bodies are less likely to handle a child. There doesn’t appear to be anything unusual about the data on this variable.
The data, and as a result the model, is restricted to only the Baystate Medical Center. A further study of other hospitals in the area and outside the area is needed to come to any major conclusions. However, it is useful as an initial insight into a major health concern.


WRESTLING ERNEST HEMINGWAY A film review by Scott Renshaw Copyright 1994 Scott Renshaw
Starring: Robert Duvall, Richard Harris, Sandra Bullock, Piper Laurie, Shirley MacLaine. Screenplay: Steve Conrad. Director: Randa Haines.
Hollywood films focusing on the elderly have generally fallen into two broad categories: comedies making them lovable codgers whose most mundane physical activity is turned into slapstick, and melodramas about loneliness and facing death. We've already had one from Column A this winter--GRUMPY OLD MEN--which makes it somewhat surprising to see WRESTLING ERNEST HEMINGWAY so soon, even though it falls under Column B; studios are notoriously fastidious in avoiding conflict with target demographics. WRESTLING ERNEST HEMINGWAY is melodramatic, and its pacing is rather slow, but it is also filled with fine acting and quirky but believable relationships, and ultimately proves quite satisfying.
WRESTLING ERNEST HEMINGWAY is the story of two older men who develop an unlikely friendship. Frank (Richard Harris) is a randy and boisterous ex-sailor fond of telling the story of the time he wrestled Ernest Hemingway in Puerto Rico; Walter (Robert Duvall) is a Cuban barber, both retired and retiring. The two seem to share little in common except their loneliness: Frank's son backs out on a visit for his 75th birthday, while Walter practices dancing alone, admiring from afar the friendly waitress (Sandra Bullock) at his favorite diner. As they spend time together, they gradually begin to have an effect on one another, Walter realizing he's lived safely for too long, and Frank realizing he still has growing up to do.
The only time that HEMINGWAY really missteps is in its forced plot. It's obvious as soon as the two men meet that the two opposites will attract and change each other, and that somewhere along the line (plot point #2 for you aspiring screenwriters) they will have a falling out.  Parts of WRESTLING ERNEST HEMINGWAY script themselves, and writer Steve Conrad tries to get away with that laziness in his plotting.
It is to his credit that when he lets his characters talk to each other, things get much more interesting. Harris and Duvall are marvelous together, sharing a couple of poignant scenes where each man, clearly thrilled simply to have someone to talk to, carries on a practically independent conversation. Yet this central relationship is only one of several which truly shine. Sandra Bullock (Stallone's partner in DEMOLITION MAN) is thoroughly charming as Elaine, the waitress for whom Walter carries a torch. She demonstrates a genuine affection for him, one which never comes off as patronizing; their connection is sweet and very affirming. Frank, meanwhile, spars with his no-nonsense landlady, played perfectly by Shirley MacLaine. Her tough-love attempts to help Frank through his troubles and to lend a friendly ear are spare and well-played. However, perhaps my favorite interaction involved Frank's attempt to romance a proper older woman named Georgia, played by Piper Laurie. In a small role, Laurie is fantastic, showing Georgia's enjoyment of Frank's flirtations coupled with her insistence on a decorum which Frank finds difficult. From top to bottom, the cast creates a rich and real collection of characters whose interplay is exceptionally touching.
It would be unfair to complete a review of WRESTLING ERNEST HEMINGWAY without giving the two central performances their due.  Robert Duvall, meanwhile, disappears into Walter. A lesser actor would have turned in a much more mannered performance, overdoing Walter's habit of inspecting his beloved bacon sandwiches before eating them. Their screenwriter and director force them to jump through some unnecessary hoops, but when they're left to do their own thing, WRESTLING ERNEST HEMINGWAY becomes an appealing drama about the need for contact.
On the Renshaw scale of 0 to 10 bacon sandwiches: 7.
-- Scott Renshaw Stanford University Office of the General Counsel
.
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


options
struct
Options
;
Container for commandline options.
Options
parse
(ref string[]
argv
);
Parse options from the commandline parameters and return them. Recognized options are removed from
argv
.
Params:
string[]
argv
The arguments passed to this program through main().
Returns:
An Options structure.
Page generated by
Ddoc
.


Copyright © 2010 Marc Worrell
Authors: Marc Worrell (marc@worrell.nl).
| charsets_provided/2 | |
| content_types_provided/2 | |
| forbidden/2 | The request must have a valid session cookie. |
| handle_message/2 | |
| init/1 | |
| provide_content/2 | |
| upgrades_provided/2 | Possible connection upgrades. |
| websocket_start/2 | Initiate the websocket connection upgrade. |
charsets_provided(ReqData, Context) -> any()
content_types_provided(ReqData, Context) -> any()
forbidden(ReqData, State) -> any()
The request must have a valid session cookie.
handle_message(Msg, Context) -> any()
init(Args) -> any()
provide_content(ReqData, Context) -> any()
upgrades_provided(ReqData, Context) -> any()
Possible connection upgrades
websocket_start(ReqData, Context) -> any()
Initiate the websocket connection upgrade
Generated by EDoc, Oct 13 2011, 14:45:57.


Getting Lucky...
| DOSE: |
27 mg |
oral |
2C-T-7 |
(capsule) |
After a rather long and traffic ridden drive to NY from Boston I found myself in the middle of the most gorgeous stretch of beach in Long Island. A bonfire blazed in the sand and bodies were back lit, glowing like phantoms against the cloud covered sky. Tonight I was to be ingesting 2C-T-7 for the first time and immediately the mood seemed to lend itself to such an adventure. I wish I had had the capability to capture the trip on paper as it happened but I will have to simply jot down the sorted observations and feelings as best I can recall them.
I took a 27 mg capsule at 12:30 a.m., on an empty stomach, went down by the ocean and looked at the waves which were crashing against the shore, they were amazing as there was a hurricane off the coast, the sky was alternating in patches of light and dark and the world in general was simply amazing, even before the trip started. I waited around for an hour, didn't really feel much, the very few lights which I could see on the horizon seemed to be flickering, but other than that nothing seemed unusual. Having already been warned that the trip did not really start until 2 to 3 hours after ingestion I was not worried, but rather patiently waiting, enjoying the night.
At some point, about 2.5 hours into the trip, slight disorientation and nausea set in, but lasted no more than 20-30 minutes, and was easily remedied by smoking a couple of bowls. Shortly after that things started to get interesting. I was affixed on the fire, I could not turn away from it, it seemed alive and I was utterly convinced that it was moving in time with the set our friends were spinning. At that point my S/O asked me if I could get him some gum from my bag, as he was rolling and he jaw was beginning to get tense. I went into the darkness, not really able to see much, fumbled around in the sand and eventually found my bag. Sitting next to my bag was a dog some of the other people at the party had brought with them, and somehow in that moment I had the most intimate deep understanding with the dog. We just looked at each other and I felt like I could read her mind. Damn weird, but really intense and beautful.
I was feeling so wonderful, better than I have ever felt, I felt calm and collected and fuzzy and warm, and intricate thought patterns kept entering my head and the world as a whole just seemed to make so much sense. Also by this time my visuals were getting intense, it had gone from having some mild persistance of vision to, in the matter of 10 minutes or so,a full-blown psychedelic light show.
I brought my S/O the gum and decided to have some myself, I found this incredibly difficult and realized that I didn't really remember how to chew gum, so after a few minutes of trying in vain I threw it in the fire. All I could think the entire time was that there were no words to possibly describe what I was feeling.
My S/O and I ventured away from the fire and looked into the sea where lone fishing boats lit in phosperence glowed on the tide. The light of the boats danced and twinked and then flashing of lighting started to appear on the far horizon. I'm sure this would have been magnificent not on 2C-T-7, but being under it's influence made the event seem so unreal and unearthy gorgeous that the only words I could muster for a good 30 mintues or so were 'Oh my god'. The pinpoint lights to our left also added greatly to the trip as they began to flash in patterns of different colors; and what once was a small line of lights covered the entire sky in a brilliant array. Wow.
I spent the rest of the night mesmerized by everything around me, there was not much of a body load and my head felt relitively clear for nearly the entire night. When the morning came I was still tripping fairly hard which made the change from dark to light even more spectacular.
Coming down was pleasant and sleepy.  I had no trouble sleeping and on the way back to Boston I feel asleep in the car, around 10:30am, and when we got home I slept for another 13 hours or so.
All in all there were no negative effects aside for the brief period of nausea towards the beginning, and a little bit of an unpleasant hallucination of a little hostile alligator when I was trying to pee in the reeds of the beach. Took me a second to realize that it was not real but once I realized that all was well.
I would recommened this drug highly, it gave me everything I have ever in a psychedelic while also being pleasant empathenogen. Fantastic.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


{% extends "layout.html" %} {% block page_title %} GOV.UK prototyping kit {% endblock %} {% block content %} ALPHA This is a new service – your feedback will help us to improve it. Your overseas waste transfers Which company transported this waste for you? Business name Address line 1 Address line 2 (optional) Town or city Country {% endblock %}
ALPHA This is a new service – your feedback will help us to improve it.


--- layout: default title: "Hair & Fur Rendering" description: "Developed a path tracer with Bounded Volume Hierarchy as it’s acceleration structure, which uses Surface Area Heuristic to calculate the best object split and is capable of handling sufficiently complex geometry consisting of the order of 1M triangles" quote: "If you need something, all you need to do is ask" ---
Developed a path tracer with Bounded Volume Hierarchy as it’s acceleration structure, which uses Surface Area Heuristic to calculate the best object split and is capable of handling sufficiently complex geometry consisting of the order of 1M triangles.


{% extends "base.html" %} {% block content %}
Your item has been successfully submitted for approval.
The administrator will post your item within 24 hours if it is apporved.
Please check your dashboard for updates.
Thank you.


A model for listed content, which may be extended for practical use cases
Constructor
Get a reference to the object at the given index
Argument: index
Index of the element
Returns: s an object representing the item at the given index
get the number of items
Returns: s the number of Items. Less or equal 0 indicates an empty list


Simply click the button below and allow the page to access your webcam.
All the processing is done on the client side, i.e., without sending images to a server.


What you see is a Glock 19. It is effectively a reduced-size Glock 17, called the "Compact" by the manufacturer. It was first produced in 1988, primarily for military and law enforcement. The Glock 19's barrel and pistol grip are shorter by about 12 mm (0.5 in) than the Glock 17. This gun is short but it is really confortable to hold in the hand because of it's size.
Beretta M9 Close range SIG Sauer P226


Add in your details for future use.
While thinking about this project, we narrowed down on 5 relationships, that effectively cover all possible human ties with other entities. Make sure to stick by them while creating your graph relations.
There might be a slight delay when it comes to adding nodes and relationships in the graph. Please be patient.
Maxmimum number of nodes per person is set to 15 as of yet. There is no upper bound
on the number of
relations, however it becomes imperative here to mention that multiple relations
between 2 nodes would
serve absolutely no purpose.
Nodes could be of the following types (case sensitive):-


When developing, we often come across code we’ve seen hundreds of times that we just copy and paste from project to project. Sometimes it’s so banal that it’s not worth trying to improve, change or even modularize it. Ctrl-C + Ctrl-V may be the cheapest and fastest solution, ergo, the best.
This is the kind of situation we see when masks must be applied to text fields
such as Social Security Numbers (SSN), Telephones, Zip Codes, and so on. Those
awful few dozens of lines we copy from one textField:shouldChangeCharactersInRange:replacementString:
to the other. It never changes because it works. There’s no need to improve it.
It’s always the same. But I’ve got tired of it. That nasty code that, in a well
structured class, can be as a mole in a beautiful woman’s face.
A few days ago I got some spare time and I started working on something I though could come handy. So how do you simplify and generalise this problem that every developer has to face at least once? Easy! Regex! Wait.. You sure it’s easy? I’ll tell you, it wasn’t easy, but we’re talking about patterns in varying occasions and, as I visualised it, regex is the best, simplest and most “approachable” solution.
While modelling, I wanted to make it as simple and as clean as possible, therefore, for now, there are only two classes, and only one method you’ll really use, but you can read the complete documentation. From now on, I’ll present a superficial approach to introduce this small library.
Fork the Github Repo!
NSStringMask
The NSStringMask is the main class responsible for applying your masks to the
NSStrings. Among it’s methods the only noteworthy is
[NSStringMask maskString:withPattern:placeholder:]
.
It formats the given string
based on the pattern
you provide, filling the
voids with the placeholder
. It automatically creates an instance of
NSRegularExpression with the option CaseInsensitive
, so if you need a different
option, you may use the alternate method which expects a regex instead of pattern
.
There’s also an alternative method that receives no placeholder
(same as nil
),
in this case, when the given string
is shorter than expected, instead of
applying the mask, the method will return a cleaned string having only the
valid characters based on validCharactersForString:
.
Important Note
Doesn’t matter if providing a pattern
or an instance of regex, the regular
expression must have capturing groups (parentheses). This is because the
class understands that everything that is not within parentheses is part of the
mask and must be interpreted as literal characters!
Suppose you’re formatting a SSN, whose regex pattern is \d{3}-\d{2}-\d{3}
.
If you provide that regex/pattern, nothing will be formatted because the class
will think that \d{3}
is part of the mask, and not 3 numbers that should go there.
The correct usage is: (\d{3})-(\d{2})-(\d{3})
// RIGHT:
NSString *result = [NSStringMask maskString:@"12345678" withPattern:@"(\d{3})-(\d{2})-(\d{3})"];
// result = @"123-45-678"
// WRONG:
NSString *result = [NSStringMask maskString:@"12345678" withPattern:@"\d{3}-\d{2}-\d{3}"];
// result = nil
Obs: If Xcode is showing a warning about unknown escape sequences, try
adding double slashes (\\d
)
UITextFieldMask
This is a subclass of UITextField, so you can set your nibs to use this class and automatically apply masks to your text fields.
Obviously, you must provide a mask to transform your strings, and it’s
recommended that you do so when initialising your view or view controller.
So you should set the text field’s mask inside viewDidLoad
or awakeFromNib
.
Suppose you have a view with an outlet to an UITextFieldMask named textFieldMask
:
- (void)awakeFromNib
{
NSStringMask *mask = [NSStringMask maskWithPattern:@"(\d+)"];
textFieldMask.mask = mask;
textFieldMask.delegate = self;
}
A question for you: what does that mask accepts?
Installation
You can install it from Cocoa Pods,
or clone the project from the Github Repo
and copy the files in the folder Classes
.
Helpful stuff
I’ve also created this gist with some common patterns. Feel free to improve it!


Explore Redeor
A digital and creative strategy studio
Home
Transport back to the agency overview.
Portfolio
Explore a sortable portfolio featuring all web + design work.
Strategy
Transform your organization with digital + creative strategies.
About
Learn about the Redeor Studio, and its super geek founder, Kiki Roeder.
Contact
Connect with Redeor. Really. Would love to hear from you.
Blog
Read mental meanderings and research on design, technology and business.
Be Social
Connect with Redeor Founder, Kiki Roeder
The ever-expanding portfolio
Discover my work. Engage with the Redeor sortable portfolio.
All
Branding
Design
UX
Web
Music Traxx
Artiquery Marketing
UT Admissions Bag
Blog Design
Color Block Design Series
Architecture Site UX
Hand-lettering
MAX_minimum Logo
Music Website
Verse Music + Social Media App
Artiquery Games
UT Design T-Shirt
Solar House Infographic
Portfolio Infographic
UT Architecture + Design Website
Thoyo Shopping App
Lecture Series Poster Series
eCommerce Site
Foldable Poster Book
You're So Pretty Illustration
Design Exhibit
Cooking + Health App
Artiquery Coloring and Study Kids Site
Bull Pen Ruby on Rails App
Artiquery Presentation Deck
Solar House Fact Brochure
Bull Pen Baseball Social App
Thoyo Web App UX Design
E-Commerce Clothing Site
Company Site UX
UT Branding
Illustrated Graphics
Color Design Series
Music Social Media App, Verse
Blog Design
Verse App, Profile View
Bull Pen Social Media Aggregator
University Branding
Thoyo Shopping App
Be Social
Connect with Redeor Founder, Kiki Roeder


After several feature requests, much consideration, and a long chat with the security engineering team at Apple, I’ve decided to make a change to the default AES mode used by RNCryptor from its current CTR to the much more ubiquitous CBC.
CTR mode has several advantages that I was hoping to exploit. First, it does not require padding, so it is not subject to padding oracle attacks (the cipher text is also generally a few bytes shorter than the equivalent CBC). That said, if the same nonce+counter+key combination is ever reused, an attacker can easily compute the key. This is pretty unlikely given how RNCryptor generates its nonce, but it’s not impossible. If the same IV+key is used for CBC mode, then some information is leaked to an attacker, but its not nearly as catastrophic as reusing a nonce. The point is that CTR is not a home run here. It’s different, exchanging one possible vulnerability for a different one (since RNCryptor does not store previous nonces to prevent reuse).
It is also possible to compute CTR in parallel on multiple cores. Apple doesn’t currently do this, and is not highly likely to do so in the future. They might, but it’s not something to adapt the design to.
Almost every AES system out there implements CBC, so using any other mode introduces a significant interoperability problem. A mode would need to be dramatically better to be worth that. CTR has not lived up to that requirement, and so I’m switching to CBC.
This will make it much easier to write RNCryptor-compatible modules in Java, JavaScript, etc., as have been requested.
Possibly most importantly, this change gets us closer to making RNCryptor compatible back to iOS 4.0, and Mac OS X 10.4. I still have to consider CCKeyDerivationPBKDF
.
If you update, note that this is incompatible with your existing encrypted files. I doubt there is enough field usage out there that this is an issue, but if it is, let me know and I can discuss with you how to convert.


Waste Not
Thank You for Registering
Almost done - follow these instructions:
Please see a supervisor to get your User Role modified to access Waste Not.
After that is complete, please log back in Waste Not and you'll have access!
Go to Login


People who...
do flamenco
study flamenco
spread flamenco
love/live flamenco
All
Navigation
Places
People
Stories
ABOUT
CONTACT


|
Bitstream Interpretation Library (BIL)
0.1
|
Namespace for XDLRC keyword constants. More...
Variables | |
| const char *const | RESOURCE_REPORT = "xdl_resource_report" |
| const char *const | TILES = "tiles" |
| const char *const | TILE = "tile" |
| const char *const | PRIMITIVE_SITE = "primitive_site" |
| const char *const | BONDED = "bonded" |
| const char *const | UNBONDED = "unbonded" |
| const char *const | INTERNAL = "internal" |
| const char *const | PINWIRE = "pinwire" |
| const char *const | INPUT = "input" |
| const char *const | OUTPUT = "output" |
| const char *const | WIRE = "wire" |
| Normal wiring. | |
| const char *const | CONN = "conn" |
| const char *const | PIP = "pip" |
| const char *const | ROUTE_THROUGH = "_ROUTETHROUGH" |
| const char *const | TILE_SUMMARY = "tile_summary" |
| const char *const | PRIMITIVE_DEFS = "primitive_defs" |
| const char *const | PRIMITIVE_DEF = "primitive_def" |
| const char *const | PIN = "pin" |
| const char *const | ELEMENT = "element" |
| const char *const | CONN_R_SYMBOL = "==>" |
| const char *const | CONN_L_SYMBOL = "<==" |
| const char *const | CFG = "cfg" |
| const char *const | SUMMARY = "summary" |
| const char *const | SITES = "sites" |
| const char *const | SITEDEFS = "sitedefs" |
| const char *const | NUMPINS = "numpins" |
| const char *const | NUMPIPS = "numpips" |
Namespace for XDLRC keyword constants.
| const char *const bil::XDLRCKeywords::RESOURCE_REPORT = "xdl_resource_report" |
Definition at line 10 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::TILES = "tiles" |
Definition at line 11 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::TILE = "tile" |
Definition at line 12 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PRIMITIVE_SITE = "primitive_site" |
Definition at line 13 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::BONDED = "bonded" |
Definition at line 14 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::UNBONDED = "unbonded" |
Definition at line 15 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::INTERNAL = "internal" |
Definition at line 16 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PINWIRE = "pinwire" |
Definition at line 17 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::INPUT = "input" |
Definition at line 18 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::OUTPUT = "output" |
Definition at line 19 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::WIRE = "wire" |
Normal wiring.
Definition at line 20 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::CONN = "conn" |
Definition at line 21 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PIP = "pip" |
Definition at line 22 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::ROUTE_THROUGH = "_ROUTETHROUGH" |
Definition at line 23 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::TILE_SUMMARY = "tile_summary" |
Definition at line 24 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PRIMITIVE_DEFS = "primitive_defs" |
Definition at line 25 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PRIMITIVE_DEF = "primitive_def" |
Definition at line 26 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::PIN = "pin" |
Definition at line 27 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::ELEMENT = "element" |
Definition at line 28 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::CONN_R_SYMBOL = "==>" |
Definition at line 29 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::CONN_L_SYMBOL = "<==" |
Definition at line 30 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::CFG = "cfg" |
Definition at line 31 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::SUMMARY = "summary" |
Definition at line 32 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::SITES = "sites" |
Definition at line 33 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::SITEDEFS = "sitedefs" |
Definition at line 34 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::NUMPINS = "numpins" |
Definition at line 35 of file XDLRCKeywords.cpp.
| const char *const bil::XDLRCKeywords::NUMPIPS = "numpips" |
Definition at line 36 of file XDLRCKeywords.cpp.


Post-Demo hangover
Wow. That was a fun talk that Jim and I did at Mix.
For the Ruby fans in the audience, here was the final version of the application that we wrote:
# This downloads a compiled C# assembly that contains a Button
require 'Silverlight.Samples.Controls,Version=<IP_ADDRESS>'
# This imports a JS and a VB module that each contain code that we will use
JS = require '3DText.js'
VB = require 'technorati.vbx'
# We don't have include working yet ...
Controls = Silverlight.Samples.Controls
Document = System.Windows.Browser.HtmlPage.Document
def initialize(sender, args)
# Create an instance of the downloaded C# button
b = Controls.Button.new
b.text = "Click Me"
JS.initialize
# Map Ruby block to .NET event from C#
b.click do |sender, args|
JS.clearList
# This uses a member injector to retrieve a reference to a HTML
# input element from the hosting HTML page
term = Document.searchTerm.value
# This retrieves data from Technorati via Yahoo Pipes serialized
# as JSON data, and then runs a LINQ over Objects query against it
items = VB.GetTitles(term)
# Blocks work, yay!
items.each { |item| JS.initializeName(item) }
# Play that funky designer animation
JS.playAnimation
end
root.Children.Add(b)
end
Keep in mind that the Ruby code here was done in about 4 weeks worth of dev time by our stud developer Tomas Matousek (of Phalanger fame, and my office-mate) with some random input from yours truly.
Great stuff, Can i run that code on Silverlight 1.1 alpha?
Posted by: krishna | May 01, 2007 at 07:28 PM
Hey John
great stuff, really. having a common platform for dynlangs is going to make a whole lot of difference, just like CLI/CLS did for static languages; it's going to finally rid us of text-based interfaces like powershell does compared to bash and its likes. so cool!
now that the curtain has been lifted, can you revisit some of my last questions?
- is it going to be as easy to call into dynlangs from c# as it is the other way round? can I finally implement libraries using dynlangs? interfaces?
- is there any discussion about a groovy-like language for the DLR? what are your thoughts on this? VB is probably not going to please the lambda-the-ultimate-crowd, right? I assume you know the discussion from the java world, so i'll spare you any additional arguments.
- and finally, considering all the great dynlang momentum, are there any plans to get stuff like AOP or metaprogramming into C# or other static CLR languages? given your past, i think you'd know, right?
- jim wrote about a lang.net conference in july. will you be there? would we be able to discuss this stuff there? is this conference by invitation or first come/first serve?
thanks a lot,
stefan
soooo tired of tinkering with dynamic proxies and stuff ;-)
Posted by: Stefan Wenig | May 02, 2007 at 12:09 AM
That code looks very, very familiar. Very RubyCLR like in fact :)
My favorite feature request:
b = Controls.Button.new do
text "Click me"
font "Verdana"
fontSize "12pt"
end
Hopefully the above will be possible just by standard meta programming tricks. THat is, overriding and updating methods on .NET objects from the ruby side.
The above also points toward a very nice XML builder-like interface for constructing your GUI ...
Posted by: Justin | May 02, 2007 at 12:55 PM
Krishna, no you cannot run that code in the current public bits because they lack support for Ruby and VB. Give us some more time and we'll get Ruby and VB bits out to all of you.
Posted by: John Lam | May 02, 2007 at 02:14 PM
Justin - you should be able to just do what you proposed using metaprogramming magic once we get enough features implemented in Ruby.
Posted by: John Lam | May 02, 2007 at 02:57 PM
Stefan,
Send me some mail (jflam) and I'll get you onto the invite list for Lang.Net - we're working on putting it together now.
As for your questions:
- we are massively resource constrained now to deliver two languages (Python/Ruby) in our group, so we don't have any bandwidth for other languages. You're more than welcome to implement groovy on DLR if you want :)
- interfaces are the easiest way to call back into DLR code
- I have no idea about AOP-like plans ... but we can talk about whether that's a good idea at Lang.Net :)
Posted by: John Lam | May 02, 2007 at 09:54 PM
Hi John,
Congrats on getting this far!
I'm a little bit concerned about Ruby compatibility when I see this code sample of yours... It looks, first of all, like your require-string take arbitrary stuff that actually identifies an assembly; how would this work with for example RubyGems? Assembly definitions wouldn't even be valid file paths in many cases...
And the second point is also about require: from the example, it looks like it returns a module/class? If that's the case, once again, how will the applications that depend on the boolean result from require work?
It looks like you have choosen to retain the exactly same assembly/class names as .NET uses in all. How have you implemented this? With method calls? Do you have problems with overlap between these method calls and regular constants? (I bet you will get those problems later, otherwise...)
In what kind of context does this run, btw? It looks like the initialize method actually gets defined one the singleton class of toplevel. In that case I take it that this initialize have _nothing_ to do with regular Ruby allocations schemes, with the allocate and new methods.
I like what you have done with the event handlers. Do I read it correctly that methods/delegates like onClick gets turned into a click-method that takes a block? That's very neat, if that's the case.
Anyway, not to nitpick; I'm just very interested in how you plan to solve these problems, or if IronRuby will have the same problems with incompatibilities that other languages implemented by MS have been known to suffer from.
Posted by: Ola Bini | May 05, 2007 at 08:45 AM
Ola, thanks for sending in this detailed set of comments!
We thought about every single issue that you brought up here and debated them at length. I kind of didn't want to call them out in the comments to see what folks thought without our bias.
I'm on vacation right now (sneaking in a blog comment or email in here or there), but I'll answer each and every one of your concerns in a separate post. Your point about context is extremely important and probably the one that we need the most feedback on.
About event handlers - exactly what you described.
More later ...
Posted by: John Lam | May 05, 2007 at 01:11 PM
Thanks John,
I'm looking forward to that post. I'm sure you have rationalizations, and it will be very interesting to read them.
Posted by: Ola Bini | May 05, 2007 at 01:23 PM


RT @BadAstronomer: This is my 14,998th tweet. That may sound like a lot, but in base 14998 it's only 10.
11/22/2010, 8:52:06 AM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @BadAstronomer: This is my 14,998th tweet. That may sound like a lot, but in base 14998 it's only 10.
11/22/2010, 8:52:06 AM
Favs: 0
Retweets: 0
link


| Isolation Level | Transactions | Dirty Reads | Non-Repeatable Reads | Phantom Reads |
|---|---|---|---|---|
TRANSACTION_NONE |
Not supported | Not applicable | Not applicable | Not applicable |
TRANSACTION_READ_COMMITTED |
Supported | Prevented | Allowed | Allowed |
TRANSACTION_READ_UNCOMMITTED |
Supported | Allowed | Allowed | Allowed |
TRANSACTION_REPEATABLE_READ |
Supported | Prevented | Prevented | Allowed |
TRANSACTION_SERIALIZABLE |
Supported | Prevented | Prevented | Prevented |


Help
Search:
Perform a text-based search of all genes and coding sequences (CDSs) in the database. The search returns all features containing the search term in any field. e.g. searching for 'leuS' returns genes and CDSs in the selected species with the name 'leuS' or with 'leuS' mentioned in any other field. Similarly, searching for 'synthetase' returns any features with a synthetase as a gene product or with 'synthetase' mentioned in any other field. Selecting a particular gene or CDS allows the user to view further details of that feature and to scroll through the genome to view neighbouring coding sequences. In the case of CDSs, orthologues in other genomes are displayed below the genome of interest.
Genomes:
Displays details of all genomes currently in the database.
MultiFun:
View genes/CDSs based on the E.coli 'MultiFun' (multi-functional) classification system. The leftmost column shows all E.coli CDSs for the selected classification (e.g. '1 Metabolism' or '7.4 Outer membrane'). The columns on the right show the orthologue CDSs in other replicons (either chromosome or plasmid of another species). By default, only the E.coli CDSs which have orthologues are displayed, but selecting the 'Show all E.coli genes' checkbox displays all CDSs.


HTTPResponseStatus
public enum HTTPResponseStatus: CustomStringConvertible
HTTP response status code/msg.
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Undocumented
Declaration
Swift
public enum HTTPResponseStatus: CustomStringConvertible
-
Returna the textual code and message pair.
Declaration
Swift
public var description: String
-
The numeric code for this response status.
Declaration
Swift
public var code: Int


U.S. Ran Its First Petroleum Surplus in At Least 40 Years | Breitbart
The United States exported more petroleum than it imported in September, running a petroleum trade surplus for the first time in records that go back to 1978.
by John CarneyThe U.S. exported $15 billion of petroleum products in September and imported $14.7 billion. The result was a surplus of $252 million, according to Commerce Department data released Tuesday.
U.S. production of petroleum has skyrocketed in recent years thanks fracking and related new extraction methods. The U.S. has become an energy super-power, accounting for 18 percent of the world’s oil production.
All the leading Democratic presidential candidates want to limit or ban fracking. Front-runners Elizabeth Warren and Bernie Sanders would ban fracking altogether, as would Kamala Harris, Corey Booker, and Tulsi Gabbard. Joe Biden and Pete Buttigieg have called on a ban on new fracking, with Buttigieg saying he would phase out all existing fracking over time.


object Ugly
this.code = Ugly
//can you see this??
PATH
activator new
GET /search/:term SearchController.search(term: String)
def search(term: String) = Action {
val results = performSearch(term)
Ok(views.search results results)
}
def search(term: String) = Action.async {
val results = Future { performSearch(term) }
results map (Ok(views.search results _))
}
@(results: List[SearchResult])
Found @results.size results
@if(!results.isEmpty) {
@for(result <- results) {
-
@result.summary
}
}
Option[T]
val father = if (person == null) null else person.father
val mother = if (father == null) null else father.mother
val sister = if (mother == null) null else mother.sister
for {
father <- person.father
mother <- father.mother
sister <- mother.sister
} yield sister
Try[T]
def tryReadInt(prompt: String) = Try(readLine(prompt)) map (_.toInt)
def divide: Try[Int] = {
val problem = for {
numerator <- tryReadInt("Enter Numerator:\n")
denominator <- tryReadInt("Enter Denominator:\n")
} yield (numerator / denominator)
problem orElse {
println("Y U NO Make Sense! Try again.")
divide
}
}
Future[T]
def getUser(id: String): Future[User]
def getCart(user: User): Future[Cart]
def getFriends(user: User): Future[List[User]]
def getAffiliations(user: User): Future[List[Affiliation]]
for {
user <- getUser(id)
futureCart = getCart(user)
futureFriends = getFriends(user)
futureAffiliations = getAffiliations(user)
cart <- futureCart
friends <- futureFriends
affiliations <- futureAffiliations
} yield Response(...)
def search(term: String) = Action {
val results = performSearch(term)
Ok(views.search.results(results))
}
trait FunctionalController {
def builder: ActionBuilder
def failureView(ex: Throwable): Html
def action[A](logic: => A,
renderer: A => Html,
failure: Throwable => Html = failureView) = builder {
Try(logic) map renderer match {
case Success(view) => Ok(view)
case Failure(ex) => Error(failure(ex))
}
}
}
class SearchController extends FunctionalController {
def Builder = MySpecialAction
def failureView = views.search.failed
def search(term: String) = action (
logic = performSearch(term),
renderer = views.search.results
)
}
trait FunctionalController {
def layout: Html => Html
def action[A](logic: => A,
renderer: A => Html,
failure: ...) = builder {
Try(logic) map (renderer andThen layout) match {
case Success(view) => Ok(view)
case Failure(ex) => Error(failure(ex))
}
}
}
type Layout = Html => Html
def composeLayout(views: Map[String, Future[Html]],
layout: Map[String, Html] => Layout): Future[Layout] = {
val listOfFutureTuples = views map {
case (name, fHtml) => fHtml map ((name, _))
}
Future sequence listOfFutureTuples map (_.toMap) map layout
}
type Layout = Html => Html
def widgets: Map[String, Future[Html]]
def layout(view: A => Html): Future[A => Html] = {
for {
layout <- composeLayout(widgets, views.layouts.default)
} yield {
(a: A) => layout(view(a))
}
}
Assuming action
supports Future
def search(term: String) = action (
logic = performSearch(term),
renderer = layout(views.search.results)
)
type Service[In, Out] = (In => Future[Out])
type Map[A, B, In, Out] =
(A, Service[In, Out]) => Future[B]
type Filter[In, Out] = Map[In, Out, In, Out]
type Map[A, B, In, Out] =
(A, Service[In, Out]) => Future[B]
val map: Map[A, B, In, Out] = _
val inner: Service[In, Out] = _
val outer: Service[A, B] = map(_, inner)
type Filter[In, Out] = (In, Service[In, Out]) => Future[Out]
class Timer[A, B](name: String) extends Filter[A, B] {
def now = System.currentTimeMillis
def apply(a: A, service: Service[A, B]): Future[B] = {
val start = now
val result = service(a)
result foreach {
_ => recordTime(name, now - start)
}
result
}
}
type Filter[In, Out] = (In, Service[In, Out]) => Future[Out]
val filter: Filter[In, Out] = _
val inner: Service[In, Out] = _
val outer: Service[In, Out] = filter(_, inner)
class AwesomeFilter[A, B](name: String,
defaults: List[Filter[A, B]])
extends Filter[A, B] {
var filters = defaults
def addFilter(filter: Filter[A, B]) { ... }
def apply(a: A, service: Service[A, B]): Future[B] = {
filters.foldRight(service)((filter, acc) => filter(_, acc))
}
}
service: Service[Request, Response]
application: Configuration => Service[Request, Response]
class Dependencies(configuration: Configuration) {
val db = DB(configuration)
val system = System(configuration)
}
def configuration = Configuration.current
def serviceBuilder: Dependencies => Service[Request, Response]
def applicationBuilder = Dependencies.apply andThen serviceBuilder
def service = applicationBuilder(configuration)
def action = ActionBuilder { service }
Reader[A, B] ~ A => B
trait Reader[Env, A] {
def apply(env: Env): A
def map(f: A => B): Reader[Env, B]
def flatMap(f: A => Reader[Env, B]): Reader[Env, B]
def zipWith(f: (A, B) => C)
(b: Reader[Env, B]): Reader[Env, C]
// ...
}
application
def configuration = Configuration.current
def serviceBuilder: Dependencies => Service[Request, Response]
def applicationBuilder = Reader(Dependencies.apply) map serviceBuilder
def service = applicationBuilder(configuration)
def action = ActionBuilder { service }
def servicer[A]: Dependencies => Service[Request, A]
def presenter[A]: Dependencies => Service[A, Response]
A bit of Future
/Service
glue
def serviceChainer[A, B, C](first: Service[A, B], second: Service[B, C]) =
(a: A) => first(a) flatMap second
def serviceBuilder = Reader(servicer).zipWith(serviceChainer)(Reader(presenter))
Thank Reader
.
sbt
build is a Scala programsbt-boilerplate
- an sbt
plugin


|
areaDetector
3-12-1
EPICS areaDetector framework
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <epicsEvent.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <iocsh.h>
#include <epicsString.h>
#include <epicsExit.h>
#include <FlyCapture2.h>
#include "ADDriver.h"
#include <epicsExport.h>
Classes | |
| struct | enumStruct_t |
| class | pointGrey |
| Main driver class inherited from areaDetectors ADDriver class. More... | |
Macros | |
| #define | DRIVER_VERSION 2 |
| #define | DRIVER_REVISION 9 |
| #define | DRIVER_MODIFICATION 0 |
| #define | MAX(x, y) ((x)>(y)?(x):(y)) |
| #define | PGPropertyAvailString "PG_PROP_AVAIL" |
| #define | PGPropertyOnOffAvailString "PG_PROP_ON_OFF_AVAIL" |
| #define | PGPropertyOnOffString "PG_PROP_ON_OFF" |
| #define | PGPropertyOnePushAvailString "PG_PROP_ONE_PUSH_AVAIL" |
| #define | PGPropertyOnePushString "PG_PROP_ONE_PUSH" |
| #define | PGPropertyAutoAvailString "PG_PROP_AUTO_AVAIL" |
| #define | PGPropertyManAvailString "PG_PROP_MAN_AVAIL" |
| #define | PGPropertyAutoModeString "PG_PROP_AUTO_MODE" |
| #define | PGPropertyAbsAvailString "PG_PROP_ABS_AVAIL" |
| #define | PGPropertyAbsModeString "PG_PROP_ABS_MODE" |
| #define | PGPropertyValueString "PG_PROP_VAL" |
| #define | PGPropertyValueBString "PG_PROP_VAL_B" |
| #define | PGPropertyValueMaxString "PG_PROP_VAL_MAX" |
| #define | PGPropertyValueMinString "PG_PROP_VAL_MIN" |
| #define | PGPropertyValueAbsString "PG_PROP_VAL_ABS" |
| #define | PGPropertyValueAbsMaxString "PG_PROP_VAL_ABS_MAX" |
| #define | PGPropertyValueAbsMinString "PG_PROP_VAL_ABS_MIN" |
| #define | PGGigEPropertyValueString "PG_GIGE_PROP_VAL" |
| #define | PGGigEPropertyValueMaxString "PG_GIGE_PROP_VAL_MAX" |
| #define | PGGigEPropertyValueMinString "PG_GIGE_PROP_VAL_MIN" |
| #define | PGVideoModeString "PG_VIDEO_MODE" |
| #define | PGFormat7ModeString "PG_FORMAT7_MODE" |
| #define | PGBinningModeString "PG_BINNING_MODE" |
| #define | PGFrameRateString "PG_FRAME_RATE" |
| #define | PGPixelFormatString "PG_PIXEL_FORMAT" |
| #define | PGConvertPixelFormatString "PG_CONVERT_PIXEL_FORMAT" |
| #define | PGTriggerSourceString "PG_TRIGGER_SOURCE" |
| #define | PGTriggerPolarityString "PG_TRIGGER_POLARITY" |
| #define | PGSoftwareTriggerString "PG_SOFTWARE_TRIGGER" |
| #define | PGSkipFramesString "PG_SKIP_FRAMES" |
| #define | PGStrobeSourceString "PG_STROBE_SOURCE" |
| #define | PGStrobePolarityString "PG_STROBE_POLARITY" |
| #define | PGStrobeEnableString "PG_STROBE_ENABLE" |
| #define | PGStrobeDelayString "PG_STROBE_DELAY" |
| #define | PGStrobeDurationString "PG_STROBE_DURATION" |
| #define | PGPacketSizeString "PG_PACKET_SIZE" |
| #define | PGPacketSizeActualString "PG_PACKET_SIZE_ACTUAL" |
| #define | PGMaxPacketSizeString "PG_MAX_PACKET_SIZE" |
| #define | PGPacketDelayString "PG_PACKET_DELAY" |
| #define | PGPacketDelayActualString "PG_PACKET_DELAY_ACTUAL" |
| #define | PGPacketResendEnableString "PG_PACKET_RESEND_ENABLE" |
| #define | PGBandwidthString "PG_BANDWIDTH" |
| #define | PGTimeStampModeString "PG_TIME_STAMP_MODE" |
| #define | PGCorruptFramesString "PG_CORRUPT_FRAMES" |
| #define | PGDriverDroppedString "PG_DRIVER_DROPPED" |
| #define | PGTransmitFailedString "PG_TRANSMIT_FAILED" |
| #define | PGDroppedFramesString "PG_DROPPED_FRAMES" |
| #define | NUM_PROPERTIES UNSPECIFIED_PROPERTY_TYPE |
| #define | NUM_GIGE_PROPERTIES 4 |
| #define | NUM_TRIGGER_MODES 17 |
| #define | MAX_ADDR NUM_MODES |
| #define | NUM_GPIO_PINS 4 |
| #define | NUM_BINNING_MODES 3 |
| #define | NUM_CONVERT_PIXEL_FORMATS 6 |
| #define | DEFAULT_PACKET_DELAY 400 |
| #define | MAX_ENUM_STRING_SIZE 26 |
| #define | FIRST_PG_PARAM PGPropertyAvail |
| Property is available (int32 read) More... | |
| #define | LAST_PG_PARAM PGDroppedFrames |
| Number of dropped frames (int32 read) More... | |
| #define | NUM_PG_PARAMS ((int)(&LAST_PG_PARAM - &FIRST_PG_PARAM + 1)) |
| Number of asynPortDriver parameters this driver supports. More... | |
Enumerations | |
| enum | propValue_t { propValueA, propValueB } |
| enum | binningMode_t { BINNING_1X1, BINNING_2X2, BINNING_4X4 } |
| enum | PGTimeStamp_t { TimeStampCamera, TimeStampEPICS, TimeStampHybrid } |
Functions | |
| int | pointGreyConfig (const char *portName, int cameraId, int traceMask, int memoryChannel, int maxBuffers, size_t maxMemory, int priority, int stackSize) |
| Configuration function to configure one camera. More... | |
| epicsExportRegistrar (pointGreyRegister) | |
| #define DEFAULT_PACKET_DELAY 400 |
| #define DRIVER_MODIFICATION 0 |
| #define DRIVER_REVISION 9 |
| #define DRIVER_VERSION 2 |
| #define FIRST_PG_PARAM PGPropertyAvail |
Property is available (int32 read)
| #define LAST_PG_PARAM PGDroppedFrames |
Number of dropped frames (int32 read)
| #define MAX | ( | x, | |
| y | |||
| ) | ((x)>(y)?(x):(y)) |
| #define MAX_ADDR NUM_MODES |
| #define MAX_ENUM_STRING_SIZE 26 |
| #define NUM_BINNING_MODES 3 |
| #define NUM_CONVERT_PIXEL_FORMATS 6 |
| #define NUM_GIGE_PROPERTIES 4 |
| #define NUM_GPIO_PINS 4 |
| #define NUM_PG_PARAMS ((int)(&LAST_PG_PARAM - &FIRST_PG_PARAM + 1)) |
Number of asynPortDriver parameters this driver supports.
| #define NUM_PROPERTIES UNSPECIFIED_PROPERTY_TYPE |
| #define NUM_TRIGGER_MODES 17 |
| #define PGBandwidthString "PG_BANDWIDTH" |
| #define PGBinningModeString "PG_BINNING_MODE" |
| #define PGConvertPixelFormatString "PG_CONVERT_PIXEL_FORMAT" |
| #define PGCorruptFramesString "PG_CORRUPT_FRAMES" |
| #define PGDriverDroppedString "PG_DRIVER_DROPPED" |
| #define PGDroppedFramesString "PG_DROPPED_FRAMES" |
| #define PGFormat7ModeString "PG_FORMAT7_MODE" |
| #define PGFrameRateString "PG_FRAME_RATE" |
| #define PGGigEPropertyValueMaxString "PG_GIGE_PROP_VAL_MAX" |
| #define PGGigEPropertyValueMinString "PG_GIGE_PROP_VAL_MIN" |
| #define PGGigEPropertyValueString "PG_GIGE_PROP_VAL" |
| #define PGMaxPacketSizeString "PG_MAX_PACKET_SIZE" |
| #define PGPacketDelayActualString "PG_PACKET_DELAY_ACTUAL" |
| #define PGPacketDelayString "PG_PACKET_DELAY" |
| #define PGPacketResendEnableString "PG_PACKET_RESEND_ENABLE" |
| #define PGPacketSizeActualString "PG_PACKET_SIZE_ACTUAL" |
| #define PGPacketSizeString "PG_PACKET_SIZE" |
| #define PGPixelFormatString "PG_PIXEL_FORMAT" |
| #define PGPropertyAbsAvailString "PG_PROP_ABS_AVAIL" |
| #define PGPropertyAbsModeString "PG_PROP_ABS_MODE" |
| #define PGPropertyAutoAvailString "PG_PROP_AUTO_AVAIL" |
| #define PGPropertyAutoModeString "PG_PROP_AUTO_MODE" |
| #define PGPropertyAvailString "PG_PROP_AVAIL" |
| #define PGPropertyManAvailString "PG_PROP_MAN_AVAIL" |
| #define PGPropertyOnePushAvailString "PG_PROP_ONE_PUSH_AVAIL" |
| #define PGPropertyOnePushString "PG_PROP_ONE_PUSH" |
| #define PGPropertyOnOffAvailString "PG_PROP_ON_OFF_AVAIL" |
| #define PGPropertyOnOffString "PG_PROP_ON_OFF" |
| #define PGPropertyValueAbsMaxString "PG_PROP_VAL_ABS_MAX" |
| #define PGPropertyValueAbsMinString "PG_PROP_VAL_ABS_MIN" |
| #define PGPropertyValueAbsString "PG_PROP_VAL_ABS" |
| #define PGPropertyValueBString "PG_PROP_VAL_B" |
| #define PGPropertyValueMaxString "PG_PROP_VAL_MAX" |
| #define PGPropertyValueMinString "PG_PROP_VAL_MIN" |
| #define PGPropertyValueString "PG_PROP_VAL" |
| #define PGSkipFramesString "PG_SKIP_FRAMES" |
| #define PGSoftwareTriggerString "PG_SOFTWARE_TRIGGER" |
| #define PGStrobeDelayString "PG_STROBE_DELAY" |
| #define PGStrobeDurationString "PG_STROBE_DURATION" |
| #define PGStrobeEnableString "PG_STROBE_ENABLE" |
| #define PGStrobePolarityString "PG_STROBE_POLARITY" |
| #define PGStrobeSourceString "PG_STROBE_SOURCE" |
| #define PGTimeStampModeString "PG_TIME_STAMP_MODE" |
| #define PGTransmitFailedString "PG_TRANSMIT_FAILED" |
| #define PGTriggerPolarityString "PG_TRIGGER_POLARITY" |
| #define PGTriggerSourceString "PG_TRIGGER_SOURCE" |
| #define PGVideoModeString "PG_VIDEO_MODE" |
| enum binningMode_t |
| enum PGTimeStamp_t |
| enum propValue_t |
| epicsExportRegistrar | ( | pointGreyRegister | ) |
| int pointGreyConfig | ( | const char * | portName, |
| int | cameraId, | ||
| int | traceMask, | ||
| int | memoryChannel, | ||
| int | maxBuffers, | ||
| size_t | maxMemory, | ||
| int | priority, | ||
| int | stackSize | ||
| ) |
Configuration function to configure one camera.
This function need to be called once for each camera to be used by the IOC. A call to this function instanciates one object from the pointGrey class.
| [in] | portName | asyn port name to assign to the camera. |
| [in] | cameraId | The camera index or serial number. |
| [in] | traceMask | The initial value of the asynTraceMask. |
If set to 0 or 1 then asynTraceMask will be set to ASYN_TRACE_ERROR. If set to 0x21 (ASYN_TRACE_WARNING | ASYN_TRACE_ERROR) then each call to the FlyCap2 library will be traced including during initialization.
| [in] | memoryChannel | The camera memory channel (non-volatile memory containing camera parameters) to load during initialization. If 0 no memory channel is loaded. If >=1 thenRestoreFromMemoryChannel(memoryChannel-1) is called. |
Set memoryChannel to 1 to work around a bug in the Linux GigE driver in R2.0.
| [in] | maxBuffers | Maxiumum number of NDArray objects (image buffers) this driver is allowed to allocate. This driver requires 2 buffers, and each queue element in a plugin can require one buffer which will all need to be added up in this parameter. 0=unlimited. |
| [in] | maxMemory | Maximum memory (in bytes) that this driver is allowed to allocate. So if max. size = 1024x768 (8bpp) and maxBuffers is, say 14. maxMemory = 1024x768x14 = 11010048 bytes (~11MB). 0=unlimited. |
| [in] | priority | The EPICS thread priority for this driver. 0=use asyn default. |
| [in] | stackSize | The size of the stack for the EPICS port thread. 0=use asyn default. |


Offerer
Now assume that you are creating "offer"...you need to use this code to create offer sdp:
var peer = RTCPeerConnection({
iceServers : { "iceServers": [{ "url"<EMAIL_ADDRESS>"credential": "muazkh" }] },
stream : clientStream,
isopus : window.isopus,
getice : function (candidate) {},
gotstream : function (event) {},
onoffer : function(sdp) {}
});
Here is the short explanation of above code ↑
-
iceServers: by default its value is:
{"iceServers": [{ "url": "stun:stun.l.google.com:19302" }]}
-
stream: client stream that you need to share with other peer!
-
isopus: this variable takes value from "
window.isopus " object from RTCPeerConnection-Helpers.js file which let him know that both peers support opus codec or not.
-
getice: it returns locally generated ICE so you can share them with other end.
candidate object contains two properties:
-
candidate.
sdpMLineIndex
-
candidate.
candidate
-
gotstream: returns event contains remote stream attached by other peer.
-
onoffer: returns offer sdp; so you can send it to other peer to get answer sdp.
Now assume that other peer generated answer sdp and sent to you; you can pass that sdp to this function:
peer.onanswer( answer_sdp );
Now assume that other peer generated ICE and sent to you; you can pass that ICE to this function:
peer.addice({
sdpMLineIndex : candidate.sdpMLineIndex,
candidate : candidate.candidate
});
|
Answerer
99% process is the same for peer who "creates answer sdp"; the only difference is: for that peer you don't need "onoffer " and also you don't need to call "peer.onanswer( answer_sdp ); ". What extra you need to do is here:
var peer = RTCPeerConnection({
iceServers : { "iceServers": [{ "url"<EMAIL_ADDRESS>"credential": "muazkh" }] },
stream : clientStream,
isopus : window.isopus,
getice : function (candidate) {},
gotstream : function (event) {},
// see below two additions ↓
offer : offer_sdp,
onanswer : function(sdp) {}
});
Let me elaborate:
-
offer: you need to pass offer sdp sent by other peer.
-
onanswer: returns answer sdp so you can send it to other end.
For ICE sent by other peer; you need to do same thing:
peer.addice({
sdpMLineIndex : candidate.sdpMLineIndex,
candidate : candidate.candidate
});
|
How to write a realtime WebRTC app using socket.io?
First of all; you need to reference socket.io.js:
<script src="https://webrtc-experiment.appspot.com/dependencies/socket.io.js"></script>
Now, open socket and transmit your request (e.g. room) until a participant found:
var socket = io.connect('http://pubsub.pubnub.com/webrtc-app', {
publish_key: 'demo',
subscribe_key: 'demo',
ssl: true,
channel: 'WebRTC App'
});
socket.on('connect', onconnect);
socket.on('message', oncallback);
function onconnect() {}
function oncallback(response) {}
Above code is same for both: offerer and answerer.
Offerer
Now, assume that it is "offerer" who transmits request for participant to join him. He will not create "offer sdp" until he receive "join request" from his participant.
Following code is for offerer (95% part of this code can be used for Answerer):
function onconnect()
{
transmitRequest();
}
var userID = 'offerer';
var foundParticipant = false;
function transmitRequest()
{
socket.send({
userID: userID,
type: 'request to join'
});
!foundParticipant && setTimeout(transmitRequest, 1000);
}
function oncallback(response)
{
if(response.userID == userID) return;
if(response.participant)
{
foundParticipant = true;
createOffer();
}
if(response.firstPart || response.secondPart)
{
processAnswerSDP(response);
}
}
var peer;
function createOffer()
{
peer = RTCPeerConnection({
onoffer: sendOfferSDP,
getice: function(candidate) {
socket && socket.send({
userID: userID,
candidate: {
sdpMLineIndex: candidate.sdpMLineIndex,
candidate: JSON.stringify(candidate.candidate)
}
});
},
gotstream: function(event) {
if(event) video.src = webkitURL.createObjectURL(event.stream);
},
stream: clientStream,
isopus: window.isopus
});
}
function sendOfferSDP(sdp)
{
var sdp = JSON.stringify(sdp);
var firstPart = sdp.substr(0, 700),
secondPart = sdp.substr(701, sdp.length - 1);
socket.send({
userID: userID,
firstPart: firstPart,
isopus: window.isopus
});
socket.send({
userID: userID,
secondPart: secondPart,
isopus: window.isopus
});
}
var answerSDP = {};
function processAnswerSDP(response)
{
if (response.firstPart) {
answerSDP.firstPart = response.firstPart;
if (answerSDP.secondPart) {
var fullSDP = JSON.parse(answerSDP.firstPart + answerSDP.secondPart);
peer.onanswer(fullSDP);
}
}
if (response.secondPart) {
answerSDP.secondPart = response.secondPart;
if (answerSDP.firstPart) {
var fullSDP = JSON.parse(answerSDP.firstPart + answerSDP.secondPart);
peer.onanswer(fullSDP);
}
}
}
That was all you need to do for offerer side.
Answerer
For answerer: you write 95% same code like offerer; there is just a little bit difference.
-
For answerer, you don't use "onoffer" instead you use "onanswer"
-
For answerer, you've to pass "offer" object containing "offer sdp" sent by offerer
-
For answerer, you don't need to call "peer.onanswer" because this function is for "offerer" only.
On the "Answerer" side; when user click "join" button; send a message to Offerer to tell him that you're ready to get "offer sdp" from him.
var userID = 'answerer';
socket && socket.send({
participant: true,
isopus: window.isopus,
userID: userID
});
Here is the function that creates "answer sdp":
function createAnswer(offer_sdp)
{
peer = RTCPeerConnection({
offer: offer_sdp,
onanswer: sendAnswerSDP,
getice: getice,
gotstream: gotstream,
stream: clientStream,
isopus: window.isopus
});
}
For answerer: socket "callback" function will be like this:
function oncallback(response)
{
if(response.userID == userID) return;
if(response.type && response.type == 'request to join') {}
if(response.firstPart || response.secondPart)
{
processAnswerSDP(response);
}
}
Remember: you don't need to call "peer.onanswer(fullSDP)" in processAnswerSDP function; instead call createAnswer like this:
createAnswer(fullSDP);
You MUST get client stream before creating offer or answer.
|


| 048:014 Khan | : |
And to Allah belongs the sovereignty of the heavens and the earth, He forgives whom He wills, and punishes whom He wills. And Allah is Ever Oft-Forgiving, Most Merciful. |
| 048:014 Maulana | : |
And Allah's is the kingdom of the heavens and the earth. He forgives whom He pleases and chastises whom He pleases. And Allah is ever Forgiving, Merciful. |
| 048:014 Pickthal | : |
And Allah's is the Sovereignty of the heavens and the earth. He forgiveth whom He will, and punisheth whom He will. And Allah is ever Forgiving, Merciful. |
| 048:014 Rashad | : |
To GOD belongs the sovereignty of the heavens and the earth. He forgives whomever He wills, and punishes whomever He wills. GOD is Forgiver, Most Merciful. |
| 048:014 Sarwar | : |
To God belongs the kingdom of the heavens and the earth. He forgives or punishes whomever He wants. God is All-forgiving and All-merciful. |
| 048:014 Shakir | : |
And Allah's is the kingdom. of the heavens and the earth; He forgives whom He pleases and punishes whom He pleases, and Allah is Forgiving, Merciful. |
| 048:014 Sherali | : |
And to ALLAH belongs the Kingdom of the heavens and the earth.  And ALLAH is Most Forgiving, ever Merciful. |
| 048:014 Yusufali | : |
To Allah belongs the dominion of the heavens and the earth: He forgives whom He wills, and He punishes whom He wills: but Allah is Oft-Forgiving, Most Merciful. |
Concepts/Themes Covered: أركان الإسلام > التوحيد > توحيد الله تعالي > مشيئته Pillars of Islam> Islamic> Oneness of Allah> His Will الجهاد > الغزوات > غزوة الحديبية وبيعة الرضوان Jihad> The Holy Battles> Al-Hudaibiah Battle and the Radwan Pledge of Allegiance تنظيم العلاقات المالية > تملك الأموال Organizing Financial Relationships>Possessing Property
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


#include <MediaInfo.h>
Public Member Functions | |
| MediaInfo () | |
| ~MediaInfo () | |
| int | Open (const MediaInfo_String &File) |
| Open a file. | |
| int | Open (const unsigned char *Begin, size_t Begin_Size, const unsigned char *End=NULL, size_t End_Size=NULL) |
| Open a stream. | |
| int | Save () |
| Save the file. | |
| void | Close () |
| Close a file. | |
| MediaInfo_String | Inform (informoptions_t Options=InformOption_Nothing) |
| Get all details about a file. | |
| MediaInfo_String | Get (stream_t StreamKind, int StreamNumber, int Parameter, info_t InfoKind=Info_Text) |
| Get a piece of information about a file (parameter is an integer). | |
| MediaInfo_String | Get (stream_t StreamKind, int StreamNumber, const MediaInfo_String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name) |
| Get a piece of information about a file (parameter is a string). | |
| int | Set (const MediaInfo_String &ToSet, stream_t StreamKind, int StreamNumber, int Parameter, const MediaInfo_String &OldValue=_T("")) |
| Set a piece of information about a file (parameter is an int). | |
| int | Set (const MediaInfo_String &ToSet, stream_t StreamKind, int StreamNumber, const MediaInfo_String &Parameter, const MediaInfo_String &OldValue=_T("")) |
| Set information about a file (parameter is a string). | |
| MediaInfo_String | Option (const MediaInfo_String &Option, const MediaInfo_String &Value=_T("")) |
| int | State_Get () |
| (NOT IMPLEMENTED YET) Get the state of the library | |
| int | Count_Get (stream_t StreamKind, int StreamNumber=-1) |
| Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream. | |
Static Public Member Functions | |
| MediaInfo_String | Option_Static (const MediaInfo_String &Option, const MediaInfo_String &Value=_T("")) |
Friends | |
| class | File_Cdxa |
Definition at line 170 of file MediaInfo.h.
|
|
|
|
|
|
|
|
Close a file. Close a file opened before with Open() (without saving)
|
|
|
Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream.
|
|
|
Get a piece of information about a file (parameter is a string).   Get all details about a file in one string
|
|
|
Open a stream. Open a stream (Begin and end of the stream) and collect information about it (technical information and tags)
|
|
|
Open a file. Open a file and collect information about it (technical information and tags)
|
|
|
Configure or get information about MediaInfoLib
|
|
|
|
|
|
Save the file. Save the file opened before with Open() (modifications of tags)
|
|
|
Set information about a file (parameter is a string).  Set a piece of information about a file (parameter is an integer)
|
|
|
(NOT IMPLEMENTED YET) Get the state of the library
|
|
|
Definition at line 302 of file MediaInfo.h. |


I have been wondering for some time now why it is I struggle so much with actually using my blog. I think I finally have the reason, but first let me tell you the summarized sob story.
I did what I had been advised to do: I looked at blogs online until I found ones I liked, and then went about making something similar, but no matter what I did I didn't like my own blog! and I don't feel the inspiration to use a webpage if doing so is devoid of any satisfaction. I had tried blogger templates, wordpress templates, and a few half cocked projects of my own (before I even knew javascript).
Enter the revisitation. I think I finally found the solution. Most blogs flaunt past blogs in an attempt to make the reader read them too. This makes good sense in terms of getting people to go read your blogs and in a general use-sense. The problem though, is that I have a severe dislike for my own writing for completely irrational reasons. Maybe if I rewrote the blog 12 times (I just reworded this sentence 3 times) I would get over it? That sounds painful too. But stumbling onto Phil Hagelberg's Technomancy I suddenly realized what it was. I want to write something, not worry about it, and not see it. I do want other people to see it, though really I care more about getting the "moment" out of my system and into a record than about people reading what I write. So just put a footnote and minimal anything into displaying the way around, and focus entirely on just one blog at a time .