Between declining revenue and interfering administrators, student-run media is facing an existential crisis.

Declining advertising. Difficulties making the transition from print to digital. A looming corporate takeover. No, this isn’t the Austin American-Statesman, the Denver Post or any of the countless other newspapers struggling to survive in the new media economy. It’s the SMU student newspaper, The Daily Campus, which, after 103 years of independence, will be folded into the school’s journalism program at the end of May. The paper’s final print edition was published on May 9.

The move comes despite a last-ditch effort by Daily Campus alumni, led by ProPublica reporter Jessica Huseman, to preserve the paper’s independence. “I’m a national politics reporter, and the only time I’ve interviewed a president was when I was editor-in-chief of The Daily Campus,” she said. (It was George W. Bush.) “I got my first management experience at The Daily Campus. If a professor was holding my hand, I never would have learned any of those lessons. So it’s upsetting to me that the journalism school is going to take that away from students.”

Huseman and other alumni learned in April that the board of directors of the Student Media Company, the independent nonprofit that oversees The Daily Campus and the yearbook, had voted to dissolve itself due to lack of funds. In response, Huseman and Chip Stewart, another Daily Campus alum and a journalism professor at TCU, launched a group called Friends of Student Media to raise the $125,000 it would take to fund the paper for another year. Through GoFundMe and the Dallas Foundation, they raised about $38,000 in less than two weeks. But at an April 24 meeting with the Student Media Company board, the alumni were told it was too little, too late. Furious, they penned an open letter to SMU President R. Gerald Turner blaming the board for ceding editorial independence after “years of mismanagement and disinterest.” It was signed by 47 alumni, a former advertising advisor and a former student advisor.

“If there is no agreement, nothing at all prevents SMU from saying, ‘We pay for you, so take this out of your archive.’ Or, ‘Give us prior review of your stories.’”

In an emailed statement to the Observer, Turner said, “SMU is firmly committed to protecting First Amendment rights. SMU’s journalism faculty, who have worked as professionals in this field, are committed to teaching and protecting these rights and preparing students for success.”

The SMU journalism department has promised to maintain The Daily Campus as a digital-only news outlet and preserve its editorial independence. Department chairman Tony Pederson said he plans to establish an advisory board, comprising both faculty and students, to oversee the paper, and he expects that one of the board’s first acts will be to issue a “statement of principle” prohibiting censorship.

“That sounds like a public relations move by SMU,” Huseman said about the statement of principle. “It sounds aspirational, not contractual. If there is no agreement, nothing at all prevents SMU from saying, ‘We pay for you, so take this out of your archive.’ Or, ‘Give us prior review of your stories.’”

SMU does have a history of censoring student media. During the 1993-94 school year, the administration threatened to kick the paper out of its offices in the student center if the staff didn’t agree to prior review. In 2011, the administration demanded the removal of an opinion piece criticizing the school’s board of trustees. And in 2013, a pledge guaranteeing a student press “free of censorship” mysteriously disappeared from the student handbook.

At TCU, where the student newspaper is overseen by the school’s journalism department, administrators have on several occasions intervened in editorial decisions, said Stewart, the TCU journalism professor. “We’ve had times when the administration came in and said, ‘You’ve got to take this out of the archives.’ And it was not a request.”

Some student newspapers attached to journalism schools have managed to avoid censorship. The University of Texas at Austin’s Daily Texan is affiliated with the Moody College of Communication and receives some funding from the university, but retains its independence through a board of directors with a guaranteed student majority. The state’s other major public universities all have similar arrangements.

But censorship isn’t The Daily Campus alumni’s only concern. They worry that under the journalism department’s control, the paper will become “a refrigerator for the professors to display their students’ work on,” as Huseman put it. Even as an independent paper, most of The Daily Campus’ hard news reporting came from students enrolled in journalism classes, according to outgoing editor-in-chief Kylie Madry. But the student editors retained — and often exercised — the right to reject student work.

“Right now, journalism students can pitch stories they wrote for class,” Madry said. “But at the end of the day, if the story sucks, we’re not publishing it.” In March, she said, a student reporter submitted a preview of a campus event that had already taken place. When she rejected the story, the student’s journalism professor complained. “The professor was like, ‘I’m not going to give credit for it if you don’t publish it,” she recalled. The professor eventually relented and the story didn’t run.

“You cannot learn to be a reporter while a professor is holding your hand.”

The journalism department hasn’t been coy about its intentions. “We’re interested in using The Daily Campus as a teaching tool for 150 majors in journalism,” said Pederson, the department chair. “We’re going to more closely integrate our reporting classes, and produce content. … [The students] will be overseen by several of the paid staff members, but also several of the professors who teach reporting.”

To Huseman, who also teaches journalism part-time at Columbia University, this is heresy. “Student newspapers should be entirely student-run and allow students to figure out how to be reporters and editors, sometimes by making mistakes. You cannot learn to be a reporter while a professor is holding your hand.”

The Daily Campus is hardly alone. Student newspapers across the country are struggling to adapt to leaner budgets and continuing administration pressure to present a positive image. In the face of these existential threats, students and alumni are organizing. In 2013, after The Daily Texan announced it was considering cutting production days because of declining revenue, alumni created Friends of The Daily Texan to raise money and provide mentorship. The effort worked: The Daily Texan still publishes a physical newspaper five days a week. In fact, Texas’ 10 largest universities, all public, continue to publish print editions.

In April, the University of Florida’s student newspaper launched the #SaveStudentNewsrooms campaign in reaction to news about The Daily Campus. Over 100 student newspapers marked Support Student Journalism Day on April 25 by spreading awareness on social media of the plight of SMU and other colleges with endangered papers.

“Student newspapers are the primary way that the student body gets its news about what’s going on on campus,” said Drew Keller, the outgoing editor-in-chief of Rice University’s student newspaper, the Thresher, which has maintained editorial autonomy since it was founded in 1913. “Without them, all you have is the rumor mill or official announcements from the university. There is no other way of getting that information.”


Every illness is curable, if the cause is found and treated. German biochemist Otto Warburg found out that no disease can exist in a alkaline and oxygen-rich cell environment. Consequently, it would therefore be very advisable to establish a cell environment in your body again. With the creation of an alkaline and oxygen-rich cell milieu, we could eliminate countless diseases, even cancer.

WHY OUR CELLS ARE CONTAMINATEDVery few people have a completely healthy cell environment, which is simply related to today's extremely unhealthy and unnatural lifestyle. Thus, most people also suffer from chronic poisoning, which in turn is due to various factors. People have become extremely lazy when it comes to caring about their body health. We are much more inclined to spend time in our homes in front of PCs or television instead of going out into nature every dayUltimately, this lack of exercise simply leads to a poorer oxygenation and can contribute to emergence of countless diseases

Many people suffer from countless physical and mental illnesses due to an unnatural lifestyle. Unhealthy lifestyle, unnatural diet, negative thoughts and stress favors the development of countless diseases.
For this reason, it is very advisable (even urgent) to introduce a natural alkaline diet so that the regeneration of your body cells could take place and healing as well.

MAGIC WATER: HIMALAYAN PINK SALT AND BAKING SODA

There are countless ways to rebalance the body's functionalities, and one of them is drinking Himalayan salt in combination with baking soda.

