M SOWMIA - 2019-08-19 21-39-37 - ma19m020_2.rst
M.SOWMIA
~~~~~~~~
MA19M020
~~~~~~~~
NUMERICAL METHODS OF SCIENTIFIC COMPUTING
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROBLEM :1
^^^^^^^^^^
A)Show that Det(V) is a polynomial in the variables $x\_0,x\_1,...,x\_n
$with degree n(n+1)/ 2 I tried solving it by using column operations but
the calculations become very tedious,and moreoer we dont need the exact
form of determinant right now.so let us now consider the fact that
.. math:: Det(v)=\sum_{i=1}^{n+1} (-1)^n v_{ij} M_{ij}
so we get that
.. math:: degree(Det(v))=degree\big(\sum_{i=1}^{n+1} (-1)^n v_{ij} M_{ij}\big)
note ,that degree of all minors are the same ,w can check this by
taking cases of n so,\
.. math:: degree(Det(v))=degree(M_{11}) (SAY)
Now,\
.. math:: deg(M_{11}=1+deg(M_{11}^1)
where$ M\_{11}^1 $denotes the same minor of nxn submatrix of
:math:`M_{11}`
.. math:: \implies deg(M_{11}=1+2+deg(M_{11}^2)
where $ M\_{11}^2$denotes the same minor of (n-1)x(n-1) submatrix of
:math:`M_{11}^1`
PART B)Show that if :math:`x_i=x_j` for some :math:`i\neq j` then
det(v)=0 This is quite straight forwrd.When :math:`x_i=x_j` for some
:math:`i\neq j` doing a single row operation :math:`R_i \to R_i-R_j`
will produce :math:`R_i =0` .Therefore determinant beomes zero.
PART C)Hence, conclude that :math:`x_i-x_j` is a factor of det(v) This
is also obvious.Since the det(v) becomes zero whenever :math:`x_i=x_j`
for some :math:`i\neq j` :math:`x_i-x_j` and also we have the additional
fact that it is a polynomial of would be a factoor of the polynomial of
$x\_0,x\_1,...,x\_n $. how many suc fcators would we get? for i=0, j
:raw-latex:`\to `1,2,....n for i=1,to get non repeated factors, j can
be 2,3...n i=2 :raw-latex:`\to `3,4,...... therefore the total no of
fcators would be n+(n-1)+(n-2)+.........1=n(n+1)/2
PART D) THE FORM OF THE DETERMINANT WOULD BE : product of n(n+1)/2
factors of :math:`(x_i -x_j)` and$ i:raw-latex:`\neq `j$therefore
.. math:: determinant(V)= k\prod_{1\leq j<i\leq n} (x_i-x_j)
where k is some contant
PART E) In part D) We see that coefficient of
:math:`x_1x_2^2x_3^2...,x_n^n =1` and from part A) we see that M\_{11}
is a monic poynomial with the leading term being
:math:`x_1x_2^2x_3^2...,x_n^n =1`.So now we compare both and coclude
that the constant k=1
PROBLEM:2
^^^^^^^^^
PART A)PROVE THE RECURRENCE:
.. math:: q_{n+1}=x q_{n}-\left(\frac{n^{2}}{4 n^{2}-1}\right) q_{n-1}
LET US START WITH THE GENERATING POLYNOMIAL OF LEGENDRE POLYNOMILAS
note:I DONT KNOW THE GENERATING FUNCTION FOR MONIC LEGENRE POLYNMIALS ,O
I AM RESORTING TO LEGENDRE POLYNOMILAS ONLY
.. math:: \frac{1}{\sqrt{1-2 x t+t^{2}}}=\sum_{n=0}^{\infty} q_{n}(x) t^{n}, t \neq 1
differentianting on both sides wrt t ,
.. math:: -\frac{1}{2}\left(1-2 x t+t^{2}\right)^{-\frac{3}{2}}(-2 x+2 t)=\sum_{n=0}^{\infty} n P_{n}(x) t^{n-1}
rearranging ,we get
.. math:: (x-t)\left(1-2 x t+t^{2}\right)^{-\frac{1}{2}}=\left(1-2 x t+t^{2}\right) \sum_{n=0}^{\infty} n P_{n}(x) t^{n-1}
now ,let us substitute back we get
.. math:: (x-t) \sum_{n=0}^{\infty} P_{n}(x) t^{n}=\left(1-2 x t+t^{2}\right) \sum_{n=0}^{\infty} n P_{n}(x) t^{n-1}
Now comparing the coefficietns on both sides for the :math:`t^n` term
we get the following recurrance relation
.. math:: x P_{n}(x)-P_{n-1}(x)=(n+1) P_{n}(x)+(n-1) P_{n-1}(x)-2 n x P_{n}(x)
PROBLEM:3
^^^^^^^^^
PART A)Show that the Chebyshev polynomials of the ﬁrst kind satisfy the
recurrence:
.. math:: T_{n+1}=2 x T_{n}-T_{n-1}
proof: :math:`T_{n+1}(x)=cos((n+1)cos^{-1}x)`\
:math:`\implies T_{n+1}(x)=cos(ncos^{-1}x+cos^{-1}x)`,
:math:`\implies T_{n+1}(x)=cos(ncos^{-1}x)cos(cos^{-1}x)-sin(ncos^{-1}x)sin(cos{-1}x)`\
:math:`\implies T_{n+1}(x)=xT_n(x)-sin(ncos^{-1}x)sin(cos{-1}x)`................................................(1)
now consider, :math:`T_{n-1}(x)=cos((n-1)cos^{-1}x)`\
:math:`\implies T_{n-1}(x)=cos(ncos^{-1}x-cos^{-1}x)`\
:math:`\implies T_{n-1}(x)=cos(ncos^{-1}x)cos(cos^{-1}x)+sin(ncos^{-1}x)sin(cos{-1}x)`\
:math:`\implies T_{n-1}(x)=xT_n(x)+sin(ncos^{-1}x)sin(cos{-1}x)`.......................................................(2)
now ,do (1)+(2) we get,
.. math:: T_{n+1}=2 x T_{n}-T_{n-1}
hence proved
PART B)SHOW that :math:`T_n` is a polynomial of degree n with leading
term coefficient =\ :math:`2^{n-1}`\ proof:
take :math:`V_n(x)=sin(ncos^{-1}x)`\ now consider
:math:`T_n(x)+i V_n(x)` \ :math:`=cos(ncos^{-1}x)+isin(ncos^{-1}x)`\
now put :math:`x=cosht`\ :math:`\implies T_n(x)+i V_n(x)= e^{inht}`\
:math:`=cosh(nt)+i sin(hnt)=(e^{iht})^n`\ :math:`=(cos ht+isin ht)^n`\
:math:`=(x+i\sqrt{(1-x^2)})^n`.........................................(1)
similarly consider\ :math:`T_n(x)-i V_n(x)`\
:math:`=cos(ncos^{-1}x)-isin(ncos^{-1}x)`\ now put :math:`x=cosht`\
:math:`\implies T_n(x)-i V_n(x)= e^{-inht}`\
:math:`=cosh(nt)-i sin(hnt)=(e^{-iht})^n`\
:math:`=(cos ht-isin ht)^n`\
:math:`=(x-i\sqrt{(1-x^2)})^n`.........................................(2)
now doing (1)+(2),we get
:math:`T_n(x)=\frac{(x+i\sqrt{(1-x^2)})^n+(x-i\sqrt{(1-x^2)})^n}{2}`
WHAT IS THE LEADING COEFFICIENT??? To find that let us do a binomial
expansion of both terms
:math:`T_n(x)=\frac{(x+i\sqrt{(1-x^2)})^n+(x-i\sqrt{(1-x^2)})^n}{2}`\
:math:`\implies T_n(x)= \frac{2{n \choose 0} x^n+{n \choose 2}x^{n-2}(i\sqrt{(1-x^2)})^2+{n \choose 4}x^{n-4}(i\sqrt{(1-x^2)})^4+.........}{2}`
So from above expresion for :math:`T_n(x)` it is obvious that it is a
degree n polynomial what would be the leading coefficient?? We have to
fin the coefficient of x^n in above expression it would be\
.. math::
=
{n \choose 0}+{n \choose 2}+{n \choose 4}+.........
.. math:: =2^{n-1}
PART C) ZEROS OF THE POLYNOMIAL: :math:`T_n(x)=cos(ncos^{-1}x))` this
would have a root when :math:`ncos^{-1}x=\frac{(2m+1)\pi}{2}` or
equivalently :math:`cos^{-1}x=\frac{(2m+1)\pi}{2n}` or
:math:`x=cos(\frac{(2m+1)\pi}{2n})` :math:`\forall m \in {0,1,2....n}`
PART D) since the polynomial has n+1 roots it is going to alter signs
exactly n+1 times in the interval [+1,-1]
PROBLEM :4
^^^^^^^^^^
PART A) CASE 1: CONSIDER UNIFORMLY SPACED NODES
.. code:: ipython3
import numpy as np
import matplotlib.pyplot as plt
from numpy import linalg as LA
import math
def cno(size):
N=[]
Y=[]
for n in range (2,size) :
N.append(n)
a = []
V=np.zeros(shape=(n,n))
for i in range (0,n):
a.append(-1+((2*i+1)/n))
for j in range (0,n):
V[:,j]=np.power(a,j)
y=math.log(LA.cond(V))
Y.append(y)
plt.plot(N,Y)
plt.show()
cases=[200,500,1000]
for i in cases :
cno(i)
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_15_0.png
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_15_1.png
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_15_2.png
INFERENCE: By plotting the condtion number as a function of no of nodes
,we could clearly see that cond no steeply increases as n increases .But
saturates at :math:`\approx 50`.So,the upper bound on condition number
is :math:`\approx 50` which is tolerable.So ,it looks like working with
these nodes and the vandermode is a well-conditioned problem!!.let us
see what happens with other two types of nodes and compare.
part A) CASE 2: CONSIDER THE CHEBYSHEV NODES
.. code:: ipython3
import numpy as np
%matplotlib inline
from numpy import linalg as LA
import math
def cno(size):
N=[]
Y=[]
for n in range (2,size) :
N.append(n)
a = []
V=np.zeros(shape=(n,n))
for i in range (0,n):
a.append(math.cos((2*i+1))/(2*n+2)*math.pi)
for j in range (0,n):
V[:,j]=np.power(a,j)
y=math.log(LA.cond(V))
Y.append(y)
plt.plot(N,Y)
plt.show();
cases=[200,500]
for i in cases:
cno(i)
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_18_0.png
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_18_1.png
INFERENCE: So,in case of chebyshev's nodes,in both cases of
n=200,n=500,we get a maximum of n=140 only,which means the nodes are
repeating .Also,notice the diffence in how cond no scales with n here
and our former case of uniform spaced nodes.In both caes,the conition
number is shooting up with n.But it appears that condition number in
case of chebychec's polynomial goes upto 700!!.So this is clearly a
ill-conditioned problem.
PART A)CASE 3: CONSIDER THE LEGENDRE NODES We shall use the python's
buit in quadrature here!!
.. code:: ipython3
import numpy as np
%matplotlib inline
from numpy import linalg as LA
import math
def cno(size):
N=[]
Y=[]
for n in range (2,size) :
N.append(n)
V=np.zeros(shape=(n,n))
a,b=np.polynomial.legendre.leggauss(n) #a is the nodes returned in aray and b is weights
for j in range (0,n):
V[:,j]=np.power(a,j)
y=math.log(LA.cond(V))
Y.append(y)
plt.plot(N,Y)
plt.show();
cases=[200,500,1000]
for i in cases:
cno(i)
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_21_0.png
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_21_1.png
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_21_2.png
INFERENCE: Observing the graph between cond no and n in case of using
legendre ploynomial's roots,we see that it behaves more or less the same
way as the uniformly spaced nodes.We also get a upper bound on condition
no to be :math:`\approx 50` which is tolerable.So,the problem of
approximating fns with legendre nodes is a better idea.
PART B) PART 1: INTERPOLATING BY SOLVING THE LINEAR SYSTEM LET US CARRY
OUT OUR INTERPLOATIONS BETWEEN THE INTERVAL[-1,+1]
.. code:: ipython3
import numpy as np
import matplotlib.pyplot as plt
from numpy import linalg as LA
import math
def Runge(x):
y=1./(1+25*x*x)
return y
def interpolation(x,SOL,l):
sum=0
for i in range(0,l):
sum+=SOL[i]*(x**i)
return sum
def approxpoly(l):
x=np.linspace(-1,1,l)
V=np.zeros(shape=(l,l))
for j in range (0,l):
V[:,j]=np.power(x,j)
b=[]
for j in range (0,l):
b.append(Runge(x[j]))
SOL= np.linalg.solve(V, b)
fig = plt.gcf()
fig.set_size_inches(18.5, 10.5)
plt.plot(x,interpolation(x,SOL,l))
for i in range(1,20):
approxpoly(5*i)
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_24_0.png
PART B) PART 2: INTERPOLATING BY USING FUNDAMENTAL LEGENDRE POLYNOMIALS
LET US CARRY OUT OUR INTERPLOATIONS BETWEEN THE INTERVAL[-1,+1]
.. code:: ipython3
import numpy as np
from scipy.interpolate import lagrange
import matplotlib.pyplot as plt
from numpy import linalg as LA
import math
def Runge(x):
y=1./(1+25*x*x)
return y
def interpolationpoly(l):
x=np.linspace(-1,1,l)
y=lagrange(x,Runge(x))
fig = plt.gcf()
fig.set_size_inches(18.5, 10.5)
plt.plot(x,y)
for i in range (1,20):
interpolationpoly(i*5)
.. image:: M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_files/M%20SOWMIA%20-%202019-08-19%2021-39-37%20-%20ma19m020_2_26_0.png
INFERENCES: 1) Based on the above observation, which method would you
prefer for polynomial approximation? Based on the observations i would
consider interploating using the solving system of linear equations
method. Because the runge function clearly does no take negative values
,but by interpolating using the lagrange method,we get a ridiculous
graph.
PART E)Plot the decay in maximum relative error as a function of n (on a
semi-logy) plot for the three diﬀerent interpolants. To get the maximum
relative error, evaluate the interpolant and the Runge function at 1000
equally spaced points and ﬁnd the relative maximum error using these
1000 points
.. code:: ipython3
import numpy as np
from scipy.interpolate import lagrange
import matplotlib.pyplot as plt
from numpy import linalg as LA
import math
def Runge(x): # actual function
y=1./(1+25*x*x)
return y
def interpolationlagn(x): ## interpolated fn by lagrangian
y=lagrange(x,Runge(x))
return y
def linearsys(x,SOL): ## interpolated fn by solving system of linear eqns
sum=0
for i in range(0,1000):
sum+=SOL[i]*(x**i)
return sum
def approxpoly(x): ##functoin to solve sytem of equations
V=np.zeros(shape=(1000,1000))
for j in range (0,1000):
V[:,j]=np.power(x,j)
b=[]
for j in range (0,1000):
b.append(Runge(x[j]))
SOL= np.linalg.solve(V, b)
def relerrorlagn(): ##relative error plotting for lagrangian interpolation
x=np.linspace(-1,1,1000)
error=[]
for i in x:
errorlagn=abs((Runge(x)-interpolationlagn(x))/(Runge(x)))
error.append(errorlagn)
plt.plot(x,error)
def relerrorsys(): ## relative error plotting for solving system of lin eqns method
x=np.linspace(-1,1,1000)
error=[]
for i in x:
errorsys=abs((Runge(x)-linearsys(x))/(Runge(x)))
error.append(errorsys)
plt.plot(x,error)
relerrorlagn()
relerrorsys()


