Introduction
============

In the elderly, liver abscess has been emerging as one of the common differentials of acute abdomen. Liver is the organ most subjected to the development of abscesses [@b1]. Based on etiology, liver abscess has been conventionally classified as (a) Amoebic, (b) Pyogenic, and (c) Fungal [@b2]. Tuberculous liver abscess (TLA) is an extremely rare condition, even in the countries of South Asia, where tuberculosis is an alarming public health problem. Hepatic tuberculosis is a rare but not an exceptional form of extrapulmonary tuberculosis [@b3]. The respiratory and gastro-intestinal tracts are the major sources of infection and the bacilli travel there via hepatic artery or the portal vein [@b4]. Primary TLA, with no evidence of infection elsewhere, is even less common.

Case Report
===========

A 68-year-old male was admitted in our in-patient ward with a history of low-grade fever for 2 months, epigastric pain with episodic nausea and vomiting, anorexia and history of unintentional weight loss. He was diagnosed with pulmonary tuberculosis thirty years back and had taken a full course of antitubercular drugs. He denied the use of tobacco products, alcohol, or any other illicit drugs. Similarly, he had no history suggestive of any high-risk behavior.

On examination, he was conscious, well oriented in time, place, and person. He was febrile with other vital parameters within the normal range. He did not have clubbing, edema, or palpable lymph nodes. He had a nontender hepatomegaly but no splenomegaly. Respiratory and cardiovascular system examination was essentially normal in this patient.