This powerful combination dissolved in water can also become an almost miraculous drink, which not only supplies our body with countless minerals, but also enriches our cells with more oxygen.Himalayan Pink Salt(the world's best and cleanest salt) has 84 trace elements and is not bleached or even blended with aluminum compounds compared to traditional refined table salt (traditional industrial processed salt has only 2 elements - Inorganic sodium and toxic chloride. Due to its purity, Himalayan Salt offers all sorts of positive benefits to our body and should therefore be used instead of extremely harmful table salt. On the other hand, the slightly alkaline baking soda ensures a more alkaline and oxygen-rich cell milieu.Baking soda can considerably support the oxygen supply in the body and raise the pH value if it is too low, i.e. to say too acidic.For this reason, baking soda is a true multipurpose ingredient and can be used against countless sufferings. Whether ulcers, arthritis, diabetes, cancer, countless bacterial infections or even cardiovascular problems, with the help of soda many ailments can be effectively alleviated. Even during bathing when rubbed with water into the skin, soda can even effectively combat acne and make the skin look more natural throughout.Along with a natural diet and sufficient exercise, the combination of Himalaya pink salt and baking soda is perfect for creating an oxygen-rich and alkaline body.The preparation of this water is very simple: you only need half a teaspoon of soda and half a teaspoon of pink Himalayan salt. Dissolve both substances in half a glass of water and drink best in the morning before breakfast.

P O P U L A R C A T E G O R I E S:

“The day she realised, it was not about the world but was all about her, she grew the wings. The day she understood she was not answerable to any of them who always blamed and pointed her, she had the fire blazing in her eyes. She raised and soared towards the sky. The whole world looked at her in awe and wished if only they could be her. She was not confined to be on the ground anymore. She had the wings of fire and she left a trail everywhere she went, for other to follow.”― Akshau Vasu


CFP Board Sanctions 13 Advisors

The CFP Board, which polices certified financial planners, announced that it has admonished, suspended or revoked the licenses of 13 financial advisors that use its designation.

The blacklist includes five advisors in California, David Larkin George in Carlsbad, Melissa Pearce in Laguana Nuguel , Max Safdie in Mill Valley, Jeffery Forrest in San Luis Obispo and Raoul Sevelius in Chico; Mario Ferrari of Boca Raton and Marcus Michles of Winter Park in Florida; John Stelman in Lake Orion, Mich.; Cynthia Murphy in Montclair, N.J.; Julia Jarvis in Upper Arlington, Ohio; Oren Sullivan in Rock Hill, S.C.; David Disraeli in Cedar Park, Texas; and Jeffrey Elverman in Genoa City, Wisc.

Stelman was in the least trouble, receiving a letter of admonishment over the state of his personal finances. The advisor, who was divorced in 2006, filed for bankruptcy in 2009, displaying “an inability to manage his personal finances and thus engaged in conduct which reflects adversely on his integrity and fitness as a certificant, upon the CFP certification marks, and upon the profession,” the Board ruled.

George was suspended for three months because he “affixed” signatures on three clients’ documents and paid for two friends’ financial plans. Pearce was suspended for six months for declaring bankruptcy in 2009. Safdie was barred for a year and a day for overstating the financial qualifications of a family member to a loan officer.

Ferrari received the same punishment, although details of his misconduct take up a lot more space: five customer arbitrations alleging unsuitability, unauthorized trading, misrepresentation, churning, fraud and violation of both state and federal securities laws; falsifying client documents; resigning from his firm due to unacceptable business practices; and failing to disclose to his clients that he does not provide financial planning services.

Elverman was barred for three years for failing to report income in his 2002 and 2003 tax returns, his suspension as a lawyer in Wisconsin and then failing to report it to the Board.

Meanwhile, Forrest was barred for life after the Securities and Exchange Commission refused to register him as an advisor, which he then failed to report to the CFP Board. Sevelius lost his designation for misdemeanor battery in California, after which he lost his insurance licenses. He, too, failed to notify the CFP Board, as did Michles, who was admonished by the New York Stock Exchange for acting in less than “high standards of commercial honor and just and equitable principles of trade.”

Jarvis lost her state licenses, and was later convicted of mail fraud, as was Sullivan, who was struck from FINRA’s list, too; Disraeli was banned by the SEC of acting as an advisor.

Of all of these cases, Cynthia Murphy’s is the most exotic: the CFP Board revoked her right to use their designation for being a Russian spy.


Ginzburg–Landau theory

In physics, Ginzburg–Landau theory, often called Landau–Ginzburg theory, named after Vitaly Lazarevich Ginzburg and Lev Landau, is a mathematical physical theory used to describe superconductivity.  In its initial form, it was postulated as a phenomenological model which could describe type-I superconductors without examining  their microscopic properties. One GL-type superconductor is the famous YBCO, and generally all Cuprates.

Later, a  version of Ginzburg–Landau theory was derived from the Bardeen–Cooper–Schrieffer microscopic theory by Lev Gor'kov, thus showing that it also appears in some limit of microscopic theory and giving microscopic interpretation of all its parameters. The theory can also be given a general geometric setting, placing it in the context of Riemannian geometry, where in many cases exact solutions can be given. This general setting then extends to quantum field theory and string theory, again owing to its solvability, and its close relation to other, similar systems.

Introduction

Based on Landau's previously established theory of second-order phase transitions, Ginzburg and Landau  argued that the free energy, F, of a superconductor near the superconducting transition can be expressed in terms of a complex order parameter field, ψ, which is nonzero below a phase transition into a superconducting state and is related to the density of the superconducting component, although no direct interpretation of this parameter was given in the original paper. Assuming smallness of |ψ| and smallness of its gradients, the free energy has the form of a field theory.

where Fn is the free energy in the normal phase, α and β in the initial argument were treated as phenomenological parameters, m is an effective mass, e is the charge of an electron, A is the magnetic vector potential, and  is the magnetic field. By minimizing the free energy with respect to variations in the order parameter and the vector potential, one arrives at the Ginzburg–Landau equations

where j denotes the dissipation-less electric current density and Re the real part. The first equation — which bears some similarities to the time-independent Schrödinger equation, but is principally different due to a nonlinear term — determines the order parameter, ψ. The second equation then provides the superconducting current.

Simple interpretation
Consider a homogeneous superconductor where there is no superconducting current and the equation for ψ simplifies to:

This equation has a trivial solution: ψ = 0. This corresponds to the normal state of the superconductor, that is for temperatures above the superconducting transition temperature, T > Tc.

Below the superconducting transition temperature, the above equation is expected to have a non-trivial solution (that is ψ ≠ 0). Under this assumption the equation above can be rearranged into:

When the right hand side of this equation is positive, there is a nonzero solution for ψ (remember that the magnitude of a complex number can be positive or zero). This can be achieved by assuming the following temperature dependence of α:  with α0/β > 0:

Above the superconducting transition temperature, T > Tc, the expression α(T)/β is positive and the right hand side of the equation above is negative. The magnitude of a complex number must be a non-negative number, so only ψ = 0 solves the Ginzburg–Landau equation.
Below the superconducting transition temperature, T < Tc, the right hand side of the equation above is positive and there is a non-trivial solution for ψ. Furthermore,

 that is ψ approaches zero as T gets closer to Tc from below. Such a behaviour is typical for a second order phase transition.

In Ginzburg–Landau theory the electrons that contribute to superconductivity were proposed to form a superfluid. In this interpretation, |ψ|2 indicates the fraction of electrons that have condensed into a superfluid.

Coherence length and penetration depth
The Ginzburg–Landau equations predicted two new characteristic lengths in a superconductor. The first characteristic length was termed coherence length, ξ. For T > Tc (normal phase), it is given by

while for T < Tc (superconducting phase), where it is more relevant, it is given by

It sets the exponential law according to which small perturbations of density of superconducting electrons recover their equilibrium value ψ0. Thus this theory characterized all superconductors by two length scales. The second one is the penetration depth, λ. It was previously introduced by the London brothers in their London theory. Expressed in terms of the parameters of Ginzburg–Landau model it is

where ψ0 is the equilibrium value of the order parameter in the absence of an electromagnetic field. The penetration depth sets the exponential law according to which an external magnetic field decays inside the superconductor.

The original idea on the parameter "k" belongs to Landau. The ratio κ = λ/ξ is presently known as the Ginzburg–Landau parameter.  It has been proposed by Landau that Type I superconductors are those with 0 < κ < 1/, and Type II superconductors those with κ > 1/.

Fluctuations in the Ginzburg–Landau model

Taking into account fluctuations. For Type II superconductors, the phase transition from the normal state is of second order, as demonstrated by Dasgupta and Halperin. While for Type I superconductors it is of first order
as demonstrated by Halperin, Lubensky and Ma.

Classification of superconductors based on Ginzburg–Landau theory

In the original paper Ginzburg and Landau observed the existence of two types of superconductors depending
on the energy of the interface between the normal and superconducting states. The Meissner state breaks down when the applied magnetic field is too large. Superconductors can be divided into two classes according to how this breakdown occurs. In Type I superconductors, superconductivity is abruptly destroyed when the strength of the applied field rises above a critical value Hc. Depending on the geometry of the sample, one may obtain an intermediate state consisting of a baroque pattern of regions of normal material carrying a magnetic field mixed with regions of superconducting material containing no field. In Type II superconductors, raising the applied field past a critical value Hc1 leads to a mixed state (also known as the vortex state) in which an increasing amount of magnetic flux penetrates the material, but there remains no resistance to the flow of electric current as long as the current is not too large. At a second critical field strength Hc2, superconductivity is destroyed. The mixed state is actually caused by vortices in the electronic superfluid, sometimes called fluxons because the flux carried by these vortices is quantized. Most pure elemental superconductors, except niobium and carbon nanotubes, are Type I, while almost all impure and compound superconductors are Type II.

The most important finding from Ginzburg–Landau theory was made by Alexei Abrikosov in 1957. He used Ginzburg–Landau theory to explain experiments on superconducting alloys and thin films. He found that in a type-II superconductor in a high magnetic field, the field penetrates in a triangular lattice of quantized tubes of flux vortices.

Geometric formulation
The Ginzburg–Landau functional can be formulated in the general setting of a complex vector bundle over a compact Riemannian manifold. This is the same functional as given above, transposed to the notation commonly used in Riemannian geometry. In multiple interesting cases, it can be shown to exhibit the same phenomena as the above, including Abrikosov vortices (see discussion below).

For a complex vector bundle  over a Riemannian manifold  with fiber , the order parameter  is understood as a section of the vector bundle . The Ginzburg–Landau functional is then a Lagrangian for that section:

The notation used here is as follows.  The fibers  are assumed to be equipped with a Hermitian inner product  so that the square of the norm is written as . The phenomenological parameters  and  have been absorbed so that the potential energy term is a quartic mexican hat potential, i.e. exhibiting spontaneous symmetry breaking, with a minimum at some real value .  The integral is explicitly over the volume form

for an -dimensional manifold  with determinant  of the metric tensor .

The  is the connection one-form and  is the corresponding curvature 2-form (this is not the same  as given up top; here,  corresponds to the electromagnetic field strength tensor). The  corresponds to the vector potential, but is in general non-Abelian when , and is normalized differently. In physics, one conventionally writes the connection as  for the electric charge  and vector potential ; in Riemannian geometry, it is more convenient to drop the  (and all other physical units) and take  to be a one-form taking values in the Lie algebra corresponding to the symmetry group of the fiber.  Here, the symmetry group is SU(n), as that leaves the inner product  invariant; so here,  is a form taking values in the algebra .

The curvature  generalizes the electromagnetic field strength to the non-Abelian setting, as the curvature form of an affine connection on a vector bundle . It is conventionally written as

That is, each  is an  skew-symmetric matrix. (See the article  on the metric connection for additional articulation of this specific notation.) To emphasize this, note that the first term of the Ginzburg–Landau functional, involving the field-strength only, is

which is just the Yang–Mills action on a compact Riemannian manifold.

The Euler–Lagrange equations for the Ginzburg–Landau functional are the Yang–Mills equations

and

where  is the Hodge star operator, i.e. the fully antisymmetric tensor.  Note that these are closely related to the Yang–Mills–Higgs equations.

Specific results
In string theory, it is conventional to study the Ginzburg–Landau functional for the manifold  being a Riemann surface, and taking , i.e. a line bundle. The phenomenon of Abrikosov vortices persists in these general cases, including , where one can specify any finite set of points where  vanishes, including multiplicity. The proof generalizes to arbitrary Riemann surfaces and to Kähler manifolds. In the limit of weak coupling, it can be shown that  converges uniformly to 1, while  and  converge uniformly to zero, and the curvature becomes a sum over delta-function distributions at the vortices. The sum over vortices, with multiplicity, just equals the degree of the line bundle; as a result, one may write a line bundle on a Riemann surface as a flat bundle, with N singular points and a covariantly constant section.

When the manifold is four-dimensional, possessing a spinc structure, then one may write a very similar functional, the Seiberg–Witten functional, which may be analyzed in a similar fashion, and which possesses many similar properties, including self-duality. When such systems are integrable, they are studied as Hitchin systems.

Self-duality
When the manifold  is a Riemann surface , the functional can be re-written so as to explicitly show self-duality.  One achieves this by writing the exterior derivative as a sum of Dolbeault operators . Likewise, the space  of one-forms over a Riemann surface decomposes into a space that is holomorphic, and one that is anti-holomorphic: , so that forms in  are holomorphic in  and have no dependence on ; and vice-versa for . This allows the vector potential to be written as  and likewise  with  and .

For the case of , where the fiber is  so that the bundle is a line bundle, the field strength can similarly be written as

Note that in the sign-convention being used here, both  and  are purely imaginary (viz U(1) is generated by  so derivatives are purely imaginary).  The functional then becomes

The integral is understood to be over the volume form
,
so that

is the total area of the surface . The  is the Hodge star, as before.  The degree  of the line bundle  over the surface  is

where  is the first Chern class.

The Lagrangian is minimized (stationary) when  solve the Ginzberg–Landau equations

Note that these are both first-order differential equations, manifestly self-dual.  Integrating the second of these, one quickly finds that a non-trivial solution must obey
.
Roughly speaking, this can be interpreted as an upper limit to the density of the Abrikosov vortecies.  One can also show that the solutions are bounded; one must have .

Landau–Ginzburg theories in string theory
In particle physics, any quantum field theory with a unique classical vacuum state and a potential energy with a degenerate critical point is called a Landau–Ginzburg theory.  The generalization to N = (2,2) supersymmetric theories in 2 spacetime dimensions was proposed by Cumrun Vafa and Nicholas Warner in the November 1988 article  Catastrophes and the Classification of Conformal Theories, in this generalization one imposes that the superpotential possess a degenerate critical point.  The same month, together with Brian Greene they argued that these theories are related by a renormalization group flow to sigma models on Calabi–Yau manifolds in the paper  Calabi–Yau Manifolds and Renormalization Group Flows.  In his 1993 paper Phases of N = 2 theories in two-dimensions, Edward Witten argued that Landau–Ginzburg theories and sigma models on Calabi–Yau manifolds are different phases of the same theory. A construction of such a duality was given by relating the Gromov–Witten theory of Calabi–Yau orbifolds to FJRW theory an analogous Landau–Ginzburg "FJRW" theory in The Witten Equation, Mirror Symmetry and Quantum Singularity Theory. Witten's sigma models were later used to describe the low energy dynamics of 4-dimensional gauge theories with monopoles as well as brane constructions.

See also

 Flux pinning
 Gross–Pitaevskii equation
 Landau theory
 Reaction–diffusion systems
 Quantum vortex
 Higgs bundle

References

Papers

 V.L. Ginzburg and L.D. Landau, Zh. Eksp. Teor. Fiz. 20, 1064 (1950). English translation in: L. D. Landau, Collected papers (Oxford: Pergamon Press, 1965) p. 546
 A.A. Abrikosov, Zh. Eksp. Teor. Fiz. 32, 1442 (1957) (English translation: Sov. Phys. JETP 5 1174 (1957)].)  Abrikosov's original paper on vortex structure of Type-II superconductors derived as a solution of G–L equations for κ > 1/√2
 L.P. Gor'kov, Sov. Phys. JETP 36, 1364 (1959)
 A.A. Abrikosov's 2003 Nobel lecture: pdf file or video
 V.L. Ginzburg's 2003 Nobel Lecture: pdf file or video

