text:
Q: How to update subplots? I need to plot many plots, take a look at them and press either "y" or "n". I can't get matplotlib showing plots one-by-one in a loop. The loop must show me a plot, then I will press some button and it starts again.
My code for now is:
def press_event(event):
    answer = event.key
    if answer=='y':
        pass
    sys.stdout.flush()
    print(answer)

files = os.listdir(folder)

fig, ax = plt.subplots(14,2, figsize=(10,30))
fig.canvas.mpl_connect('key_press_event', press_event)
for file in files:
    target = file
    data = pd.read_csv(folder + target)
    fig.suptitle(target, fontsize=30)
    r = 0
    for key in data:
        sample = data[key]
        ts = [sample[i+1] - sample[i] for i in range(len(sample)-1)]
        decs,ts,point = cusum(sample,10)
        ax[r,0].plot(sample)
        ax[r,0].axvline(point,color='red')
        ax[r,1].plot(decs)
        ax[r,1].axvline(point, color='red')
        r += 1
    plt.show()
    fig.canvas.draw()
    plt.waitforbuttonpress()
    plt.pause(0.1)
    fig.clear()

Now it shows me the first plot. I press a button and next window is blank and kernel crashes.

A: Here is an adaption from this gallery example, using plt.waitforbuttonpress()

Blocking call to interact with the figure.
Wait for user input and return True if a key was pressed, False if a mouse button was pressed and None if no input was given within timeout seconds. Negative values deactivate timeout.

The figure updates as long as you press a key, if you click with the mouse the loop breaks.
import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots(5, 2)

for i in range(10):
    x = np.random.random((5, 2, 100))

    for r, xx in enumerate(x):
        ax[r, 0].plot(xx[0], 'ro')
        ax[r, 1].plot(xx[1], 'bx')

    plt.show()
    fig.canvas.draw()
    if plt.waitforbuttonpress():  # True for key, False for mouse
        for axx in ax.flat:
            axx.clear()
    else:
        break

Another possibility is to use key_press_event. For this you need to combine the plot update in a separate function and call it accordingly.
In this example I use the left and right keys to toggle through the data.

import numpy as np
import matplotlib.pyplot as plt

n = 10
x = np.random.random((n, 5, 2, 100))
global i
i = 0

fig, ax = plt.subplots(5, 2)

def update(j):
    for axx in ax.flat:
        axx.clear()

    for r, xx in enumerate(x[j]):
        ax[r, 0].plot(xx[0], 'ro')
        ax[r, 1].plot(xx[1], 'bx')

def press_event(event):
    global i
    if event.key == 'left':
        i -= 1
    elif event.key == 'right':
        i += 1
    else:
        return
    i %= n
    update(i)

fig.canvas.mpl_connect('key_press_event', press_event)
update(0)


text:
package com.sun.corba.se.spi.ior.iiop;

import java.util.List ;
import java.util.Iterator ;

import org.omg.CORBA_2_3.portable.OutputStream ;

import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;

import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
import com.sun.corba.se.spi.orb.ORB ;

/**
 * IIOPProfileTemplate represents the parts of an IIOPProfile that are independent
 * of the object identifier.  It is a container of tagged components.
 */
public interface IIOPProfileTemplate extends TaggedProfileTemplate
{
    /** Return the GIOP version of this profile.
    */
    public GIOPVersion getGIOPVersion() ;

    /** Return the IIOP address from the IIOP profile.  This is called the
    * primary address here since other addresses may be contained in
    * components.
    */
    public IIOPAddress getPrimaryAddress()  ;
}

redpajama_set_name: RedPajamaGithub


This Outstanding Doll Truly Makes For A "Talk" Piece In Your Home.
Hand Crafted, "The Immigrant" Enters The USA Through Ellis Island With His Suitcase, Papers And ID Number. It Comes With A Certificate Of Authenticity. The Hair, Face And Hands Look So Real.
The Sculpture Measures Approximately 19 1/2"H X 6"W.


Saigon Café on level 1 of the hotel will offer a Vietnamese-themed buffet dinner on Lunar New Year's Eve, February 15 to welcome the Year of the Dog. The buffet features an array of traditional Vietnamese dishes including crispy pork with honey and sesame seeds, braised prawn with young coconut juice, chicken curry, hot and sour fish soup, fried rice with salted fish and shredded chicken and wok fried crab with Tamarind sauce. The buffet available from 6 p.m. to 10 p.m. is priced at VND1.5 million++, including free flow of sparkling wine, house wine, draft beer and soft drinks. In addition, the restaurant will prepare a special buffet dinner for couples on Valentine's Day (February 14), which falls on the 29th of the 12th lunar month this year. Meanwhile, those seeking a peaceful and romantic place to celebrate the day of love could contemplate Level 23 Signature Restaurant decorated with roses and candles. Diners will be served with a five-course menu accompanied with a glass of Moet & Chandon rose champagne from 6 p.m. to 10 p.m. on February 14, with prices starting from VND1.9 million++ per set menu.


text:
The Unique Purposes of Rocks and Stones
Lisa Doss
For thousands of years, humans forced or moved one of Earth's most plentiful resources – rocks were the means to change our standard of living. Curiosity, trial, and invention created cement, building materials, a statue, or an attraction. Across time, individuals had the titles of builder or architect, landscaper or artist; today, those titles suit the homeowner, who continues to seek ways to use rocks and stones purposefully. In the season of outdoor projects, you may be looking for a decorating, eye-catching idea to add to your yard or garden. The answer may be in rocks and stones!
What is the Difference Between a Rock and a Stone?
The cohesion of solidified minerals such as quartz, feldspar, mica, amphibole, olivine, and calcite that form a mass is a rock. Although the words themselves are interchangeable, rocks can be rough and smooth; but only a stone can fit inside a pocket.
Rock Pathways
Similar to the shapes of clouds, rocks and stones catch our attention. We happen upon them in our wanderings, and discover once in a while, the coloring or form is the only reason needed to transfer it home. You, too, may be a collector of stones. When a few rocks become a pile, one solution is to create a pathway.
Tips: Organize your stones into piles according to thickness. Consider whether you want a natural pathway covered with moss and other types of creeping perennials, or one secured in concrete. Ensure the dirt is removed well below the grass line and leveled flat. Add a layer of rocks to encourage drainage before placing handfuls of soil on top before adding each stone. Creeping perennials need very little depth and water. Choose the most massive stones for your pathway and smaller stones for decoration.
The Stone Wall
The dry stacked stone wall is both a successful and attractive building technique. While it does not take a professional to level the ground, add a bottom layer of small stones, and begin the task of layering two similar-sized flat rocks for a thickened solid wall. The total number required may change your overall dimensions.
Tips: How-to-videos will assist in offering useful tips in preparing the wall, needed and helpful tools, maintaining a straight line, and stacking advice.
The Dry Creek
An accumulated amount of small to semi-heavy stones can comprise a decorative design in your yard, especially for areas of barrenness or where drainage is needed. By planting perennials to suit either drought or wet locations, you will add splashes of color.
Tips: Before starting, consider the width and the depth of your creek. A broad "u-shape" is best, lined with thick plastic sheets. Test your creek by watching a bucket of water flow over the rocks. Low areas may change your desired course unless you alter the depth of the creek bed to force the flow in a different direction. A dry creek can incorporate striking features such as a small pond, waterfalls, or a design of "S-curves." Plan well!
Tower of Rocks
Stacking objects in a conical form is a natural curiosity. From an early age, children test their ability to balance and use hand-eye coordination to counterbalance stones. You, too, can create a tower of rocks with the aid of a drill, a rod of rebar, and a diverse grouping of stones. As a decoration, the structure could be a simple attraction in a flower garden,
The Personalized Rock Picture
Large rectangular stone chards with one perfectly round and flat stone comprise the pieces to create a picture of the sun. You, too, may have segments in hopes of creating a dragonfly, footprints, a letter, or number. Arranging the rock pieces among other stones or in concrete are two options.
Stepping Stone Instructions: With a handsaw or circular saw, cut a 12" diameter and 2" thick from a concrete building tube. Pour concrete until it reaches ¾ full within the mold. Use a trowel to smooth and eliminate air bubbles. Quickly transfer the design picture starting from the center and working outward. With a plastic drop cloth, cover the stones for 24 hours; then, remove the mold to allow the concrete a week to cure before arranging the stepping stones in the garden.
From small to large projects, this spring and summer, you can begin investing time in building with an amazing resource, rocks and stone!
Forsyth Magazines writer since 2012. Lisa is originally from Maryland and, after living in New York, Colorado and Texas, she's proud to finally call North Carolina home. Lisa shares a home with her husband of 10 years, Kevin. Together, they have daughter, Sayre and their angel-son, Finn who lived two years. Their family also includes two dogs. Lisa has a degree in education and, as such, writes many educational articles for the magazines. Lisa enjoys traveling, is an avid reader and has done extensive work on her family's genealogy. She is a state certified beekeeper since 2018 and a certified master gardener since 2019. When it comes to writing for Forsyth Magazines, Lisa said, "I love writing spring themes in winter, back to school articles in the heat of summer, and, best of all, starting to anticipate the Christmas season in October."
PrevPrevious ArticleHow Introverts Can Enjoy Parties More
Next ArticleThe Health Benefits of CatsNext

redpajama_set_name: RedPajamaCommonCrawl