He had hemoglobin level of 10.1 g/dL (normal: 13.3--16.2 g/dL) and total leukocyte count of 6500/mm^3^ (normal: 4000--11000/mm^3^). Erythrocyte sedimentation rate was 70 mm in the first hour (normal: 0--20 mm in the first hour, Wintrobe\'s method). Kiney function test was normal. Liver functions tests (LFT) showed a total bilirubin of 1.4 mg/dL (normal: 0.3--1.2 mg/dL), serum alkaline phosphatase (ALP) of 290 U/L (normal: 40--280 U/L), aspartate aminotransferase (AST) of 132 U/L (normal: 12--38 U/L), alanine aminotransferase (ALT) of 181 U/L (normal: 7--41 U/L). Ultrasonography (US) of the abdomen revealed a large heterogeneously hypoechoic lesion with internal echoes in the segment six of liver suggestive of abscess (Fig.[1](#fig01){ref-type="fig"}). A contrast-enhanced computerized tomographic (CT) scan of abdomen also revealed abscess in the right lobe of liver (Fig[2](#fig02){ref-type="fig"}). There was no significant mesenteric, retroperitoneal, or pelvic lymphadenopathy with no other focal lesion. No perihepatic or pleural effusion was seen. All other abdominal viscera appeared normal with no free fluid.

![Ultrasonography of abdomen showing a large abscess in segment 6 of liver.](ccr30003-0043-f1){#fig01}

![Contrast-enhanced computerized tomography of abdomen showing abscess in the right lobe of liver.](ccr30003-0043-f2){#fig02}

He was started on intravenous Ceftriaxone and Metronidazole. His clinical conditions did not improve even after 1 week of treatment. A follow-up US showed no reduction in the size of the abscess. Under US guidance, a pig-tail catheter was inserted, and around 100 mL of thick cream colored fluid was aspirated. The fluid was negative for any gram positive or negative bacteria. Fungal stain was also negative. Ziehl--Neelsen staining of the specimen showed *Mycobacterium tuberculosis* (MTB) in the specimen (Fig.[3](#fig03){ref-type="fig"}). Contrast-enhanced CT of the chest had signs of old pulmonary tuberculosis but none of active tuberculosis. Sputum as well as broncho-alveolar lavage fluid stain for acid-fast bacilli (AFB) as well as Gene-expert for MTB were negative. The patient was nonreactive in HIV serology. The diagnosis of primary TLA was made.

![Ziehl--Neelsen staining of the aspirate showing tubercular bacilli.](ccr30003-0043-f3){#fig03}

As he had a history of pulmonary tuberculosis, TLA was considered as a relapsed form of tuberculosis. With that consensus, he was started on systemic antitubercular treatment (ATT) of twelve months duration, and this included isoniazid (300 mg once daily), rifampicin (450 mg once daily), pyrazinamide (1200 mg once daily), ethambutol (750 mg once daily), intramuscular streptomycin (750 mg once daily), and pyridoxine (20 mg once daily) which was to be continued for 2 months. After 2 months, the patient was instructed to take all the drugs, other than Streptomycin for 2 more months. For the remaining last 8 months, the patient was instructed to take rifampicin (450 mg once daily) and isoniazid (300 mg oncle daily) with pyridoxine (20 mg once daily). The patient improved significantly within 1 week of initiation of ATT with normalization of his biochemical parameters. He was then discharged with periodic follow-up plans.

At the follow-up visit after 4 months, the patient was asymptomatic, his liver size had decreased and a repeat US of abdomen revealed regression of the abscess. He was free of adverse drug effects like drug-induced hepatitis (common with isoniazid and rifampicin), gastro-intestinal upsets (common with rifampicin), or symptoms suggestive of peripheral neuropathy (common with isoniazid). The patient will be under our observation till he finishes the complete course of ATT.

Discussion
==========

TLA is as a very rare condition. No isolated TLA was described in two prospective reviews by Amarapurkar et al. [@b5] and Maharaj et al. [@b6] involving 171 non-AIDS patients with hepatic Tuberculosis. Primary tuberculous abscess of the liver has been reported sporadically, with only 17 cases previously reported in the literature [@b7]. Chaudhary reports a single case of isolated tuberculosis liver abscess in his review article on hepatic tuberculosis and mentions it to be a rare manifestation of hepatobiliary tuberculosis [@b8]. Miliary tuberculosis was frequently associated with most of the cases of TLA. TLA has nonspecific symptoms and signs. Fever, vague abdominal pain, anorexia, and weight loss are the most common modes of presentation by the patients. Hepatomegaly is a common physical finding.

TLA is frequently confused with hepatoma, amoebic, and pyogenic liver abscess [@b9] or empyema of gall bladder [@b10]. It is usually diagnosed at autopsy or occasionally after laparotomy because of its nonspecific clinical presentation [@b11]. Despite having low specificity in TLA [@b12], CT and US are very helpful in delineating the site, size, and multiseptate nature of the abscess [@b4]. AFB are most easily found in caseous necrotic material. Demonstration of AFB in the aspirated pus, pus culture showing MTB, positive Enzyme-linked Immunosorbant assay (ELISA), and Polymerase Chain Reaction (PCR) for MTB are the various methods for the confirmation of the diagnosis [@b13]. Even the absence of AFB should not detract from diagnosis, especially in countries with high prevalence of tuberculosis [@b3]. Medical treatment of TLA has always been a disputable issue. Some of the authors postulate that the presence of thick fibrous tissue around the abscesses and their large size may prevent antitubercular drugs from reaching the target [@b14]. Despite that, ATT alone or in conjunction with percutaneous aspiration is the preferred therapeutic option till date [@b15]. Surgery is reserved for cases of unsuccessful attempts of percutaneous aspiration, inaccessible site, and multiseptate nature of the abscess. In our case, the abscess was drained percutaneously and the patient was discharged on ATT.

Conclusion
==========

Thus, tuberculosis can have a varied presentation in the elderly population. The clinical features are also quite different in the elderly in comparison to their younger counterparts. We suggest that treating physicians should be vigilant for TLA in cases of liver abscess not responding to optimal therapy with conventional antibiotics, antiprotozoals, or antifungals.

Conflict of Interest
====================

None declared.

[^1]: **Funding Information** No funding source was involved in this study.


It’s all Ryden’s fault. If he hadn’t gotten Meg pregnant, she would have never stopped her chemo treatments and would still be alive. Instead, he’s failing fatherhood one dirty diaper at a time. And it’s not like he’s had time to grieve while struggling to care for their infant daughter, start his senior year, and earn the soccer scholarship he needs to go to college.

The one person who makes Ryden feel like his old self is Joni. She’s fun and energetic—and doesn’t know he has a baby. But the more time they spend together, the harder it becomes to keep his two worlds separate. Finding one of Meg’s journals only stirs up old emotions, and Ryden’s convinced Meg left other notebooks for him to find, some message to help his new life make sense. But how is he going to have a future if he can’t let go of the past?

I was given an ARC by the publisher through Netgalley in exchange for an honest review.

I went into What You Left Behind with huge expectations. I know I shouldn't have done that, but come on! The main character is a single dad, which is something that I've been waiting for, and I'm guessing a lot of other people have been as well.

The book started out with what I felt was an unnatural and tense tone, but got better a while later. I'm not sure if it really became better or I just got used to that tone, but it flowed more and more smoothly as the story went on. I was a bit disappointed at first, but as the story progressed, it began to live up to my expectations.

It seemed kind of weird that Ryder was able to love another girl after only seven months after Meg had died, but I think the journals and the other events in the book really helped Ryder find closure.

What I really liked about this book is how realistic the story felt to me. Ryder started out with no clue how to take care of Hope and he kind of despised the kid a little bit at the start. Then, as the story progressed, he learned to be more at ease with Hope, and he learned to treasure her, to become a father to her. I'm glad that things started and ended that way since I think that's what really happens. He is a single father after all, and Meg died conceiving Hope.

I really like how the plot in this book went as well. I loved the pacing of book - it was neither to fast nor too slow, but just right. I loved how things progressed and unravelled. The book was kind of predictable for me, although I'm not sure whether the author intended it to be that way or not. Either way, I still really enjoyed reading this book.

My favorite character in the book is Ryden's mom. Joni comes a close second, but the mom wins it all. There were times when it was clear that she didn't like Ryden's decisions regarding Hope, but since Hope is his daughter, she only supported Ryden and stood behind him; even helping him with the decision he made. She sacrificed a lot not only for her son but also for her granddaughter. At age 30+, that's really huge! She definitely wins a mother of the year award for me.

I like how despite Ryden blaming himself for what happened to Meg, this book is not full of self-pity and wallowing. This book is not centered on that, and it's more than that. It's about closure, family, friends and learning through one's own experiences.

"Even though life has been fucking hard lately and it's going to be really fucking hard for the forseeable future, … I love this baby. She's more than just Meg's legacy. She's my daughter too. I'm her dad."

What You Left Behind is definitely worth a read. I can't give it more stars because of the first few parts of this book, but I was really able to enjoy this one. It has such a unique story and I really connected with it. I even felt a bit teary eyed, which has not happened to me in a long time.

Overall, What You Left Behind is enjoyable and unique, and it will definitely be worth your time.

Hi guys! Thanks for taking your time to read through my post and comment on this blog. I appreciate each and every one of your comments, though I might not respond immediately to them. Also, if you're commenting on a meme, I would prefer replying on your meme post rather than here on my blog. :)

About Me

Hi, I'm Kim! I'm Chinese, though I was born and raised here in the Philippines. I've been reading books since I was in fourth grade and I've been blogging since December 2012. I love reading both YA novels, and my favorite genre is Contemporary. I rarely read dystopian, aside from my obvious favorite of course - Divergent. I used to not like Fantasy, but after reading Throne of Glass, I am a changed person. ;) I love meeting new people, so feel free to talk to me anytime via comments or Twitter! (@DivergentGryffi)

For authors, publishers:
I would love to review the said genres, and the preferred copy is paperback, though eGalleys are fine. You can contact me at offashionandbeauty@gmail.com and look at my Review Policy for more info.


Q:

Immutable list in .NET: Why are you allowed to add and remove items?

In C#, I just got the need of having an immutable list, meaning that the list can not be changed.
Much like in Java's immutable list: https://www.geeksforgeeks.org/immutable-list-in-java/
From there:

If any attempt is made to add null element in List,
  UnsupportedOperationException is thrown.

Now, with .NET (at least with Core 2.2) there is also an immutable list, documented here.
They say (emphasis mine):

When you add or remove items from an immutable list, a copy of the
  original list is made with the items added or removed, and the
  original list is unchanged.

So, this implementation basically allows changing the list (by getting a manipulated copy each time), as opposed to the java understanding, and what's more, it will mostly go undetected clogging memory.
What's the point in having an immutable list that supports add and remove methods in the first place?
The problem for me here is, that users of my code would get a list, immutable presumably, but out of neglectance would happily add items, which will never made it to the original "repository". This will cause confusion.
I guess the (only) way to go here, to forbid manipulation entirely, and make it clear to the code user, would be to use the IEnumerale interface?

A:

What's the point in having an immutable list that supports add and
  remove methods in the first place?

No one but to be conform with the List contract, the implementation even immutable will expose every List methods.
After you have two ways to cope with these modification methods : throwing an exception or guaranteeing the immutability by creating and returning a new List at each modification.
About :

I guess the (only) way to go here, to forbid manipulation entirely,
  would be to use the IEnumerale interface?

Indeed, in Java you use Iterable (that is close enough) when you want to be able to manipulate a collection of things without a way to change it.
As alternative you can also use an array.


Q:

Choosing right range for data while using scikit-learn

I have a dataset with 1175 examples and 21 features which are in the range of [-1, +1], and two class labels 1 and 0. As I read in the most of the resources, it is good to have data in the range of [-1, +1] or [0, 1]. So I thought I don't need any preprocessing. But when I run SVM and decision tree classifiers from scikit-learn. I got 100% accuracy using cross-validation with 10 folds.
Afterwards, I tried to multiply the data by 10, 100, 1000 etc. Every time I increase the number, I get less accuracy. For example I got 91% for multiplying with 100. On the other hand, the decision tree classifier stays the same for all multiplications.

A:

From the sklearn docs:

Support Vector Machine algorithms are not scale invariant, so it is
  highly   recommended to scale your data. For example, scale each
  attribute on the input vector X to [0,1] or [-1,+1], or standardize it
  to have mean 0 and variance 1. Note that the same scaling must be
  applied to the test vector to obtain meaningful results. See section
  Preprocessing data for more details on scaling and normalization.

Decision trees though, are scale invariant, and in fact, are invariant under any monotonic transformation of the features.
To see why, notice that the default kernel, the rbf kernel, contains a scale parameter $\gamma$:
$$ exp( -\lambda |y - x|^2) $$
The $\lambda$ parameter controls the width of the kernel, so the scale is built in right there.  You can pass a $\lambda$ into the svm as a parameter to the fit function, and by choosing it appropriately you can probably recover your initial results with all the features re-scaled.
On the other hand, the decision tree is just looking for optimal splits between data points, and the concept of a split is not dependent on scale, only ordering.


Reflections on my life as a Christian songwriter..."remembering into the future." - by Rory Cooney

Search This Blog

Thursday, March 14, 2013

"How were your eyes opened?"

It strikes me that scripture is full of questions. Off the top of my head, here are a few, in no particular order, though to think about them I’m starting with Genesis:

"Question mark," by Marco Bellucci

•Who told you you were naked?•Where is your brother?•Am I my brother’s keeper?•Would you destroy the city for the sake of the five?•Who shall I say (to the Pharaoh) sent me?•Is the Lord in our midst, or not?•How long, O Lord?•Why have you abandoned me?•Whom shall I send? Who will go for us?•Where were you when I founded the earth?•How can this be, since I have no relations with a man?•Are you the one, or shall we wait for another?•Who is my neighbor?•What is the greatest commandment?•Who do people say that I am?•Who do you say that I am?•Where do you expect to get this flowing water?•Has no one condemned you?•Whose face is this on the coin?•We don’t know where you are going; how can we know the way?•When did we see you hungry, and feed you, or thirsty, and give you to drink?•Truth? What does that mean?

Well, you get the idea. If you are so inclined, you can certainly leave your favorites in a comment!

For some of us, one of those questions was in Sunday's (scrutiny) gospel. “How were your eyes opened?” is the question the Pharisees ask the blind man. He tells them as much as he knows, but it struck me today that he’s taking their word for it that it was Jesus, because he couldn’t see the guy who put the mud paste on his eyes. He had to go wash it off in the water of the Siloam pool. He keeps reverting back to what happened to him, and his experience - going from blindness to sight - is what he will not abandon. While the opponents of Jesus threaten him and his family, he is unshakeable in simply holding on to what he has experienced. “I don’t know whether he’s a sinner or not. I do know one thing: I was blind before, but now I can see.” As the harassment gets more and more intense, for the once-blind man, the answers don’t change much. He can’t believe that the Pharisees don’t believe what is right in front of their eyes: a blind man who can now see.

"How were your eyes opened?" I think I’ve been guilty a lot in my life of criticizing the religious experience of other people by comparing it to my own, or to what I have been led to believe genuine religious experience is. We’re told “by their fruits you will know them,” and yet our knowledge of the “fruits” is limited to our own experience. Would you eat an ugli? How about a guinep or kówósól? I’m OK with adding an apple, a banana, or an orange to my lunch, but I’m more circumspect about a rambutan or feijoa. This is not to say that new knowledge and mentoring can’t change the way we eat: fried plantains and carambola (starfruit) never crossed my lips until I was an adult. “By the fruits you will know them” only really works if your heart is as big as a world market.

"How were your eyes opened?"I resist, for instance, people whose attachment to their faith is too emotional, too devotional (sounds like I’m starting a rap song), too rubrical, too old-fashioned, too EWTN, too new-agey, too paternalistic, too feminist, too hierarchical, too, too, too. But who am I to say? I mean, a person’s experience of God is their experience, and it’s part of the truth of their life. I know that, in the context of the church, the community can and should help discern genuine experience of God from counterfeits of that experience for the protection of the community, but this is really a big Church we’re talking about, and shutting out the experience of anyone or any part of the human family runs the risk of limiting our vision. Since the reality of God exceeds the sum of our abilities to conceive of God’s true self, all of our experience is an approximation, a conjecture, a shadow. If we’re lucky, there’s some truth in it. The closer it is to some aspect of Jesus as we can come to know him in the gospel, to some aspect of the One who is the “image of the invisible God,” the better chance we have that the truth of our experience is a true reflection of the light, rather than, say, a reflection of a reflection of a reflection.

"How were your eyes opened?" I can point backwards through my life and see all kinds of people whose personal witness or teaching or way of life changed me a little bit, turning me toward the divine. But in the last several years, I think I’ve learned as much from my “adversaries,” and strangely enough, I mean people who believe in the same things that I do but in a different way, as I have from anyone. One thing I know is that I don’t want to be like people who seem to be intolerant of other points of view. So even if a person’s point of view is repulsive or unknowable to me, I really try not to write them completely off. I can be the Pharisee if I end up trying to protect my “truth” from someone else’s experience. It just may be that person’s experience that is closer to the light than mine. To them, at least, it’s real, and I have to learn to be able to reverence that without necessarily assimilating it; love the person and discern the truth without judgment, maybe taking a bite of that “ugli.” I have to work to remain open to the divine working in others, since God is always making everything new in Christ. "How were your eyes opened?" Trying to learn to see as God sees. Learning that God is a God who doesn’t necessarily wait for the Sabbath to be over to heal. The exorcism of the false religion that places human rite and religious practice above the actual service of other people. Browsing outside the “fruit” (and nut?) market of those who think like we do in the small confines part of one pocket of Christendom. Maybe that is the second scrutiny doing its work?


Important: This table ONLY lists climbers who are using Peakbagger.com to log their ascents, plus a few random famous climbers. It is NOT in any way a comprehensive or authoritative listing of those who are pursuing or have completed this peak list.

The list shows the top 200 climbers, ordered by peaks climbed. A climber becomes a candidate for inclusion by climbing at least 2 of the peaks on this list, AND more than 5% of the total number of peaks. (For lists with over 400 peaks, the minimum is simply 20 peaks climbed.) The Priority column shows a user-entered value from 1 (highest priority) to 100 (lowest).

Compare Climbers: Click here to compare ascents of up to 5 climbers working on this list.

Man of Steel opened yesterday, a much-anticipated reboot of the story of Superman¡¯s origins. The title character is played by British actor Henry Cavill, who appeared at the June 12 U.K. premier of the movie in London sporting a Tom Ford suit and an Omega Seamaster wristwatch.
It has been reported that in 2005 Cavill was a contender to www.attrinity.com play the new James Bond in Casino Royale, which hit theaters in 2006. Apparently, the producers found him too ¡°young¡± for the role at the time, and it was given to Daniel Craig. This is interesting because both James Bond and Daniel Craig are Omega ambassadors, though both of their model choices generally fall in the sporty Seamaster direction.
The version of the elegant Omega Seamaster that Cavill sports includes an annual calendar function. This replica omega Seamaster addition to the automatic movement displays day and date, and will only need to be manually corrected on March 1 due to the differing lengths of February. One very notable thing about the Seamaster¡ªand every other movement now made by Omega¡ªis that it contains the Co-Axial escapement invented by Dr. George Daniels and serialized by Omega over the course of more than ten years to make it perfect for use in a wristwatch movement. The finely finished movement can be seen through the sapphire crystal case back of this officially certified chronometer¡ªwhich means that the movement has undergone a series of grueling tests performed by Switzerland¡¯s Contr?le Official Suisse de Chronom¨¨tres (C.O.S.C. for short), a non-profit organization established in 1973 in Switzerland to certify accuracy. The version that Cahill wears is housed in a 41 mm red gold case that is water-resistant to 100 meters. On a brown leather strap it retails for $23,900 in the United States.

Questions/Comments/Corrections? See the Contact Page
Copyright ?1987-2015 by Peakbagger.com. All Rights Reserved.


Florida’s $200 million medical cannabis industry has spurred the state to issue an additional four “medical marijuana treatment center” licenses. The state health department expects to be swamped with as many as 400 applications for the lucrative licenses, according to the News Service of Florida. Here’s what you need to know: The expansion was triggered […]

Florida to expand sizzling medical marijuana market with four new licenses is a post from: Marijuana Business Daily: Financial, Legal & Cannabusiness news for cannabis entrepreneurs

Continue reading…


Java 8 introduced lambdas and streams, two tools that seem to offer many ways for improve our code, in particular for what concerns conciseness and readability. There are a lot of samples around, focusing often on over-simplified contexts. In this post I'm describing a small refactoring that I applied to a portion of code in a project I'm developing. With its own limitations, I think it's an interesting real-world case to analyse. In this post, I'm assuming that the reader knows the basic concepts and syntax of some Java 8 features, such as lamdas, Streams and Optional<T> .

First, let's give the relevant context. I have a MediaItem interface, which represents e.g. an audio file, which exposes a Metadata interface:

public interface Metadata { @Nullable public <T> T get (@Nonnull Key<T> key); @Nonnull public Set<Map.Entry<Key<?>, ?>> getEntries(); … }

It's basically a type-safe Map , that there is a set of pre-defined Key items which carry the type information of the value they're associated with. So there's no need to cast the values coming out from the get() method.

Now I have to extract metadata items and store them into a semantic repository. You don't need to know a lot about semantic repositories, but the fact that they contain statements, or triples, in the form subject-predicate-object. Subjects or objects, when they refer to an entity and not a literal value, are basically the identifiers of the related entities (which are URIs in the semantic world). That's all you really need to know.

Indeed, for the scope of this post, you could pretend that the semantic repository is just a plain relational database in which I have to insert some SQL statements. The relevant point is that I'm going to insert them by firing an asynchronous message in a publish-and-subscribe architecture; a subscriber somewhere will be notified of the request and perform the insertion. For the sake of performance, I'm not firing a message for each statement, but I'm grouping them together (this might also have to do with transaction control: perhaps I want to process them as atomic batches). On this purpose, there's an AddStatementRequest message with its fluent Builder . The fluent nature of this object was a small problem with streams that I needed to solve.

Here it is the version of the code at the beginning of the refactoring:

public void importMediaItemEmbeddedMetadata (final @Nonnull MediaItem mediaItem, final @Nonnull URI mediaItemUri) { log.info("importMediaItemEmbeddedMetadata({}, {})", mediaItem, mediaItemUri); final MediaItem.Metadata metadata = mediaItem.getMetadata(); final Integer trackNumber = metadata.get(MediaItem.Metadata.TRACK); final Integer sampleRate = metadata.get(MediaItem.Metadata.SAMPLE_RATE); final Integer bitRate = metadata.get(MediaItem.Metadata.BIT_RATE); final Duration duration = metadata.get(MediaItem.Metadata.DURATION); AddStatementsRequest.Builder builder = AddStatementsRequest.build(); if (sampleRate != null) { builder = builder.with(mediaItemUri, MO.SAMPLE_RATE, literalFor(sampleRate)); } if (bitRate != null) { builder = builder.with(mediaItemUri, MO.BITS_PER_SAMPLE, literalFor(bitRate)); } if (trackNumber != null) { builder = builder.with(mediaItemUri, MO.TRACK_NUMBER, literalFor(trackNumber)); } if (duration != null) { builder = builder.with(mediaItemUri, MO.DURATION, literalFor((float)duration.toMillis())); } messageBus.publish(builder.create()); }

I think it is quite readable. There are two immediate code smells: the sequence of if statements, and the fact that I'm dealing with null s.

Let's start from the latter issue. Java 8 offers the Optional<T> class which represents a value that can be present or not. I can refactor Metadata as follows:

public interface Metadata { @Nunnull public <T> Optional<T> get (@Nonnull Key<T> key); @Nonnull public Set<Map.Entry<Key<?>, ?>> getEntries(); … }

So get() now is guaranteed to return a non null value. The method can be rewritten as follows:

public void importMediaItemEmbeddedMetadata (final @Nonnull MediaItem mediaItem, final @Nonnull URI mediaItemUri) { log.info("importMediaItemEmbeddedMetadata({}, {})", mediaItem, mediaItemUri); final MediaItem.Metadata metadata = mediaItem.getMetadata(); final Optional<Integer> trackNumber = metadata.get(MediaItem.Metadata.TRACK); final Optional<Integer> sampleRate = metadata.get(MediaItem.Metadata.SAMPLE_RATE); final Optional<Integer> bitRate = metadata.get(MediaItem.Metadata.BIT_RATE); final Optional<Duration> duration = metadata.get(MediaItem.Metadata.DURATION); AddStatementsRequest.Builder builder = AddStatementsRequest.build(); if (sampleRate.isPresent()) { builder = builder.with(mediaItemUri, MO.SAMPLE_RATE, literalFor(sampleRate.get())); } if (bitRate.isPresent()) { builder = builder.with(mediaItemUri, MO.BITS_PER_SAMPLE, literalFor(bitRate.get())); } if (trackNumber.isPresent()) { builder = builder.with(mediaItemUri, MO.TRACK_NUMBER, literalFor(trackNumber.get())); } if (duration.isPresent()) { builder = builder.with(mediaItemUri, MO.DURATION, literalFor((float)duration.get().toMillis())); } messageBus.publish(builder.create()); }

Honestly, this is an almost neglectable improvement. Sure, isPresent() is marginally better readable than != null , but there's no much beef. The if statements are still needed, and while there can't be NPEs any longer, I can still get it wrong: if a presence check is wrong, sampleRate.get() will throw NoSuchElementException . So, I've just exchanged an exception with another. While there's plenty of code samples like this, and flame wars about whether it's good or not, to me it's quite evident that this usage of Optional is basically meaningless.

Optional offers a more functionally oriented method, such as map () to apply a Function . It would eliminate conditionals, but wouldn't solve an issue, described below, with the fact that builder is not final . That's why I did not consider this route.

Now, a fundamental point is that, if you want quality in your code then you need testing. But a compiler of a statically-typed language could help in avoiding some blatant errors and, in the end, save some time. By introducing Optional it has not been the case.

Basically, the null -related issue is secondary. The problem here is conditioned by the major code-smell, which is the sequence of conditional statements. It's also an approach that badly scales: what if I need to add mapping for another dozen of metadata items?

Let's think of a Java 8-oriented refactoring that will bring the code down to 4 lines. Well, I'm lying: the fundamental lines will be 4+4, plus some other stuff. But improving the quality of code doesn't (always) mean literally shrinking lines, rather having better lines.

First, we realize that, rather than having a sequence of special-cases, we need a collection of metadata mappings, and iterating over it. In Java 8 we have lambda expressions that allow code an iteration in a single line. For instance, something such as the following pseudo-code:

AddStatementsRequest.Builder builder = AddStatementsRequest.build(); mapping.stream().forEach(() -> builder = builder.with(… /* do something smart */)); messageBus.publish(builder.create());

Unfortunately, it can't work whatever smart the thing is conceived. The problem is that a lambda is a sort of masked inner class, and the usual rule applies: if it accesses local variables declared outside its scope, they must be final . But a fluent Builder can't be referenced by a final variable (it prevents from writing builder = builder.with(...) ). While at first sight one might think: “ok, these are the classic devil's details that jeopardise a could-be elegant approach, and I give up”, the problem is that we're looking at a very limited number of features offered by Java 8. Functional often requires that you re-think some details. For instance, a fluent Builder is a sort of 'collector' of things that are incrementally added. But Java 8 streams offer their own version of a Collector : an object that 'terminates' a stream, collecting all the elements in it into a single object. Perhaps we can replace our collector with their collector, and find that their collector fits better?

I received some feedback about this passage. It was pointed out that the problem is not only related to the limitation about lambdas and final references pointing to immutable objects such as Builder . Indeed from the design point of view a good functional approach should avoid side-effects.

So our code becomes:

Collector<Statement, List<Statement>, AddStatementsRequest> collector = ...; AddStatementRequest request = mapping.stream(). … .collect(collector); messageBus.publish(request);

Even better, taking advantage of static methods, in a single line:

messageBus.publish(mapping.stream(). … .collect(toAddStatementsRequest()));

Now, what is the cost of writing a custom Collector ? Something like that:

@Nonnull public static Collector<Statement, List<Statement>, AddStatementsRequest> toAddStatementsRequest() { return new ArrayListCollectorSupport<Statement, AddStatementsRequest>() { @Override @Nonnull public Function<List<Statement>, AddStatementsRequest> finisher() { return statements -> new AddStatementsRequest(statements); } }; } public abstract class ArrayListCollectorSupport<COLLECTED_TYPE, COLLECTING_TYPE> implements Collector<COLLECTED_TYPE, List<COLLECTED_TYPE>, COLLECTING_TYPE> { @Override @Nonnull public Supplier<List<COLLECTED_TYPE>> supplier() { return ArrayList::new; } @Override @Nonnull public BiConsumer<List<COLLECTED_TYPE>, COLLECTED_TYPE> accumulator() { return List::add; } @Override @Nonnull public BinaryOperator<List<COLLECTED_TYPE>> combiner() { return (left, right) -> { left.addAll(right); return left; }; } @Override @Nonnull public Set<Characteristics> characteristics() { // Not CONCURRENT since ArrayList is not thread-safe return Collections.emptySet(); } }

Honestly, we're adding a lot of lines of code. But:

ArrayListCollectorSupport is a very reusable class for many kinds of programmer-defined Collectors . Actually, it was already in my kitchen-sink library of small useful things that I reuse everywhere. toAddStatementsRequest() is very specific to AddStatementsRequest , but I can reuse it a few times.

I think most people working with Java 8 know Collectors up to a certain degree, since they offer some facility methods to easily re-pack a Stream into a List , or format it to a String with controllable formatting. But I see that only a few ones understand that they could write their own Collector for their classes, and this kind of usage of the Java 8 APIs can be useful for achieving a real benefit. Sometimes you have complex logics in the collection strategy that don't fit with a simply iterative approach. For instance, within a Stream you can filter() item by item, but you cannot take a decision based on the whole collection of items accumulated so far. In a earlier version of the code related to this post it was possible to override statements with the same subject and predicate, because a certain piece of medatada was first extracted by an audio file and later superseded by a better piece of information retrieved from the web. This was implemented in a custom Collector . This requirement went away with other refactorings, so now the custom Collector was removed. I'm leaving it in this post just for didactic purposes - let's just recall that in some more complex cases it can help us. Ignoring that the Java 8 Streams API is made not only of Stream s might make you give up a refactoring and preclude an interesting way to re-shape your code.

Now, let's focus on the stream. We can start with the whole set of metadata entries:

mediaItem.getMetadata().getEntries().stream()

and then apply a filter for picking only those that I want to store to my semantic repository:

filter(e -> MAPPER.containsKey(e.getKey())

Now the trickiest part. I have to 'translate' a Metadata Key in the corresponding Statement . A Statement , I repeat, is a triple subject-predicate-object. In my case the subject is the id (i.e. the URI) of the mediaItem . This is a variable part for each invocation, so can't be a responsiblity of the MAPPER . The predicate and object are fixed for each metadata key, so they can be a responsibility of the MAPPER . First, we need to introduce a Pair class which encapsulates predicate and object:

@Immutable @RequiredArgsConstructor @ToString static class Pair { @Nonnull private final URI predicate; @Nonnull private final Value object; }

I'm taking advantage of Lombok for saving some plumbing code (constructor and getters). At this point I can define the MAPPER as a Map from Key to a Function transforming an Object (the metadata item value) to a Pair of predicate and object:

private static final Map<Key<?>, Function<Object, Pair>> MAPPER = new HashMap<>(); static { MAPPER.put(Metadata.TRACK, v -> new Pair(MO.P_TRACK_NUMBER, literalFor((int)v))); MAPPER.put(Metadata.SAMPLE_RATE, v -> new Pair(MO.P_SAMPLE_RATE, literalFor((int)v))); MAPPER.put(Metadata.BIT_RATE, v -> new Pair(MO.P_BITS_PER_SAMPLE, literalFor((int)v))); MAPPER.put(Metadata.DURATION, v -> new Pair(MO.P_DURATION, literalFor((float)((Duration)v).toMillis()))); }

Note that here we are already losing something. While in the original code, with the “unrolled” conditional statements, we were taking advantage of the type information brought by Key , here we have lost it. For this reason, we are forced to put explicit casts in the parameter of literalFor() . I don't see solutions, and the cause is the limited support of type information, not reified, in Java generics.

The final touch is to add to Pair a method to create a Statement with a given subject:

@Nonnull public Statement createStatementWithSubject (final @Nonnull URI subject) { return ...createStatement(subject, predicate, object); }

How to use that stuff? By applying a mapping to the stream, in which we first get the relevant Function inside the MAPPER , then apply it to the metadata value, retrieve the Pair and create the Statement :

stream().map(e -> MAPPER.get(e.getKey()).apply(e.getValue()).createStatementWithSubject(mediaItemUri))

Putting all together:

public void importTrackMetadata (final @Nonnull MediaItem mediaItem, final @Nonnull URI mediaItemUri) { log.debug("importTrackMetadata({}, {})", mediaItem, mediaItemUri); messageBus.publish(mediaItem.getMetadata().getEntries().stream() .filter(e -> MAPPER.containsKey(e.getKey())) .map(e -> MAPPER.get(e.getKey()).apply(e.getValue()).createStatementWithSubject(mediaItemUri)) .collect(toAddStatementsRequest())); }

So, let's recap. The original method had 15 lines (excluding logging, blanks and braces). The refactored method has got 4, but part of the information has been moved to the further 4 lines that populate MAPPER . In the end, we have 8 lines: we saved 7 lines. But we had to introduce Pair (4 lines, and a few one saved by Lombok): 4 further lines. Roughly, the number of lines didn't change. Was it worth the effort?

First, the refactored code scales much better: for each new metadata item to map, we need to add one more line (we can't do better than this!); in the original code we needed to add a whole new if statement. Not only it's made by 2 lines, but it's less readable. In the end, we split the original blob into an imperative part (the one in the method, with the stream iteration), which will stay the same forever. Then we have a purely declarative part, which is the code populating MAPPER . There's not much to test in it, but the correctness of the mapping. So we have split an original blob of two responsibilities into two separate sections, each one with a single responsibility. We can understand each section separately, focusing only on a few lines at a time.

On the other hand, I think that many would argue that they find the new solution more “complex” (whatever the word means...) than the original.

The most controversial line is clearly this:

.map(e -> MAPPER.get(e.getKey()).apply(e.getValue()).createStatementWithSubject(mediaItemUri))

Is there any further room for improvement? It can be refactored as:

.map(e -> MAPPER.forItem(e).createStatementWithSubject(mediaItemUri))

but with a non neglectable cost, as we need to create a subclass:

static class Mapper extends HashMap<Key<?>, Function<Object, Pair>> { @Nonnull public Pair forItem (final @Nonnull Map.Entry<Key<?>, ?> entry) { return get(entry.getKey()).apply(entry.getValue()); } }

We're not saving any line here, instead we're introducing 4 more lines. And they are not reusable. In the end I applied this refactoring as well, but I'm not sure it's worth while.

What conclusion to draw? This is a specific problem, but a real case one. Undoubtedly, Java 8 was useful for refactoring my code in a way that has better responsibility separation, readability and maintainability. In terms of lines of code, there's not really a real gain, even considering some of the new lines I wrote are at least partially reusable.

So, if we limit ourselves to the mere LoC count, we could be easily displeased. When taking a broader horizon in consideration, the advantage is evident.

There are other advantages, in addition to readability. Streams are parallelizable, which means that if I had a large numbers of items to map, the refactored code would be faster, by taking advantage of multiple cores.

PS. While I was writing this post, my code evolved further. In particular, I found that the semantic schema I was applying was not correct: some metadata items have to be related to a certain entity, while others to a different one. The current code is:

static class Mapper extends HashMap<Key<?>, Function<Object, Pair>> { @Nonnull public Pair forItem (final @Nonnull Map.Entry<Key<?>, ?> entry) { return get(entry.getKey()).apply(entry.getValue()); } } private static final Mapper SIGNAL_MAPPER = new Mapper(); private static final Mapper TRACK_MAPPER = new Mapper(); static { TRACK_MAPPER. put(Metadata.TRACK, v -> new Pair(MO.P_TRACK_NUMBER, literalFor((int)v))); SIGNAL_MAPPER.put(Metadata.SAMPLE_RATE, v -> new Pair(MO.P_SAMPLE_RATE, literalFor((int)v))); SIGNAL_MAPPER.put(Metadata.BIT_RATE, v -> new Pair(MO.P_BITS_PER_SAMPLE, literalFor((int)v))); SIGNAL_MAPPER.put(Metadata.DURATION, v -> new Pair(MO.P_DURATION, literalFor((float)((Duration)v).toMillis()))); } public void importAudioFileMetadata (final @Nonnull MediaItem mediaItem, final @Nonnull URI signalUri, final @Nonnull URI trackUri) { log.debug("importAudioFileMetadata({}, {}, {})", mediaItem, signalUri, trackUri); final Set<Map.Entry<Key<?>, ?> entries = mediaItem.getMetadata().getEntries(); messageBus.publish(entries.stream() .filter(e -> SIGNAL_MAPPER.containsKey(e.getKey())) .map(e -> SIGNAL_MAPPER.forItem(e).createStatementWithSubject(signalUri)) .collect(toAddStatementsRequest())); messageBus.publish(entries.stream() .filter(e -> TRACK_MAPPER.containsKey(e.getKey())) .map(e -> TRACK_MAPPER.forItem(e).createStatementWithSubject(trackUri)) .collect(toAddStatementsRequest())); }

The readability improvement due do the introduction of MAPPER is now even more evident: the original sequence of conditional statements would easily induce errors in mis-matching the metadata items with the URIs of the two entities, while now we have two MAPPER s with their own configuration.

I have to further stress the point, anyway, that the final warranty of quality can't be given by syntax, but I need testing. Actually I have an integration test running over a few thousands audio files of my personal collection that makes sure data is properly translated; I couldn't have applied this radical refactoring without being supported by this test that assured me I was not introducing regressions at each step.

The better syntax, however, might help in making fewer errors and spending less time to run tests, detect problems and fix them.


No one knows exactly why premature babies, especially those who weigh less than three pounds, are so susceptible to deadly intestinal infections. But study after study has shown that breast milk dramatically improves their chances of survival.

For preemies, breast milk is a wonder elixir also shown to reduce blood infections, blindness and readmission to the hospital in the first year of life. It’s packed with mom’s antibodies, which boost premature babies’ immune systems and provide nutrients needed for development.

But mothers can’t always provide enough of this critical liquid on their own. Some may be on medications that could harm their child. Others may have trouble developing an adequate supply before their tiny infant is strong enough to nurse vigorously.

This is where milk banks come in. They collect, test, pasteurize, package and deliver donated milk from mothers who have extra to give.

Many hospitals in San Diego County have been buying ounce after ounce of donated milk for their tiniest patients, but it has come from as far away as San Jose.

That is expected to change next year as the Division of Neonatology at UC San Diego creates the region’s first breast-milk bank with the help of a financial gift from local couple Hannah and Zachary Johnson.

Having crewed on collegiate rowing teams, Hannah Johnson said she and her husband learned the value of nutrition and its connection to delivering the best possible performance. Though her son was not born premature and did not require milk from a bank, Johnson said she wanted to find a project that would have lasting impact on children. Helping at-risk newborns avoid disease in their first few weeks of life had the promise of lifelong benefits she was seeking.

“Nutrition has definitely always been my passion. I’m a busybody, and I am always looking for something more to do,” Johnson said.

She had no problem finding willing participants in Dr. Lisa Stellwagen, lactation director for the university’s Supporting Premature Infant Nutrition Program, and Dr. Jae Kim, the program’s medical director.

Both have contributed to the growing knowledge base about breast milk’s benefits for preterm babies, and both said they have wanted to create a local breast-milk bank for years. Funding was always the sticking point.

The Johnsons, who asked that the amount of their gift remain private, were just the people to push the project from idea to implementation.

Stellwagen said a big part of the bank will be working with local hospitals and other health-care providers to create a collection infrastructure that allows women to donate their milk without having to drive too far out of their way. Talks are also underway with the San Diego Blood Bank to seamlessly provide blood tests required of each donor to rule out infectious diseases.

And then, there is the challenge of raising awareness about the opportunity to donate.

“We need to get that message out so that women aren’t dumping their milk out when they don’t need it anymore,” Stellwagen said.

At least initially, the San Diego breast-milk bank will not do its own processing. All collected milk will be shipped in coolers to the Mother’s Milk Bank in San Jose, which has already invested in the necessary processing equipment.

“They do a great job, they’re interested in partnering with us and they have the extra capacity, so we think it’s going to be a great collaboration,” Stellwagen said.

Once the milk arrives back at local hospitals — at the cost of about $4 per ounce — it will be fortified with additional nutrients, a task that each hospital will typically handle on its own.

Kim, the premature infant program’s medical director, said the use of donated milk has been around for decades but did not really take off for babies in neonatal intensive care units until adequate fortification methods were developed. Babies born before their due dates, he explained, will not get enough of what they need from breast milk alone.

“A preterm baby’s growth rate is far faster than a term baby’s,” Kim said. “They add over 20 grams of weight per day for every kilo of body weight. I tell my parents that’s like an adult needing to gain three pounds per day.”

Fortification has been a controversial point of entry for for-profit milk banks, which, according to a recent piece by California Healthline, charge up to $180 per ounce after adding nutrients to breast milk they buy from mothers. The industry has recently come under criticism for paying women to donate, a practice that generated publicity in Detroit in 2014 with accusations that a program bought from moms whose own babies needed every ounce.

Stellwagen said the San Diego program will not accept any donations from women within three months after they have given birth to avoid similar issues.

“We want to be very cautious that we’re never having a mother donate milk that might be needed by their own baby,” Stellwagen said.

Breast milk, which is often collected using special pumps, is good in a normal freezer for up to six months and in a deep freeze, which stores food at minus 80 degrees Fahrenheit, for up to one year.

It will take about a year for the local program to get up and running. In the meantime, mothers who want to donate their breast milk can contact the San Jose program. Call (877) 375-6645 or email donate@mothersmilk.org for more information.

paul.sisson@sduniountribune.com

(619) 293-1850

@paulsisson


One Woman's Power of Persistence

Award-winning director Mirra Bank heard about the plight of a people halfway around the world and decided she wanted to help—but it took six years. Here, the story of what she did, the film she made ("The Only Real Game"), the obstacles she overcame…and how you can help now

by Judith Coyne

Devika, a mother in Manipur, India, hopes to support her family by becoming a baseball coach.

Photograph: Axel Baumann for Baseball Dreams, LLC

MB: On my last trip, I was walking on a slippery floor, carrying something heavy, and I started to fall. If I’d just fallen I might’ve been OK, but in catching my balance, I torqued my back. I thought I’d just pulled a muscle very badly, but I later learned that I had actually broken a disc in my back. Because of that I was in agony and partly lost the use of my right leg. I had no real medication in India, just ibuprofen. I didn’t go to the hospital—partly because I didn't know how badly hurt I was, and partly because hospitals in Manipur have to deal with regular power outages, and they also have different approaches to dealing with serious medical situations. So I opted to just work through the pain for almost two weeks. Back in New York, I found out I needed surgery to remove a centimeter of disc from the nerve shaft that runs up and down the spine. And then there was a long recovery.

More: How did you keep going in the face of all that? How did you keep up your passion, your determination?

MB: It’s a kind of stubborn pride. I didn’t want to let the people in Manipur down. I felt a tremendous commitment not to be yet another person who would disappoint them. They’ve already had too much disappointment and psychic abuse; I was damned if I was going to be part of that list. And I cared too much about the work that had gone into the film; I couldn’t quit working on it without reaching my own standard of how the film should be, and that took a long time.

More: What’s the situation in Manipur now?

MB: Something called The Disturbed Area Permit Requirement has been lifted, so once you have a visa for India, you can go to Manipur without a special permit. As a result, there is beginning to be more tourism and Indians can go there without restriction, which brings some money into Manipur. And that’s great, but the state is still under martial law, which means businesses stay away. So in that sense the situation has changed very little.

More: What do you hope will happen next?

MB: My intention is to show the film in India, with the hope that the film will show India the courage and spirit of the people in Manipur and create an upwelling of support for the lifting of martial law.

We also hope that the U.S. embassy and consulates in India will continue to facilitate sports projects and other exchanges, thereby making Manipur more open and more of a center for baseball and sports activity. That's another way of helping the people.

More: What can More readers do?

MB: The ultimate solution is a political one, but in the meantime, there a couple of ways to get involved. First Pitch is raising money to supply baseball equipment (the Manipuris have very little and a lot of it is old and worn; one kid I met, for example, had a hand-me-down glove with no leather left in the palm) and build a regulation baseball field for them complete with a diamond and the necessary safety features. Instructions how to donate are on the website, firstpitchusa.org. To help women widowed by the violence, you could consider making a donation to Manipur Women Gun Survivors Network. This NGO, founded by Binalakshmi Nepram, who in 2011 received a "Real Heroes" award from the CNN-Indian Broadcasting Network, is a women’s empowerment group that helps women whose husbands have been killed in the conflict to make a living. Some of these women are not only widows, they are also shut out by their late husband’s family and left entirely on their own to support their children.


[From oxygen to erythropoietin, as a protagonist of the skin-brain-kidney axis].
Erythropoietin synthesis is one of the essential adaptive responses to a hypoxic environment. In mammals, a renal oxygen sensor capable of stimulating erythropoietic hormone synthesis through a transcriptional factor called HIF (hypoxia-inducible factor) has long been identified. Recent research has demonstrated that cerebral astrocytes and skin keratocytes can also produce erythropoietin as a response to different oxygen concentrations. Therefore, it is possible to hypothesize a skin-brain-kidney link which, through erythropoietin production, modulates the oxygen contribution to tissues. Moreover, the results are not so unambiguous and further research on the pleiotropic effects of erythropoetin would be opportune.


Structural characterization and immunostimulating activity of a levan-type fructan from Curcuma kwangsiensis.
A fructan designated as CKNP with apparent molecular weight of 5.3kD was isolated from the hot water extract of Curcuma kwangsiensis through a combination of ion-exchange chromatography on DEAE 650M and gel filtration on Superdex G-200. CKNP was characterized by chemical derivatization as well as HPLC, GC, and GC-MS technologies. Structural studies revealed that CKNP is composed predominately of fructose (96.8%) and a small amount of glucose (3.2%) with a degree of polymerization (DP) of 30-31. It was deduced to be a levan-type fructan containing a backbone composed of (2→6)-linked β-d-Fruf residues and single β-d-Fruf residues as side chains branched at the O-1 position along the backbone. Preliminary in vitro bioactive tests on RAW 264.7 murine macrophage cells revealed that the levan-type fructan from C. kwangsiensis shows significant immunostimulating activity based on its ability to stimulate macrophage proliferation and enhance phagocytosis.


I would never suggest that Axiom would do anything like that either, but there is evidence of at least one recent price increase - check out the difference between the actual price of a pair of M40Tis ($490 US) and the "Towers from $465" statement in the tower link of the "Store" web page.

In the few weeks I've been on this forum, the FO discounts have appeared to shrink a bit. They seem now to hover around 10% off, although you'll occasionally see some that are discounted a greater amount, and subscribers to the email newsletter sometimes get extra incentives (I just got a pair of cherry M40Tis from the Outlet for $416US). I've read that in some instances it depends on the amount of stock on hand. If there are fewer sets of a particular model in a particular finish, the price can go up.

You are correct, sir. I don't set the prices but I sorta know how they work on the FO. It's Economics 101, the law of supply and demand.

For example, a few days ago we had a lot of M60's in light Maple, so they were $640/pair. Now we don't have as many and there's a second choice of finish, so they are back to $680/pair. We had one pair of M60s (not posted) in Boston Cherry for $720/pair. All of these prices would be lowered by the "Holiday Special" bonus discount, which is a great deal.


Why the U.S. Should Be Downgraded

10/16/2013 10:34AM

Even if a debt deal emerges soon, the drawn-out budget battle will at the least ding the reputation of the U.S. and its government. As a result, the U.S. should not be rated triple-A anymore, Michael Casey says. Photo: Getty Images.

This transcript has been automatically generated and may not be 100% accurate.

... in due ... all he is betting heavily ... a Washington will finally get around to agreeing on a budget and avoid the potential debt default ... however ... the strong the budget battle will it lead in the reputation of the US the ... certainly ... and its government in fact our first guest says ... the Lord conclusion from this debt drama ... the U S should not be rated AAA anymore my Casey ... horizons columnist for my need be ... a strong statement Mr. it is our money to it if it's fifty decided that I knew it sits in the day in addition to spot because two years ago right ... but close to them the majority of of ... the three big readings as the Basilan ... of the Swans ... to give us a triple a and ... and and that reading has traditionally been built upon two factors one costing the debt numbers which not all that going on and on the state gross debt to GDP ... but they have a good counterbalance factors with all this is to shoot will strengthen the U S has ... it's kind of commitment to the foreplay from prison instead it's ... built around the idea that has a reserve currency everything else ... well when just out looking at that second pot any anyway in that his reputation the rest of the political system that put the suspicions that on that thing ... is to be staying ... ultimately the current of ... dysfunction that we've seen ... is I think ... causing a great loss of confidence in a state which ultimately undermines polls that were ... the earliest time I don't doubt that we can pay our bills the United States only was the money ... that's not the issue ... well one thing we haven't coming in it's a pretty ... decent point he said ... AAA rated sovereigns don't ask I mean in that sense into what I was in a better rating is a rating is a relative concept is critically important weekend it was a triple I so we hope you can pay the bills that apply for a double agent isn't a single edged up into the bills as well ... to do with the highest rating possible said we need it to real concert to see if they don't compare to other countries the stock around the well then the other two boys are out there ... and I did this this appeal quizzes US artist rendering it is not enough good idea for a bit of coast ride as a very good reputation for Number reasons ... that built a massive stockpile of political Superannuation dominant on defense and also Sozzi Creek Robins that I know the way ... they have these independent body that looks up that ... another aspect of budget that in Norway which has this institutionalize sovereign wealth fund that the soft soil this money for years on intimate buzz buzz buzz and it has a hundred and fifty proceed asset to GDP no didn't also the other side of the Ledger ... I'm any good Germany which of course it does decide the calm ... he noted that the goods numbers on as good as those two countries but that it's it's it's got this compromise in capacity which means that I'm that cool ... just recently when he licks the most she has to form a grand coalition cover with the arch rivals and no one doubts is condemned because they don't understand it this is how the system was to Jimmy the two rivals come together to form a government so ... it's imperative that what's been happening in Washington even if you really do we deserve to be in that league ...


Q:

Import multiple csv files into pandas and concatenate into one DataFrame

I would like to read several csv files from a directory into pandas and concatenate them into one big DataFrame. I have not been able to figure it out though. Here is what I have so far:
import glob
import pandas as pd

# get data file names
path =r'C:\DRO\DCL_rawdata_files'
filenames = glob.glob(path + "/*.csv")

dfs = []
for filename in filenames:
    dfs.append(pd.read_csv(filename))

# Concatenate all data into one DataFrame
big_frame = pd.concat(dfs, ignore_index=True)

I guess I need some help within the for loop???

A:

If you have same columns in all your csv files then you can try the code below.
I have added header=0 so that after reading csv first row can be assigned as the column names.
import pandas as pd
import glob

path = r'C:\DRO\DCL_rawdata_files' # use your path
all_files = glob.glob(path + "/*.csv")

li = []

for filename in all_files:
    df = pd.read_csv(filename, index_col=None, header=0)
    li.append(df)

frame = pd.concat(li, axis=0, ignore_index=True)

A:

An alternative to darindaCoder's answer:
path = r'C:\DRO\DCL_rawdata_files'                     # use your path
all_files = glob.glob(os.path.join(path, "*.csv"))     # advisable to use os.path.join as this makes concatenation OS independent

df_from_each_file = (pd.read_csv(f) for f in all_files)
concatenated_df   = pd.concat(df_from_each_file, ignore_index=True)
# doesn't create a list, nor does it append to one

A:

import glob, os
df = pd.concat(map(pd.read_csv, glob.glob(os.path.join('', "my_files*.csv"))))


About Me: Hello~ and welcome to...this page! My name, as I just noticed, is very similar to this other person so just to make things clear we\'re not the same person. Her stories and my stories aren\'t related. Those are her stories and these are mine. If I don\'t update quick enough or notice I haven\'t done anything give me a buzz and remind me.

Crazy Over At The MomentMildly Interested At The Moment

Twilight Criminal Minds NCIS Doctor Who CSI: Anime House

Oh! I used to be Team Edward but now I\'m Team Everyone~ ^.^ or Team Carlisle. The guy\'s smoking~I\'m getting tired of vampires right now. Don\'t get me wrong, vampires are kinda cool but...I dunno. I see more Edward fans than any other.

Summary: It's been a while since you two have seen each other so meeting at a place like this must mean it's destiny! Right? Sure you had a little crush on when you were younger, he was cute with his huge glasses, book-wormy self. But now isn't the time to reminiscence, now is the time to run like the wind before this weird-o kills you.


Russia has questioned the US contribution to a global oil deal a day before the OPEC+ virtual meeting.

The world’s largest oil producers will meet on Thursday and Friday in an attempt to stem the decline in market values of oil, which threatens the stability of companies and countries. Saudi Arabia, Russia, and their OPEC allies are discussing deliberate cuts to production to offset the impact of the coronavirus pandemic on demand, but so far, the US is only offering a reduction in market-led production.

“Russia does not consider reduced supply, driven by falling demand or lower prices, to actually reduce production in the parameters of the proposed deal in OPEC+”, said the Kremlin on Wednesday. It was the first statement from Moscow about this key aspect of the talks, which stated that President Vladimir Putin could expect more significant input from the US than his counterpart Donald Trump was prepared to give. “You are comparing the overall decline in demand to redundancies aimed at stabilizing the global market”, said Kremlin spokesman Dmitry Peskov, when asked if Russia would accept cuts in US production. “These are completely different things”, added he.

So far, Washington has only offered an “automatic” and “market” decline in production, which is the result of actions by companies such as Exxon Mobil Corp. to reduce costs in response to low prices.

If Russia, the Organization of the Petroleum Exporting Countries and other global producers such as Brazil and Canada manage to reach a deal, it could still lead to a 10% reduction in global production. The so-called physical commodity market – trading in real goods, not futures contracts – needs a real reduction in supplies.

In a televised address on Tuesday, Jason Kenney, Premier of Alberta in Canada, warned that there was “a very real possibility” of negative energy prices.


Implements optimal matching with near-fine balance in large observational studies with the use of optimal calipers to get a sparse network. The caliper is optimal in the sense that it is as small as possible such that a matching exists. The main functions in the 'bigmatch' package are optcal() to find the optimal caliper, optconstant() to find the optimal number of nearest neighbors and nfmatch() to find a near-fine balance match with a caliper and a restriction on number of nearest neighbors.
Glover, F. (1967). <doi:10.1002/nav.3800140304>.
Lipski, W., Jr, and Preparata, F. P. (1981). <doi:10.1007/BF00264533>.
Rosenbaum, P.R. (1989). <doi:10.1080/01621459.1989.10478868>.
Yang, D., Small, D. S., Silber, J. H., and Rosenbaum, P. R. (2012). <doi:10.1111/j.1541-0420.2011.01691.x>.


Can the complicated forgotten indwelling ureteric stents be lethal?
The forgotten ureteral stents remain a urological dilemma and complications related to it can be lethal for the patient. The management of such stents require lithotripsy and endourological techniques. We retrospectively reviewed the records of 19 cases of forgotten stents managed between 1998 and 2003. The mean patient age was 32 +/- l2 years, male to female ratio 17:2 and the mean duration of stents in urinary system was 24.2 months (7 months to l0 years). The stent were complicated in 14 patients and 5 patients had uncomplicated stents. The stents were severely calcified and encrusted in 6 patients, large stone formation seen at upper end of stent in 2 patients and at lower end of stents in 2 patients. The stents were spontaneously fragmented in 2 patients. The advanced renal failure secondary to hydroureteronephrosis because of severe encrustation and stone formation over the stent in solitary kidney was seen in 1 patient and 1 patient had upmigrated stent with infected hydronephrosis, but the duration of upmigration in this case was unknown. The stents were removed by retrograde approach in all 5 uncomplicated cases. In 6 patients of severely calcified and encrusted stents, the retrograde stent removal could be done in 4 patients while stent got broken in proximal ureter in 2 cases when they were being removed. In these 2 cases the stents were removed by percutaneous nephrostomy. The percutaneous nephrolithotomy and stent removal was done in 2 patients who had large stone at the upper end of stent in renal pelvis. In 2 patients who had large stone formation at lower end, stones were fragmented by mechanical lithotripsy in one and by laser lithotripsy in another case and stents removed by retrograde approach. Two cases of spontaneous fragmented stents were managed by retrograde endoscopic approach. The patient of advanced renal failure refused treatment and died. The patient of infective hydronephrosis with upmigrated stent died because of complications related to operative intervention. The management of complicated forgotten ureteral stents need judicious use of endourological techniques and lithotripsy. The stent related complication can be directly lethal for the patient or indirectly can cause death because of complications related to operative intervention.


Married sex chat germany online dating tricks for men

Posted by
/ 09-Nov-2014 16:04

Treas and Giesen found that people who had stronger sexual interests, more permissive sexual values, lower subjective satisfaction with their partner, weaker network ties to their partner, and greater sexual opportunities were more likely to be unfaithful.The form and extent of these consequences are often dependent on the gender of the unfaithful person.One measure of infidelity among couples is the frequency of children secretly conceived with a different partner, leading to "non-paternities".

Article uses three different citation styles: inline footnotes, a "references section" and a "further reading" section. For example, the first citation, Leeker & Carlozzi, points to the further reading section. Other scholars define infidelity as a violation according to the subjective feeling that one's partner has violated a set of rules or relationship norms; this violation results in feelings of sexual jealousy and rivalry.The second citation (Weeks) is both defined in text and pointed at using a footnote. In marital relationships, exclusivity expectations are commonly assumed although they are not always met.A survey conducted in 1990 found 2.2% of married participants reported having more than one partner during the past year.In general, national surveys conducted in the early 1990s reported that between 15-25% of married Americans reported having extramarital affairs.Such covertly illegitimate children amount to about 1–2% of newborns in European populations.

According to The New York Times, the most consistent data on infidelity comes from the University of Chicago's General Social Survey (GSS).


Paddy's "Letter from London"

Tuesday, December 31, 2013

My Twitter year

By the end of 2013 I had posted 43,800 Tweets in total since my first some three years ago. Assuming an average number of characters of 120 and six characters/spaces per word that amounts to 876,000 words. That is roughly as many words as there are in three of the novels of Charles Dickens. Am I mad? How do I find the time?

The thing about Twitter is that you mostly do it in “downtime” when you have nothing else to do. Of course you could be reading an improving book or, if you are a writer like me, you could be doing “proper” writing. But Twitter is addictive and it is also informative and entertaining. Regular users of Twitter don't really need to have the benefits explained to them and those who don't use it can only really find out by giving it a trial. I have never succeeded in explaining to a Twitter sceptic why I like it. You have to try it.

A Tweeter of the Year

2013 brought some personal highlights and a few low points. Lets get the main highlight out of the way first. The Conservative broadcaster and journalist Iain Dale named me as one of his “Top 100 tweeters of the year”. He placed me in the “Bloggers” category. I was very pleased about this as Iain is a master of social media and one of the best bloggers around in his day. I was also chuffed because I am emphatically not a Conservative – so Iain was not leaning towards a political kindred spirit!

Going Viral

Towards the end of the year I had my first personal experience of a Tweet going viral. I saw a tweet on my timeline with a picture of a blonde woman grinning at the camera and holding the dead body of a leopard she had shot. I then tweeted the picture with my own caption like this:

Well the effect of this was astonishing. The tweet went viral and by today it has had nearly 2700 retweets. For those unfamiliar with Twitter a “retweet” is when someone posts your tweet, often with a comment, under their own twitter ID. This doesn't not necessarily mean they agree with your tweet (thought usually they do) but just that they want their followers to see it. I think that the largest number of retweets I have ever had before for any tweet was less than 100. There is a correlation between the number of followers you have and the number of retweets you get. So the football pundit Gary Lineker, with over 2m followers, would get 500-1000 retweets for most of his tweets and more for special ones. But for an ordinary non-Celeb, like me, to get approaching 3000 retweets is unusual.

The Power of Twitter

What have I learned from this. Well obviously the power of Twitter. Every retweet leads to many more retweets in such a situation – rather like a digital chain letter! When this happens you cannot look at all the retweets – the sheer volume is difficult to handle. It also dominates your “Connect” line so you may miss some of the more usual responses to your other tweets. But you can handle that! It also increases your followers – mine went up by 300 in the space of a couple of weeks. You also have to be very careful – particularly on a subject like Animal Rights.

But be very careful…

I care very mush about protecting the world’s wildlife and I deplore hunting. But I am not an animal rights activist and some of the actions of some of those who are troubles me. I would describe myself as mildly militant on the subject and not against affirmative action – in the protection of Badgers for example or in combating the killing of dolphins in Japan. But some activists go too far and some of these people responded to my Tweet with some rather nasty threats at the leopard-killing woman. As the instigator of the original tweet I feel some vicarious responsibility here, but obviously you cannot reply to all of the tweets you receive given the scale of the matter.

…there’s lowlife waiting to ambush you!

Twitter is a free-for-all and that is a key part of its appeal. In the past I have tried to be accurate and honest in what I say and since the Sally Bercow affair I have been particularly careful – as I am sure have many other regular and responsible tweeters. But in the past I have occasionally used bad language for effect. This caused one of the low moments for me this year. During the Trent Bridge test match I was contacted by a Daily Mail sports writer who was, or so he said, interested in the work I was doing as part of the “MCC Reform Group”. I gave him a twenty minute interview and passed him one or two titbits about our campaign. A few days later the following brief piece appeared in the Daily Mail:

The writer who perpetrated this is a particularly noisome character who had previously insulted much more famous people than me (Brian Moore and Jonathan Agnew amongst them). And he is a poor journalist as well as he completely ignored the information I have him during the interview to make instead a personal attack on me. But what he said, though cruelly selective, was true. So I immediately made a resolution never to swear on Twitter again on the grounds that there is low life around who may use it against you!

A Year to remember

So that's my 2013 Twitter year. The very good, the occasionally bad and once very ugly. What I have left to last to say is how many friends you make on Twitter. I have, I think, become close to dozens of people via the medium. Some are kindred spirits on sport or politics but many are not. We exchange views – and above all use Twitter as a link to other things. The link to this blog will be tweeted and drive traffic as a result to the blog. I feel better informed by following links on Twitter to blogs and other pieces in the public domain that I would otherwise not have seen. And, as we have seen with the leopard Tweet, you can if you are lucky start a campaign of awareness about something you feel strongly about that might just make a difference. So if you are not on twitter why not give it a try – you might surprise yourself. But keep it clean!

Wednesday, December 11, 2013

Proud Scots who are proud to be British as well

I lived in Scotland for three years then in Hong Kong, which was run by Scots in those days, for four more. I have many Scottish friends and love their country. I have never, ever heard Scots of my acquaintance demean their Scottishness of which they are justly proud. But I've never heard them deny or denigrate their Britishness either. More than the English Scots can resolve easily the slight paradox of being binational. They are simultaneously Scottish and British - and proud of it. They don't see themselves as victims - on the contrary they rather relish the fact that they can emphasise their Scottishness (at Murrayfield) or their Britishness (at London 2012) without there being an ounce of conflict in this.

When it comes to Mr Salmond's referendum Scots will surely ask themselves whether they want to break up the United Kingdom, after three hundred years, or not. And whether they as individuals will give up one of their bits of national identity, their Britishness, or not. They will be no less Scottish if they stay British. And that I think will clinch the argument for "No".

Friday, December 06, 2013

The Queen's Mandela tribute wasn't very good

"The Queen was deeply saddened to learn of the
death of Nelson Mandela last night. He worked tirelessly for the good of his
country, and his legacy is the peaceful South Africa we see today.

Her Majesty remembers with great warmth her meetings
with Mr. Mandela and sends her sincere condolences to his family and the people
of South Africa at this very sad time."

Now let’s play a tasteless game. Let’s say that it was
former United States President George Bush (Senior) who had died. Let’s apply
The Queen's words to him instead:

"The Queen was deeply saddened to learn of the death of George
H.W. Bush last night. He worked tirelessly for the good of his country, and his
legacy is the peaceful United States we see today.

Her Majesty remembers with great warmth her meetings with Mr. Bush and
sends her sincere condolences to his family and the people of America at this
very sad time."

OK the bit about a "peaceful United States" might
seem a bit fanciful but you could make the case. Actually you could make the
case for the US being peaceful rather better than you could say the same about
South Africa. With one of the highest murder rates in the world South
Africa is sadly far from “peaceful”

Nelson Mandela was so much more than a man who worked for
his country (although he did of course do this). This is a pretty down key
commendation that applies to most politicians. Its looks like whoever drafted the
Monarch’s “tribute” dusted-off things that she’d said in the past about others and
gave them a whirl again.

The bit about “the warmth of her meetings” is a bit
gratuitous and changes the focus of the tribute a bit from Mandela to The Queen.
It adds little of substance other than motherhood stuff. So what should she
have said (and keeping to approximately the same word count)?

How about this:

"The Queen is deeply saddened at the death of
Nelson Mandela. Mr Mandela suffered at the hands of those who abused him and
his people - but in his battle he ultimately triumphed to live to create the democratic
and proud South Africa we see today.

Her Majesty sends her condolences to Mr Mandela’s
family and to the people of South Africa who can remember with pride a truly
great man.”

Wednesday, December 04, 2013

Capitalism is good, but it doesn't have to be driven by greed as Boris would have us believe

In an opinion piece in The Times today Danny Finkelstein, defending Boris Johnson's assertion of the virtue of greed, points us to Korea as an example of why capitalism (the driver of the successful South) is good compared with "Marxism" (the ideology of the failed North). It is not his finest hour! The Korea story is so obvious it teaches us nothing. The success of the South compared withe the failure of the North is not mainly about economic systems. It's not about the virtues of capitalism but about the virtues of freedom and democracy. There should not need to be a defence of the latter when confronted by the extreme venality of totalitarianism. Of course command and control political systems usually historically incorporated central planning of the economy - as in North Korea. But they don't have to and you can look to modern China or modern Russia to see what unbridled capitalism within non-democratic mega States leads to.

The capitalism of China or Russia is cowboy capitalism. Here greed is not an inevitable consequence of corrupt and unregulated Laisser-Faire, it is it's driver. Yes we have greedy, uncontrolled and dodgy capitalists in the West as well. But nothing as venal as the billionaire "businessmen" who emerged when the leaders of China and Russia decided that greed was good and that they wanted some of it's rewards.

The choice for us is not the imposition of a Socialist state compared with greed-driven capitalism. Our membership of the European Union, among it's many benefits, precludes the possibility of the imposition of command and control in any member state. Capitalism is at the heart of the EU and any country which doesn't embrace that reality could not join or would have to leave. One of the extreme ironies of the UKIP and Tory Right call for withdrawal from the EU is that it would make Socialism in Britain more not less likely! A democratically elected Socialist government in a Britain cast adrift from the EU could do things which would be impossible if we were still a member! Is that what the "Better Out" brigade really want?

"Greed" is a deadly sin and you don't need it to make capitalism work. Capitalism isn't great - but it's better than all the alternatives. To make it work it must be regulated which means curbing its excesses - and these excesses often come from greed. So our choice is not between North and South Korea as a model but between totalitarianism and democracy and we made that choice long ago when we abolished the divine Right of Kings! But to argue for unrestricted capitalism and for everything to be left to the market is to argue for the crony capitalism of Russia or China where no meaningful checks and balances exist at all.

Monday, December 02, 2013

We don't vote for Growth. We vote according to how we feel as
individuals.

The vast majority of voters is not that bothered with macroeconomic indicators. I suspect that if you asked people what "Growth" is few would be able to give you even a sketchy explanation. The same applies to the "deficit" and even to something closer to our individual personal experience like inflation. Real economics are at the personal not the macro level.

"It's the economy stupid" did not mean "It's the growth of our Gross Domestic Prouduct". It meant "Have I a job?", "Can' I afford to finance my home purchase?", "Is the cost of food and essentials affordable for me?", "Have I enough money for a holiday", "Can I afford to keep warm this winter?" - and so on.

The worst political rhetoric is to make claims, even if true, which simplify and generalise. The man without a job for a year just won't believe you if you say that there are more people in employment than ever. The Pensioner who can't turn on the heating at current energy prices won't be impressed by a price freeze.

And the problem with individuals alienation from politics (which is what all this is) is that it leads to scapegoating. So the EU is blamed, or immigrants, or bankers or politicians. In reality individual hardship is always a combination of personal failure and bad luck. Not everyone can get on their bike to find a job. And not everyone's skills and experience is in demand in sufficient numbers. And the cumulative effect of being unemployed is pernicious. So don't tell the long term unemployed that the Economy has returned to growth. They'll tell you where you can stuff your statistic.


--- /dev/null
+++ b/drivers/bcmdrivers/mdio/iproc_mdio_dev.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifndef _IPROC_MDIO_DEV_H
+#define _IPROC_MDIO_DEV_H
+
+/* IOCTL commands */
+
+#define MDIO_IOC_MAGIC       'm'
+
+struct mdio_ioc_transfer {
+    uint8_t   pa; /* phy address */
+    uint8_t   ra; /* register address */
+    uint16_t  tx_buf;
+    uint16_t  rx_buf;
+};
+
+#define MDIO_MSGSIZE(N) \
+	((((N)*(sizeof (struct mdio_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \
+		? ((N)*(sizeof (struct mdio_ioc_transfer))) : 0)
+
+#define MDIO_IOC_MESSAGE(N) _IOW(MDIO_IOC_MAGIC, 0, char[MDIO_MSGSIZE(N)])
+
+#define MDIO_IOC_EXTERNAL_R_REG _IOWR(MDIO_IOC_MAGIC, 0, char[MDIO_MSGSIZE(1)])
+#define MDIO_IOC_EXTERNAL_W_REG _IOW(MDIO_IOC_MAGIC, 1, char[MDIO_MSGSIZE(1)])
+#define MDIO_IOC_LOCAL_R_REG _IOWR(MDIO_IOC_MAGIC, 2, char[MDIO_MSGSIZE(1)])
+#define MDIO_IOC_LOCAL_W_REG _IOW(MDIO_IOC_MAGIC, 3, char[MDIO_MSGSIZE(1)])
+
+
+#endif
diff --git a/drivers/bcmdrivers/nand/.gitignore b/drivers/bcmdrivers/nand/.gitignore
new file mode 100644
index 0000000..26ea8be


Q:

Call an ActionCreator from another ActionCreator

I need to call an ActionCreator from another
ducks/products.ts - ActionCreator and Reducers of Products...
import { setStock } from './Store.ts';
//....
export const addProduct = (product: IProduct) => async (
  dispatch: Dispatch,
  getState: () => IState,
  { auth }: IServices
) => {
    dispatch(fetchStart());

    const response = await Axios.post('/api/products', product)

    const producto = response.data as IDataProduct

    // # I need to call SetStock()
    // # [Try 1] to Call
    setStock(producto)

    // # [Try 2] to Call
    // return (dispatch2: any) => {
      //  dispatch2(
         //setStock(producto._id)
        //  )
    // }

    dispatch(fetchSucess(producto))
};

I saw an example that used try 2, but it doesn't work, and the first try does nothing,
ducks/stores.ts
export const setStock = (product: any) => async (
  dispatch: Dispatch,
  getState: () => any,
  { auth, db }: IServices
) => {
  console.log('INIT SETSTOCKACTIONCREATOR....')
  dispatch(fetchStart());
  try {
    const ref = db.collection("stores").doc(storeId);
    await ref.update({ [product._id]: product.newStock });

    dispatch(updateSucess({ _id: storeId, stock: product.newStock, productId: product.productId }));

  } catch (error) {
    dispatch(fetchError(error));
  }
};

I can't do a Dispatch(setStock(producto)) because I get the following from the typescript:
Argument of type '(dispatch: Dispatch, getState: () => any, { auth, db }: IServices) => Promise' is not assignable to parameter of type 'AnyAction'.
Property 'type' is missing in type '(dispatch: Dispatch, getState: () => any, { auth, db }: IServices) => Promise' but required in type 'AnyAction'

A:

You just need to dispatch the setStock action like dispatch(setStock(producto._id)) which is similar to what you do for fetchStart
export const addProduct = (product: IProduct) => async (
  dispatch: ThunkAction<Promise<void>, {}, {}, AnyAction>,
  getState: () => IState,
  { auth }: IServices
) => {
    dispatch(fetchStart());

    const response = await Axios.post('/api/products', product)

    const producto = response.data as IDataProduct

    dispatch(setStock(producto._id))

    dispatch(fetchSucess(producto))
};


Shaquille O'Neal already represents Reebok, Icy Hot/Gold Bond, Buick, and Zales. Clearly, cream soda is the next logical step. The retired basketball player/cop/video game martial arts master/actor has partnered up with AriZona Beverages to release Soda Shaq Cream Soda, available in blueberry, orange, strawberry, and vanilla in 23.5-ounce cans. The sodas, each featuring a different Shaq facial expression, can only be found at 7-Eleven stores, where they sell for 99 cents.

AriZona promotes the fact that all four flavors are made of all-natural ingredients, including carbonated filtered water, sugar, honey, vanilla extract—from Madagascar, they say—and citric acid. There are also specific and ambiguous fruit and vegetable juices for flavor and color. These sodas are a bit less bubbly than the average canned and carbonated soft drink, and a single can holds three servings, with a total of 72 grams, or roughly 17 teaspoons, of sugar. We're assuming that to the 7' 1" Shaq, 17 teaspoons of sugar is nothing.

Vanilla Cream Soda

The closest of the bunch to a plain cream soda is the vanilla flavor. Poured into a glass (because everyone pours their AriZona drinks into a glass, right?), it has a color similar to that of an American lager. It seems a bit fizzier than the others, and the strong vanilla flavor does indeed taste quite natural. But of the four, this one is the sweetest of the set, cloyingly so, especially when paired with salty food such as pretzels. Still, some tasters chose it as a favorite.

Blueberry Cream Soda

Had we been handed the blueberry soda blind, we wouldn't have been able to identify the fruit as easily as we could with the other cans in the lineup. There's a little blueberry there, but also something that tastes like grape, and overall, the soda doesn't have a particularly strong fruit flavor. That doesn't mean it's bad, though—the fruit actually paired pretty well with the vanilla flavors. You could even garnish this with fresh mint if you want to get fancy.

Orange Cream Soda

It took us a second to place the flavor, and then it hit: the orange cream soda tastes like a Creamsicle. A slightly less artificial Creamsicle, mind you, but a Creamsicle nonetheless. It's not as fizzy as most orange sodas, and not as bright as, say, a fresh clementine, but it's our overall favorite—especially good when turned into a vanilla ice cream float.

Strawberry Cream Soda

Soda Shaq's strawberry flavor smells like strawberry ChapStick, and tastes like it, too. It's the most fruit-forward of the bunch, and although we still tasted the vanilla, it was less evident than in the other three drinks. We found that it paired well with dark chocolate, which toned down the strawberry flavor a bit, and came across not unlike a real chocolate-covered strawberry. It's the one flavor that we wouldn't want to drink on its own.

Have you tried the Shaq sodas? What did you think?

All products linked here have been independently selected by our editors. We may earn a commission on purchases, as described in our affiliate policy.


function testXMLTextLiteral() returns [xml, xml, xml, xml, xml, xml] {
    string v1 = "11";
    string v2 = "22";
    string v3 = "33";
    xml x1 = xml `aaa`;
    xml x2 = xml `${v1}`;
    xml x3 = xml `aaa${v1}bbb${v2}ccc`;
    xml x4 = xml `aaa${v1}bbb${v2}ccc{d{}e}{f{`;
    xml x5 = xml `aaa${v1}b\${bb${v2}c\}cc{d{}e}{f{`;
    xml x6 = xml ` `;
    return [x1, x2, x3, x4, x5, x6];
}

function testXMLTextLiteral1() returns [xml, xml, xml, xml, xml, xml] {
    string v1 = "11";
    string v2 = "22";
    string v3 = "33";
    xml x1 = xml `
aaa`
    ;
    xml x2 = xml `${
        v1
        }`
    ;
    xml x3 = xml `
aaa${
        v1
        }bbb${
        v2
        }ccc`
    ;
    xml x4 = xml `aaa${
        v1
        }bbb${
        v2
        }ccc{d{}e}{f{`
    ;
    xml x5 =
        xml `aaa${
        v1
        }b\${bb${
        v2
        }c\}cc{d{}e}{f{`
    ;
    xml x6 =
        xml ` `
    ;
    return [x1, x2, x3, x4, x5, x6];
}


Identification of protein synthesis elongation factor G as a 4.5 S RNA-binding protein in Escherichia coli.
Escherichia coli 4.5 S RNA is metabolically stable and abundant. It consists of 114 nucleotides, and it is structurally homologous to domain IV of mammalian signal recognition particle (SRP) RNA. In this study, we found two 4.5 S RNA-binding proteins in cell extracts by means of a gel mobility shift assay. One protein was identified as Ffh, which has been characterized as 4.5 S RNA-binding protein. The other protein was separated from Ffh by two consecutive column chromatographic elutions and by monitoring the 4.5 S RNA binding activity. After the second chromatography, a dominant protein with an approximate molecular weight of 78,000 was associated with 4.5 S RNA binding activity. A sequence of the NH2-terminal 19 residues of the 78-kDa protein was completely identical to that of the protein elongation factor G (EF-G) of E. coli, and further it cross-reacted with antiserum against E. coli EF-G. The results obtained using a synthetic oligo RNA corresponding to the 23 S rRNA defining the EF-G binding site indicated that 4.5 S RNA and 23 S rRNA are competitive in 4.5 S RNA binding and that a decanucleotide sequence conserved between them serves as a binding site for EF-G. Conservation of the SRP RNA binding activity of EF-G from Bacillus subtilis suggests that the binding of EF-G to SRP RNA is essential for its function.


# Copyright:: Autotelik Media Ltd
# Author ::   Tom Statter
#
require 'csv'
require 'datashift/column_packer'
require 'datashift/model_methods/model_method'

class CSV

  include DataShift::ColumnPacker

  # Convert an AR instance to a set of CSV columns
  # Additional non instance data can be included by supplying list of methods to call
  # on the record
  #
  # Returns the data added
  #
  def ar_to_csv(record, remove_list = [], method_list = [])

    serializable_hash = record.serializable_hash(except: remove_list)

    csv_data = serializable_hash.values.collect { |c| escape_for_csv(c) }

    [*method_list].each do |x|
      csv_data << escape_for_csv(record.send(x)) if record.respond_to?(x)
    end

    csv_data
  end

  def ar_to_row(record, remove_list = [], method_list = [])
    add_row( ar_to_csv(record, remove_list, method_list) )
  end

  def ar_association_to_csv(record, model_method, _options = {})
    # pack association instances into single column
    csv_data = if DataShift::ModelMethod.association_type?(model_method.operator_type)
                 record_to_column( record.send(model_method.operator) )
               else
                 escape_for_csv( record.send(model_method.operator) )
               end

    csv_data
  end

end


Q:

Write a file with dd over ssh

I want to write a .img file to a hdd over ssh.
Host A want to execute dd to write the img file to /dev/sda . The dd file is located at Host B.
How should the command look like?

A:

Something like:
(from hosta) ssh hostb cat /the/file.img | dd of=/dev/sda

or
(from hostb) ssh hosta dd of=/dev/sda < /the/file.img

With ssh (and rsh before it) the I/O redirection happens on the local host unless you quote it to pass it through to the remote host.  Compare these three commands (in all cases the date command runs on rmthost), but:
ssh rmthost date > /tmp/thedate                    ! local file written
ssh rmthost 'date > /tmp/thedate'                  ! remote file written
ssh rmthost date '>' /tmp/thedate                  ! remote file written