Category:Superconductivity


In short: an interesting, well organised raceIn full: I had been reading last years reviews of the race to try to work out the hills etc, basically the first 8 miles were slight inclines/declines along the portway sections of which had a strong head wind, heading back into town the course is a bit winding with a few cobbles and a few short sharp inclines in the last few miles which are a bit energy sapping but overall i really enjoyed this raceDate of review: September 15, 2011

In short: Great organisation, good route, more cheers from the crowd, please!In full: Really well organised - all city races should learn from this one. My route planning and running watch both think it's longer than 13.1 miles but a good circuit. Agree with the need for clearer mile markers for the last 2 miles, especially countdown markers. Crowd was fine but nothing on the enthusiasm and support of ReadingDate of review: September 14, 2011

In short: Enjoyable 1st half but organisation could be betterIn full: First of all my race pack went to a completely incorrect address! Secondly the t-shirts could be in more female runner friendly sizes! My "Small" t-shirt drowns me! Otherwise all went well for my first half marathon.Date of review: September 14, 2011

In short: new course, same hills, more wind and sun - may as well go on holiday and not run In full: The hills in the centre within a few miles of the finish are too much for any but the regular club runner. The weather was not fit for a race. It was hot. I lost 4 kg (almost 9 pounds) of fluids. I couldn't possibly drink 4 pints during the run to replace fliuds. Overall: race from hell.Date of review: September 14, 2011

In short: Generally well thought out event. Better than mostIn full: This was my first time at this event. The course is generally fast and flat with lots of long straight sections in the first 8 miles and a two wave start, both reducing congestion. Despite this, the number of runners in the event (10000) can lead to the first mile or so being slow.There is plenty of NCP type parking available within a few minutes walk of the start, and the race facility provision and organisation(toilets, bag drop, information, post race drinks etc) is nothing short of excellent I was also very impressed with the sheer number of people who had given up their Sunday morning, clearly on a voluntary basis. As noted elsewhere, the only negative was the absence or poor positioning of markers within the last 2 miles. The 12 mile marker seemed to be absent and as the finish gantry only becomes visible within the last 200m or so, "countdown" markers - 800m, 400m etc would have been useful. Otherwise a fantastic day out ! Date of review: September 14, 2011