text:
Back English Deutsch
Account Orders Services Sign out
Back Account Orders Services Sign out
Back ⯅
Improve Customer Email Interactions
Improve Customer Email Interaction with KPMG Intelligent Interactions
Email remains one of the most used ways customers interact with businesses with about 281 billion emails sent every day. It is common for customers to email businesses with inquiries such as why their mobile phone service provider charged a certain fee or to add a new service to their account.
In our example, a bank has charged an overdraft fee. Unexplained fees can jeopardize relationships, especially if customers can't understand the reason for a fee and can't get a resolution quickly.
We developed KPMG Intelligent Interactions for email and other channels to help meet this challenge. These solutions, built using Google Cloud APIs and KPMG-developed custom models, apply machine learning and other automations such as RPA (Robotic Process Automation) to help businesses answer inquiries and solve customer issues in a less costly, more efficient manner.
When frustrated customers inquire about fees, businesses need to respond quickly to identify the issue and initiate interaction based on the customers intent and sentiment.
KPMG Intelligent Interactions incorporates cloud, artificial intelligence and automation technologies to create a more consistent experience by design. The system uses natural language processing to identify key words and understand a customer's mood. In this case, key words show the customer is frustrated. The system can also automatically contextualize a conversation's importance. It then uses machine learning and big data to select an appropriate response and automatically displays the customer's details for the human agent, augmenting his actions and enabling a better customer experience.
The system allows companies to customize how it displays information on each customer. Based on the inquiry type, the system recommends a response for the customer support representative. It replaces template content such as the assessed fee amount.
The human agent reviews the answer, has the opportunity to reject, edit or verify it and delivers the response to the customer.
Automation reduces manual copy & paste efforts, as well as the need for customer service agents to juggle systems. The saved time allows agents to handle more inquiries and focus on high-value customer interactions.
The customized response improves the customer experience by providing information about the charge and how to avoid future fees.
As the interaction continues, the customer asks which payment caused the overdraft. The system used machine learning to determine that they have not overdrafted their account in more than a year and are considered a premium customer. Based on the customer's relationship, the system automatically removes the fee and proactively offers options to eliminate future issues.
Once the issue is resolved, the system applies the data related to the interaction to enhance its ability to serve future customers.
By supporting customers with a transparent blend of human and system support, businesses are able to build trust with customers while improving the system's effectiveness and augmenting agent performance.
Get in contact with us and request a demo.
Order Demo
Find more information on KPMG Source.
Go to KPMG Source
© 2022 KPMG AG Wirtschaftsprüfungsgesellschaft, a corporation under German law and a member firm of the KPMG global organization of independent member firms affiliated with KPMG International Limited, a private English company limited by guarantee. All rights reserved.