Previous consumed medications/chemicals: MDMA: 2, 4, 8 days ago. Dextroamphetamine: 2 days ago. Phenergan: 75MG 1 day ago.
20 mg of cyclobenzaprine – oral w/ full glass of water at 12:05am saturday (Note I'm writing this while under intoxication, to increase effect and see whether or not verbal(written) structures change as time progresses [writing this at 0:18])
0:00 – Took 4 of the little yellow home-base shaped plates, 5 mg in each, adding up to 20 mg total.
0:05 – Heartbeat seems more pronounced, at noticing it's only been 5 minutes, I'm going to say it's placebo mixing in with anticipation for the full blown effects.
0:15 – Put on some Beatles music, sounds normal, doubt the drug would take this short of time to take effect. (A reason I chose Beatles music, is due to when I'm documenting usage of chemicals, whether it be Flexeril or MDMA, I choose music I'm extremely familiar with so that I may recognize whether or not the chemical has altered my perception or appreciation of music. A recommendation for those who often document chemical experiences.)
0:30 – According to the reports I've read, and other sources, the effects shouldn't be coming on this fast. Especially considering I ate 4 hours ago. However I will bleed over MDMA philosophy to Flexeril, the trip is what I make of it. So I'm going to put aside the little voice in my head and assume that the euphoria I feel is coming from the drug.  However by the time I'm finished typing this it seems to be dying down. I'm going to read “Strange Brains and Genius”.
0:35 – I have now just read to not use Flexeril in combination with SSRI's, MDMA's function is similar to SSRI's, however now may be too late to turn back, by ways of vomit. 20 MG + 100MG of MDMA 2 days ago seems safe, however let the reader note I must lie to myself to keep calm and not panicking. This is going to be an interesting night. (Hopefully with no hospital visits)
0:58 – Feeling relaxed, conscious is a bit “groovy” so to say, talking to friends in a “pfft c'mon why not?” way. Slight euphoric feeling, seems to be getting stronger. “Fuzzy” patterns on white objects, going to get stronger I hope. These “Fuzzy” patterns remind me of Diphenhydramine's effects.
1:07 – Was hard adding up all those numbers..the 1:07 thing I mean. Well, I thought about it and like...MDMA 2 days ago doesn't really like..count as an SSRI I guess, because SSRi's last longer. And i'm king aof like..grouping MAOI and SSRI and so I thought 2 weeks for MAOI, same thing with SSRI, but who knows maybe i'm wrong? We'll find out. So since I realised this , i'm just going to take the other 15 mg I have. To experience a full blown effect. It's going to be great.
1:10 – There, I took 10mg more. I decided to leave over 5mg for whatever purposes my future plans, however I also like even numbers as far as multiples of 5's go, and so 30 looks better than 35, and so we'll just go with 30. So..take note! 30Mg now. 20Mg 1:10 ago, and 10MG right now.
1:13 – Okie dokie, a checkup time. Euphoria, doesn't seem special, maybe cuz I take MDMA which gives me more euphoria than seeing Jesus, but it's definitely there...and I can't ignore it, which is good in my world. But my head really hurts..probably from playing loud music through headphones which are basically squishing my head..I'll be back!
1:20 – Woo headache..I'm going to drink a lot of Dr.Pepper and hope it goes away.
1:25 – Well, I saw this and I gotta say it..the timer on my player..the music one, it's not really time moving in the sense like 4:08 – 4:09, it's more like the seconds are just adding up on top of each other. Time seems forced, but really why have time? That and sometimes I think that it goes from 4 5 faster than it does from 5 to 6, which it doesn't but probably I just think it does. In which it might but I doubt it. But I don't really doubt it if I said “In which it might”...but..whatever.
1:35 – patterns on rug kinda scared me, out of the corner of my eye. Of course this might all be placebo..but..I just feel great overall..relaxed, talkitive, great warm feeling everywhere. This is life.
1:40 – Im really enjoying some of this techno-type music, probably cuz it was memories of good times, but in general it's just great...great mood..i'm in that “tired but hyper” mood y'know? This music is like my theme music, if there was a movie where I would be getting up in the morning stretching at the window looking at the beautiful world, this would be the music playing. Maybe “Good day sunshine” but that's like..not..exciting.
1:50 – Blahh dry mouth
2:10 – Went around the house and had many of those “corner of the eye” type flashing thingies and what else, I feel nice...it feels great to just sit..talk to a friend and kinda move my head to some songs or something, I feel beyond happy! Happ..ier.
2:15 – 5 minutes? Geeze. Time sure is slow.
3:00 – More relaxed, more quite, euphoria still there, feels nice to move, music is relaxing.
3:05 – Kinda tired, going to stay up to fully document, might go to bed at 4 or 5 am.
3:30 – euphoria still there, a lot less talkitive, really tired.
3:45 – Having a nice relaxing time, talking to a friend, short replies, music is nice, when I move I feel intense euphoria in the muscles involved, I'm going to go to bed at the 4 hour mark because I have to get up early.
3:50 – subtle visuals on white objects, like the antichligeric or hwatever that stuff is! Flashing lights and aslk that carp in darkn places. It's like the antihistiamine stuff.
4:00 – Euphoria seemed to re “hit” me, going to bed, some visuals, very subtle and “out of the corner of the eye”, muscles are really relaxed, moving is nice, thinking reminds me of Cannabis, music seems real, getting into bed is going to be great. Gnight
It's the next day, I've woken up and been up for about 3 hours. I feel great, had the strangest dreams, but I had a great sleep, I feel refreshed. My body seems fine, head doesn't hurt, kind of “foggy”, but a cup of coffee cleared that up.
I'll probably try it again in the future if I'm just having a relaxed night where I've had a hard week, just something to sit, relax, write, listen to music or something. In comparison to Phenergan, this takes a bit longer to feel great, but unlike Phenergan I felt great mentally. I wasn't cloudy minded, I could have a conversation, a funny one at that due to my strange use of vocabulary and sentence structuring. Obviously I had no Ill effects from taking this 2 days after MDMA.
Anyway, my conclusion is that this is a great way to relax and talk without being cloudy minded and anti-social.
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.


Author: {{quote.author}}
publisher: {{quote.publisher}}
published date: {{quote.completeDate | date }}


Morning roundup: Former OSU and Steelers' quarterback Mason Rudolph was fined $50,000 by the NFL on Saturday
Pittsburgh Steelers quarterback Mason Rudolph didn't escape the brawl with the Cleveland Browns unpunished.
Rudolph was fined $50,000 on Saturday by the NFL for his involvement in the melee that began when Browns defensive end Myles Garrett pulled off his helmet and hit him over the head with it.
Rudolph avoided suspension for his actions he tried to pull off Garrett's helmet and charged him but was one of 33 players fined by the league for their involvement. The league penalized 29 players $3,507 apiece for "entering the fight area."
In all, the league handed out more than $700,000 for discipline stemming from the ugly final seconds of Cleveland's 21-7 win over Pittsburgh last week. There was another $77,206 assessed for personal fouls earlier in the game.
Garrett was indefinitely suspended by the league for tearing off Rudolph's helmet and using it "as a weapon."
JETS: Signed tight end Ryan Griffin to a multiyear contract extension, rewarding one of the team's few bright spots on offense this season.
GOLF
Kim holds slim lead in LPGA finale
Sei Young Kim was on the verge of taking all the drama out of the chase for the richest payoff in women's golf history.
She opened with three birdies in seven holes Saturday in the CME Group Tour Championship in Naples, Florida, as her challengers either stalled or faded. She led by five shots before making the turn.
Kim hit the brakes. Nelly Korda hit the gas.
When the third round ended at Tiburon Golf Club, Kim had to settle for a 4-under 68 and a one-shot lead over Korda with one round remaining to see who wins the $1.5 million.
PGA: A few years removed from battling the full yips, Brendon Todd has a chance to be mentioned alongside Tiger Woods and Dustin Johnson as he goes for a third straight PGA Tour victory.
Todd felt like he couldn't miss Saturday at Sea Island and he rarely did. With six birdies on the front side of the Seaside Course in St. Simons Island, Georgia, he shot an 8-under 62 to tie the 54-hole tournament record and build a two-shot lead in the RSM Classic.
Not since Dustin Johnson in 2017 has anyone won three straight starts on the PGA Tour.
Not since Tiger Woods in 2006 has anyone won three straight tournaments on the PGA Tour schedule.
TENNIS
Canada to meet Spain in Davis Cup finals
Canada reached its first Davis Cup final after beating Russia 2-1 on Saturday in Madrid.
In the decisive doubles, Vasek Pospisil and Denis Shapovalov beat Karen Khachanov and Andrey Rublev 6-3, 3-6, 7-6 (5).
Canada will meet Spain, a five-time Davis Cup champion, on Sunday. Rafael Nadal won his singles and doubles in leading Spain to a 2-1 comeback win over Britain on Saturday.
Nadal and Feliciano López defeated Jamie Murray and Neal Skupski, 7-6 (3), 7-6 (8) in the decisive doubles to secure Spain its first final since 2012.
SLALOM RACING
American Mikaela Shiffrin sets record for wins
Coming off a record-breaking season with 17 race wins, Mikaela Shiffrin didn’t need much time in the new campaign to reach yet another milestone.
The American set the all-time World Cup record for most slalom wins by any skier on Saturday, after earning her 41st career victory in the discipline at the season-opening slalom race.
Shiffrin beat the 32-year-old best mark from Swedish great Ingemar Stenmark, who won 40 slaloms between 1974 and 1987. Shiffrin amassed her total in just seven years, having won her first race in December 2012.
Wire reports


Vivo V17 now official, it's a rebranded Vivo S1 Pro - Gizchina.com
by Marco LancasterRate this post
Vivo has traced an unusual path with the V17 series. After announcing V17 Neo and V17 Pro in August and September respectively, the company decided that now it’s time to unveil the vanilla Vivo V17. Interestingly enough, the new device is just a rebranded Vivo S1 Pro which debuted the Philippines earlier this week.
Vivo V17 specifications
The Vivo V17 Pro boasts a 6.38″ Super AMOLED display that has a 2340×1080 pixel resolution. Furthermore, it features a u-shaped notch at the top and under-display fingerprint scanner. The notch serves as a house for the 32MP selfie snapper. Moving around to the back, there is a unique diamond-shaped Quad-Camera setup. This setup comprises of a 48MP main camera, an 8MP ultrawide, 2MP macro, and 2MP depth sensor.
Despite the premium appeal and the AMOLED display, the handset features a mid-range SOC. It’s the Snapdragon 665 chipset, the favorite choice of many brands in the mid-range segment. The chipset is paired with 8GB of RAM, which is overkill considering the chipset’s power. The handset features 128GB of Internal Storage, but if it isn’t enough for you, it also supports microSD cards up to 256GB.
The handset draws power from a 4,500mAh battery that charges with an 18W standard via the USB Type-C port. Other features include a 3.5mm headphone jack and come with an NFC chip for contactless payments. It features FunTouch OS 9.2 which runs atop of Android 9 Pie.
The vivo V17 is available in Cloud Blue and Blue Fog colors. Customers in Russia can pre-order it for RUB22,990 ($360/€325) till December 5. Pre-bookers will receive a free Vivo Y11.


None
In this project you will create a well-designed webpage that displays one of your favorite recipes. It will include the ingredients, the steps needed to make the dish, links to similar recipes, and at least one photo.
Phase 1 of the project involves coding the structure of your webpage using HTML. This includes the ingredients, the steps needed to make the dish, links to similar recipes, and at least one photo.
Phase 2 of the project involves adding styling and pizazz using CSS. This includes changing the font style, font size, colors, and significantly altering the layout.
Phase 3 of the project involves incorporating Bootstrap. You’ll add a navigation bar and several other Bootstrap components of your choosing.
Phase 4 of the project involves incorporating jQuery. You’ll add at least one interactive element of your choosing.

tagsUse the Terminal for navigating around the file system and creating new folders and files. Refer to the lesson on The Command Line Interface if you need guidance on using the Terminal.
When you get to the steps below that ask you to initialize a git repo and track files using git, refer to the lesson on Git and Version Control if you need guidance.
recipe-page
directory.If you have questions, do not disturb your colleagues until you have spent at least 20 minutes troubleshooting on your own. Be sure to format your question using the template we practiced in the Asking Good Questions lesson.
You’ll be building on the HTML code you completed in Phase 1 of this project.
recipe-page
directory. Create a file called styles.css
. You can verify this worked by running the ls
command.code .
to open the recipe-page
directory in VSCode.git status
. You should see that ‘styles.css’ is not being tracked yet.
tagsstyles.css
file in VSCode that you just created. Add this small bit of CSS code to the file, then save the file.We’re doing this so we can easily see if we’ve successfully connected styles.css
to index.html
. We’ll know it worked if all of our paragraph text appears blue instead of the default black when we load index.html
at the end of this step.
styles.css
from within index.html
. Find the index.html
file in VSCode. Read the following code snippet and make sure you understand what it does. Then, copy and paste it into the
area of index.html
, just below the <meta>
tag.Questions to Consider
rel
, type
and href
called?"stylesheet"
, "text/css"
and "styles.css"
called?Open index.html
in Chrome. The blurb under your title should be blue!
When you’re satisfied that styles.css
is properly linked to index.html
, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Link stylesheet to index.”
If you want to change your paragraph text back to black from the temporary blue, do so now by simply deleting all the code in styles.css
.
Now, write some CSS code in styles.css
that will change the background color to any color you like!
cmd + spacebar
to bring up your Spotlight window, and begin to type color
. After you select and launch Digital Color Meter, you’ll see a small window that “picks” the pixel your mouse is currently hovering over. There is no dropdown option to show the color values in hexadecimal, so you’ll have to use a piece of scratch paper, write down the RGB values, and use an online converter to get the hex code (google provides one if you search for rgb to hex
).Refresh index.html
in Chrome by pressing <COMMAND> + r
. Does your new background color show up?
When you’re happy with the background color, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Change background color.”
styles.css
and change the color to something that works well with your background color.Refresh index.html
in Chrome by pressing <COMMAND> + r
to see if it worked!
When you’re happy with the new font color, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Change font color.”
When you find a font you want to use, click the orange plus sign in its upper right hand corner. A black strip will appear at the bottom of your browser.
Click on it to expand it. You’ll now see a pane that contains some HTML code and some CSS code. Copy and paste these code snippets into the proper files in order to include this new font in your project.
Refresh index.html
in Chrome by pressing <COMMAND> + r
to see if it worked.
If you need to make the font size larger or smaller for your headings due to the new font’s default size, go ahead and make these changes now in styles.css
.
When you’re happy with the new font, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Link to Google font for headers.”
You may remember from Phase 1 of the project that we constrained the width of the image to 600px. (If you didn’t do this yet for some reason, please do so now.) Let’s now also constrain the blurb text under neath the title to a width of 600px, to make it easier for the user to read.
The description is currently inside a pair of

tags. But if we use the

element as a selector, if we add more paragraph text later, it will also be affected by the 600px constraint. A better way to select the description is to give its opening

a class called “description” and then use .description
as a selector in styles.css
. Go ahead and do this, implementing the width constraint to 600px on your own.
Refresh index.html
in Chrome by pressing <COMMAND> + r
. Did it work?
When you’ve successfully constrained the width of the description to match the width of the image, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Constrain description width to 600px.”
Right now, the entire webpage is displayed in a vertical fashion. We can make all the content appear on the screen, side by side, and eliminate the need for a user to have to scroll to read everything.
We’ve already accomplished some initial steps for making this happen. We have the title and description in their own

which has a class called top
. If we don’t specify any layout styling for this div in styles.css
, it just defaults to taking up the whole width of the screen. This is what we want, based on the layout image shown in the instructions.
We’ve also created divs that have a class called left
and right
, respectively. Can you guess what we’re going to use those classes for? We’re going to use them as CSS selectors!
styles.css
, use the left
class as a selector. We want to constrain the width of this div to 600px so that it aligns perfectly with the image above it. Implement that now. We also want it to float on the left. Implement that now, too.Refresh index.html
in Chrome by pressing <COMMAND> + r
. Do you see a change to your layout?
You should see that while the div with the left
class has stayed on the left, the div with the right
class is now on the right and overlapping some of the content. Progress! Let’s fix that silly overlap in the next step.
When you’ve successfully made the

with the .left
class float on the left of the webpage, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Float half the content on the left.”
styles.css
, use the right
class as a selector. We want to constrain the width of this div to 600px so that it matches the width of the image and the left div. Implement that now. We also want it to float on the left of its allotted space. Implement that now, too.Refresh index.html
in Chrome by pressing <COMMAND> + r
. Do you see a change to your layout?
No more overlap!
Play around with the float position of the right
class. What happens when you use float: center;
and float: right;
? Why do you think this happens? Reset back to float: left;
when you’re done.
Let’s add a little bit of blank space in between the two divs. Using the margin-left
property, add at least 30px of space onto the right
div.
If the top of your image is not aligned with the top of your instructions, add a margin-top
property to the left
div so they match.
Voila!
When you’re happy with the layout of your webpage, run git status
. Add and commit, making sure to write a descriptive commit message in the present tense, such as “Complete styling and layout.”


--- layout: post status: publish published: true title: "看图说话：这个场景叫做温馨" author: Leask author_login: leask author_email<EMAIL_ADDRESS>author_url: https://leaskh.com wordpress_id: 266 wordpress_url: http://leaskh.wordpress.com/2008/03/21/%e7%9c%8b%e5%9b%be%e8%af%b4%e8%af%9d%ef%bc%9a%e8%bf%99%e4%b8%aa%e5%9c%ba%e6%99%af%e5%8f%ab%e5%81%9a%e6%b8%a9%e9%a6%a8 date: '2008-03-21 09:42:28 +0800' date_gmt: '2008-03-21 09:42:28 +0800' categories: tags: [] comments: [] ---


!Library of Sages Director Sophia:
This book? Well Holly, who is now a grocer in Aden Castle, gave this book to me. And I lost it... for a library director I sure lose a lot of books.. Anyway let me tell you a secret... ready? I don't believe in coincidence.
...That being said, perhaps fate wants you to take this book back to Holly, the grocer in Aden Castle?


surveyJS let's you create a survey from a JSON and manage all the process ( fields validation, local storage and form data are already managed )
You can manage:
surveyJS is compatible with ( desktop & mobile versions ):
* for compatibility with IE 10/11 and old versions of Edge you have to load some JS polyfills ( from polyfill.io or else ):
Array.from
Element.prototype.closest
Element.prototype.matches
Promise
Promise.prototype.finally
AbortController
fetch

surveyJS is developed with these dependencies:
Include css and js in your page.
 <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/simplysayhi/surveyJS/dist/survey.min.css">
or from unpkg.com:

or install via NPM:
npm install surveyjs
and use as ES6 module:
import Survey from 'surveyjs';
or use as CommonJS module:
var Survey = require('surveyjs');
This is the basic HTML structure to initialize the survey ( element with data-surveyjs-body
will be filled with questions & answers. ):

 <form action="page.jsp" name="surveyjs-form" class="surveyjs-form" data-surveyjs-form novalidate>

 <button type="submit">SEND</button>
 </form>

Mandatory attributes:
data-surveyjs-*
attributes
action
the page where to send the users answers ( with the AJAX call )
novalidate
prevent the HTML5 default validation of required fields ( they will be validated via JS )
CSS classes ( like .surveyjs-*
) are optional but used to give styles to the demos.
For custom graphic inputs, using CSS class surveyjs-custom-inputs
on the Survey container ( with class "surveyjs-container" ) is suggested in order to default Survey CSS be applied.
You must specify the url to retrieve the JSON data to build the survey.
var formEl = document.querySelector('[data-surveyjs-form]'); var options = { url: 'json/survey.json' }; var mySurvey = new Survey( formEl, options ); mySurvey.init().then(function( response ){ console.log('SURVEY DATA RETRIEVED', response); });
var formEl = '.my-container .my-form';
url
surveyJS has some more properties:
data
: the survey data structure returned from the AJAX call.
internals
: objects & methods used internally ( formInstance
can be useful also for you ).
isInitialized
: whether or not the init method was called on the Survey instance.
version
: the version number.
Example of JSON file for the survey is here.
Note that the AJAX call to get the JSON file MUST return it as JSON string or JSON object.
The survey will be built if status
is "success" and questions
is a non-empty array.
{ "status": "success", // MANDATORY, IF "success" THE SURVEY WILL BE BUILT "data": { "id": 0, "title": "My Survey", "description": "Answer the questions", // LIST OF ALL QUESTIONS "questions": [ // RADIO ANSWER { "id": "1", "question": "Do you have pets?", "answers": [ // EACH ANSWER IS AN OBJECT WITH SOME DATA { "id": "1", "type": "radio", "answer": "Yes" }, { "id": "2", "type": "radio", "answer": "No" } ], // IF required IF FOUND, THE ANSWER FIELDS WILL HAVE THE required ATTRIBUTE (SO THIS QUESTION REQUIRE AN ANSWER) "required": "", // THE POSITION TO SET FOR THE QUESTION (USED ALSO FOR ANSWERS - SEE ABOVE) - THIS IS OPTIONAL "sort": 1 }, // VALIDATE INPUT FIELD ONLY IF FILLED ( validateIfFilled ) AND WITH SPECIFIC subtype VALIDATION ( SEE FORM JS PLUGIN ) { "id": "1b0", "question": "What's your name?", "answers": [ { "id": "1ba0", "type": "text", "answer": "", "subtype": "alphabeticExtended" } ], "validateIfFilled": "", "sort": 0 }, // TEXT INPUT ANSWER NOT MANDATORY { "id": "1b", "question": "Do you have pets?", "answers": [ { "id": "1ba", "type": "text", "answer": "" } ], "sort": 2 }, // INPUT WITH SUBTYPE ( IF TYPE EXISTS IN HTML YOU CAN SET IT AS "type" -> "type": "email" ) { "id": "1c", "question": "What's your email address?", "answers": [ { "id": "1c", "type": "text", "answer": "", "subtype": "email" } ], "required": "", "sort": 1 }, { "id": "2", "question": "Which are your hobbies/interests?", "answers": [ { "id": "6", "type": "radio", "answer": "Music", "sort": 5 }, { "id": "7", "type": "radio", "answer": "Photography", "sort": 2 }, { "id": "8", "type": "radio", "answer": "Technology", "sort": 3 }, { "id": "9", "type": "radio", "answer": "Games", "sort": 4 }, { "id": "10", "type": "radio", "answer": "Reading", "sort": 1 }, { "id": "11", "type": "radio", "answer": "Wellness", "sort": 6 }, { "id": "100", "type": "radio", "answer": "Other...", "sort": 7 } ], "required": "", "sort": 3 }, // TEXTARE { "id": "3", "question": "If yes, specify which sport:", "answers": [ { "id": "18", "type": "textarea", "answer": "", "maxlength": 300 } ], "sort": 4 }, // RELATED FIELD ANSWER WITH INPUT TEXT ( SEE attribute FIELD ) { "id": "5", "question": "What is important for you about the loyalty program?", "answers": [ { "id": "19", "type": "radio", "answer": "It should be funny" }, { "id": "20", "type": "radio", "answer": "It does not require much time" }, { "id": "200", "type": "radio", "answer": "Other...", "attribute": { "id": "", "type": "text", "answers": "" } } ], "required": "", "sort": 6 }, // NESTED ANSWERS ( SEE nested ATTRIBUTE ) // RELATED FIELD ANSWER WITH SELECT FIELD ( SEE attribute FIELD ) { "id": "6", "question": "How do you prefer to be interact with the loyalty program?", "answers": [ { "id": "21", "type": "radio", "answer": "Website", "nested": [ { "id": "21a", "type": "radio", "answer": "Pc", "sort": 1 }, { "id": "21b", "type": "radio", "answer": "Smartphone", "sort": 2 }, { "id": "21c", "type": "radio", "answer": "Tablet", "sort": 3 } ], "sort": 1 }, { "id": "21aPlus", "type": "radio", "answer": "Website", "attribute": [ { "id": "21aa", "type": "option", "answer": "Pc", "sort": 1 }, { "id": "21ba", "type": "option", "answer": "Smartphone", "sort": 2 }, { "id": "21ca", "type": "option", "answer": "Tablet", "sort": 3 } ], "sort": 6 }, { "id": "24", "type": "radio", "answer": "App", "sort": 3 }, { "id": "25", "type": "radio", "answer": "Phone", "sort": 4 }, { "id": "26", "type": "radio", "answer": "With loyalty card", "sort": 5 } ], "required": "", "sort": 7 }, // CHECKBOX ANSWER WITH MULTIPLE CHOICE ( maxChoice: NUMBER OF MAXIMUM SELECTABLE ANSWERS ) { "id": "8", "question": "What do you like the most about this edition?", "answers": [ { "id": "43", "type": "checkbox", "answer": "Clear of communication", "sort": 1 }, { "id": "44", "type": "checkbox", "answer": "Simplicity of usage", "sort": 2 }, { "id": "45", "type": "checkbox", "answer": "Graphic style and language", "sort": 3 }, { "id": "46", "type": "checkbox", "answer": "Duration", "sort": 4 }, { "id": "47", "type": "checkbox", "answer": "Content/prizes", "sort": 5 } ], "checks": "[1,2]", "required": "", "sort": 9 }, // SELECT ANSWER { "id": "9", "question": "How much is important that the loyalty program is funny?", "answers": [ { "id": "160", "type": "option", "answer": "Not much", "sort": 1 }, { "id": "161", "type": "option", "answer": "Medium", "sort": 2 }, { "id": "162", "type": "option", "answer": "Much", "sort": 3 } ], "required": "", "sort": 10 }, // PRIVACY CHECK { "id": "22", "question": "hidden-privacy", "answers": [ { "id": "44", "type": "radio", "answer": "Yes", "sort": 1 }, { "id": "45", "type": "radio", "answer": "No", "sort": 2 } ], "required": "", "sort": 12 } ] } }
Note:
To bind the privacy acceptance field to the survey you can set a question object as shown in the JSON above ( see PRIVACY CHECK ):

 <input data-exclude-storage data-name="bind-surveyjs-answer"/>

 <input data-exclude-storage data-name="bind-surveyjs-answer"/>

You can initialize the survey with some extra options:
cssClasses
JS object with keys:
fieldErrorFeedback
whether or not to load the field error message inside the HTML ( shown on failed field validation )
fieldErrorMessage *
Text to show on generic field error validation.
See below for default messages ( depending on the language ).
fieldErrorMessageMultiChoice *
Text to show on error validation of checkboxes with multiple choice.
See below for default messages ( depending on the language ).
fieldOptions
JS object with field options passed to isValidField method of Form instance.
See formJS plugin for details.
formOptions
JS object with form options passed to the Form instance creation.
See formJS plugin for details.
initAjaxOptions
JS object with ajax options passed to the fetch call to retrieve the survey data.
lang
language for messages (eg: loading box), select default option etc...
other values: 'it'
loadingBox *
HTML container and text for the loading box (used when requesting the survey JSON file).
See below for default messages ( depending on the language ).
maxChoiceText *
This text can be used for quesions that let the user choose more than one answer (checkboxes).
See below for default messages ( depending on the language ).
selectFirstOption *
Used if an option with empty id is NOT found in the JSON.
See below for default messages ( depending on the language ).
templates.fieldError
HTML string to be used as field error container ( when showing an error message on failed field validation ).
See Templates section.
templates.input
HTML string to be used for input fields when generating the survey
See Templates section.
templates.inputGroup
HTML string to be used for input group answers when generating the survey.
See Bootstrap Input Group
See Templates section.
templates.inputTag
HTML string to be used as input tags when generating the survey
See Templates section.
templates.labelTag
HTML string to be used for label tags when generating the survey
See Templates section.
templates.question
HTML string to be used as question (and answers) container when generating the survey
See Templates section.
templates.select
HTML string to be used for select answers when generating the survey
See Templates section.
templates.selectTag
HTML string to be used for select tags when generating the survey
See Templates section.
templates.textarea
HTML string to be used for textarea answers when generating the survey
See Templates section.
textareaPlaceholder *
See below for default messages ( depending on the language ).
useLocalStorage
Whether or not to use JS local storage to save user answers while compiling the survey.
When reloading the page, JS local storage will be used to polulate the questions with the answers selected/typed by the user.
Note that localStorage for the survey will be cleared on submit success.
destroy()
Remove all events listeners from the Survey and Form instances.
init()
This will retrieve the survey data and initialize the Form instance for it.
Promise
You can use these methods ONLY from the original Survey object ( not from a new instance - but you can always set each single property/method from the class prototype ):
addLanguage( langString, langObject )
You MUST pass all the key/value pairs to set a new language.
You can pass only new key/value pairs if you want to override an existing language.
This will affect ONLY new instances
This can be used to add a new language or override an existing one.
setOptions( options )
This will affect ONLY new instances
You can initialize the survey with your custom HTML templates for:
Remember to use ALL the data-* attributes and placeholders with the curly braces, for example {{questionId}}, in your custom code.
Here some examples of initialization with custom templates ( these are, actually, the basic templates ):
Custom Template for Loading Box
{ url: 'json/survey.json', loadingBox: '
 Loading...
' }
Custom Template for Fields Error
{ url: 'json/survey.json', templates: { fieldError: '
{{fieldErrorMessage}}
' } }
Custom Template for Inputs
{ url: 'json/survey.json', templates: { input: '
'+ '{{inputTagCode}}'+ '{{labelTagCode}}'+ '
' } }
Custom Template for Input Groups
{ url: 'json/survey.json', templates: { inputGroup: '
'+ '
'+ '
'+ '<input type="{{answerType}}" name="surveyjs-answer-{{questionNumber}}" id="{{answerCode}}" data-answer-id="{{answerId}}" value="{{answerIdValue}}" {{attrRequired}} data-require-more="" class="surveyjs-input surveyjs-radio form-check-input" />'+ '{{answerString}}'+ '
'+ '
'+ '{{relatedAnswerField}}'+ '
' } }
Custom Template for Input Tags
{ url: 'json/survey.json', templates: { inputTag: '<input type="{{answerType}}" {{attrSubtype}} name="surveyjs-answer-{{questionNumber}}{{addMoreName}}" class="surveyjs-input surveyjs-{{answerType}} {{fieldClass}}" id="{{answerCode}}" {{nestedAnswer}} data-answer-root="{{progIdsJoined}}" data-answer-id="{{answerId}}" value="{{answerIdValue}}" {{attrRequired}} {{attrChecks}} {{attrRequiredFrom}} />' } }
Custom Template for Label Tags
{ url: 'json/survey.json', templates: { labelTag: '{{answerString}}' } }
Custom Template for Questions
{ url: 'json/survey.json', templates: { question: '
'+ '
Question {{questionNumber}}
'+ '
'+ '
{{questionText}}
'+ '
'+ '{{answersHtml}}'+ '{{fieldErrorTemplate}}'+ '
'+ '
'+ '
' } }
Custom Template for Selects
{ url: 'json/survey.json', templates: { select: '
'+ '{{selectTagCode}}'+ '
' } }
Custom Template for Select Tags
{ url: 'json/survey.json', templates: { selectTag: '<select id="{{answerCode}}" name="surveyjs-answer-{{questionNumber}}{{addMoreName}}" class="surveyjs-select {{fieldClass}}" {{attrRequired}} {{nestedAnswer}} data-answer-root="{{progIdsJoined}}" {{attrRequiredFrom}}>'+ '{{optionsHtml}}'+ '</select>' } }
Custom Template for Textareas
{ url: 'json/survey.json', templates: { textarea: '
'+ '<textarea id="{{answerCode}}" data-answer-id="{{answerId}}" {{nestedAnswer}} name="surveyjs-answer-{{questionNumber}}" {{attrRequired}} class="surveyjs-textarea {{fieldClass}}" {{answerMaxlength}} rows="6" placeholder="{{answerPlaceholder}}"></textarea>'+ '
' } }
If you find a bug, please report it here


| DOSE: |
|
oral |
Pharms - Mefloquine |
In late 2002 I got a chance to take a free two-week trip to Kenya. As part of the medical preparations, I was prescribed an eight-week course of the anti-malarial drug Lariam, the generic name of which is mefloquine. This is a preventative drug which must be taken once a week before, during, and after the possible malaria exposure. I was warned by my doctor that it could cause 'neuropsychiatric symptoms', and he indicated that this meant different things for different people, ranging from nothing at all in the most common case to (rarely) psychosis.
The first four times I took the drug, I experienced very strange dreams the following night. For example, I had a lucid dream in which I was in a dream-version of the actual hotel room. It took a while before I knew it was a dream, even though I had full reflective consciousness. I reached for my mobile phone, but the screen made no sense. This was because I needed to download the phone's software into my brain through my skull, and just as this process began -- I could see the data streaming in -- I woke up feeling rather anxious at the frankly schizophrenic character of this delusion.
On another occasion I had nested lucid dreams -- I was dreaming that I was dreaming; in each case the dream was a lucid one of me being in my bed, and I had to cry for help to get my friend to release me from this state (in reality I was silent). This carried on repeatedly all night -- most confusing and disturbing to sleep.
The experiences diminished as the course of mefloquine carried on, and did not occur at all on the six nights of the week that I didn't take it. There were no perceptible effects during the day.
Several substances are sold online as oneirogenics, but this is the only thing that has actually worked for me. At least it proved that it's possible for drugs to induce dreams. Trouble is, they're not the sort I want.
I did not catch malaria, and these experiences would not put me off from taking it again if necessary.
[Reported Dose: '250 mg/week']
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.


Go to the source code of this file.
Define Documentation
| #define TIMERF_ENABLE_EVENTS 0x0001 |
| #define TIMERF_ENABLED 0x0100 |
| #define TIMERF_USER_MASK 0x00ff |
Function Documentation
| void TimerEvent |
( |
__in TIMER & |
timer | ) |
|
| void TimerInit |
( |
__out TIMER & |
timer, |
|
|
__in int |
timerFlags |
|
) |
| |
This function initializes the event timer.
- Parameters:
-
| timer | Points to the TIMER structure to be initialized. |
| timerFlags | Specifies the timer flags. |
Definition at line 56 of file timer.h.
| void TimerReset |
( |
__out TIMER & |
timer | ) |
|
This function resets the event timer.
- Parameters:
-
| timer | Points to the TIMER structure. |
Definition at line 100 of file timer.h.
| void TimerSet |
( |
__out TIMER & |
timer, |
|
|
__in int |
time |
|
) |
| |
This function sets the event timer.
- Parameters:
-
| timer | Points to the TIMER structure. |
| time | Specifies the expire time relative to current time in msec. |
Definition at line 79 of file timer.h.
| void TimerTask |
( |
__inout TIMER & |
timer | ) |
|
This function performs the timer task.
- Parameters:
-
| timer | Points to the TIMER structure. |
Definition at line 120 of file timer.h.


class: center, middle # Kotlin is Delightful :-) ## Hugh Greene
### June 2017 .footnote[Presentation made with [remarkjs](https://remarkjs.com/).] ??? In this talk I'm going to introduce you to the delightful programming language, Kotlin. I'm not going to walk exhaustively through the basic syntax, just show you the coolest bits :-) with some asides for minor cool features. --- # Overview 1. Why program in Kotlin? 2. Delightful features 3. Syntactic sugar 4. Nice surprises 5. Not-so-nice(?) surprises 6. Other aspects --- class: center, middle # Why program in Kotlin? --- # Why program in Kotlin? -- It's not the silver bullet. -- There are many causes of project failure (or success) and the choice of programming language and ecosystem is only one. -- However, good tools make a developer's life more pleasant. --- # Why program in Kotlin? ## Because it's delightful! -- ... and also * cross-ecosystem * powerful * parsimonious * pragmatic * easy to learn * professional ??? (The opportunity to use the word "parsimonious" is in itself delightful :-) Parsimony here means "economy in the use of means to an end": rather than having multiple ways to do things, it tends to use the same constructs to acheive several ends. Pragmatic in that it gives you clear, easy ways to do many things. Easy to learn if you know Java, Groovy, C#, Swift, and probably C++. Worth learning if you know JavaScript or TypeScript. Professional in the sense that it has good tooling (IntelliJ, Eclipse; Maven, Gradle), commercial support, and is stable. --- class: center, middle # Delightful features --- # Delightful features (IMHO) Cross-ecosystem Type inference Types are non-nullable by default No checked exceptions Inline functions + lambdas = block-structure macros & type-safe DSLs/builders Property delegation Class delegation Coroutines ??? These slides will skip most details of features which are similar to other languages focus on the cool bits :-) --- .left-column[ ### Delightful features ] .right-column[ # Cross-ecosystem ] .clear[ Apply the same language cross-platform and cross-stack Compile to JVM, JavaScript, or native code (alpha) Standard cross-platform libary Easy access to other platform libraries In future, build multi-platform modules ] --- .left-column[ ### Delightful features ] .right-column[ # Cross-ecosystem: JVM ] .clear[ Based on JDK 7, 8, or 9 Easy to learn if you know Java (or Groovy, or C#) Great interop both ways Officially supported by Google for Android Officially supported by Spring ] ??? Can't generate JDK 9 modules, as of 1.1.3. --- .left-column[ ### Delightful features ] .right-column[ # Cross-ecosystem: JavaScript ] .clear[ More powerful than TypeScript or Flow Client-side in browser Server-side in Node.js Define strongly-typed interfaces to JS modules * `ts2kt` tool to _mostly_ translate from TypeScript Build your own standard JS modules ] ??? Not a strict supserset of TypeScript or Flow (e.g., no union types) but does more than just provide better type info. --- .left-column[ ### Delightful features ] .right-column[ # Cross-ecosystem: Native ] .clear[ Alpha quality LLVM-based Efficient, type-safe access to C * `cinterop` generates Kotlin wrappers from C headers Create EXEs and multi-platform static libraries Platforms: Ubuntu Linux, Raspberry Pi, iOS, MacOS, Windows GC: Automatic ref-counting with cycle detection ] ??? https://blog.jetbrains.com/kotlin/2017/04/kotlinnative-tech-preview-kotlin-without-a-vm/ https://github.com/JetBrains/kotlin-native/blob/v0.1.0/INTEROP.md https://blog.jetbrains.com/kotlin/2017/06/kotlinnative-v0-3-is-out/ --- .left-column[ ### Delightful features ] .right-column[ # Non-nullable types ] .clear[ ``` class Person( val name: `String`, var nickname: String`?` = null ) { fun sayHello() { val splitNick = nickname`?.`split(' ') val myName = when(splitNick?.size) { null -> name // At this point Kotlin knows splitNick is not null 1 -> nickname `?:` name else -> splitNick.map { it.first() }.joinToString() } println("Hello, my name is $myName") } } ``` ] ??? `val` declares a constant reference variable, `var` declares a mutable one. Declaring constructor parameters with `val`/`var` generates properties and assigns them on construction. If you call a Java API, Kotlin lets you treat it as nullable or not. If you treat it as non-nullable and it is in fact `null`, you'll get a `NullPointerException` as soon as you try to use it. The compiler knows about various standard Java annotations for annotating nullability so, if a libary you're calling makes use of them, the compiler will take them into account to give you warnings/errors when you call methods and handle return values. This slide also shows type inference; see following slides for more detail. --- .left-column[ ### Delightful features ] .right-column[ # Type inference 1/2 ] .clear[ ``` // size inferred as Double var `size` = 10.0 fun foo1() { size = 11 // compile error } fun
forEach(items: Collection
, block: (T) -> Unit) { // item inferred as T for (`item` in items) block(item) } fun foo2() { // it inferred as Int forEach(listOf(1, 2, 3)) { print(`it` + 1) } } ``` ] ??? --- .left-column[ ### Delightful features ] .right-column[ # Type inference 2/2 ] .clear[ ``` // Return type defaults to Unit (like void) fun
maybeDo(o: T?, block: (T) -> Unit) { if (`o != null`) { // o inferred as T (not T?) block(`o`) } } fun throwAnything(o: Any): Nothing = when(o) { `is Throwable` -> throw o // o inferred as Throwable `is String` -> throw Exception(o) // o inferred as String else -> throw Exception(o.toString()) } ``` ] ??? `(T) -> Unit` is a function type, taking an instance of `T` and returning with no result. The definition of `throwAnything` shows the shorthand for a single-expression function. The return type of `Nothing` means "does not return". The compiler will, for example, warn you about dead code if you have any code after a call to function returning `Nothing`. --- .left-column[ ### Delightful features ] .right-column[ # No checked exceptions ] .clear[ The theory of checked exceptions is: they are part of an API, so they should be explicit. * That's only useful when there's something you can do about a particular case of error. * It's only useful if the exceptions distinguish each kind of error. * Layering is verbose, with `try/catch` and per-layer exception classes. ] ??? Maybe if a language also provided pre- and post-condition checking, or software transactional memory, they would be more useful. --- .left-column[ ### Delightful features ] .right-column[ # Inline + lambdas: "macros" ] .clear[ ``` `inline` fun
T.autoClose(block: (T) -> Unit) { var caught: Boolean = false try { block(this) } catch (e: Exception) { caught = true try { this?.close() } catch (e2: Exception) { e.addSuppressed(e2); throw e } } finally { if (!caught) { this?.close() } } } fun getFirstLineStartingWith(fileName: String, prefix: String): String? { FileReader(File("foo.txt")).autoClose { it.useLines { it.forEach { if (it.startsWith(prefix)) `return` it } } } return null } ``` ] ??? `autoClose` is declared as an extension function on `T`. `autoClose`, `useLines`, `forEach` and the innermost block are all inlined into `getFirstLineStartingWith`, so the `return` will return from that function. Keywords `noinline` and `crossinline` allow you to declare restrictions on how function-typed arguments can be inlined. --- .left-column[ ### Delightful features ] .right-column[ # Inline + lambdas: DSL/builder ] .clear[ ``` fun sort(header: HTMLTableCellElement): Unit = `TODO()` fun getPeopleTable(entries: Map
): HTMLElement { fun TR.sortableTh(block: TR.() -> Unit) { block() onClickFunction = { sort(it.target as HTMLTableCellElement) } } return document.create.`div` { h2 { +"People" } table { tr { sortableTh { +"Name" }; sortableTh { +"Age" } } for ((name, age) in entries) { tr { th { +name }; th { +age.toString() } } } } } } ``` ] ??? `sortableTh` is an extension function, and accepts a `block` which is itself an extension function. The `TODO()` function always throws a "not implemented" exception. Within each block, only the methods for the appropriate HTML elements are available. The "unary plus" operator is used to insert text. --- .left-column[ ### Delightful features ] .right-column[ # Property delegation: lazy ] .clear[ ``` inline fun retry(count: Int, block: () -> Unit) { val exceptions `by lazy` { LinkedList
() } for (i in 0 until count) { try { block(); return } catch (e: Exception) { exceptions.add(e) } } val message = when (exceptions.size) { 0 -> "Count must be a positive integer" 1 -> throw exceptions[0] else -> "Failed after $count retry attempts" } throw RuntimeException(message).apply { for (e in exceptions) addSuppressed(e) } } ``` ] ??? `lazy` is a delegate from the Kotlin standard library, along with `observable` and `vetoable` In this example, the linked list of exceptions is not created until it's needed. --- .left-column[ ### Delightful features ] .right-column[ # Property delegation: SQL 1/3 ] .clear[ ``` interface HasSqlId { val table: String val pkCol: String val id: Int } `object` DbConfig { lateinit var url: String } class Vehicle(override val id: Int) : HasSqlId { override val table = "vehicle" override val pkCol = "id" var type: String `by sql()` var make: String by sql() var model: String by sql() } ``` ] ??? Here's an example using a custom delegate. A delegate object has to provide one or two functions, `getValue` and `setValue`, _or_ a `provideDelegate` function which returns an object providing `getValue`/`setValue`. --- .left-column[ ### Delightful features ] .right-column[ # Property delegation: SQL 2/3 ] .clear[ ``` class SqlDelegateFactory { operator fun provideDelegate(thisRef: HasSqlId, prop: KProperty<*>): ReadWriteProperty
{ DriverManager.getConnection(DbConfig.url).use { it.prepareStatement("select 1 from ${thisRef.table} where 1 = 0").use { it.execute() // throws if table doesn't exist } } return SqlDelegate() } } fun `sql()` = SqlDelegateFactory() ``` ] ??? --- .left-column[ ### Delightful features ] .right-column[ # Property delegation: SQL 3/3 ] .clear[ ``` class SqlDelegate : ReadWriteProperty
{ private fun getStmt(thisRef: HasSqlId, property: KProperty<*>) = "SELECT ${property.name} FROM ${thisRef.table} WHERE ${thisRef.pkCol} = ?" override fun getValue(thisRef: HasSqlId, property: KProperty<*>): String { DriverManager.getConnection(DbConfig.url).use { it.prepareStatement(getStmt(thisRef, property)).use { it.setInt(1, thisRef.id) it.executeQuery().use { return if (it.first()) it.getString(property.name) else throw IllegalArgumentException("ID ${thisRef.id} not found") } } } } override fun setValue(thisRef: HasSqlId, property: KProperty<*>, value: String) = TODO() } ``` ] ??? Delegates don't have to implement the `ReadWriteProperty` or `ReadOnlyProperty` interfaces, they just have to provide `operator fun getValue`/`setValue` with the right signature. --- .left-column[ ### Delightful features ] .right-column[ # Class delegation ] .clear[ ``` class LimitedIterator
( val limit: Int, private val wrapped: Iterator
): Iterator
`by wrapped` { private var count = 0 `override` fun next(): T { if (++count > limit) { throw IllegalStateException("No more than $limit items can be read") } return wrapped.next() } `override` fun hasNext(): Boolean { return count < limit && wrapped.hasNext() } // No override of 'remove', so it's just delegated to 'wrapped'. } ``` ] ??? Class delegation makes re-use by composition as easy as re-use by inheritance, which I think is a subtle but really powerful thing. --- .left-column[ ### Delightful features ] .right-column[ # Coroutines ] .clear[ Suspend execution of a code block without blocking a thread; resume on any thread later. * Compiler converts the block to a state machine. * Suspend/resume at calls to any `suspend fun`. Extension of C#2/ES6 generators/`yield`, C#5/ES7 `async`/`await`, Go channels/`select`, ... Your code can freely customise dispatch of coroutines. Coroutines can be serialisable so * "any thread" can be in another process; * "later" can be after reloading from persistent store. ] ??? No big restructuring of your code needed -- a coroutine block of code looks much like a normal code block. --- .left-column[ ### Delightful features ] .right-column[ # Coroutines: JS callbacks ] .clear[ ```JavaScript $.ajax("https://server/api/firstStep", { success: function (data, status, req) { var key = data; $.ajax("https://server/api/secondStep?key=" + key, { success: function (data, status, req) { window.setTimeout(function() { $("#result").text(data); }, 0); }, error: function (req, status, error) { window.setTimeout(function() { $("#result").text("Invalid key: " + key); }, 0); } }) }, error: function (req, status, error) { window.setTimeout(function() { $("#result").text("Failed to get key: " + error); }, 0); } }); ``` ] ??? --- .left-column[ ### Delightful features ] .right-column[ # Coroutines: JS Promises ] .clear[ ```JavaScript var key = data $.ajax("https://server/api/firstStep") .then(function (data, status, req) { key = data; $.ajax("https://server/api/secondStep?key=" + key) }) .catch(function (req, status, error) { window.setTimeout(function() { $("#result").text("Invalid key: " + key); }, 0); }) .then(function (data, status, req) { window.setTimeout(function() { $("#result").text(data); }, 0); }) .catch(function (req, status, error) { window.setTimeout(function() { $("#result").text("Failed to get key: " + error); }, 0); }; ``` ] ??? --- .left-column[ ### Delightful features ] .right-column[ # Coroutines: Kotlin JS 1/2 ] .clear[ ``` fun doAjax() = async { fun showResult(result: Any?) = window.setTimeout({ jQuery("#result").text(result.toString()) }) var key: Any? = null try { key = jQuery.ajax("https://server/api/firstStep").await() showResult(jQuery.ajax("https://server/api/secondStep?key=$key").await()) } catch(e: Exception) { showResult(if (key == null) { "Failed to get key: ${e.message}" } else { "Invalid key $key: ${e.message}" }) } } ``` ] ??? This example assumes the existence of `external` definitions for jQuery, and of the definition for JavaScript's `Promise` type in the Kotlin standard library. `if` can be an expression; using `when` would be even shorter here, but still easily understandable. --- .left-column[ ### Delightful features ] .right-column[ # Coroutines: Kotlin JS 2/2 ] .clear[ ``` external interface JQueryPromise
{ fun then( // Real definition has other overloads ... doneFilter: (value: T?, values: Any) -> Unit, failFilter: ((reasons: Any) -> Any)? = definedExternally ): JQueryPromise
} fun
async(c: suspend () -> T): Promise
{ return Promise { resolve, reject -> c.startCoroutine(object : Continuation
{ override fun resume(value: T) = resolve(value) override fun resumeWithException(exception: Throwable) = reject(exception) override val context = EmptyCoroutineContext }) } } inline suspend fun
JQueryPromise
.await() = suspendCoroutine
{ c -> then({ v, vs -> c.resume(v) }, { reasons -> c.resumeWithException(reasons as Throwable) }) } ``` ] --- class: center, middle # Syntactic sugar --- # Syntactic sugar 1/2 Terse constructors and properties Constructors and factory methods look identical Extension methods Named arguments Data classes and destructuring Sealed classes Strings: templates and multi-line Nullable handling (smart type inference, platform types, `?.`, `?:`, `let`, `lateinit` etc.) Ranges `when` (super-`switch`/`if-else`) ??? Named arguments are automatically available for any Kotlin function, including constructors. Doesn't work for calling into Java because Java may not retain argument names. Sealed classes only allow direct subclasses defined in the same file. Use for partially restricted hierarchies, e.g., HTTP status codes: there are five standard subclasses, but some server implementations such as IIS add their own sub-status codes such as `404.4 No handler was found to serve the request`. Data classes let you define final classes with auto-generated (but overridable) `equals`, `hashCode`, and `toString` methods. --- # Syntactic sugar 2/2 `var name: Type`: ordered so long types don’t obscure the name Interfaces can have behavior (but not state) lambda-to-SAM for JVM can be explicit (`val run = Runnable { ... }`) Explicit syntax for `override` and `tailrec` Explicit singletons Operator overloading Infix functions Calling multiple methods on an object instance (`with { ... }`) `this@scope` `return`/`continue`/`break@scope` ??? SAM = Interface with a Single Abstract Method, which can be automatically implemented by a suitable lambda. Explicit syntax for method overrides and tail recursion is good because it means the compiler will tell you if the code changes such that your method is no longer an override (because the base method changed or was removed) or is no longer tail-recursive. Lots of operators you can override, including `get` (like C++ `operator []`) and `invoke` (like C++ `operator ()`). There's no equivalent of C++'s `operator *`/ `operator ->` but delegated properties are similar. You can't define your own operators, which is a good thing for eas of understanding by other developers. There are various other helper methods like `with`; use carefully to avoid code which is confusing to Kotlin newbies. `this@scope` lets you pick which object to use as `this` when you're deep in nested lambdas, functions, or clases. `return`/`continue`/`break@scope` let you jump out only part way from multiple levels of inline lambada nesting. --- class: center, middle # Nice surprises --- # Nice surprises Co- and contra-variance at both declaration and use sites. If-not-null (`?:`, etc.) can `throw`/`return`/`continue`/`break` Generic type information is erased * ... but there’s a shorthand to get it in inline functions (`
`) Multi-file classes (like C++, or C# `partial class`; JVM only) Doc tool uses Markdown, can include compiled function bodies as samples. --- class: center, middle # Not-so-nice(?) surprises --- # Not-so-nice(?) surprises No ternary operator: `if` is an expression No collection literals: `listOf(1, 2, 3, ...)`, `mapOf(1 to "one", ...)` No implicit numeric conversions, not even widening * ... to avoid surprises comparing JVM boxed values of different types Classes final by default * ... because extensibility should be an explicit API decision * ... compiler option/plugin for "open by default" `protected` members not visible to other instances of type/subtype Ranges are closed: `0..10` is "0, 2, ..., 10", not "... 9". ??? Ternary operator and collection literals may be added in future; see forums / surveys. --- class: center, middle # Other aspects --- .left-column[ ## Other aspects ] .right-column[ # Professional ] .clear[ Commercially supported by creators, JetBrains * Used internally for their products Well supported even in free version of IntelliJ IDEA ... but JavaScript debugging is painful without commercial version of IntelliJ IDEA. Also integrates with Eclipse, Android Studio, Maven, Gradle * You can even write Gradle scripts in Kotlin! Compiler is open source (Apache licence) Active communities on forums, StackOverflow, Slack, etc. ] --- .left-column[ ## Other aspects ] .right-column[ # Parsimony ] .clear[ Constructor argument definitions can define properties at the same time. Constructors and factory methods have the same syntax, so switching needs little code change. Function argument names are automatically argument keywords. The syntax for what look like static methods from other languages is actually for instance methods on a per-class singleton `companion object`, which can implement interfaces. Properties, functions, delegated properties, extension functions, and classes can exist at top-level, within a class, or within a function. Within a class, all these kinds of function are overridable. Property delegation uses objects and function signatures, not specific classes or interfaces, so you can use singleton objects and/or extension functions for delegates. Coroutines can be extended to async calls, sequence generators, channels, thread pools, etc. ] --- class: center, middle # The End :-)


|
| struct | gts::FreeListNode |
| | An intrusive singly-linked list node used for free-lists. More...
|
| |
| struct | gts::MemoryStore |
| | The header for each Slab. More...
|
| |
| class | gts::BinnedAllocator |
| | A collection of BlockAllocators binned to size classes. More...
|
| |
| class | gts::ReadGuard< T, TAccessorSharedMutex, TGrowSharedMutex > |
| | A read-only item guarded by a mutex. The mutex is released on destruction. More...
|
| |
| class | gts::WriteGuard< T, TAccessorSharedMutex, TGrowSharedMutex > |
| | A read-write item guarded by a mutex. The mutex is released on destruction. More...
|
| |
| struct | gts::KeyValue< TKey, TValue > |
| | A key-value keyVal. More...
|
| |
| class | gts::ParallelHashTable< TKey, TValue, THasher, TAccessorSharedMutex, TGrowSharedMutex, TAllocator > |
| | A parallel hash table. Properties: More...
|
| |
| class | gts::ParallelVector< T, TSharedMutex, TAllocator > |
| | A obstruction-free parallel vector. Properties: More...
|
| |
| class | gts::QueueMPMC< T, TMutex, TAllocator > |
| | A multi-producer, multi-consumer queue. Properties: More...
|
| |
| class | gts::QueueMPSC< T, TMutex, TAllocator > |
| | A multi-producer, multi-consumer queue. Properties: More...
|
| |
| class | gts::QueueSPMC< T, TMutex, TAllocator > |
| | A multi-producer, multi-consumer queue. Properties: More...
|
| |
| class | gts::QueueSPSC< T, TAllocator > |
| | A single-producer, single-consumer queue. Properties: More...
|
| |


This week’s tip is about ways to format strings in Python.
An ‘intuitive’ way for string formatting can be using ‘+’ operator for concatenating strings. To use this formatting style, we have to cast the integers or other data types into strings manually. An example can be as following:
>>> num_of_items = 42
>>> type_of_items = 'songs'
>>> print('Here, we have ' + str(num_of_items) + ' ' + type_of_items)
Output: Here, we have 42 songs
While the ‘+’ operator seems easy to use, it comes with a bunch of problems (e.g. manual type casting, difficulty in reading code). Instead, you should consider using one of these recommended methods:
Below, you can find some examples of use:
>>> num_of_items = 42
>>> type_of_items = 'songs'
# Old style
>>> print('Here, we have %d %s' % (num_of_items, type_of_items))
# New style
>>> print('Here, we have {} {}'.format(num_of_items, type_of_items))
# F-strings
>>> print(f'Here, we have {num_of_items} {type_of_items}')
Output: Here, we have 42 songs
>>> params = {'hop_size': 512, 'frame_size': 1024}
# Old style
>>> print('The parameters for hop size is %(hop_size)d, and frame size is %(frame_size)s.' % params)
# New style
>>> print('The parameters for hop size is {hop_size}, and frame size is {frame_size}.'.format(**params))
# F-strings
>>> print(f'The parameters for hop size is {params["hop_size"]}, and frame size is {params["frame_size"]}.')
Output: The parameters for hop size is 512, and frame size is 1024.
>>> def get_duration():
>>> return<PHONE_NUMBER>
# Old Style
>>> print('Duration of this track is %.2f seconds.' % get_duration())
# New Style
>>> print('Duration of this track is {:.2f} seconds'.format(get_duration()))
# F-strings
>>> print(f'Duration of this track is {get_duration():.2f} seconds.')
Output: Duration of this track is 331.19 seconds.
>>> songs = ['Yesterday', 'All You Need Is Love', 'Hey Jude']
>>> albums = ['Help!', 'Magical Mystery Tour', 'The Beatles']
>>> song_ids = [483, 65448, 98]
# Old Style
>>> for i in range(3):
>>> print('%20s - %-20s - %6d ' % (songs[i], albums[i], song_ids[i]))
# New Style
>>> for i in range(3):
>>> print('{:>20} - {:<20} - {:>6}'.format(songs[i], albums[i], song_ids[i]))
# F-strings
>>> for i in range(3):
>>> print(f'{songs[i]:>20} - {albums[i]:<20} - {song_ids[i]:>6}')
Output: Yesterday - Help! - 483
All You Need Is Love - Magical Mystery Tour - 65448
Hey Jude - The Beatles - 98
In most of the cases, one of the methods shown above would be appropriated. However, these methods might introduce security vulnerabilities to your programs. For instance, a user of a web application could retrieve some variables with a designed input. Let’s have a look at a simple example where an hypothetical attacker would be able to access some global variables:
# This is a variable we don't want to show
>>> SECRET_VARIABLE = "don't tell anyone"
>>> class Music:
>>> def __init__(self):
>>> pass
>>> song = Music()
# New Style
>>> user_provided_string = '{track.__init__.__globals__[SECRET_VARIABLE]}'
>>> print(user_provided_string.format(track=song))
Output: don't tell anyone
Here is where the Template strings method becomes useful:
>>> from string import Template
>>> user_provided_string = '${track.__init__.__globals__[SECRET_VARIABLE]}'
>>> print(Template(user_provided_string).substitute(track=song))
Raises: ValueError: Invalid placeholder in string: line 1, col 1
For joining all the items in a tuple or a list into a single string, you might be tented to use a for loop and concatenate elements one by one. However, the ‘.join()’ function provides a better way to do it:
>>> songs = ['Yesterday', 'Come Together', 'Hey Jude', 'Blackbird', '...']
>>> message = 'Processing the songs: '
>>> message += ', '.join(songs)
>>> print(message)
Output: Processing the songs: Yesterday, Come Together, Hey Jude, Blackbird, ...


Привет RustRush 👋
$ whoami
@spacekookie
Software Engineer at Ferrous Systems
<EMAIL_ADDRESS>@spacekookie
on twitter
I make some attrocious puns
An async story
An async story
How do you define success?
Rust is a young language
Rust communities are young
Yet, we have seen some amazing work from them
Lots of companies are adopting Rust
Finding Rust jobs is easier as ever
Every 6 weeks a new Rust.
Contribution pipeline is short
[Rust] is fundamentally about empowerment: no matter what kind of code you are writing now, Rust empowers you to reach farther, to program with confidence in a wider variety of domains than you did before.
– Rust book, foreword
What is unique is how the language and tooling support the community in ways that other language ecosystems do not!
A community of developers empowered by their tools and each other
In my opinion: momentum is success
Bringing new people to new domains
People who are curious and adventerous.
Supported by their tools and the community,
who are encouraged to build exciting things!
This isn’t easy!
This isn’t perfect!
Who here doesn’t know what Rust 2018 is?
This is done via the edition flag
[package]
name = "foobar"
version = "1.0.0"
edition = "2018"
2015
is default to preserve backwards compatibility
The goal of these groups is to focus on the end-to-end user experience of using Rust in each domain.
– Announcing the 2018 Domain Working Groups
This meant a low barrier-to-entry for newcomers
[…] focusing on the end-to-end experience for both sync and async networking code
Using available resources the most efficiently…
Doing things while waiting for long-running operations to finish…
Future
= calculation that hasn’t happened yet
Event Loop = runtime for Future
s
Future
until it is readyIncluded a runtime in stdlib
Rust wanted to go in a different direction
libgreen
is dead, long live libgreen
“Metal I/O” 🤘
tokio-core
mio.rs
and futures.rs
async
& await
Write code that looks synchronous/ blocking.
It actually does async under the hood!
enum Poll<T> {
Ready(T),
Pending
}
trait Future {
type Output;
fn poll(self: Pin<&mut Self>, lw: &LocalWaker)
-> Poll<Self::Output>;
}
Now provided by libcore
/ libstd
async
- marks a function as … asyncawait
- waits for something async to happenromio
A minimal tokio
fork that uses async
/await
async fn say_hello(mut s: TcpStream) { /* ... */ }
async fn listen() -> Result<(), ::std::io::Error> {
let socket_addr = "<IP_ADDRESS>:80".parse()?;
let mut listener = TcpListener::bind(&socket_addr)?;
let mut incoming = listener.incoming();
// accept connections and process them serially
while let Some(stream) = await!(incoming.next()) {
await!(say_hello(stream?));
}
Ok(())
}
(on nightly)
Future
trait now in libcore
/ libstd
futures-rs
updated to the new APIsWriting networking code has many problem domains
Future
traitKate, what hell was your point?
async
in Rust 2018 is still WIP.
But it’s on a good track,
because it’s the community that’s driving development!
Who makes Rust?
All of you! All of us!
And the language is better off because of it.
If you can remember one thing from this talk?
Collaboration takes time.
But the result will be amazing!
thank you


associateFirstName |
associateLastName |
associateEmail |
associateMobile |
Update associate |
Delete associate |
|---|---|---|---|---|---|
{{employee.associateFirstName}} |
{{employee.associateLastName}} |
{{employee.associateEmail}} |
{{employee.associateMobile}} |


|
|
You can use Infomosaic SecureXML Digital Signature from a variety of programming languages. Please follow the links below to learn how you can get started with SecureXML using the programming language of your choice: |
|
|
All contents are Copyright © 2000--2002 Infomosaic Corporation.
All rights reserved.
Page last updated on Thursday, January 2, 2003 |


This site is temporary unavailable for maintenance reason.
You cannot submit new projects or extract the Bubble during this time, but you can still see previous projects.
If you are in hurry, you can deploy your own instance using Heroku for example using the instructions on this
page.


PERLNEWMOD
Section: Perl Programmers Reference Guide (1)Updated: 2009-02-12
Index Return to Main Contents
NAME
perlnewmod - preparing a new module for distributionDESCRIPTION
This document gives you some suggestions about how to go about writing Perl modules, preparing them for distribution, and making them available via CPAN.One of the things that makes Perl really powerful is the fact that Perl hackers tend to want to share the solutions to problems they've faced, so you and I don't have to battle with the same problem again.
The main way they do this is by abstracting the solution into a Perl module. If you don't know what one of these is, the rest of this document isn't going to be much use to you. You're also missing out on an awful lot of useful code; consider having a look at perlmod, perlmodlib and perlmodinstall before coming back here.
When you've found that there isn't a module available for what you're trying to do, and you've had to write the code yourself, consider packaging up the solution into a module and uploading it to CPAN so that others can benefit.
Warning
We're going to primarily concentrate on Perl-only modules here, rather than XS modules. XS modules serve a rather different purpose, and you should consider different things before distributing them - the popularity of the library you are gluing, the portability to other operating systems, and so on. However, the notes on preparing the Perl side of the module and packaging and distributing it will apply equally well to an XS module as a pure-Perl one.What should I make into a module?
You should make a module out of any code that you think is going to be useful to others. Anything that's likely to fill a hole in the communal library and which someone else can slot directly into their program. Any part of your code which you can isolate and extract and plug into something else is a likely candidate.Let's take an example. Suppose you're reading in data from a local format into a hash-of-hashes in Perl, turning that into a tree, walking the tree and then piping each node to an Acme Transmogrifier Server.
Now, quite a few people have the Acme Transmogrifier, and you've had to write something to talk the protocol from scratch - you'd almost certainly want to make that into a module. The level at which you pitch it is up to you: you might want protocol-level modules analogous to Net::SMTP which then talk to higher level modules analogous to Mail::Send. The choice is yours, but you do want to get a module out for that server protocol.
Nobody else on the planet is going to talk your local data format, so we can ignore that. But what about the thing in the middle? Building tree structures from Perl variables and then traversing them is a nice, general problem, and if nobody's already written a module that does that, you might want to modularise that code too.
So hopefully you've now got a few ideas about what's good to modularise. Let's now see how it's done.
Step-by-step: Preparing the ground
Before we even start scraping out the code, there are a few things we'll want to do in advance.- Look around
-
Dig into a bunch of modules to see how they're written. I'd suggest
starting with Text::Tabs, since it's in the standard
library and is nice and simple, and then looking at something a little
more complex like File::Copy. For object oriented
code, "WWW::Mechanize" or the "Email::*" modules provide some good
examples.
These should give you an overall feel for how modules are laid out and written.
- Check it's new
- There are a lot of modules on CPAN, and it's easy to miss one that's similar to what you're planning on contributing. Have a good plough through the <http://search.cpan.org> and make sure you're not the one reinventing the wheel!
- Discuss the need
- You might love it. You might feel that everyone else needs it. But there might not actually be any real demand for it out there. If you're unsure about the demand your module will have, consider sending out feelers on the "comp.lang.perl.modules" newsgroup, or as a last resort, ask the modules list at<EMAIL_ADDRESS>Remember that this is a closed list with a very long turn-around time - be prepared to wait a good while for a response from them.
- Choose a name
- Perl modules included on CPAN have a naming hierarchy you should try to fit in with. See perlmodlib for more details on how this works, and browse around CPAN and the modules list to get a feel of it. At the very least, remember this: modules should be title capitalised, (This::Thing) fit in with a category, and explain their purpose succinctly.
- Check again
-
While you're doing that, make really sure you haven't missed a module
similar to the one you're about to write.
When you've got your name sorted out and you're sure that your module is wanted and not currently available, it's time to start coding.
Step-by-step: Making the module
- Start with module-starter or h2xs
-
The module-starter utility is distributed as part of the
Module::Starter CPAN package. It creates a directory
with stubs of all the necessary files to start a new module, according
to recent ``best practice'' for module development, and is invoked from
the command line, thus:
module-starter --module=Foo::Bar \ --author="Your Name"<EMAIL_ADDRESS>If you do not wish to install the Module::Starter package from CPAN, h2xs is an older tool, originally intended for the development of XS modules, which comes packaged with the Perl distribution.
A typical invocation of h2xs for a pure Perl module is:
h2xs -AX --skip-exporter --use-new-tests -n Foo::Bar
The "-A" omits the Autoloader code, "-X" omits XS elements, "--skip-exporter" omits the Exporter code, "--use-new-tests" sets up a modern testing environment, and "-n" specifies the name of the module.
- Use strict and warnings
- A module's code has to be warning and strict-clean, since you can't guarantee the conditions that it'll be used under. Besides, you wouldn't want to distribute code that wasn't warning or strict-clean anyway, right?
- Use Carp
-
The Carp module allows you to present your error messages from
the caller's perspective; this gives you a way to signal a problem with
the caller and not your module. For instance, if you say this:
warn "No hostname given";
the user will see something like this:
No hostname given at /usr/local/lib/perl5/site_perl/5.6.0/Net/Acme.pm line 123.
which looks like your module is doing something wrong. Instead, you want to put the blame on the user, and say this:
No hostname given at bad_code, line 10.
You do this by using Carp and replacing your "warn"s with "carp"s. If you need to "die", say "croak" instead. However, keep "warn" and "die" in place for your sanity checks - where it really is your module at fault.
- Use Exporter - wisely!
-
Exporter gives you a standard way of exporting symbols and
subroutines from your module into the caller's namespace. For instance,
saying "use Net::Acme qw(&frob)" would import the "frob" subroutine.
The package variable @EXPORT will determine which symbols will get exported when the caller simply says "use Net::Acme" - you will hardly ever want to put anything in there. @EXPORT_OK, on the other hand, specifies which symbols you're willing to export. If you do want to export a bunch of symbols, use the %EXPORT_TAGS and define a standard export set - look at Exporter for more details.
- Use plain old documentation
- The work isn't over until the paperwork is done, and you're going to need to put in some time writing some documentation for your module. "module-starter" or "h2xs" will provide a stub for you to fill in; if you're not sure about the format, look at perlpod for an introduction. Provide a good synopsis of how your module is used in code, a description, and then notes on the syntax and function of the individual subroutines or methods. Use Perl comments for developer notes and POD for end-user notes.
- Write tests
- You're encouraged to create self-tests for your module to ensure it's working as intended on the myriad platforms Perl supports; if you upload your module to CPAN, a host of testers will build your module and send you the results of the tests. Again, "module-starter" and "h2xs" provide a test framework which you can extend - you should do something more than just checking your module will compile. Test::Simple and Test::More are good places to start when writing a test suite.
- Write the README
- If you're uploading to CPAN, the automated gremlins will extract the README file and place that in your CPAN directory. It'll also appear in the main by-module and by-category directories if you make it onto the modules list. It's a good idea to put here what the module actually does in detail, and the user-visible changes since the last release.
Step-by-step: Distributing your module
- Get a CPAN user ID
- Every developer publishing modules on CPAN needs a CPAN ID. Visit "http://pause.perl.org/", select ``Request PAUSE Account'', and wait for your request to be approved by the PAUSE administrators.
- perl Makefile.PL; make test; make dist
-
Once again, "module-starter" or "h2xs" has done all the work for you.
They produce the standard "Makefile.PL" you see when you download and
install modules, and this produces a Makefile with a "dist" target.
Once you've ensured that your module passes its own tests - always a good thing to make sure - you can "make dist", and the Makefile will hopefully produce you a nice tarball of your module, ready for upload.
- Upload the tarball
- The email you got when you received your CPAN ID will tell you how to log in to PAUSE, the Perl Authors Upload SErver. From the menus there, you can upload your module to CPAN.
- Announce to the modules list
- Once uploaded, it'll sit unnoticed in your author directory. If you want it connected to the rest of the CPAN, you'll need to go to ``Register Namespace'' on PAUSE. Once registered, your module will appear in the by-module and by-category listings on CPAN.
- Announce to clpa
- If you have a burning desire to tell the world about your release, post an announcement to the moderated "comp.lang.perl.announce" newsgroup.
- Fix bugs!
- Once you start accumulating users, they'll send you bug reports. If you're lucky, they'll even send you patches. Welcome to the joys of maintaining a software project...
AUTHOR
Simon Cozens<EMAIL_ADDRESS>by Kirrily ``Skud'' Robert<EMAIL_ADDRESS>SEE ALSO
perlmod, perlmodlib, perlmodinstall, h2xs, strict, Carp, Exporter, perlpod, Test::Simple, Test::More ExtUtils::MakeMaker, Module::Build, Module::Starter http://www.cpan.org/ , Ken Williams' tutorial on building your own module at http://mathforum.org/~ken/perl_modules.html
Index
This document was created by man2html, using the manual pages.
Time: 05:29:08 GMT, December 24, 2015


Employee
Employee ID
Name
Age
Salary
Accounting
Average age :
Sum of salary :
Engineering
Average age :
Sum of salary :
Transportings
Average age :
Sum of salary :


Toaster Title
!
menu
compose
FroM
tO
SubjecT
BodY
AlL
Message loadinG
SynC MorE
No messagE
ReaD
FroM
tO
cC
BcC
BacK
AttachmenT
SenD
ComposE MessagE
tO:
cC:
BcC:
SubjecT:
AttachmentS:
MaiL
To SenD and ReceivE email, you will need to set up an account.
NexT
NeW AccounT
ManuaL SetuP
NeW AccounT
PleasE WaiT WhilE I SeT UP YouR AccounT
MaiL AccounT SetuP
AlL DonE!
AdD AnotheR AccounT
ContinuE tO MaiL
NexT
ManuaL SetuP
AccounT TypE
IMAP+SMTP
ActiveSync
ImaP SettingS
SockeT TypE
SsL
SmtP SettingS
SockeT TypE
SsL
ActivesynC SettingS
BaD PassworD
BaD PassworD FoR
UsE PassworD
ImaP DisableD
EnablE ImaP
RetrY
NeeD ApP PassworD
EnteR ApP PassworD
UsE PassworD
Done
MaiL SettingS
AccountS
AdD AccounT
GeneraL SettingS
ChecK MaiL
Manually
3 Minutes
5 Minutes
10 Minutes
15 Minutes
30 Minutes
60 Minutes
AlwayS ShoW ImageS
DownloaD AttachmentS
NotifY ME OF NeW MaiL
v1
AccounT NamE
DefaulT AccounT
AccounT TypE
AccounT TypE
SynchronizE
AutomatiC
1 DaY
3 DayS
1 WeeK
2 WeekS
1 MontH
AlL MessageS
CredentialS
DeletE AccounT
AccounT NamE
CredentialS
UsernamE
PassworD
AccounT NamE
ServeR TypE
HostnamE
PorT
Debug!
Reset App
Dump log to storage
!
Send new maiL
ReplY
View contacT
Save new contacT
Add to existing contacT
CanceL
CanceL
OK
ConfirmatioN
CanceL
OK
Confirmation
CanceL
OK
OK
DeletE
CanceL
SaVe DrAft
DisCarD
CanCeL
ConfirmatioN
CanceL
OK
Sending messagE
ConfirmatioN
CanceL
OK


Sweet Free Stuff
///////////////////////////////////////////
Free Tostitos Dip-etizers at Kroger & Affiliate Stores
Posted: 15 Apr 2016 11:01 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Load the coupon to your shoppers card today only (4/15) and use by
5/1. Free Tostitos Dip-etizers at Kroger Affiliate Stores
The post Free Tostitos Dip-etizers at Kroger Affiliate Stores appeared
first on SweetFreeStuff.com.
///////////////////////////////////////////
Free Goat BackCountry.com Sticker
Posted: 15 Apr 2016 03:00 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
The post Free Goat BackCountry.com Sticker appeared first on
SweetFreeStuff.com.
CommentsGreat looking sticker!! by Kyle campbellGreat sticker!! Gotta have
it. by minkieCool sticker by raul gamboa jrGreat looking decal! by Wade
ZetterbergI want that sticker by Jacob brooks
///////////////////////////////////////////
Free Smart Sense Soap Dispensing Brush at Kmart
Posted: 15 Apr 2016 02:02 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Download the Kmart mobile app then go to the Friday Fix section to get a
free coupon.
The post Free Smart Sense Soap Dispensing Brush at Kmart appeared first on
SweetFreeStuff.com.
///////////////////////////////////////////
Free Bag of M&Ms
Posted: 15 Apr 2016 12:07 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
First 50,000 will receive a coupon good for a FREE bag of MM’s!
The post Free Bag of MM’s appeared first on SweetFreeStuff.com.
CommentsMy fav!! by CynthiaFinger licking Good! by Brittney CookI LOVE
M&M ’S by Julie WilsonYum by Shirley
///////////////////////////////////////////
Free PeroxiClear Contact Lens Solution Sample
Posted: 14 Apr 2016 10:00 PM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Select Clear Clear then click Next. Free PeroxiClear Contact Lens Solution
Sample
The post Free PeroxiClear Contact Lens Solution Sample appeared first on
SweetFreeStuff.com.
Commentscool by ARTHUR TUCKER
///////////////////////////////////////////
SwagBucks - Earn Free Gift Cards Online
Posted: 14 Apr 2016 10:00 PM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Swagbucks is the webs leading rewards platform, dedicated to providing FREE
gift cards to its 12+ million members. Swagbucks lets you earn FREE gift
cards for taking surveys, watching videos, shopping online and more!
The post SwagBucks Earn Free Gift Cards Online appeared first on
SweetFreeStuff.com.


{{ appSignupLink({
herading: {
text: "Stay up to date with GOV.UK"
},
text: "Sign up to get emails when we add new coronavirus education and childcare information",
href: "https://www.gov.uk/email-signup?topic=/coronavirus-taxon/education-and-childcare"
}) }}


If the import data does not contain notes, the notes entered below will be used.
{{ edit_field(form.general_notes, field_width="col-sm-12", spellcheck="false", rows="10", class="form-control") }}
Import Instructions
- Paste the import data onto the text window below.
- The first data line must be a header line.
- The data fields must be comma delimited.
- If a data field does not contain any value, leave it blank.
- The serial number data field cannot be blank.
- For data with duplicate serial numbers, only the first data entry will be imported, the rest will be ignored.
- The notes data field must be double-quoted, if not blank.
- Acceptable header fields are serial_number, model_name, and notes.
- Mandatory header field is serial_number.
serial_number,model_name,notes <- header (model_name and notes are optional)
FOC162980AA,, <- leave blank for empty field(s)
FOT1981P81A,A9K-RSP440-SE,"spare RSP"
{{ edit_field(form.data_list, field_width="col-sm-12", spellcheck="false", rows="10", class="form-control") }}