In short: Well organized and enjoyable.In full: I've done this race each year since 2005 and always found it a good experience. I used to prefer going round the streets first and then up the Portway and back to the finish. The drag round the streets at the end is heavy going but I see the point of getting into a wide road as quickly possible. Basics like baggage storage and toilets are excellent and the only gripe I have is that some mile-markers seemed to have been missed or were difficult to see. Will take part next year without doubt and would recommend it to anyone wondering whether to try this race.Date of review: September 13, 2011


Events

Rams Rally Falls Short In Loss To San Jose State

FORT COLLINS, Colo. (AP) — Jabari Carr hauled in a go-ahead TD pass from Matt Faulkner with 54 seconds remaining to help San Jose State snap a 16-game road losing skid with a 38-31 win over Colorado State on Saturday.

The Spartans (2-3) have now won back-to-back games for the first time in three years.

Brandon Rutley rushed for 131 yards and two touchdowns before limping off the field after spraining his left ankle in the third quarter.

The Spartans lost some of their steam without their powerful tailback, squandering a 31-17 lead in the second half.

With the game tied and 3:30 remaining, Faulkner guided the Spartans down the field and found a wide open Carr on the left side for a 38-yard touchdown.

Cornerback Ronnie Yell ended a last-gasp effort by the Rams (3-2) as he intercepted a long pass from Pete Thomas in the closing seconds.

Faulkner threw for 313 yards and two scores, including one to tight end Ryan Otten, who finished with 112 yards receiving.

Rutley accounted for a bulk of the damage against the Rams as he scored on runs of 12 and 23 yards in the first half, recording his second straight 100-yard game. The senior tailback ran for 209 yards in a win over New Mexico State last weekend.

However, Rutley was helped to the bench after hurting his ankle midway through the third quarter. He grimaced in pain as trainers and teammates checked on him, before limping off the field and into the locker room on crutches.

Rutley returned in the game’s waning moments to celebrate with his teammates.

This was the Spartans’ first win away from home since beating Idaho on Nov. 1, 2008. It’s also their first non-conference road win in nine years, when they knocked off Illinois.

The Rams trailed 31-17 with 3:32 left in the third quarter but rallied behind the play of Thomas. The sophomore hit Thomas Coffman in stride for a 47-yard TD pass to pull CSU within a touchdown.

Thomas then tied the game with 11:33 remaining as he raced in from 9 yards, leaping over several San Jose State defenders at the goal line.

The Rams had a chance to win the contest with 3:30 left, but Ben DeLine’s attempt at a career-long 48-yard field goal drifted wide left.

The Spartans took over at their 30 and methodically drove down the field for the winning score.

Thomas finished with 387 yards passing and three scores for the Rams.

Behind a powerful first-half performance by Rutley, the Spartans took a 24-14 lead into the locker room. Rutley had 104 yards as San Jose scored its most points in a first half in four years.

The lead could have been even more convincing had the Spartans not fumbled inside their own territory just before halftime. Chandler Jones caught a pass over the middle and ran into the back of a teammate, causing the ball to pop free and Shaq Bell pounced on it for CSU.

Five plays later, Thomas hit Lou Greenwood for a 25-yard score, their second TD connection of the half.

Before that, the game’s momentum heavily favored San Jose State. Safety Duke Ihenacho returned a fumble 20 yard for a score, the first time the Spartans have done that in nearly seven years.

The Spartans looked impressive from the opening drive, when they marched it 78 yards on seven plays. Rutley capped it off with a 12-yard scoring burst.

It was the first time this season the Rams have allowed a score in the opening quarter.

Rams linebacker Mychal Sisson turned 23 on Saturday, but spent his birthday hobbling around the sideline instead of harassing San Jose State. Sisson, a senior captain, broke his right ankle three weeks ago against Northern Colorado. He’s a big loss to one of the top pass defenses in the country.

The Rams have a week off before hosting fourth-ranked Boise State and Heisman hopeful Kellen Moore on Oct. 15.


The knock on-effects here are profound. On a B2B basis, one has to wonder why MVPDs would continue to pay contractual rates. Of course, they don’t have a particularly clear legal argument to refuse them – hence work-to-the-rule. But if I were John Malone or Charlie Ergen, I’d look at these decisions and just refuse. Disney, WarnerMedia, and NBCUniversal are making the right decisions for themselves, but these decisions aren’t exactly in good faith of the contracts (and plans) they set over the past few years. The good news here is that (entirely reasonable) renegotiations would, in theory, allow MVPDs to materially reduce their programming costs. The bad news is that reductions in in Pay-TV revenues would only encourage Hollywood to move on from it.

But most important is the consumer side. From 2010-2019, the perceived value of Pay-TV eroded because (1) better, lower cost substitutes emerged, and (2) Pay-TV pricing continued to increase. even though the quality and volume of content available in the Pay-TV bundle grew. What’s set to happen from 2020 onward is quite different. Pay-TV will, for the first time, get rapidly worse on an absolute basis as it is undermined, underfunded, and eventually defunded.

What’s more, most of what’s available in the Pay-TV ecosystem will be available elsewhere via better experiences and at lower prices (and often earlier, too). Again, this is different than 2010-2019. Netflix and Amazon, for example, had later content rights to Pay-TV titles. Hulu, meanwhile, only had next-day rights to a small number of currently airing shows and the last five episodes that aired. Hulu, HBO Max, and Peacock will have full rights to most in-season shows, plus the full stack of prior seasons. These services will also have many shows, such as The Big Bang Theory, that have never before been available in SVOD and could only be watched in a random airing order on various linear channels at various times of the day. In addition, this OTT trio will boast exclusive new originals that, for the most part, are better and higher budget than anything available through the traditional system.

This means that Pay-TV decline estimates are wrong. It’s not about escalation or curve modelling. The floor will suddenly start falling out. This is almost impossible to model correctly; there’s probably no equivalent example in media where all partners not only rapidly change distribution channel and halt investments, but also try to pivot from B2B to B2C monetization.

What about Sports?

The strongest counterpoint to this thesis is that the bundle will remain in place to access live sports, and that it’s already the only thing households are really thinking about when buying a subscription. If true, it wouldn’t matter that much of the rest is being harvested. However, I think there’s more frailty and tunnel vision here than many assume.

For one, the very companies (Disney, NBCUniversal, and WarnerMedia) accelerating the decline of Pay-TV also tend to be the biggest sports rights holders (they own ESPN, NBC Sports, Turner Sports). This means those that own the most powerful sports networks have both an awareness of the impending challenges in Pay-TV and a willingness to lean into them. You can’t logically cut off one gangrenous arm and pay no attention to another arm suffering from the same malady because it has less rot.

To point, 22 months ago, Disney’s Head of Direct-to-Consumer, Kevin Mayer, told Recode that the company isn’t contractually prohibited from making ESPN available direct-to-consumer, but it just didn’t make business sense. There was an obvious unsaid modifier in this claim: “yet”. With ESPN distribution now south of 80MM households, down from nearly 100MM, it’s obvious this time is fast approaching. And you can bet Disney would rather pull the trigger early than try to perfect the timing.

Indeed, it’s impossible to imagine there’s a better time to make this transition. Disney will almost assuredly never have more D2C buy-in from the street than it does today. The next three years will see a substantial number of key sports rights come up for licensing, and the company is rapidly accumulating experience in D2C. It’s fair to say the technical experience may not be there yet, but the adoption curve of a true D2C ESPN wouldn’t be as rapid as Disney+. Disney+ is a new product with new content; ESPN is just the old thing sold in an incremental fashion. Almost all subscribers (and an even greater share of consumption) will still be via traditional TV. My bet would be that by the end of 2020, Disney will announce plans to launch D2C ESPN in 2021. To this end, Disney CEO Bob Iger recently told Bill Simmons that in the future “ESPN will be far more of a direct-to-consumer product,” having previously said, “If you’re running a business in a dynamic world…and you try to maintain any kind of status quo, you will become irrelevant.”

In positioning HBO Max as a rebundling platform, AT&T has already begun suggesting that it will soon offer an OTT/D2C Turner Sports subscription add-on. It’s hard to imagine “New Fox” isn’t planning something similar with FS Go, and NBCUniversal with Peacock/NBC Sports (perhaps launching February 2022 around the Olympics).

It also seems likely that the next round of sports deals will be mostly non-exclusive – if a linear-predominant platform, such as TNT or Fox, buys the rights, it’ll have to share with an online-only platform, such as YouTube TV or Amazon Prime, or otherwise demonstrate clear scale in its digital products. As a result, we’re looking at a world in which the “last stand” of Pay-TV will soon be available outside Pay-TV.