This is your MVP (membership vice president of course) reporting in for a spotlight! I am so beyond excited to see what is in store for us this frigid semester (hopefully some sun rays (; ) A little about me I guess.... I am a Speech Pathology and Audiology major with a minor in Psychology! I have only been in college for 3 years, but I will be graduating this spring and going onto 4 years of grad school (ewwww)! My favorite piece about my life right now, besides APO obviously, is that I coach an Upward basketball in Aurora with Kali (the service chair). Our team is made up of 10 girls who are 1-3rd grade and they are all every bit of sassy!
I am also getting married this July to the most amazing guy and I cannot wait to see what is planned for our future!
I am actively involved on campus. Besides APO, I have been on Hall council, an RA, a research assistant, and an SSL. This year, I work at the New Front desk where I see a lot of your lovely faces and I am a part of CRU.
Enough about me, stay tuned next week to learn more about your Pledge Educator!


As scientific understanding of both altruism and the plasticity of the human brain – and, in a sense, of human heredity – becomes more sophisticated, might we actually engineer ourselves to become better people?
We're not there, for sure ... but as the technology improves, becomes more precise, anybody who is forward-looking will want to take information, and as we think about what we're learning about, it'll help determine how we teach people in the future and sculpt their brains over many thousands of years.
It's hard to tell where we're going to go. We don't know what the social situation is. Look at any child in any different culture, how a child learns information now. We can see that the brain is highly programmed, in a sense, to subserve the knowledge we're teaching.
Aspects of that vary across cultures. The information we gather from various sciences: can we take it out of individual child and development, and think about it in terms of evolution across the brain across generations?
It's like a meme ... not simply in the ether, though, but actually impacting our brain.
Our own brains become a little more adaptable and adaptive during life, or we couldn't grow and change.... We know that, and it gives us an opportunity, when people have brain injuries, to help people recover better, to be able to deal with the world around them. It's not usually as dramatic as emphasizing, for example, certain brain areas to the detriment of others, depending on the way we're teaching new knowledge.... But you want to be able to say, with some certainty, that the way we gain knowledge, and what we do with that, will affect the evolution of our brain. And evolving doesn't necessarily mean evolving in a good sense. If you're really a future thinker, you're worried about that.
Other great apes have a frontal lobe, fairly well developed, but not nearly as well developed as our own. If you believe in Darwin and evolution, you argue that the area grew, and the neural architecture had to change in some way to accommodate the abilities associated with that behavior. There's no doubt that didn't occur overnight; probably a slow change, and it was one of the last areas of the brain to develop as well. It's very recent evolutionary development that humans took full advantage of. What in the future? What in the brains can change?
The issue becomes – do we teach this? Train people to do this?
Children tend to be selfish, and have to be taught to share. One of the most primitive things you see is self-preservation. If we can make altruism seem like a more appropriate and rewarding activity than it is.... It's a skill. You gotta get good at it. You teach some of these things, but don't feel it's necessarily at the opposite end f what we call competitive. You can still be competitive, but have an altruistic streak. They can work together. We want more social bonding and less conflict.


text:
Spirit Riding Free (Nederlandse titel: Spirit – Samen vrij)  is een met de computer geanimeerde televisieserie gebaseerd op Spirit: Stallion of the Cimarron. De serie is geproduceerd door Dreamworks Animation Television en wordt uitgegeven door Netflix. De serie ging in première op 5 mei 2017 en in hetzelfde jaar zijn seizoen 2 en 3 ook nog uitgekomen.

Verhaal
In een kleine stad (Miradero) in Texas komt een twaalfjarig meisje genaamd Fortuna ''Lucky'' Prescott, dat pasgeleden uit de stad is gekomen, een wilde mustang tegen met de naam Spirit. Spirit wordt gevangengenomen door paardenhandelaren, en wordt meegenomen naar Miradero om vervolgens doorverkocht te worden. Alleen is Spirit een wild paard en lukt het de handelaren niet om hem tam te krijgen. Lucky krijgt een band met Spirit, en daarom wordt besloten dat het paard bij Lucky hoort. Ook leert Lucky twee andere meiden kennen: Pru(dence) en Abigail die zelf allebei een paard hebben. Tezamen met de paarden gaan ze iedere dag op avontuur in het land.

Rolverdeling
Amber Frank als Fortuna "Lucky" Esperanza Navarro Prescott
Sydney Park als Pru(dence) Granger
Bailey Gambertoglio als Abigail Stone
Darcy Rose Byrnes als Maricela
Nolan North als Jim Prescott
Kari Wahlgren als Aunt Cora
Jeff Bennett als Mesteneros
Tiya Sircar als Miss Flores

Nederlandse rolverdeling
Lucky: Vajen van den Bosch
Pru(dence): Jeske van de Staak
Abigail: Sanne Bosman
Maricela: Bente van den Brand
Tante Cora: Peggy Vrijens
Meneer Granger: Murth Mossel
Althea: Marjolein Algera
Knip: Moos Parser
Neef Julian: Finn Karels
Mevrouw Kate Flores: Reneé van Wegberg
Mixtli: Enzo Coenen

Spin-off series
 Spirit Riding Free: Pony Tales, ging in première op 9 augustus 2019.
 Spirit Riding Free: Riding Academy, ging in première op 3 april 2020.

Externe links

Programma van Netflix
Amerikaanse animatieserie
Televisieserie gebaseerd op een film

redpajama_set_name: RedPajamaWikipedia


There's a heavily-reduced schedule in Sky Bet League One this weekend, with a number of teams in FA Cup action.
However, five fixtures remain, with Southend United — 13 games unbeaten — hosting table-topping Sheffield United in a game brought forward, and third-placed Scunthorpe United welcoming Bury, who are 15 league games without a win.
1. Four of the last five meetings between Bradford and Chesterfield have finished 1-0 the side away from home, with the exception being the Bantams' 2-0 Valley Parade triumph to close out the 2015/16 season.
2. Bristol Rovers and Northampton meet for the 99th time this weekend. The Cobblers are on top with 38 wins to 32, but the Gas won the reverse fixture 3-2 back in October.
3. After a pair of 2-2 draws in 2013/14, Scunthorpe have won the last three encounters against Bury by two goals to one. Prior to those draws, Bury won 2-1 on consecutive occasions.
4. Southend's 13-game undefeated streak is only bettered this season by the 15-match stretch set by Sheffield United earlier in the campaign. The Blades have won their last five, so something must give at Roots Hall.
5. Swindon have won all five of their home matches with Shrewsbury since the turn of the century, with the Shrews' last County Ground success coming in April 1996.


New year, new you, new jewelry. There isn't a better way to celebrate birthdays than with gorgeous baubles.
January babies have the privilege of kick-starting the year of birthstone festivities with garnet, a versatile gemstone worth celebrating.
From rhodolite garnet to spessartine garnet and mandarin garnet to tsavorite garnet, the gem proves it is as diverse as the individuals who wear it.
Here are a few Amanda's Style File selects for those born in the first month of the year.


text:
package ch.javasoft.metabolic.parse;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import ch.javasoft.metabolic.MetabolicNetwork;
import ch.javasoft.metabolic.Metabolite;
import ch.javasoft.metabolic.MetaboliteRatio;
import ch.javasoft.metabolic.Reaction;
import ch.javasoft.metabolic.fa.FaConstants;
import ch.javasoft.metabolic.fa.FaConstants.SuperNet;
import ch.javasoft.metabolic.impl.DefaultMetabolicNetwork;
import ch.javasoft.metabolic.impl.DefaultMetaboliteRatio;
import ch.javasoft.metabolic.impl.DefaultReaction;
import ch.javasoft.metabolic.impl.FilteredMetabolicNetwork;
import ch.javasoft.metabolic.parse.junit.AbstractParseTestCase;
import ch.javasoft.metabolic.util.MetabolicNetworkUtil;
import ch.javasoft.metabolic.util.Output;
import ch.javasoft.util.Arrays;

abstract public class FaColiTest extends AbstractParseTestCase {

	protected FaConstants.SubNet 	mSubNet;
	protected FaConstants.SuperNet	mSuperNet;

	@Override
	protected void setUp() throws Exception {
		mSubNet		= null;
		mSuperNet	= null;
		super.setUp();
	}
	@Override
	protected void tearDown() throws Exception {
		mSubNet		= null;
		mSuperNet	= null;
		super.tearDown();
	}

	public void testSuperAll() throws Exception {
		internalTest(FaConstants.SUPERALL_UP_AMINO_EX_SUCC);
	}
	public void testSuperXXX() throws Exception {
		internalTest(FaConstants.SUPERXXX_UP_ASP_GLU_SER_THR_TRP_EX_SUCC);
	}
	public void testSuperXXTrp() throws Exception {
		internalTest(FaConstants.SUPERXX_UP_ASP_GLU_SER_TRP_EX_SUCC);
	}
	public void testSuperXXThr() throws Exception {
		internalTest(FaConstants.SUPERXX_UP_ASP_GLU_SER_THR_EX_SUCC);
	}
	public void testSuperX() throws Exception {
		internalTest(FaConstants.SUPERX_UP_ASP_GLU_SER_EX_SUCC);
	}
	public void testSuper() throws Exception {
		internalTest(FaConstants.SUPER_UP_ASP_EX_SUCC);
	}
	public void testAll() throws Exception {
		internalTest(FaConstants.SUBNET_ALL);
	}
	public void testAllAccumulate() throws Exception {
		internalTest(allowMetaboliteAccumulation(FaConstants.SUBNET_ALL));
	}
	public void testAllX() throws Exception {
		internalTest(FaConstants.SUPER_EX_SUCC);
	}
	public void testAc() throws Exception {
		internalTest(FaConstants.SUBNET_AC);
	}
	public void testAcAccumulate() throws Exception {
		internalTest(allowMetaboliteAccumulation(FaConstants.SUBNET_AC));
	}

	public void testNoEx() throws Exception {
		internalTest(FaConstants.SUBNET_NOEX);
	}
	public void testAce() throws Exception {
		internalTest(FaConstants.SUBNET_ACE);
	}
	public void testAceAccumulate() throws Exception {
		internalTest(allowMetaboliteAccumulation(FaConstants.SUBNET_ACE));
	}

	public void testGl() throws Exception {
		internalTest(FaConstants.SUBNET_GL);
	}
	public void testGl(String amino) throws Exception {
		FaConstants.SuperNet superNet = new SuperNet(
			"glpts_" + amino, new String[][] {
				FaConstants.SUCC_EX,
				findAmino(amino)
			},
			FaConstants.GL_PTS_UP_ALL_AMINO_EX_SUCC.excludeReactions
		);
		internalTest(superNet);
	}
	public void testGlX() throws Exception {
		internalTest(FaConstants.GL_EX_SUCC);
	}
	public void testGlX_MTHF_forward_only() throws Exception {
		SuperNet net = new SuperNet(
			"glx", new String[][] {
				FaConstants.SUCC_EX,
				{"MTHF_Synth", "ATP + NADPH --> MTHF"}
			},
			new String[] {"Succ_up", "Glyc_up", "Ac_up", "MTHF_Synth"}
		);
		internalTest(net);
	}
	public void testGlX(String amino) throws Exception {
		FaConstants.SuperNet superNet = new SuperNet(
			"glx_" + amino, new String[][] {
				FaConstants.SUCC_EX,
				findAmino(amino)
			},
			FaConstants.GL_UP_ALL_AMINO_EX_SUCC.excludeReactions
		);
		internalTest(superNet);
	}
	private String[] findAmino(String amino) {
		for (int i = 0; i < FaConstants.AMINO.length; i++) {
			if (FaConstants.AMINO[i][0].startsWith(amino)) {
				return FaConstants.AMINO[i];
			}
		}
		throw new IllegalArgumentException("no such amino acid: " + amino);
	}
	public void testGlXXAmino_AlaAspGluHisPheSerThr() throws Exception {
		internalTest(FaConstants.GL_UP_ALA_ASP_GLU_HIS_PHE_SER_THR_EX_SUCC);
	}
	public void testGlXAmino_AlaAspGluHisPheSer() throws Exception {
		internalTest(FaConstants.GL_UP_ALA_ASP_GLU_HIS_PHE_SER_EX_SUCC);
	}
	public void testGlAmino_AlaAspGluPheSer() throws Exception {
		internalTest(FaConstants.GL_UP_ALA_ASP_GLU_PHE_SER_EX_SUCC);
	}
	public void testGlPtsXXXAmino_AlaAspGluHisPheSerThrVal() throws Exception {
		internalTest(FaConstants.GL_PTS_UP_ALA_ASP_GLU_HIS_PHE_SER_THR_VAL_EX_SUCC);
	}
	public void testGlPtsXXAmino_AlaAspGluHisPheSerThr() throws Exception {
		internalTest(FaConstants.GL_PTS_UP_ALA_ASP_GLU_HIS_PHE_SER_THR_EX_SUCC);
	}
	public void testGlPtsXAmino_AlaAspGluHisPheSer() throws Exception {
		internalTest(FaConstants.GL_PTS_UP_ALA_ASP_GLU_HIS_PHE_SER_EX_SUCC);
	}
	public void testGlPtsAmino_AlaAspGluPheSer() throws Exception {
		internalTest(FaConstants.GL_PTS_UP_ALA_ASP_GLU_PHE_SER_EX_SUCC);
	}

	public void testGly() throws Exception {
		internalTest(FaConstants.SUBNET_GLY);
	}

	public void testStandard() throws Exception {
		internalTest(FaConstants.SUBNET_STANDARD);
	}
	public void testStandardAccumulate() throws Exception {
		internalTest(allowMetaboliteAccumulation(FaConstants.SUBNET_STANDARD));
	}

	public void testSuc() throws Exception {
		internalTest(FaConstants.SUBNET_SUC);
	}

	private FaConstants.SubNet allowMetaboliteAccumulation(FaConstants.SubNet subNet) {
		return new FaConstants.SubNet(subNet.name + "-accumulate", subNet.excludeReactions, true);
	}

	private void internalTest(FaConstants.SuperNet superNet) throws Exception {
		MetabolicNetwork net	= FluxAnalyserParser.parse(FaConstants.COLI_FOLDER);
		Reaction[] addReacts	= new PalssonParser(false /*don't check consistency*/).parseReactions(new StringReader(superNet.toString()));
		//test whether metabolites exist
		for (Reaction reac : addReacts) {
			for (MetaboliteRatio ratio : reac.getMetaboliteRatios()) {
				String metaName = ratio.getMetabolite().getName();
				if (net.getMetabolite(metaName) == null) {
					new Output(System.err).printMetabolites(net, true, true);
					throw new RuntimeException("metabolite " + metaName + " not found in network.");
				}
			}
		}
		Reaction[] reacts = new Reaction[net.getReactions().length() + addReacts.length];
		net.getReactions().toArray(reacts);
		System.arraycopy(addReacts, 0, reacts, net.getReactions().length(), addReacts.length);
		MetabolicNetwork supNet = new DefaultMetabolicNetwork(reacts);
		if (superNet.excludeReactions.length > 0) {
			FilteredMetabolicNetwork fNet = new FilteredMetabolicNetwork(supNet);
			fNet.excludeReactions(superNet.excludeReactions);
			supNet = fNet;
		}
		mSuperNet = superNet;
		internalTest(supNet, null);
	}

	private void internalTest(FaConstants.SubNet subNet) throws Exception {
		MetabolicNetwork net = FluxAnalyserParser.parse(FaConstants.COLI_FOLDER);
		if (subNet.allowMetaboliteAccumulation) {
			Set<String> hasEx = new HashSet<String>();
			for (Reaction reac : net.getReactions()) {
				if (reac.isExtract() && reac.getMetaboliteRatios().length() == 1) {
					hasEx.add(reac.getMetaboliteRatios().get(0).getMetabolite().getName());
				}
			}
			List<Reaction> ex = new ArrayList<Reaction>();
			for (Metabolite meta : net.getMetabolites()) {
				ex.add(new DefaultReaction(meta.getName() + "_ex", new MetaboliteRatio[] {new DefaultMetaboliteRatio(meta, -1)}, false));
			}
			Reaction[] reacts = new Reaction[net.getReactions().length() + ex.size()];
			net.getReactions().toArray(reacts);
			System.arraycopy(ex.toArray(), 0, reacts, net.getReactions().length(), ex.size());
			net = new DefaultMetabolicNetwork(reacts);
		}

		final Set<String> suppressedReacs = Arrays.asSet(subNet.excludeReactions);

		mSubNet = subNet;
		internalTest(net, suppressedReacs);
	}

	protected void internalTest(MetabolicNetwork network, Set<String> suppressedReactions) throws Exception {
		LogPkg.LOGGER.finer("original network:     " + MetabolicNetworkUtil.getReactionNamesString(network));
		LogPkg.LOGGER.finer("suppressed reactions: " + suppressedReactions);
		internalTestOrDelegate(network, suppressedReactions);
	}

}


Kentucky Packrat: It Burns! It Burns!
My skin does, at least. Our neighbor is in the horse-racing industry, and he obtained tickets to the Churchill Downs day at Six Flags Kentucky Kingdom for his family and ours. We were able to keep the kids lathered in sunscreen, but Milady and I couldn't keep ourselves lathered up. We're both toasty red in several spots.
I'm also starting to hurt. Number One Son took a friend with him, and both of them wanted to go into the 5 foot section of Kentucky Kingdom's big wave pool. They couldn't stand up themselves, so I had to hold them up on the high waves. Considering that each of them weights over 130 pounds (and neither is overweight), I hurt today. A lot.
What's worse, Number One Son is turning into a daredevil. He talked his friend and I into riding The Tornado. You get on a raft, then slide for a moment before going straight down a couple of stories into this big funnel. You then go up a couple of stories on the other side, and start down again. Number 1 Son wanted to go again, and also insisted on riding everything that even remotely resembled a roller coaster. He only rode the smaller ones this time, since no one else would go on the scarier one with him.


text:
package org.noorganization.instalist.server.api;

import com.fasterxml.jackson.databind.util.ISO8601Utils;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.noorganization.instalist.server.AuthenticationFilter;
import org.noorganization.instalist.server.CommonData;
import org.noorganization.instalist.comm.message.CategoryInfo;
import org.noorganization.instalist.server.controller.impl.ControllerFactory;
import org.noorganization.instalist.server.model.Category;
import org.noorganization.instalist.server.model.DeletedObject;
import org.noorganization.instalist.server.model.Device;
import org.noorganization.instalist.server.model.DeviceGroup;
import org.noorganization.instalist.server.support.DatabaseHelper;

import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;

import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import static org.junit.Assert.*;

public class CategoriesResourceTest extends JerseyTest {

    private EntityManager mManager;
    private DeviceGroup   mGroup;
    private DeviceGroup   mNotAccessibleGroup;
    private String        mToken;
    private Category      mCategory;
    private Category      mNotAccessibleCategory;
    private DeletedObject mDeletedCategory;

    @Override
    protected Application configure() {
        enable(TestProperties.LOG_TRAFFIC);
        enable(TestProperties.DUMP_ENTITY);

        ResourceConfig rtn = new ResourceConfig(CategoriesResource.class);
        rtn.register(AuthenticationFilter.class);
        return rtn;
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();

        CommonData data = new CommonData();

        mManager = DatabaseHelper.getInstance().getManager();
        mManager.getTransaction().begin();
        mGroup = new DeviceGroup();
        Instant now = Instant.now();
        Device aDev = new Device().withAuthorized(true).withGroup(mGroup).
                withSecret(data.mEncryptedSecret).withName("testDev");
        mCategory = new Category().withGroup(mGroup).withName("cat1").withUUID(UUID.randomUUID()).
                withUpdated(now);
        mDeletedCategory = new DeletedObject().withGroup(mGroup).
                withType(DeletedObject.Type.CATEGORY).withUUID(UUID.randomUUID()).withUpdated(now);
        mNotAccessibleGroup = new DeviceGroup().withUpdated(Date.from(now));
        mNotAccessibleCategory = new Category().withGroup(mNotAccessibleGroup).withName("cat2").
                withUUID(UUID.randomUUID()).withUpdated(now);

        mManager.persist(mGroup);
        mManager.persist(aDev);
        mManager.persist(mCategory);
        mManager.persist(mDeletedCategory);
        mManager.persist(mNotAccessibleGroup);
        mManager.persist(mNotAccessibleCategory);
        mManager.flush();
        mManager.getTransaction().commit();
        mManager.refresh(mGroup);
        mManager.refresh(aDev);
        mManager.refresh(mCategory);
        mManager.refresh(mDeletedCategory);
        mManager.refresh(mNotAccessibleGroup);
        mManager.refresh(mNotAccessibleCategory);

        mToken = ControllerFactory.getAuthController().getTokenByHttpAuth(mManager, aDev.getId(),
                data.mSecret);
        assertNotNull(mToken);
    }

    @After
    public void tearDown() throws Exception {
        mManager.close();
        super.tearDown();
    }

    @Test
    public void testGetCategories() throws Exception {
        final String url = "/groups/%d/categories";
        Response wrongTokenResponse = target(String.format(url, mGroup.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongToken").get();
        assertEquals(401, wrongTokenResponse.getStatus());

        Response wrongGroupResponse = target(String.format(url, mNotAccessibleGroup.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).get();
        assertEquals(401, wrongGroupResponse.getStatus());

        Response wrongTimeResponse = target(String.format(url, mGroup.getId())).
                queryParam("changedsince", "So 7. Feb 18:26:52 CET 2016").
                request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).get();
        assertEquals(400, wrongTimeResponse.getStatus());

        Response okResponse = target(String.format(url, mGroup.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).get();
        assertEquals(200, okResponse.getStatus());
        CategoryInfo[] allCategories = okResponse.readEntity(CategoryInfo[].class);
        assertEquals(2, allCategories.length);
        for (int i = 0; i < 2; i++) {
            assertNotNull(allCategories[i].getLastChanged());
            if (mDeletedCategory.getUUID().equals(UUID.fromString(allCategories[i].getUUID()))) {
                assertNull(allCategories[i].getName());
                assertTrue(allCategories[i].getDeleted());
                assertEquals(mDeletedCategory.getUpdated(), allCategories[i].getLastChanged().
                        toInstant());
            } else if (mCategory.getUUID().equals(UUID.fromString(allCategories[i].getUUID()))) {
                assertEquals("cat1", allCategories[i].getName());
                assertFalse(allCategories[i].getDeleted());
                assertEquals(mCategory.getUpdated(), allCategories[i].getLastChanged().toInstant());
            } else {
                fail("Got wrong category.");
            }
        }

        Response okResponseEmpty = target(String.format(url, mGroup.getId())).
                queryParam("changedsince", ISO8601Utils.format(new Date(
                        System.currentTimeMillis() + 10000), true)).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).get();
        assertEquals(200, okResponseEmpty.getStatus());
        CategoryInfo[] noCategories = okResponseEmpty.readEntity(CategoryInfo[].class);
        assertEquals(0, noCategories.length);
    }

    @Test
    public void testPutCategory() throws Exception {
        final String url = "/groups/%d/categories/%s";
        Response wrongTokenResponse = target(String.format(url, mGroup.getId(), mCategory.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongToken").
                put(Entity.json(new CategoryInfo().withName("dev111")));
        assertEquals(401, wrongTokenResponse.getStatus());

        Response wrongGroupResponse = target(String.format(url, mNotAccessibleGroup.getId(),
                mCategory.getUUID().toString())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                put(Entity.json(new CategoryInfo().withName("dev111")));
        assertEquals(401, wrongGroupResponse.getStatus());

        Response wrongCatResponse = target(String.format(url, mGroup.getId(),
                mNotAccessibleCategory.getUUID().toString())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                put(Entity.json(new CategoryInfo().withName("dev111")));
        assertEquals(404, wrongCatResponse.getStatus());

        Response invalidCatResponse = target(String.format(url, mGroup.getId(), mCategory.
                getUUID().toString())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                put(Entity.json(new CategoryInfo().withUUID(mNotAccessibleCategory.getUUID().toString()).
                        withName("dev111")));
        assertEquals(400, invalidCatResponse.getStatus());
        mManager.refresh(mNotAccessibleCategory);
        mManager.refresh(mCategory);
        assertEquals("cat1", mCategory.getName());
        assertEquals("cat2", mNotAccessibleCategory.getName());

        Instant beforeChange = Instant.now();
        Thread.sleep(200);
        Response validCatResponse = target(String.format(url, mGroup.getId(), mCategory.getUUID().
                toString())).request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                put(Entity.json(new CategoryInfo().withName("dev111")));
        assertEquals(200, validCatResponse.getStatus());
        mManager.refresh(mCategory);
        assertEquals("dev111", mCategory.getName());
        assertTrue(beforeChange.isBefore(mCategory.getUpdated()));

        Response conflictCatResponse = target(String.format(url, mGroup.getId(), mCategory.
                getUUID().toString())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                put(Entity.json(new CategoryInfo().withName("cat1").
                        withLastChanged(Date.from(beforeChange))));
        assertEquals(409, conflictCatResponse.getStatus());
        mManager.refresh(mCategory);
        assertEquals("dev111", mCategory.getName());
        assertTrue(beforeChange.isBefore(mCategory.getUpdated()));
    }

    @Test
    public void testPostCategory() throws Exception {
        final String url = "/groups/%d/categories";

        UUID uuid = UUID.randomUUID();
        Response wrongTokenResponse = target(String.format(url, mGroup.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token wrongToken").
                post(Entity.json(new CategoryInfo().withUUID(uuid).withName("cat3")));
        assertEquals(401, wrongTokenResponse.getStatus());

        Response wrongGroupResponse = target(String.format(url, mNotAccessibleGroup.getId())).
                request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                post(Entity.json(new CategoryInfo().withUUID(uuid).withName("cat3")));
        assertEquals(401, wrongGroupResponse.getStatus());

        Response invalidCatResponse = target(String.format(url, mGroup.getId())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                post(Entity.json(new CategoryInfo().withUUID(uuid)));
        assertEquals(400, invalidCatResponse.getStatus());

        Response conflictCatResponse = target(String.format(url, mGroup.getId())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                post(Entity.json(new CategoryInfo().withUUID(mCategory.getUUID()).
                        withName("cat3")));
        assertEquals(409, conflictCatResponse.getStatus());

        mManager.refresh(mCategory);
        assertEquals("cat1", mCategory.getName());

        Response validCatResponse = target(String.format(url, mGroup.getId())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).
                post(Entity.json(new CategoryInfo().withUUID(uuid).withName("cat3")));
        assertEquals(201, validCatResponse.getStatus());
        TypedQuery<Category> savedCatQuery = mManager.createQuery("select c from Category c where " +
                "c.UUID = :uuid and c.group = :groupid", Category.class);
        savedCatQuery.setParameter("uuid", uuid);
        savedCatQuery.setParameter("groupid", mGroup);
        List<Category> savedCats = savedCatQuery.getResultList();
        assertEquals(1, savedCats.size());
        assertEquals("cat3", savedCats.get(0).getName());
    }

    @Test
    public void testDeleteCategoryById() throws Exception {
        final String url = "/groups/%d/categories/%s";
        Response wrongTokenResponse = target(String.format(url, mGroup.getId(),
                mCategory.getUUID())).request().header(HttpHeaders.AUTHORIZATION, "X-Token " +
                "wrongToken").delete();
        assertEquals(401, wrongTokenResponse.getStatus());

        Response wrongGroupResponse = target(String.format(url, mNotAccessibleGroup.getId(),
                mCategory.getUUID())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete();
        assertEquals(401, wrongGroupResponse.getStatus());

        Response wrongCatResponse = target(String.format(url, mGroup.getId(),
                mNotAccessibleCategory.getUUID())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete();
        assertEquals(404, wrongCatResponse.getStatus());
        mManager.clear();
        assertNotNull(mManager.find(Category.class, mNotAccessibleCategory.getId()));

        Response goneCatResponse = target(String.format(url, mGroup.getId(),
                mDeletedCategory.getUUID())).request().
                header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete();
        assertEquals(410, goneCatResponse.getStatus());

        Response validCatResponse = target(String.format(url, mGroup.getId(), mCategory.getUUID()))
                .request().header(HttpHeaders.AUTHORIZATION, "X-Token " + mToken).delete();
        assertEquals(200, validCatResponse.getStatus());
        mManager.clear();
        assertNull(mManager.find(Category.class, mCategory.getId()));
        TypedQuery<DeletedObject> deletedCat1Query = mManager.createQuery("select do from " +
                "DeletedObject do where do.UUID = :uuid and do.group = :groupid and " +
                "do.type = :type", DeletedObject.class);
        deletedCat1Query.setParameter("uuid", mCategory.getUUID());
        deletedCat1Query.setParameter("groupid", mGroup);
        deletedCat1Query.setParameter("type", DeletedObject.Type.CATEGORY);
        List<DeletedObject> deletedCat1 = deletedCat1Query.getResultList();
        assertEquals(1, deletedCat1.size());
    }
}


Upon his ascendancy to power and remembering his first inaugural address, he challenged the nation to wake up from its crippling state of inaction.
The President in his inaugural address highlighted several key issues his government will address among them support to Liberian-owned businesses to stop Liberians from being spectators to their own economy.
I have spent my life in stadiums but I've never felt like this," Weah said in his inaugural address, AFP reported.
Shakya, in his inaugural address, said that the exhibition has contributed to enhance people-to people relations between the two countries, Nepal and China.
Khaled Awad, the first president of the American Concrete Institute (ACI) from outside the Americas, delivered his inaugural address in California, where he indicated that institute will take part in the inaugural Big 5 Heavy expo in Dubai, UAE, next year (March 23 to 28).
Mohammad Qasim Bughio Chairman PAL will deliver inaugural address.
Rajitha Senarathne delivered the inaugural address of the session and explained the health situation of the country.
The Sermon on the Mount in today's Gospel can be likened to an inaugural address.
Donald Trump was a candidate like no other and a president-elect like no other, so it's no surprise that he would deliver an inaugural address unlike any that has come before.
Following the inaugural address, Congress was to host a luncheon for Trump, Vice President-elect Mike Pence and their families.
With Governor K Rosaiah's inaugural address of the first session of the 15th Legislative Assembly, the mothballed Sriperumbudur plant of Nokia, once the world's single largest mobile phone-making unit, is seeing flickering hopes of revival.


Another death reported after woman became entrapped between the mattress and the recalled bed handles.
The yarn from the sheep figures can unravel, posing an entanglement and strangulation hazard to young children.
Consumers should immediately put the recalled mobiles out of the reach of children and contact The Land of Nod for a full refund.
Three women died after becoming entrapped between the mattress and the recalled bed handles.
Consumers should immediately stop using the recalled garments and contact Precious Cargo to return them for a full refund.
The multivitamin supplement tablets inside the non child-resistant bottles contain iron, which can cause serious injury or death to young children if multiple tablets are ingested at once.


text:
Is it time for Netflix to invest in system upgrade?
Hardware malfunction causes delays a few months after a separate problem causes a system crash. What does it mean that the video rental site has seen two meltdowns this year?
August 28, 2008 4:09 PM PDT
Netflix has traced the causes of a lengthy system outage this month that prevented the online movie rental service from shipping for several days to a hardware glitch.
The good news for the company is that it received lots of help from vendors to determine that the cause of the outage, which hobbled the company's ability to ship DVDs from August 11 to August 15, was a "key faulty hardware component." Steve Swasey, a Netflix spokesman, said the company's "strongest aspiration is to safeguard this from ever happening again."
The bad news for the company is that Netflix can't yet prevent these system outages. While a piece of hardware, about which Netflix declined to provide details, was the cause of the latest glitch, it was not responsible for the system crash back in March, Swasey confirmed.
In that earlier case, a malfunction knocked out the company's Web site, as well as its logistics and delivery systems, for 12 hours, the company then said. In both cases, Netflix was unable to ship movies "to a large number of Netflix customers."
Two major meltdowns in 2008 raises serious questions about the soundness of Netflix's system. Tony Wible, an analyst at Citigroup, estimated that Netflix lost $1.8 million to $3.6 million for each of the days it was down. The 15 percent credit Netflix is providing to affected customers will reduce the company's third-quarter revenue by $6 million, according to Michael Pachter, an analyst at Wedbush Morgan Securities.
As more and more competitors jump into Web video rental, annoying system blackouts could become more of a liability for Netflix.
In both outages, Swasey said many customers hardly noticed the delays. Many users who were expecting packages weren't put out very much by waiting a day or two extra for their films. Customers never lost money or personal information, and by most anecdotal accounts, the service remains extremely popular with users.
At the root of the problem is the fact that Netflix is quite different from most e-commerce companies. It relies on the Internet, the U.S. Postal Service, and a groundbreaking fulfillment operation that combines software, hardware, and plain old elbow grease to ship those little red packages.
Netflix has won accolades for using technology to wrest market share away from big brick-and-mortar video renters, such as Blockbuster. The company has amassed 8.4 million customers and ships more than 2 million movies per day.
But perhaps now is the time that Netflix would do well to invest in a major system upgrade. If Netflix customers continue to see delays, it could undermine the company's credibility. Does Netflix really want users to consider Blockbuster's in-store kiosks? I don't think so.
5 tips to keep your data safe on Facebook: Hide your life from Facebook, while still posting about your life on Facebook.
6 ways to delete yourself from the internet: Finally ready to get off the grid? It's not quite as simple as it should be, but here are a few easy-to-follow steps that should point you in the right direction.
Discuss: Is it time for Netflix to invest in system upgrade?


We all learned in school that John Hancock drafted the Declaration of Independence in 1776. But do you know what happened next? How did the public learn about this exciting development?
After the Second Continental Congress adopted the Declaration of Independence on July 4th, newspapers ran copies of the ratified text, and broadsides were posted in the thirteen newly sovereign states to announce the news. Two weeks later, on July 19, 1776, Congress resolved to write the Declaration neatly on parchment and have it signed by each delegate, which mostly happened on August 2, 1776. This is the historical document on display at the National Archives in Washington, D.C. and popularly regarded as the official document.
The Boston Public Library is the proud owner of several early copies of the Declaration of Independence, including: original broadsides printed in New Haven, Connecticut, and Salem, Massachusetts; the first newspaper to run the Declaration's text, the Pennsylvania Evening Post from July 6, 1776; an engraving by William J. Stone of the engrossed and signed parchment; and a broadside from 1777 which lists all of the signers' names. Together these documents heralded the states' first steps toward forming the United States of America. Boston Public Library staff recently digitized the Library's copies of these historic documents.
To learn more about the different versions of the Declaration of Independence, check out Harvard University's Declaration Resources Project.
To view the BPL's copies of the Declaration of Independence, please the visit the Digital Commonwealth. In addition to viewing the text itself, it is interesting to see the marks on the versos. BPL Rare Books Curator Jay Moschella (seen below) points out that "there's something interesting on the "blank" side of every one of the BPL copies. Printer's ink smudges on a paper proof of the Stone broadside, type bite, provenance on others."


MONROVIA, LIBERIA-President Ellen Johnson Sirleaf is consoling President Mohamadou Issoufou of Niger, following heavy rain that left at least forty-four persons dead and about eleven –thousand injured.
Several homes, infrastructure and other installations were damaged in the Tuesday, August 29, 2017, incident.
A Foreign Ministry release said President Sirleaf described the incident as unfortunate, and expressed her deepest sympathy to the Nigerien Leader, Government and people, and especially to the bereaved families over the incident.
President Sirleaf, according to the release, is praying for strength, courage and fortitude upon the people of Niger during this period of National Mourning.


affordable_art_and_frame has no other items for sale.
CONTEMPORARY / ABSTRACT. This IS NOT a reproduction or limited edition giclee, but a genuine original oil painting on canvas. ORIGINAL OIL ON CANVAS. To View All of Our Artwork at. to view all of our art.


text:
Bolivian parliament passed a resolution recognizing the Armenian Genocide
Bolivia's parliament unanimously passed a resolution recognizing the Armenian Genocide and condemning Ankara's denialism.
Prensa Armenia - On Wednesday 26 November, the Plurinational Legislative Assembly of Bolivia unanimously passed a resolution in solidarity with the claims of the Armenian people and condemning "all denialist policy regarding the genocide and crimes against humanity suffered by the Armenian nation."
Speaking to Prensa Armenia, Senator Zonia Guardia Melgar, acting chairperson of the Senate of Bolivia, explained that "the resolution was approved unanimously by both the Senate and the Chamber of Deputies, with the approval of the Foreign Ministry".
"We offer our full support, solidarity and comradeship to the Armenian people and the Kurdish people, because our State Constitution, which is the law of laws, says no to discrimination, violation of human rights and genocide" she added.
The unofficial translation of the full text of the resolution reads:
"The Plurinational Legislative Assembly of Bolivia share and is in solidarity with the Armenian people for the fight of their claims, the preservation of human rights, and the establishment of truth and justice.
Declares: its firm commitment to human rights, truth, justice, solidarity and condemnation against all denialist policy regarding the genocide and crimes against humanity suffered by the Armenian nation."
Politics more
Congress must end funding for Azerbaijan. Adam Schiff
Preventing a second Armenian Genocide. Ruben Vardanyan participated in the Columbia University...
Evidence of discrimination against Armenians in Nagorno-Karabakh was presented at the Hague Court
Aliyev is carrying out ethnic cleansing in Artsakh. Yeghishe Kirakosyan's speech at the Hague court
Remember - Artsakh will never be part of Azerbaijan. Mamijanyan at the PACE plenary session
Julhakyan referred to the terrible cases of violence against female servicemen at the PACE session


Colson Conductive Rubber Wheels - 3-5 Series by AIE Company Inc.
Many computer manufacturers and electronics companies require conductive wheels on assembly carts to eliminate static build-up and discharge. Although conductive caster wheels have existed for years, almost all of them mark floors. Colson has solved this problem with our new selection of Performa Conductive Wheels. These new models combine a soft cushion ride with a non-marking tread design. All wheels feature a cushion grey Performa tread bonded to a black Polyolefin wheel core.
Performa Conductive wheels have been rigorously tested and approved by an independent lab and meet the requirements of federal specification FF-C-88C.


Wild Amelanchier's blooming along the waters edge. One of my favorite spring native trees.
I love the in-between moments 💗. Spotting green buds on the trees, the graceful shadows of branch and limb, the glow of early spring light on the vibrant neon grass. Maybe it's the anticipation of what soon follows or maybe the older I get I learn to slow down and take notice of these quickly fleeting days. The in-between moments.
Whole-grain tortilla Wednesday = the new Taco Tuesday 🌮🌮 ••• One thing my 21 day cleanse taught me is how to eat a balanced meal and LOVING IT! ••• So on tonight's menu: fresh fish tacos with mango salsa 😍 ••• Find your balance and LOVE every second!


A flexible loop electrode for electroretinographic (ERG) recordings of extra-corneal signals with a protective bead and a U-shaped electrode form that is particularly adapted for use with spectacles or a fixed mount. Means also employed to detect electrode integrity.
Electroretinographic (ERG) recordings are physiologic measurements of the eye (human or animal) in response to optical stimulation. Electrodes placed on or near the eye can sense the neurological activity of the retina. The potentials so recovered are very small, ranging from a few micro-volts to a few hundred micro-volts. By analysis of the signals, disease or injury of the eye can be diagnosed.
The International Society for Clinical Electrophysiology of Vision (ISCEV), in its "Standard for full-field clinical electroretinography" provides recommendations for the use and types of electrodes. Conductive fibers, corneal wicks, foils, conjunctival loops, and contact lens types are referenced.
Contact lens electrodes are known to provide the highest amplitude and provide the most stable or repeatable results. The greatest signal is found at the center, and gradually lessens toward the periphery of the eye. But corneal electrodes can be painful, and too difficult for some subjects.
The means for making electrodes had proceeded on an ad hoc basis since its earliest beginnings. Most of the pioneering development was conducted in research centers, and as the value of the methods to diagnose retinal disease was recognized, it has become an important clinical tool.
Described as a transparent corneal cup, it is used in conjunction with a conductive fluid (U.S. Pat. No. 4,131,113).
Owing to its simplicity and economy, a corneal wick described by W W Dawson, G L Trick and C A Litzkow, is popularly referred to as the "DTL electrode" (U.S. Pat. No. 4,417,581).
Not quite a contact lens, because it can have a central aperture hole, a conductive gel corneal electrode is cast to shape with an attached flexible wire lead (U.S. Pat. No. 4,735,207).
At the far end of this category, scleral electrodes record biopotentials as far from the cornea to avoid issues of damage or irritation (U.S. Pat. No. 4,874,237).
A second type of scleral electrode was described that is formed of a stiff coaxial cable loop that is inserted under the lower eyelid (U.S. Pat. No. 5,154,174).
Combining both corneal and scleral electrode support in a large contact lens, a device that also provides a fixture for the illumination optics is useful for animal studies because it prevents blinking (U.S. Pat. No. 5,297,554).
An array of electrodes in a corneal lens combined with multifocal ERG is applied in a retinal mapping application (U.S. Pat. No. 7,384,145).
Combining a flexible coaxially shielded interconnecting cable and a spherical button electrode, the assembly can be packaged individually, or in an array. The purpose of the spherical form of the electrode is to help anchor it in one spot (U.S. Pat. No. 7,596,400).
When corneal electrodes are used, topical anesthesia may be required as the cornea is very sensitive. It may also be necessary to apply a lubricating solution between the cornea and the electrode.
Coaxial cables are useful to shield the voltage measurement from outside interference. However, coaxial cables are prone to a source of noise that is piezo and triboelectrically generated. As the cable is flexed, the dielectric between the center conductor and the shield is alternately squeezed or stretched, electrical charges are generated. Special low noise cables may have a graphite inner lining to reduce triboelectric noise, but the piezo effects can remain.
To limit the flexing of the cables, attachment of the lead wires near the eye is necessary. This has to be done with great care to avoid pulling the electrode(s) out of alignment. This is in spite of movement of the eye or blinking. This can be very uncomfortable to the subject and painful to remove.
A springy wire lead is fixtured in front of the eye. The springy wire lead is formed into a U-shape, with a smooth bead electrode positioned at the bottom of the U-form. The electrode assembly is held at about a 45-degree angle from vertical, so that the bead electrode makes contact with the eye at the junction between the lower edge of the cornea at the sclera margin next to the lower eyelid. With the electrode so disposed, the eye is free to move normally, and the subject may blink without interfering with the placement and alignment of the electrode.
The electrode fixture could be in the form of a pair of spectacles, or a fixed mount such as used in a Ganzfeld ERG apparatus. The fixture can include preamplification and EMI shielding. This eliminates the flexible interconnect to the electrode and the attendant noise that might be generated. Other forms of fixed mounts could be adapted to fixture an electrode in a similar manner.
The advantage of such an arrangement is the speed at which a subject for an ERG assessment can be fitted for measurement. In the case where glasses are used as the fixture, the subject simply looks up, and puts on the glasses.
An additional aspect of the invention is the means to detect if the electrode lead is broken. The electrical continuity of the electrode loop can be sensed. This would alert the operator to effect corrective action.
FIG. 1 is a perspective close up view of the electrode assembly in contact with the eye.
FIG. 2 is a side view of the electrode assembly showing the mount angle and the contact of the electrode bead to the corneal margin.
FIG. 3 is a front view showing the width of the electrode U-shape relative to the eye, and clearance to the pupil and the ERG illumination path.
FIG. 4 is a schematic of an electrode preamplifier and the bias means to sense continuity of the electrode loop.
A wire of about 43 mm free length is held in a fixture such that the wire is shaped into a U-form (3) with the terminal ends (1, 2) of the electrode spaced about 10 mm apart. A smooth silver bead (5) of about 2 mm diameter is threaded onto the lead wire and positioned at the bottom of the U-form.
The wire is preferably made of a super-elastic alloy, such as Nitinol, an alloy of nickel and titanium. This material can be repeatedly flexed to an extreme degree and the electrode will return to its original form. It also is very immune to stress fracture.
The electrode assembly is supported in a fixture by its terminal ends so that the U-form is angled about 45 degrees from vertical. Ideally, the mount is adjusted such that the electrode is held in contact with the eye with about 2 mm of engagement.
The electrode assembly will flex on contact of the bead electrode to the eye. The forces placed on the eye must be limited to avoid distorting the cornea, and thereby distorting the vision or worse yet, injuring the subject. A Nitinol wire of about 0.4 mm diameter yields a good compromise of stiffness and flexibility.
The length of the wire, the spacing between the terminal ends, and the mount angle can be altered as needed to make the alignment desired to the subject's eye.
The bead electrode is preferably made of silver, or plated with silver, which acts to inhibit microbial growth. Alternatively, the electrode could be coated with an anti-bacterial agent. The electrode assembly can be autoclaved and reused.
The bead electrode could be left to be free to rotate like a bearing on the wire, or it could be bonded to the wire. Simple gravity could be adequate to maintain the position of the bead at the bottom of the U-form.
A means to monitor the integrity of the electrode loop should be implemented to assure the safety of the user. Although it should be obvious if one end of the electrode is broken from the mount, it is a fairly simple matter to test the continuity of the connections.
The ERG signals require amplification in order to be recorded. A common method to accomplish this is a non-inverting amplifier. It has a high input impedance and can be tailored to have the gain and bandwidth needed for the application. Devices are available for the amplifier that operate from a single power supply, and can amplify signals near or including the zero potential (a property called the common mode voltage range). This is useful for battery operation and economy of construction.
One means of dealing with signals that are very close to the negative, or in this case, zero supply rail, is to very slightly bias the amplifier input so it stays positive of the zero point. In this application, the bias needs to be only a few millivolts to compensate for any input offset voltage of the amplifier.
The ERG standards recommend that the input impedance of the electrode amplifier be on the order of 10 Meg ohms. This impedance can be used with the bias network to generate a few millivolts offset.
The schematic at FIG. 4 illustrates one embodiment of an amplifier with the desired functions. R1 is a 10 M resistor connected to node P2 of the electrode wire, and together with R5 establishes the input impedance requirement. The other end of the electrode wire is the node P1, and it completes the connection to the amplifier input filter (R6, C2), the offset bias (R5), and the input protection network (R4, D1). The amplifier (U1) is configured with a voltage gain of 50 V/V by the feedback network (R7, R8). C4 further acts on the amplifier feedback to limit the amplifier bandwidth above 600 hertz.
The voltage divider formed by R5 (connected to a 15 mV bias) and the input impedance (R1), create a 5 mV input bias. A reference electrode is biased (voltage divider at R2, R3) to the same degree of offset so as to cancel any potential differential with the ERG electrode 3. The reference electrode is connected to the subject by any number of means (nose bridge, forehead touch bar, temple contacting glasses, etc) and would be well known to any one skilled in the art of ERG methods.
The voltage gain of the amplifier develops a 250 mV output, upon which the amplified ERG signals are superimposed. A very small current (500 pA) from R5 passes through the electrode loop and then R1. If the connection to the electrode loop is broken, the input bias will then rise to 15 mV, and the amplifier output rises to about 0.75 volts.
Any time the amplifier output is found to be significantly higher than 0.25 volts, the electrode connection can be considered to be faulty. Anyone skilled in the art could develop alternative topologies that pass a current through the electrode to establish continuity and make the ERG measurements.
The preceding description and the accompanying drawing figures describe the present invention. Variations are possible without departing from the spirit and scope of this invention.
1. A flexible conductive loop assembly for the measurement of extra-corneal electroretinographic signals with a bead shaped electrode contact.
2. An ERG electrode as described in claim 1 wherein the flexible conductive loop is either a super-elastic alloy, conductive elastomer, conductive plastic, conductive glass capillary, or a conductive glass fiber.
3. An ERG electrode as described in claim 1 wherein the electrode contact is fabricated from either a silver alloy, a gold alloy, a platinum alloy, a titanium alloy, or a base metal alloy with a protective coating.
4. An ERG electrode as described in claim 1 wherein the electrode contact is fabricated from either a conductive elastomer, conductive plastic, or conductive glass.
5. An ERG electrode as described in claim 1 wherein the electrode contact is fabricated from an insulating material with a conductive coating.
6. An ERG electrode as described in claim 1 wherein the electrode contact is fixed to the flexible conductive loop.
7. An ERG electrode as described in claim 1 wherein the electrode contact is free to move on the flexible conductive loop, or is constrained to only revolve.
8. An ERG electrode as described in claim 1 wherein the flexible conductive loop is shaped into a U-form with the electrode contact mounted at the bottom of the U shape.
9. An ERG electrode as described in claim 1 wherein the flexible conductive loop is supported in a fixed mount at an angle so as to present the electrode contact to make physical and electrical contact to the subject's eye, and holding the flexible conductive loop so as to not obscure the subject's pupil or the ERG illumination light source.
10. An ERG electrode as described in claim 9 wherein the fixed mount is either a spectacle mount, goggles, a hand held appliance, or a fixed head rest such as a Ganzfeld illuminator.
11. An ERG electrode as described in claim 1 wherein the electrical continuity of the flexible conductive loop is sensed either by current, voltage, resistance or impedance.
Riggs 1941 Continuous and reproducible records of the electrical activity of the human retina.


The adventure to a new and fun place starts!
In your bag you will carry clothes, toothbrush, caps and shoes among other things but do not forget ¡the most important ingredient" ILLUSION!
When our families start thinking about their #ErasmusForFamilies they include tons of ILLUSION. And it is MAGIC: no matter how much illusion you bring with you, it fits in any place and the luggage does not weigh more!. The more illusion you bring the easier everything turns!
Just remember when you were a child…Did not illusion help you to see with different eyes a small town circus to look as the most wonderful one ever seen on Earth? Is just because … illusion can do everything. It makes the difference!
Don't you think we need it?


When adding content, you can choose to "Show All" or "Expand & Collapse" text for longer paragraphs.
Show All - This option will show make all text within a post visible to website visitors without truncating text.
Expand & Collapse - Choosing this option will truncate the text with the content post with an option to "read more" to show the rest of the text.


A lovely diamond wedding ring featuring a classic prong style setting. Positively enchanting in 14k white gold.
Copyright © 2019, United Petals LLC. All Rights Reserved.
updates about new products and to get new deals!


text:
Wilkins remembers tough times as commentator
Alan Wilkins, a renowned television face, launched his autobiography, 'Easier Said Than Done', in Kolkata on Thursday.
Y.B. Sarangi
Kolkata 24 May, 2018 21:50 IST
Alan Wilkins, a renowned television face, launched his autobiography, 'Easier Said Than Done', in Kolkata on Thursday. - THE HINDU ARCHIVES
Noted television commentator Alan Wilkins on Thursday said that covering the 2002 US Open tennis, a year after the 9/11 tragedy, was the most difficult moment for him as a commentator.
At the launch of his autobiography, 'Easier Said Than Done', Wilkins said the setting created in memory of the incident led to a sombre atmosphere. "The flag of the World Trade Centre was torn, tattered and burnt. They unfurled the flag on the court and let off doves. We wondered what to say. It was the most emotional moment of my commentating career," said Wilkins in the presence noted cricketers Sourav Ganguly, V.V.S. Laxman, Michael Slater and Tom Moody.
Ganguly, who had a short stint as a commentator, agreed that "it's never easy to keep one's emotions out" while commentating.
Slater and Moody said they learnt a lot from Wilkins about the art of commentating. "It was fun to work with him. The title of the book is so apt," said Slater.
Moody added, "He (Alan) is a great educator."
Laxman, who also holds the mic on television, said, "Alan is always there to help others. Only a good natured person can share his knowledge."
Read more stories on Star Life.
Tom Moody
Alan Wilkins


text:
Paul Ryan's Brother is a Cargill Exec in China
Stan Ryanscreenshot/WSJ Digital video
As China consolidates its position as the globe's low-cost manufacturing center, the nation is using some of its wealth to shift to industrial-style agriculture and a Western-style high-meat diet. One company that stands to cash in on these trends is the US agribusiness giant Cargill, one of the globe's largest privately held firms. About 60 percent of the globe's traded soybeans end up in China as feed for the country's fast-growing factory farms, and Cargill is one of the the handful of companies that broker those deals. In August, the company announced it was investing $250 million to build an "integrated chicken broiler facility" designed to raise and process 65 million chickens per year. So Cargill will not only sell China the feed it needs for its burgeoning meat habit, but it will also produce some of the the meat.
At the center of this fast-emerging profit center for Cargill is none other than Paul Ryan's brother, Stan Ryan, who "serves as corporate vice-president of Cargill's agricultural supply-chain businesses" based in Shanghai. According to his bio, Stan Ryan is "focused on growing Cargill's business operations in Asia and its agriculture-based supply-chain businesses globally, in addition to other corporate functional responsibilities."
Below I've pasted a recent interview with Stan Ryan on China's food situation. If there's anything remarkable about it, it's the way Ryan aligns Cargill's interests with those of the Chinese government. He notes approvingly that the government has decided that the country's farms should grow the bulk of the corn, rice, and wheat that the nation uses, while choosing to import soybeans—a smart strategy, he says, because soybeans require plenty of water, something China is running short on. (It probably is a smart strategy, if your goal is to ramp up factory-style meat production.) And he praises the country's latest five-year agricultural plan. In general, from listening to Ryan, you get the idea that Cargill and the Chinese government are working seamlessly together: partners in the industrialization of Chinese agriculture and the Westernization of its diet.
Given that Paul Ryan is an acolyte of Ayn Rand, who thundered against "collectivism" and government control, Ryan family events must get tense when Stan Ryan begins extolling the virtues of Chinese agricultural planning—even if it's very profitable, indeed, for Cargill.
China's Other Sleeping Giant Is the Other White Meat
I Was an Instacart Shopper. I Had Enough When Someone Gave Me a 1-Star Review for Too-Ripe Bananas.
Alice as told to Noah Lanard
These Prickly Invasive Plants Could Feed Us One Day


text:
Report urges overhaul of Chicago-area economy
The Chicago-area economy has lost its zip, and major changes in how we work, move and educate our children are needed if the city is to get its mojo back.
That's the conclusion of yet another report on the status of the greater metropolitan area, this one prepared for local officials by the Organisation for Economic Co-operation and Development, a global economic policy group.
Only portions of the report will be available free online. But you can click here to read a summary.
Like a somewhat similar plan released last week by World Business Chicago, this wet fish in the face suggests that the economy of the three-state Chicago area has suffered through what Mayor Rahm Emanuel terms a "lost decade" of sorts, in which it badly trailed growth elsewhere in America and around the country.
As was the case with the WBC report, this one suggests solutions including better links between educational institutions and employers, and rebuilding Chicago's outmoded ground transportation system.
But this report has more context and is, frankly, a bit more dire, saying that a metropolitan area that is home to 9.5 million people is "at a tipping point."
And it suggests that the area's woes began earlier — at least by the mid-1990s — and by some accounts show no sign of improvement.
"Despite tremendous assets, Chicago's economy displays a worrying lack of dynamism which needs to be addressed quickly," OECD Secretary-General Angel Gurria said in a statement.
"Since 1995, the region's unemployment rate has been above the average for U.S. metro regions.
"Even more worrying," he adds,"is that this mismatch is closely linked to a racial divide. At 24 percent, the unemployment rate for African-Americans is nearly four times that of whites."
That kind of candor, at least on racial matters, was not included in the WBC report.
Per capita production in Chicago still is the 16th highest among the 90 leading metropolitan areas, productivity per worker ranks 13th and the area has retained a fair amount of high-end manufacturing.
Other pluses: Patent applications here rank 12th, with particular strength in nanotechnology and biotechnology; the age of the area's workforce is relatively young; and the region continues to attract young college graduates, though not as fast as some other American regions.
But productivity growth has slowed, ranking 46th of 76 regions studied from 2001 to 2007 — well under Milwaukee's 29th. Jobs have grown faster elsewhere, including in New York and Los Angeles.
Among key recommendations:
• Develop a regionwide approach to skill development and job placement so that manufacturers don't have trouble filling even medium-skilled posts and college graduates don't move elsewhere.
Mr. Emanuel and Cook County Board President Toni Preckwinkle say they've taken steps in that direction: uniting their workforce agencies, for instance, and shifting City Colleges into a more vocational direction with direct ties to big employers.
• Get universities and colleges to do a better job of getting research out to potential users and employers.
• Build on recent success in green technology and focus on particularly promising sectors like biotech, which received little attention in the WBC report.
• Work as a region, rather than "poaching" jobs from city to suburb and state to state. Notably, though, the bulk of local officials who participated in drafting the report come from Illinois, and not Indiana or Wisconsin.
• Put more resources into ending traffic congestion, which is "far above" any other U.S. metro except New York and L.A. Similarly, mass transit needs help, too: Only a quarter of those who live near transit stations are able to get to work within 90 minutes.
• Refocus giving economic incentives and tax breaks to small and emerging companies, which drive the innovation the Chicago-area economy needs.
The report was commissioned by the U.S. Department of Commerce, the Chicago Metropolitan Agency for Planning and the Chicagoland Chamber of Commerce.


text:
package protocol

import (
	"bufio"
	"compress/flate"
	"errors"
	"fmt"
	"io"
	"sync"
	"time"

	"github.com/calmh/syncthing/xdr"
)

const BlockSize = 128 * 1024

const (
	messageTypeClusterConfig = 0
	messageTypeIndex         = 1
	messageTypeRequest       = 2
	messageTypeResponse      = 3
	messageTypePing          = 4
	messageTypePong          = 5
	messageTypeIndexUpdate   = 6
)

const (
	FlagDeleted    uint32 = 1 << 12
	FlagInvalid           = 1 << 13
	FlagDirectory         = 1 << 14
	FlagNoPermBits        = 1 << 15
)

const (
	FlagShareTrusted  uint32 = 1 << 0
	FlagShareReadOnly        = 1 << 1
	FlagShareBits            = 0x000000ff
)

var (
	ErrClusterHash = fmt.Errorf("configuration error: mismatched cluster hash")
	ErrClosed      = errors.New("connection closed")
)

type Model interface {
	// An index was received from the peer node
	Index(nodeID string, repo string, files []FileInfo)
	// An index update was received from the peer node
	IndexUpdate(nodeID string, repo string, files []FileInfo)
	// A request was made by the peer node
	Request(nodeID string, repo string, name string, offset int64, size int) ([]byte, error)
	// A cluster configuration message was received
	ClusterConfig(nodeID string, config ClusterConfigMessage)
	// The peer node closed the connection
	Close(nodeID string, err error)
}

type Connection interface {
	ID() string
	Index(repo string, files []FileInfo)
	Request(repo string, name string, offset int64, size int) ([]byte, error)
	ClusterConfig(config ClusterConfigMessage)
	Statistics() Statistics
}

type rawConnection struct {
	id       string
	receiver Model

	reader io.ReadCloser
	cr     *countingReader
	xr     *xdr.Reader
	writer io.WriteCloser

	cw   *countingWriter
	wb   *bufio.Writer
	xw   *xdr.Writer
	wmut sync.Mutex

	indexSent map[string]map[string][2]int64
	awaiting  []chan asyncResult
	imut      sync.Mutex

	nextID chan int
	outbox chan []encodable
	closed chan struct{}
}

type asyncResult struct {
	val []byte
	err error
}

const (
	pingTimeout  = 4 * time.Minute
	pingIdleTime = 5 * time.Minute
)

func NewConnection(nodeID string, reader io.Reader, writer io.Writer, receiver Model) Connection {
	cr := &countingReader{Reader: reader}
	cw := &countingWriter{Writer: writer}

	flrd := flate.NewReader(cr)
	flwr, err := flate.NewWriter(cw, flate.BestSpeed)
	if err != nil {
		panic(err)
	}
	wb := bufio.NewWriter(flwr)

	c := rawConnection{
		id:        nodeID,
		receiver:  nativeModel{receiver},
		reader:    flrd,
		cr:        cr,
		xr:        xdr.NewReader(flrd),
		writer:    flwr,
		cw:        cw,
		wb:        wb,
		xw:        xdr.NewWriter(wb),
		awaiting:  make([]chan asyncResult, 0x1000),
		indexSent: make(map[string]map[string][2]int64),
		outbox:    make(chan []encodable),
		nextID:    make(chan int),
		closed:    make(chan struct{}),
	}

	go c.readerLoop()
	go c.writerLoop()
	go c.pingerLoop()
	go c.idGenerator()

	return wireFormatConnection{&c}
}

func (c *rawConnection) ID() string {
	return c.id
}

// Index writes the list of file information to the connected peer node
func (c *rawConnection) Index(repo string, idx []FileInfo) {
	c.imut.Lock()
	var msgType int
	if c.indexSent[repo] == nil {
		// This is the first time we send an index.
		msgType = messageTypeIndex

		c.indexSent[repo] = make(map[string][2]int64)
		for _, f := range idx {
			c.indexSent[repo][f.Name] = [2]int64{f.Modified, int64(f.Version)}
		}
	} else {
		// We have sent one full index. Only send updates now.
		msgType = messageTypeIndexUpdate
		var diff []FileInfo
		for _, f := range idx {
			if vs, ok := c.indexSent[repo][f.Name]; !ok || f.Modified != vs[0] || int64(f.Version) != vs[1] {
				diff = append(diff, f)
				c.indexSent[repo][f.Name] = [2]int64{f.Modified, int64(f.Version)}
			}
		}
		idx = diff
	}
	c.imut.Unlock()

	c.send(header{0, -1, msgType}, IndexMessage{repo, idx})
}

// Request returns the bytes for the specified block after fetching them from the connected peer.
func (c *rawConnection) Request(repo string, name string, offset int64, size int) ([]byte, error) {
	var id int
	select {
	case id = <-c.nextID:
	case <-c.closed:
		return nil, ErrClosed
	}

	c.imut.Lock()
	if ch := c.awaiting[id]; ch != nil {
		panic("id taken")
	}
	rc := make(chan asyncResult)
	c.awaiting[id] = rc
	c.imut.Unlock()

	ok := c.send(header{0, id, messageTypeRequest},
		RequestMessage{repo, name, uint64(offset), uint32(size)})
	if !ok {
		return nil, ErrClosed
	}

	res, ok := <-rc
	if !ok {
		return nil, ErrClosed
	}
	return res.val, res.err
}

// ClusterConfig send the cluster configuration message to the peer and returns any error
func (c *rawConnection) ClusterConfig(config ClusterConfigMessage) {
	c.send(header{0, -1, messageTypeClusterConfig}, config)
}

func (c *rawConnection) ping() bool {
	var id int
	select {
	case id = <-c.nextID:
	case <-c.closed:
		return false
	}

	rc := make(chan asyncResult, 1)
	c.imut.Lock()
	c.awaiting[id] = rc
	c.imut.Unlock()

	ok := c.send(header{0, id, messageTypePing})
	if !ok {
		return false
	}

	res, ok := <-rc
	return ok && res.err == nil
}

func (c *rawConnection) readerLoop() (err error) {
	defer func() {
		c.close(err)
	}()

	for {
		select {
		case <-c.closed:
			return ErrClosed
		default:
		}

		var hdr header
		hdr.decodeXDR(c.xr)
		if err := c.xr.Error(); err != nil {
			return err
		}
		if hdr.version != 0 {
			return fmt.Errorf("protocol error: %s: unknown message version %#x", c.id, hdr.version)
		}

		switch hdr.msgType {
		case messageTypeIndex:
			if err := c.handleIndex(); err != nil {
				return err
			}

		case messageTypeIndexUpdate:
			if err := c.handleIndexUpdate(); err != nil {
				return err
			}

		case messageTypeRequest:
			if err := c.handleRequest(hdr); err != nil {
				return err
			}

		case messageTypeResponse:
			if err := c.handleResponse(hdr); err != nil {
				return err
			}

		case messageTypePing:
			c.send(header{0, hdr.msgID, messageTypePong})

		case messageTypePong:
			c.handlePong(hdr)

		case messageTypeClusterConfig:
			if err := c.handleClusterConfig(); err != nil {
				return err
			}

		default:
			return fmt.Errorf("protocol error: %s: unknown message type %#x", c.id, hdr.msgType)
		}
	}
}

func (c *rawConnection) handleIndex() error {
	var im IndexMessage
	im.decodeXDR(c.xr)
	if err := c.xr.Error(); err != nil {
		return err
	} else {

		// We run this (and the corresponding one for update, below)
		// in a separate goroutine to avoid blocking the read loop.
		// There is otherwise a potential deadlock where both sides
		// has the model locked because it's sending a large index
		// update and can't receive the large index update from the
		// other side.

		go c.receiver.Index(c.id, im.Repository, im.Files)
	}
	return nil
}

func (c *rawConnection) handleIndexUpdate() error {
	var im IndexMessage
	im.decodeXDR(c.xr)
	if err := c.xr.Error(); err != nil {
		return err
	} else {
		go c.receiver.IndexUpdate(c.id, im.Repository, im.Files)
	}
	return nil
}

func (c *rawConnection) handleRequest(hdr header) error {
	var req RequestMessage
	req.decodeXDR(c.xr)
	if err := c.xr.Error(); err != nil {
		return err
	}
	go c.processRequest(hdr.msgID, req)
	return nil
}

func (c *rawConnection) handleResponse(hdr header) error {
	data := c.xr.ReadBytesMax(256 * 1024) // Sufficiently larger than max expected block size

	if err := c.xr.Error(); err != nil {
		return err
	}

	go func(hdr header, err error) {
		c.imut.Lock()
		rc := c.awaiting[hdr.msgID]
		c.awaiting[hdr.msgID] = nil
		c.imut.Unlock()

		if rc != nil {
			rc <- asyncResult{data, err}
			close(rc)
		}
	}(hdr, c.xr.Error())

	return nil
}

func (c *rawConnection) handlePong(hdr header) {
	c.imut.Lock()
	if rc := c.awaiting[hdr.msgID]; rc != nil {
		go func() {
			rc <- asyncResult{}
			close(rc)
		}()

		c.awaiting[hdr.msgID] = nil
	}
	c.imut.Unlock()
}

func (c *rawConnection) handleClusterConfig() error {
	var cm ClusterConfigMessage
	cm.decodeXDR(c.xr)
	if err := c.xr.Error(); err != nil {
		return err
	} else {
		go c.receiver.ClusterConfig(c.id, cm)
	}
	return nil
}

type encodable interface {
	encodeXDR(*xdr.Writer) (int, error)
}
type encodableBytes []byte

func (e encodableBytes) encodeXDR(xw *xdr.Writer) (int, error) {
	return xw.WriteBytes(e)
}

func (c *rawConnection) send(h header, es ...encodable) bool {
	if h.msgID < 0 {
		select {
		case id := <-c.nextID:
			h.msgID = id
		case <-c.closed:
			return false
		}
	}
	msg := append([]encodable{h}, es...)

	select {
	case c.outbox <- msg:
		return true
	case <-c.closed:
		return false
	}
}

func (c *rawConnection) writerLoop() {
	var err error
	for es := range c.outbox {
		c.wmut.Lock()
		for _, e := range es {
			e.encodeXDR(c.xw)
		}

		if err = c.flush(); err != nil {
			c.wmut.Unlock()
			c.close(err)
			return
		}
		c.wmut.Unlock()
	}
}

type flusher interface {
	Flush() error
}

func (c *rawConnection) flush() error {
	if err := c.xw.Error(); err != nil {
		return err
	}

	if err := c.wb.Flush(); err != nil {
		return err
	}

	if f, ok := c.writer.(flusher); ok {
		return f.Flush()
	}

	return nil
}

func (c *rawConnection) close(err error) {
	c.imut.Lock()
	c.wmut.Lock()
	defer c.imut.Unlock()
	defer c.wmut.Unlock()

	select {
	case <-c.closed:
		return
	default:
		close(c.closed)

		for i, ch := range c.awaiting {
			if ch != nil {
				close(ch)
				c.awaiting[i] = nil
			}
		}

		c.writer.Close()
		c.reader.Close()

		go c.receiver.Close(c.id, err)
	}
}

func (c *rawConnection) idGenerator() {
	nextID := 0
	for {
		nextID = (nextID + 1) & 0xfff
		select {
		case c.nextID <- nextID:
		case <-c.closed:
			return
		}
	}
}

func (c *rawConnection) pingerLoop() {
	var rc = make(chan bool, 1)
	ticker := time.Tick(pingIdleTime / 2)
	for {
		select {
		case <-ticker:
			go func() {
				rc <- c.ping()
			}()
			select {
			case ok := <-rc:
				if !ok {
					c.close(fmt.Errorf("ping failure"))
				}
			case <-time.After(pingTimeout):
				c.close(fmt.Errorf("ping timeout"))
			case <-c.closed:
				return
			}

		case <-c.closed:
			return
		}
	}
}

func (c *rawConnection) processRequest(msgID int, req RequestMessage) {
	data, _ := c.receiver.Request(c.id, req.Repository, req.Name, int64(req.Offset), int(req.Size))

	c.send(header{0, msgID, messageTypeResponse},
		encodableBytes(data))
}

type Statistics struct {
	At            time.Time
	InBytesTotal  int
	OutBytesTotal int
}

func (c *rawConnection) Statistics() Statistics {
	return Statistics{
		At:            time.Now(),
		InBytesTotal:  int(c.cr.Tot()),
		OutBytesTotal: int(c.cw.Tot()),
	}
}

func IsDeleted(bits uint32) bool {
	return bits&FlagDeleted != 0
}

func IsInvalid(bits uint32) bool {
	return bits&FlagInvalid != 0
}

func IsDirectory(bits uint32) bool {
	return bits&FlagDirectory != 0
}

func HasPermissionBits(bits uint32) bool {
	return bits&FlagNoPermBits == 0
}