(Related: It’s often argued that Fox or TNT or NBC Sports, etc., doesn’t have the rights for a direct-to-consumer sports offering. This was true at the time most major sports deals were struck, but these deals are frequently reopened to allow for things like sports betting, social integrations, new camera angles and devices, etc. Many have already been expanded to allow for, at additional or different fees, true D2C. And for the skeptics, consider the reverse logic. You’d have to believe, for example, that the NCAA or NBA, having sold 5–15 year rights to their leagues before the collapse of Pay-TV, would just throw up their hands and say, “Shucks, well, TNT didn’t buy D2C rights, so I guess we’ll have to wait”. Or that having purchased these same rights, TNT would say, “Yeah, well, I guess go ahead and sell these rights elsewhere even though we bought the long-term — and highest priced — rights to the old system”.)

All of which is to say that we talk a lot about the progressive, predictable, or even accelerated decline of Pay-TV and what its asymptote might look like. Does it level at 50MM households? At 55MM? At 45MM? Late 2021/early 2022, to me, looks like the point in which consumers will wake up and see that Pay-TV isn’t just a zombie business and delivery model, it’s a zombie product — and one that is increasingly deprived of fresh meat. There’s no model for this decline, but it certainly won’t look like a simple acceleration of the past decade’s trendlines.

Matthew Ball (@ballmatthew)


Interested in reading this tutorial as one of many chapters in my GraphQL book? Checkout the entire The Road to GraphQL book that teaches you to become a fullstack developer with JavaScript.

This tutorial is part 3 of 3 in this series. Part 1: A complete React with GraphQL Tutorial

Part 2: React with Apollo and GraphQL Tutorial

You may have used a GraphQL client library that was view-layer agnostic and thus able to work with React or other solutions like Angular or Vue. Other GraphQL client libraries like Relay and Urql aren't so powerful, because they are used only for React. The next chapter is to illustrate how to implement a GraphQL client library that works with React. The takeaway shouldn't be "build your own GraphQL client for your production ready applications", however, you should instead learn:

how a GraphQL client library works under the hood

how simple a GraphQL client library can be implemented your way

how it is capable of contributing to the GraphQL ecosystem

There is lots of room to contribute to the GraphQL ecosystem, because the tools surrounding it are still fairly new. A diverse set of tools would speed this along, instead of Apollo pushing its maturation forward alone. This is not only a useful addition for your web development skillset, it is also an opportunity to contribute to the early stages of GraphQL.

Before diving into implementing your own GraphQL client for React, consider the essentials for consuming a GraphQL API in a React application:

A GraphQL client must be used. It can be any HTTP library or even the native fetch API, but it must be able to send HTTP methods with a payload across the wire. While the GraphQL specification isn't opinionated about the transportation layer, the GitHub GraphQL API you consume with a GraphQL client is using HTTP. Because we are using their API, our GraphQL client must be able to execute GraphQL operations using HTTP methods.

There must be a way to provide the GraphQL client instance to the React view layer . It is the perfect use for React's Context API to provide the GraphQL client instance at the top level of the React component tree, and to consume it in every React component interested in it.

There must be a way to execute GraphQL operations, like a query or a mutation, in a declarative way in React. You will implement a Query component and a Mutation component that exposes an API to execute the GraphQL operations and to access its result. Because you are implementing these components, you won't touch the GraphQL client provided with React's Context API explicitly in your React components, but only in the Query and Mutation components.

The first part is React agnostic, but the second and third glue the GraphQL client (data layer) to React (view layer). It can be seen as an analog to the redux and react-redux or apollo-client and react-apollo libraries. The former is view layer agnostic, the latter is used to connect it to the view layer.

While you implement a GraphQL client for React in the following sections, you will also implement a GitHub client application with React that consumes GitHub's GraphQL API, using GraphQL client.

Implementing your GraphQL Client

Next, you will separate the domain specific application (GitHub client) and the GraphQL client with its connecting parts to the React world. The latter could be extracted later, as a standalone library, and published on npm. It could even be split up into two libraries, where the first part is the view layer agnostic GraphQL client, and the second is used to connect the former to the view layer..

First, bootstrap your React application with create-react-app where you will implement your GraphQL client and the connecting parts to the view layer.

Second, create a file to implement your standalone GraphQL client. You are going to use axios as HTTP client to send queries and mutations with HTTP POST methods.

npm install axios -- save

The GraphQL client build with axios could be as lightweight as the following:

import axios from 'axios' ; const graphQLClient = axios . create ( ) ; export default graphQLClient ;

Since you may need greater control for creating the GraphQL client instance--passing in the GraphQL API endpoint or HTTP headers, for example--you can also expose it with a function that returns the configured GraphQL client instance.

import axios from 'axios' ; const createGraphQLClient = ( baseURL , headers ) => axios . create ( { baseURL , headers , } ) ; export default createGraphQLClient ;

Maybe you want to avoid using the GraphQL client with HTTP methods (e.g. graphQLClient.post() ), or you may want to expose different functions for the query and mutation methods (e.g. graphQLClient.query() ) called from the outside. That way, you never see the behind the scenes HTTP POST when interacting with the GraphQL client. For this, JavaScript class makes sense.

import axios from 'axios' ; class GraphQLClient { axios ; constructor ( { baseURL , headers } ) { this . axios = axios . create ( { baseURL , headers , } ) ; } query ( { query , variables } ) { return this . axios . post ( '' , { query , variables , } ) ; } mutate ( { mutation , variables } ) { return this . axios . post ( '' , { query : mutation , variables , } ) ; } } export default GraphQLClient ;

That's it for the GraphQL client. You created an instance of the GraphQL client and executed GraphQL operations (query and mutation) with it. You may wonder: Where is the state, the caching of requests, and the normalization of the data? You don't need them. The lightweight GraphQL client operates without any extra features, though I invite you to extend the feature set of the GraphQL client after you implement it in the following sections.

Next, use the instantiated GraphQL Client in your top level React component.

import React from 'react' ; import ReactDOM from 'react-dom' ; import App from './App' ; import GraphQLClient from './my-graphql-client' ; import registerServiceWorker from './registerServiceWorker' ; const client = new GraphQLClient ( { baseURL : 'https://api.github.com/graphql' , headers : { Authorization : ` bearer ${ process . env . REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN } ` , } , } ) ; ReactDOM . render ( < App /> , document . getElementById ( 'root' ) , ) ; registerServiceWorker ( ) ;

Necessary information is provided for the GraphQL client constructor to create a GitHub GraphQL client instance. In previous applications, you have seen how to obtain the personal access token from GitHub to access their data and how to use it in a .env file for environment variables, to make it securely accessible for the GraphQL client instantiation.

Implementing your GraphQL to React Bridge

In this section, you connect your GraphQL client instance to your React view layer, and the best way is to use React's Context API. In a separate file, you can create the necessary parts for creating the context used to tunnel the GraphQL client instance from a Provider component to all Consumer components.

import { createContext } from 'react' ; const GraphQLClientContext = createContext ( ) ; export default GraphQLClientContext ;

To provide the GraphQL client instance to your React component tree, use the previous context and its Provider component to make it available to the underlying React component hierarchy.

import React from 'react' ; import ReactDOM from 'react-dom' ; import App from './App' ; import GraphQLClient from './my-graphql-client' ; import GraphQLClientContext from './my-graphql-client-react/context' ; import registerServiceWorker from './registerServiceWorker' ; const client = new GraphQLClient ( { baseURL : 'https://api.github.com/graphql' , headers : { Authorization : ` bearer ${ process . env . REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN } ` , } , } ) ; ReactDOM . render ( < GraphQLClientContext.Provider value = { client } > < App /> </ GraphQLClientContext.Provider > , document . getElementById ( 'root' ) , ) ; registerServiceWorker ( ) ;

Since you provided the GraphQL client instance to your React component tree, you can use the Consumer component from the context object to retrieve the client as a value. You can implement a higher-order component (HOC) to make the GraphQL client instance accessible to React components using this HOC.

import React from 'react' ; import GraphQLClientContext from '../context' ; const withClient = Component => props => ( < GraphQLClientContext.Consumer > { client => < Component { ... props } client = { client } /> } </ GraphQLClientContext.Consumer > ) ; export default withClient ;

Rather than using the Consumer component directly in your React components, use it implicitly with a higher-order component to expose the GraphQL client instance to the props. By now you have implemented all the parts necessary to bridge the data layer to the view layer. You have a Provider component providing the GraphQL client instance for the whole React component tree, and a higher-order component using the Consumer component to make the GraphQL client instance available to all React components interested in it.

Implementing the Query component in React

Now you are going to explore on how to execute GraphQL queries and mutations with your own GraphQL client instance. However, rather than using the client directly in your React components by using the withClient() HOC, which would be possible as well, you will implement two components, called Query and Mutation, which are performing the GraphQL operations in your component tree in a declarative way.

Both the Query and Mutation component implement the render props pattern to pass information to the component using Query or Mutation component. The minimal implementation of the Query component could look like the following:

import React from 'react' ; import withClient from './withClient' ; class Query extends React . Component { state = { data : null , loading : null , errors : null , } ; componentDidMount ( ) { const { query , variables } = this . props ; this . query ( { query , variables } ) ; } query = ( { query , variables } ) => { this . props . client . query ( { query , variables } ) . then ( result => this . setState ( { data : result . data . data , errors : result . data . errors , loading : false , } ) , ) . catch ( error => this . setState ( { errors : [ error ] , loading : false , } ) , ) ; } ; render ( ) { return this . props . children ( { ... this . state , } ) ; } } export default withClient ( Query ) ;

The Query component receives a GraphQL query and optional variables as props. Once it mounts, it executes the query using the GraphQL client instance injected with the withClient higher-order component. If the request resolves successfully, all data and GraphQL errors are stored in the local state of the Query component. Otherwise, a network error is stored in the local state, in an array of errors. Also, a loading boolean tracks the request state. The Query component uses the render prop as a children function to pass in the local state of the component. The user of the Query component decides what should be rendered in response to the information (data, loading, errors) from the children function.

In your App component's file, you can import the component, pass in a query and optional variables, and let the Query component execute the GraphQL query once it mounts. You will receive the information from the Query component in the children function during each render.

import React , { Component } from 'react' ; import { Query } from './my-graphql-client-react' ; const GET_ORGANIZATION = ` query ( $organizationLogin: String!, ) { organization(login: $organizationLogin) { name url } } ` ; class App extends Component { state = { value : 'the-road-to-learn-react' , organizationLogin : 'the-road-to-learn-react' , } ; onChange = event => { this . setState ( { value : event . target . value } ) ; } ; onSubmit = event => { this . setState ( { organizationLogin : this . state . value } ) ; event . preventDefault ( ) ; } ; render ( ) { const { organizationLogin , value } = this . state ; return ( < div > < h1 > React GraphQL GitHub Client </ h1 > < form onSubmit = { this . onSubmit } > < label htmlFor = " url " > Show organization for https : / /github.com/ </ label > < input id = " url " type = " text " value = { value } onChange = { this . onChange } style = { { width : '300px' } } /> < button type = " submit " > Search </ button > </ form > < hr /> < Query query = { GET_ORGANIZATION } variables = { { organizationLogin , } } > { ( { data , loading , errors , fetchMore } ) => { if ( ! data ) { return < p > No information yet ... </ p > ; } const { organization } = data ; if ( loading ) { return < p > Loading ... </ p > ; } if ( errors ) { return ( < p > < strong > Something went wrong : </ strong > { errors . map ( error => error . message ) . join ( ' ' ) } </ p > ) ; } return ( < Organization organization = { organization } /> ) ; } } </ Query > </ div > ) ; } } const Organization = ( { organization } ) => ( < div > < h1 > < a href = { organization . url } > { organization . name } </ a > </ h1 > </ div > ) ; export default App ;

For the sake of completion, the implementation could also add a list of repositories that belong to the organization. This part of the application provides a good reason to implement pagination later, as well as a mutation with your GraphQL client, Query component, and Mutation component.

... const GET_ORGANIZATION = ` query ( $organizationLogin: String!, ) { organization(login: $organizationLogin) { name url repositories(first: 5) { edges { node { id name url watchers { totalCount } viewerSubscription } } } } } ` ; const isWatch = viewerSubscription => viewerSubscription === 'SUBSCRIBED' ; ... const Organization = ( { organization } ) => ( < div > < h1 > < a href = { organization . url } > { organization . name } </ a > </ h1 > < Repositories repositories = { organization . repositories } /> </ div > ) ; const Repositories = ( { repositories } ) => ( < div > < ul > { repositories . edges . map ( repository => ( < li key = { repository . node . id } > < a href = { repository . node . url } > { repository . node . name } </ a > { ' ' } { repository . node . watchers . totalCount } { isWatch ( repository . node . viewerSubscription ) ? ' Watched by you' : ' Not watched by you' } </ li > ) ) } </ ul > </ div > ) ; export default App ;

The GraphQL query works now, using the Query component. But it only works for the initial request, not when searching for another GitHub organization with the input element. This is because the Query component executes the GraphQL query only when mounts, but not when the organizationLogin variable changes. Let's add this little feature in the Query component.

import React from 'react' ; import { isEqual } from 'lodash' ; import withClient from './withClient' ; class Query extends React . Component { state = { data : null , loading : null , errors : null , } ; componentDidMount ( ) { ... } componentDidUpdate ( prevProps ) { if ( ! isEqual ( this . props . variables , prevProps . variables ) ) { const { query , variables } = this . props ; this . query ( { query , variables } ) ; } } query = ( { query , variables } ) => { ... } ; render ( ) { ... } } export default withClient ( Query ) ;

In this case, lodash is used to make an equal check on the previous and next variables which are passed as props to the Query component. So don't forget to install lodash or any other utility library which can do the check for you.

npm install lodash -- save

Once the variables change, the GraphQL query is executed again. When you try your application, the search for another GitHub organization works now, because when the variable for the organizationLogin changes on a submit click, the GraphQL query in the Query component executes again.

Implementing the Query component with Pagination in React

We've added some functionality, but the application only fetches the first page of repositories, and there is currently no means to fetch the next page. You have to add a mechanism that executes a query to fetch more pages from the GraphQL backend. To do this, we extend the Query component:

... class Query extends React . Component { state = { data : null , loading : null , fetchMoreLoading : null , errors : null , } ; componentDidMount ( ) { ... } componentDidUpdate ( prevProps ) { ... } query = ( { query , variables } ) => { ... } ; queryMore = ( { query , variables } ) => { this . props . client . query ( { query , variables } ) . then ( result => this . setState ( state => ( { data : this . props . resolveFetchMore ( result . data . data , state ) , errors : result . data . errors , fetchMoreLoading : false , } ) ) , ) . catch ( error => this . setState ( { errors : [ error ] , fetchMoreLoading : false , } ) , ) ; } ; render ( ) { return this . props . children ( { ... this . state , fetchMore : this . queryMore , } ) ; } } export default withClient ( Query ) ;

The queryMore() method, exposed with the children function as fetchMore() function, is used similar to the query() method. You switch from a declarative query execution to a imperative query execution using the fetchMore() function in React now. There, pass in a query and variables with a pagination argument to the function.

The one crucial difference to the query() method is the resolveFetchMore() function that is passed to the Query component as prop. It is used when a query resolves successfully, to merge the result with the component state. You can define from the outside how to merge this information.

First, the query needs to provide a cursor argument in the GitHub GraphQL API to fetch another page of repositories. The pageInfo field is used to retrieve the cursor for the next page, and to see whether there is a next page.

const GET_ORGANIZATION = ` query ( $organizationLogin: String!, $cursor: String ) { organization(login: $organizationLogin) { name url repositories(first: 5, after: $cursor) { pageInfo { endCursor hasNextPage } edges { node { id name url watchers { totalCount } viewerSubscription } } } } } ` ;

Second, the fetchMore() function is accessed in the Query's children as a function. The function can be passed down as a wrapped higher-order function to the next component that makes use of it. This way, the next component doesn't have to worry about passing arguments to the function anymore, as it is handled in the App component.

... const resolveFetchMore = ( data , state ) => { ... } class App extends Component { ... render ( ) { const { organizationLogin , value } = this . state ; return ( < div > ... < Query query = { GET_ORGANIZATION } variables = { { organizationLogin , } } resolveFetchMore = { resolveFetchMore } > { ( { data , loading , errors , fetchMore } ) => { ... return ( < Organization organization = { organization } onFetchMoreRepositories = { ( ) => fetchMore ( { query : GET_ORGANIZATION , variables : { organizationLogin , cursor : organization . repositories . pageInfo . endCursor , } , } ) } /> ) ; } } </ Query > </ div > ) ; } } ... export default App ;

Third, the Repositories component can use the function to fetch the next page of the paginated list of repositories with a button. The button becomes available only when there is a next page of the paginated list.

const Organization = ( { organization , onFetchMoreRepositories , } ) => ( < div > < h1 > < a href = { organization . url } > { organization . name } </ a > </ h1 > < Repositories repositories = { organization . repositories } onFetchMoreRepositories = { onFetchMoreRepositories } /> </ div > ) ; const Repositories = ( { repositories , onFetchMoreRepositories , } ) => ( < div > < ul > ... </ ul > { repositories . pageInfo . hasNextPage && ( < button onClick = { onFetchMoreRepositories } > More </ button > ) } </ div > ) ;

Next, implement the resolveFetchMore() function which was already passed in a previous step to the Query component. In this function, you have access to the query result when you fetch another page, as well as the state of the Query component.

const resolveFetchMore = ( data , state ) => { const { edges : oldR } = state . data . organization . repositories ; const { edges : newR } = data . organization . repositories ; const updatedRepositories = [ ... oldR , ... newR ] ; return { organization : { ... data . organization , repositories : { ... data . organization . repositories , edges : updatedRepositories , } , } , } ; } ;

The function merges the edges of the repositories from the state and new result into a new list of edges. The list is used in the returned object, which is used in the Query function for the data property in the state. Check the Query component again to verify it. With this resolving function, you can decide how to treat a paginated query, by merging component state of the Query component and the query result into a new state for the Query component.

Implementing the Mutation component in React

So far, you have implemented data reading part with your GraphQL client using a Query component, with pagination. Now you'll add its counterpart, a Mutation component:

import React from 'react' ; import withClient from './withClient' ; class Mutation extends React . Component { constructor ( props ) { super ( props ) ; this . state = { data : null , loading : null , errors : null , } ; } mutate = ( { mutation = this . props . mutation , variables = this . props . variables , } ) => { const { client } = this . props ; client . mutate ( { mutation , variables } ) . then ( result => { this . setState ( { data : result . data . data , errors : result . data . errors , loading : false , } ) ; } ) . catch ( error => this . setState ( { errors : [ error ] , loading : false , } ) , ) ; } ; render ( ) { return this . props . children ( this . mutate , this . state ) ; } } export default withClient ( Mutation ) ;

It is similar to the initial Query component except for three things: the render method, the arguments passed to the mutate method, and the point when the mutate method is executed.

First, the render method gives access to the state of the component, but also to the mutate method to use imperatively from the outside. Second, arguments passed to the mutate method are either the arguments passed to the mutate method at execution or the props passed to the Mutation component as fallback. Third, the mutate method exposed to the outside as a function is used any time except when the Mutation component mounts, as it did in the Query component. It is up to the user of the Mutation component to trigger it.

So how to use it in your App component's file? First, you can implement a mutation which works for GitHub's GraphQL API.

const WATCH_REPOSITORY = ` mutation($id: ID!, $viewerSubscription: SubscriptionState!) { updateSubscription( input: { state: $viewerSubscription, subscribableId: $id } ) { subscribable { id viewerSubscription } } } ` ;

Use the new Mutation component in your Repositories component for each repository to watch or unwatch it on GitHub with the mutation.

... import { Query , Mutation } from './my-graphql-client-react' ; ... const Repositories = ( { repositories , onFetchMoreRepositories , } ) => ( < div > < ul > { repositories . edges . map ( repository => ( < li key = { repository . node . id } > ... < Mutation mutation = { WATCH_REPOSITORY } > { ( toggleWatch , { data , loading , errors } ) => ( < button type = " button " onClick = { ( ) => toggleWatch ( { variables : { id : repository . node . id , viewerSubscription : isWatch ( repository . node . viewerSubscription , ) ? 'UNSUBSCRIBED' : 'SUBSCRIBED' , } , } ) } > { repository . node . watchers . totalCount } { isWatch ( repository . node . viewerSubscription ) ? ' Unwatch' : ' Watch' } </ button > ) } </ Mutation > </ li > ) ) } </ ul > ... </ div > ) ;

The Mutation component grants access to the mutation function and the mutation result in its child as a function. The button can then use the function to watch or unwatch the repository. In this case, the variables are passed in the mutate function, but you could pass them in the Mutation component too.

You may notice your mutation works only once now, as every other mutation keeps same count of watchers, meaning it doesn't toggle between watch and unwatch. This is because the repository prop with the viewerSubscription and the totalCount properties doesn't change after a mutation, since it is a prop from the Query component above. It is managed in the Query component, not in the Mutation component. You need to manage the data in the Mutation component instead, to update it after a mutation accordingly.

import React from 'react' ; import withClient from './withClient' ; class Mutation extends React . Component { constructor ( props ) { super ( props ) ; this . state = { data : this . props . initial , loading : null , errors : null , } ; } mutate = ( { mutation = this . props . mutation , variables = this . props . variables , } ) => { const { client , resolveMutation } = this . props ; client . mutate ( { mutation , variables } ) . then ( result => { this . setState ( state => ( { data : resolveMutation ( result . data . data , state ) , errors : result . data . errors , loading : false , } ) ) ; } ) . catch ( error => this . setState ( { errors : [ error ] , loading : false , } ) , ) ; } ; render ( ) { return this . props . children ( this . mutate , this . state ) ; } } export default withClient ( Mutation ) ;

The previous additions to the Mutation component implemented two requirements:

The Mutation component has to take over the state of the data to be mutated. In this case, the initial prop makes it possible to set an initial state with the data it takes over.

The Mutation component needs a way to update the state after a successful mutation, to retrieve recent data from it. In this case, the resolveMutation() function is passed as prop to the Mutation component, which is used to merge the Mutation component state with the mutation result into a new Mutation component state. This is similar to the resolveFetchMore() function from the Query component used for pagination.

After these improvements, you can update the Mutation component in your GitHub client application. Give it the initial state using the prop for it, which should give all the information needed for the Mutation component's render prop function.

const resolveWatchMutation = ( data , state ) => { ... } ; const Repositories = ( { repositories , onFetchMoreRepositories , } ) => ( < div > < ul > { repositories . edges . map ( repository => ( < li key = { repository . node . id } > < a href = { repository . node . url } > { repository . node . name } </ a > { ' ' } < Mutation mutation = { WATCH_REPOSITORY } initial = { { repository : { viewerSubscription : repository . node . viewerSubscription , totalCount : repository . node . watchers . totalCount , } , } } resolveMutation = { resolveWatchMutation } > { ( toggleWatch , { data , loading , errors } ) => ( < button type = " button " onClick = { ( ) => toggleWatch ( { variables : { id : repository . node . id , viewerSubscription : isWatch ( data . repository . viewerSubscription , ) ? 'UNSUBSCRIBED' : 'SUBSCRIBED' , } , } ) } > { data . repository . totalCount } { isWatch ( data . repository . viewerSubscription ) ? ' Unwatch' : ' Watch' } </ button > ) } </ Mutation > </ li > ) ) } </ ul > ... </ div > ) ;

Rather than letting a user outside the Mutation component dictate its data, the Mutation component takes over, only using data provided by its child function for rendering. Once you execute the mutation, the state of the Mutation component should change and the new state should be reflected in the return value of the child function. What's missing is the update to the Mutation component's state using the resolveMutation function. It could look like the following, to merge the previous state with the mutation result to a new state object.

const resolveWatchMutation = ( data , state ) => { const { totalCount } = state . data . repository ; const { viewerSubscription } = data . updateSubscription . subscribable ; return { repository : { viewerSubscription , totalCount : viewerSubscription === 'SUBSCRIBED' ? totalCount + 1 : totalCount - 1 , } , } ; }

The resolving function updates the Mutation component's internal state. See the Mutation component's usage of the resolving function again. It takes the totalCount of watchers of the repository and increments or decrements it based on the viewerSubscription property from the mutation result. The new state is passed as data to the Mutation component's child function. What's important is that the resolving function has to return the identical structure of the data provided to the Mutation component with the initial prop. Otherwise, your rendering may break, because data from the render prop function has lost its identical structure.

If the props used for the initial prop of the Mutation component changes in the Mutation component, nothing reflects this update. We'll need to add a lifecycle method in the Mutation component to update its local state when a new initial prop comes in.

import React from 'react' ; import { isEqual } from 'lodash' ; import withClient from './withClient' ; class Mutation extends React . Component { constructor ( props ) { super ( props ) ; this . state = { data : this . props . initial , loading : null , errors : null , } ; } componentDidUpdate ( prevProps ) { if ( ! isEqual ( this . props . initial , prevProps . initial ) ) { this . setState ( { data : this . props . initial } ) ; } } ... } export default withClient ( Mutation ) ;

Everything is in place for the Mutation component now. It manages its own state, which is used as data in the Mutation component's render prop function. We've implemented a Mutation component that handles the GraphQL mutation using your GraphQL client in a React application.

There's a big difference between this lightweight GraphQL client and a sophisticated GraphQL client like Apollo Client. Obviously, the Apollo Client has more features, probably has better performance, and certainly gives more options. The key difference is where the data is stored. Apollo Client has a central cache to manage all normalized data, but the lightweight GraphQL client manages the data in the intermediate Query and Mutation components. They are only locally available to the React components using the Query and Mutation components and the components below them using React's props.

This implementation of a GraphQL client in React should have illustrated that it's not as complicated as it seems. Hopefully this will eventually inspire you to contribute to the GraphQL and React ecosystem with your own libraries. Perhaps you'll create more sophisticated GraphQL client libraries on top of the previous ideas. You can find the previous GraphQL client as library and repository on GitHub. Check it out to find your own solutions and open source them on npm as library. I am looking forward to seeing what you come up with, so please contact me when you'd like to discuss contributing to the ecosystem.


The Shallows - Finally, a Worthy Jaws Successor?

Directed by Jaume Collet-Serra. Produced by Lynn Harris and Matti Leshem. Written by Anthony Jaswinski. Release date: June 24, 2016.

A quick Google search of shark movies quickly leads to the conclusion that there's only been one good one: Jaws. There were some that tried to be good, and then a whole bunch of silly ones, like Sharktopus, but the only success, prior to right here, right now, was Jaws, a film that did it so well that none other could even come close - and didn't need to. However, we can now, tentatively, add a second shark success story onto that list. The Shallows, even with more than a few issues, is a good shark movie.

The premise is simple: Nancy (Blake Lively) has gone to a secluded Mexican beach in order to help herself recover from the loss of her mother, who was ill for quite some time. Her mother previously visited the beach and took some photos, so she sees it as a way to honor her, I guess. However, late in the day, a shark appears, bites her, strands her on a rock, and leaves her fighting for her life. She's losing blood, nobody else is around, her surfboard's gone, and the tide will, eventually, swallow up the rock and leave her completely defenseless.

There are worse ideas for a movie. "Here's a woman, here's a shark, here are some obstacles, now have at it." Most of Nancy's attempts to save herself find themselves thwarted for one reason or another, even though she's an intelligent, perseverant person, who is also conveniently a med student. She can fix her shark bite, at least for the time being, but dehydration, starvation, a cold night, and a shark on the prowl could still do her in.

Basically, The Shallows thinks that watching someone struggle for survival on a tiny chunk of rock is thrilling enough, and also there's a shark waiting for our protagonist to slip up, even a little bit, so it can pounce. Any misstep could end her life, and that tension keeps us on edge. It's effective. It's a thriller with a few horror elements thrown in, and it's thrilling and occasionally scary. That's what you want from these things. It's also a little funny, because taking a step back to laugh at an absurd situation is something we all like to think we'd do in similar circumstances.

The Shallows might just be the second best killer shark movie of all time, which admittedly says more about the quality of its competition than it, but is an accomplishment worth celebrating nonetheless.

Director Jaume Collet-Serra also makes the right decision in regards to the shark, in that the more we see it, the less scary it becomes. For the majority of the film, we only see its fin, or a shadowy shape moving in the water; we rarely get full glimpses of the creature. It's only near the conclusion that we see it in its full glory. And while the CGI isn't perfect, it's usually serviceable - but also reinforces why it was a good choice to not showcase it.

A large piece of The Shallows' success is owed to its lead, Blake Lively, who turns in both a strong physical performance as well as a surprisingly good emotional one. If she had phoned it in, it would've been tough to care for her Nancy, but Lively pulls it off. She has to do a lot of swimming and other physical activity, but she also generates pathos for her character. And it is a character - the relationships with her family help make her feel more fleshed out, and her budding friendship with a seagull (seriously) is just the best thing. She even names him "Steven Seagull," and he is the standout character of the film.

It doesn't all work. The finale is a throw-everything-and-hope-something-sticks kind of ending, and it doesn't quite work. Some of the shark CGI isn't great, it suffers from Gravity-like Murphy's Law plotting at times, and it might've been more memorable had it tried to be scarier. It's often nail-biting, but it's only rarely frightening. There are also a few ugly found-footage shots, which is a shame because most of the film is actually quite beautiful. It helps that it's set on this secluded beach, but the filmmakers capture a good number of gorgeous moments.

The Shallows might just be the second best killer shark movie of all time, which admittedly says more about the quality of its competition than it, but is an accomplishment worth celebrating nonetheless. It's a slight but mostly effective thriller about a woman trying to survive a shark attack while stranded on a rock. Blake Lively brings it, the shark's fun, the movie's thrilling, and Steven Seagull needs approximately 30 sequels.

Bottom Line: A tight thriller with a shark antagonist is almost unprecedented, so let's sit back and appreciate The Shallows.

Recommendation: Want a good shark movie? Here's a good shark movie.

If you want more of Matthew "Marter" Parkinson, you can follow him on the Twitter @Martertweet.


Q:

How to check if specific set of ID's exists?

I have a source table (piece of it):
+--------------------+
|  E M P L O Y E E   |
+--------------------+
| ID |   EQUIPMENT   |
+--------------------+
| 1  | tv,car,phone  |
| 2  | car,phone     |
| 3  | tv,phone      |
+----+---------------+

After normalization process I ended with two new tables:
+----------------+
| DICT_EQUIPMENT |
+----------------+
| ID | EQUIPMENT |
+----------------+
| 1  | tv        |
| 2  | car       |
| 3  | phone     |
+----+-----------+

+---------------------+
|    SET_EQUIPMENT    |
+----+--------+-------+
| ID | SET_ID | EQ_ID |
+----+--------+-------+
| 1  |   1    |   1   |
| 2  |   1    |   2   |
| 3  |   1    |   3   |
| 4  |   2    |   2   |
| 5  |   2    |   3   |
| 6  |   3    |   1   |
| 7  |   3    |   3   |
+----+--------+-------+

(the piece/part)
+-----------------+
| E M P L O Y E E |
+-----------------+
| ID | EQ_SET_ID  |
+-----------------+
| 1  |     1      |
| 2  |     2      |
| 3  |     3      |
+----+------------+

And now when I want to find correct SET_ID I can write something like this:
SELECT SET_ID
  FROM SET_EQUIPMENT S1,
       SET_EQUIPMENT S2,
       SET_EQUIPMENT S3
 WHERE S1.SET_ID = S2.SET_ID
   AND S2.SET_ID = S3.SET_ID
   AND S1.EQ_ID = 1
   AND S2.EQ_ID = 2
   AND S3.EQ_ID = 3;

Maybe any ideas for optimize this query? how find the correct set?

A:

First, you should use explicit join syntax for the method you are using:
SELECT S1.SET_ID
FROM SET_EQUIPMENT S1 JOIN
     SET_EQUIPMENT S2
     ON S1.SET_ID = S2.SET_ID JOIN
     SET_EQUIPMENT S3
     ON S2.SET_ID = S3.SET_ID
 WHERE S1.EQ_ID = 1 AND
       S2.EQ_ID = 2 AND
       S3.EQ_ID = 3;

Commas in a from clause are quite outdated.  (And, this fixes a syntax error in your query.)
An alternative method is to use group by with a having clause:
SELECT S.SET_ID
FROM SET_EQUIPMENT S
GROUP BY S.SET_ID
HAVING SUM(CASE WHEN S.EQ_ID = 1 THEN 1 ELSE 0 END) > 0 AND
       SUM(CASE WHEN S.EQ_ID = 2 THEN 1 ELSE 0 END) > 0 AND
       SUM(CASE WHEN S.EQ_ID = 3 THEN 1 ELSE 0 END) > 0;

Which method works better depends on a number of factors -- for instance, the database engine you are using, the size of the tables, the indexes on the tables.  You have to test which method works better on your system.


Regarding Eugene George Warner (mentioned early in this thread), the Second Superseding Indictment in this case was entered on the case docket at entry 132 on March 5, 2009. The indictment charges Eugene George Warner and Lorna K. Warner with various tax-related crimes.

United States v. Warner
3:07-cr-00123-RRB
U.S. District Court for the District of Alaska

The indictment contains what appears to be a clerical error. The caption of the indictment, the heading of the description of Count 1 of the indictment, and the body of the textual description under Count 1 appear to describe a Klein conspiracy under 18 USC 371. However, the verbiage at the end of the text under Count 1 cites "26 USC 7201" (tax evasion). This may have been a drafting error. It appears that the violation citation at the end of the text under Count 1 should have been to "18 USC 371."

The trial had previously been rescheduled for July 6, 2009. On June 3, 2009, the trial was rescheduled for August 21, 2009.

However, on July 2, 2009, Lorna K. Warner filed a Notice of Intent to Change Plea (docket entry 191) -- indicating that she planned to plead guilty to Count 1 of the indictment. On July 5, 2009, Eugene George Warner filed a similar Notice of Intent to Change Plea (docket entry 193) with respect to Count 1.

A hearing on the matter is set for July 30, 2009.

...why is anyone in this [losthorizons] community paying the least attention to...'Larry Williams' [Famspear], or other purveyors of disinformation from...quatloos? – Pete Hendrickson, former inmate 15406-039, Fed’l Bureau of Prisons

In October 2009, Eugene George Warner was sentenced to 37 months in prison.

...why is anyone in this [losthorizons] community paying the least attention to...'Larry Williams' [Famspear], or other purveyors of disinformation from...quatloos? – Pete Hendrickson, former inmate 15406-039, Fed’l Bureau of Prisons