/*
 Copyright (C) 2018 Quaternion Risk Management Ltd
 All rights reserved.

 This file is part of ORE, a free-software/open-source library
 for transparent pricing and risk analysis - http://opensourcerisk.org

 ORE is free software: you can redistribute it and/or modify it
 under the terms of the Modified BSD License.  You should have received a
 copy of the license along with this program.
 The license is also available online at <http://opensourcerisk.org>

 This program is distributed on the basis that it will form a useful
 contribution to risk analytics and model standardisation, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
*/

/*! \file fixedbmaswap.hpp
    \brief fixed vs averaged bma swap

    \ingroup instruments
*/

#ifndef quantlib_makefixedbmaswap_hpp
#define quantlib_makefixedbmaswap_hpp

#include <ql/cashflows/averagebmacoupon.hpp>
#include <ql/instruments/swap.hpp>

namespace QuantExt {
using namespace QuantLib;

//! swap paying a fixed rate against BMA coupons
class FixedBMASwap : public Swap {
public:
    class results;
    class engine;
    enum Type { Receiver = -1, Payer = 1 };
    FixedBMASwap(Type type, Real nominal,
                 // Fixed leg
                 const Schedule& fixedSchedule, Rate fixedRate, const DayCounter& fixedDayCount,
                 // BMA leg
                 const Schedule& bmaSchedule, const boost::shared_ptr<BMAIndex>& bmaIndex,
                 const DayCounter& bmaDayCount);

    //! \name Inspectors
    //@{
    Real fixedRate() const;
    Real nominal() const;
    //! "payer" or "receiver" refer to the BMA leg
    Type type() const;
    const Leg& bmaLeg() const;
    const Leg& fixedLeg() const;
    //@}

    //! \name Results
    //@{
    Real fixedLegBPS() const;
    Real fixedLegNPV() const;
    Rate fairRate() const;

    Real bmaLegBPS() const;
    Real bmaLegNPV() const;
    //@}
    // results
    void fetchResults(const PricingEngine::results*) const;

private:
    Type type_;
    Real nominal_;
    Rate fixedRate_;
    // results
    mutable Rate fairRate_;
};

class FixedBMASwap::results : public Swap::results {
public:
    Rate fairRate;
    void reset();
};

class FixedBMASwap::engine : GenericEngine<FixedBMASwap::arguments, FixedBMASwap::results> {};
// factory class for making fixed vs bma swaps

class MakeFixedBMASwap {
public:
    MakeFixedBMASwap(const Period& swapTenor, const boost::shared_ptr<BMAIndex>& bmaIndex,
                     Rate fixedRate = Null<Rate>(), const Period& forwardStart = 0 * Days);

    operator FixedBMASwap() const;
    operator boost::shared_ptr<FixedBMASwap>() const;

    // We regard the BMA leg parameters as fixed by convention apart from tenor
    // and provide a factory for the fixed leg per MakeVanillaSwap

    MakeFixedBMASwap& receiveFixed(bool flag = true);
    MakeFixedBMASwap& withType(FixedBMASwap::Type type);
    MakeFixedBMASwap& withNominal(Real n);
    MakeFixedBMASwap& withBMALegTenor(const Period& tenor);

    MakeFixedBMASwap& withSettlementDays(Natural settlementDays);
    MakeFixedBMASwap& withEffectiveDate(const Date&);
    MakeFixedBMASwap& withTerminationDate(const Date&);

    MakeFixedBMASwap& withFixedLegTenor(const Period& t);
    MakeFixedBMASwap& withFixedLegCalendar(const Calendar& cal);
    MakeFixedBMASwap& withFixedLegConvention(BusinessDayConvention bdc);
    MakeFixedBMASwap& withFixedLegTerminationDateConvention(BusinessDayConvention bdc);
    MakeFixedBMASwap& withFixedLegRule(DateGeneration::Rule r);
    MakeFixedBMASwap& withFixedLegEndOfMonth(bool flag = true);
    MakeFixedBMASwap& withFixedLegFirstDate(const Date& d);
    MakeFixedBMASwap& withFixedLegNextToLastDate(const Date& d);
    MakeFixedBMASwap& withFixedLegDayCount(const DayCounter& dc);

    MakeFixedBMASwap& withDiscountingTermStructure(const Handle<YieldTermStructure>& discountCurve);
    MakeFixedBMASwap& withPricingEngine(const boost::shared_ptr<PricingEngine>& engine);

private:
    Period swapTenor_;
    boost::shared_ptr<BMAIndex> bmaIndex_;
    Rate fixedRate_;
    Period fixedTenor_;
    Period forwardStart_;

    Natural settlementDays_;
    Date effectiveDate_, terminationDate_;
    Calendar fixedCalendar_, bmaCalendar_;

    FixedBMASwap::Type type_;
    Real nominal_;
    Period bmaLegTenor_;
    BusinessDayConvention fixedConvention_, fixedTerminationDateConvention_;
    BusinessDayConvention bmaConvention_, bmaTerminationDateConvention_;
    DateGeneration::Rule fixedRule_, bmaRule_;
    bool fixedEndOfMonth_, bmaEndOfMonth_;
    Date fixedFirstDate_, fixedNextToLastDate_;
    Date bmaFirstDate_, bmaNextToLastDate_;
    DayCounter fixedDayCount_, bmaDayCount_;

    boost::shared_ptr<PricingEngine> engine_;
};
} // namespace QuantExt

#endif


USS Chandler (DD-206)

USS Chandler (DD-206/DMS-9/AG-108) was a  in the United States Navy. She was the only ship named for William Eaton Chandler, who served as Secretary of the Navy from 1882 to 1886.

Chandler was launched on 19 March 1919 by William Cramp and Sons Ship and Engine Building Company; sponsored by Mrs. L. H. Chandler; and commissioned 5 September, Lieutenant Commander F. Cogswell in command.

Service history

1920s
Assigned to Destroyer Squadron 3 of the U.S. Atlantic Fleet, Chandler sailed from Newport, Rhode Island, 19 December for duty with U.S. Naval Forces, Turkey. After carrying a diplomatic mission to the Crimea, and aiding the American Red Cross in its relief work with Russia refugees, Chandler joined the U.S. Naval Detachment, Adriatic. She served as station ship at Venice and had relief duty throughout the Adriatic until January 1921.

Sailing through the Suez Canal, Chandler arrived at Cavite, on 15 February 1921. She served with the Asiatic Fleet, protecting American interests throughout the Far East, until on 25 August 1922. Clearing Chefoo, China, she arrived at San Francisco 30 September. She was decommissioned on 20 October 1922, and placed in reserve at Mare Island Navy Yard.

1930s
Chandler was recommissioned on 31 March 1930 for operations off the west coast, Hawaii, the Panama Canal Zone, and in the Caribbean. In 1934, she sailed to New York for the Presidential Fleet Review of 31 May. In 1936 she took part in radio sound tests, and in 1940, served as plane guard during the flight of the Secretary of the Navy to Hawaii.

Destroyer minesweeper (DMS)

Reporting to Mare Island Navy Yard in October 1940, Chandler was reclassified DMS-9 on 19 November, and converted to a high-speed minesweeper. She arrived at Pearl Harbor on 12 February 1941 to begin operational training and patrol. At sea when the attack on Pearl Harbor occurred, she returned to base 2 days later. Until on 30 June 1942, she escorted convoys to San Francisco, Palmyra Atoll, Christmas, and Midway Islands, and swept and patrolled in Hawaiian waters.

While en route to operations in the Aleutians on 27 July, she collided with  in a heavy fog, so Chandler underwent repair from 11 August to 27 September at Mare Island Navy Yard. On 5 October, she reported at Dutch Harbor for duty patrolling and escorting convoys in the Aleutians. In May 1943, she covered the landings at Attu, and in August, those at Kiska. Leaving the fog and difficult waters of the Aleutians behind in October, Chandler was readied at San Francisco for duty farther south in the Pacific.

Chandler docked at Pearl Harbor on 1 January. From there, in a succession of landings, at Majuro (31 January), Eniwetok (17 February–6 March), Saipan (13 June–20 July), and Tinian (21 July–24 July), she swept mines and screened assault shipping. Patrolling each invasion area as the operation developed, Chandler joined with  in sinking the  on 22 June, at 15°55′N., 147°09′E.

On 17 October 1944, Chandler resumed mine-sweeping in landings, as she sailed into Leyte Gulf in advance of the major force for the assault to sweep a path for the attacking  amphibious ships. She remained on duty, sweeping, patrolling, and screening, through the start of the landings, retiring on 25 October for Manus after the delay caused by the Battle for Leyte Gulf.

Called upon for similar duty in the Lingayen operation, Chandler came under heavy fire from Japanese aircraft on the night of 6–7 January 1945. Fire from Chandler and  shot down a Japanese aircraft, but only after it had launched a torpedo, which struck Hovey, sinking her within three minutes. Chandler stood by, recovering 229 officers and men from Hovey.  At the time of her sinking, Hovey was carrying survivors primarily from the  as well as some from the , which she had recently rescued.  Chandler remained on duty in Lingayen Gulf until 10 January, when she cleared for convoy escort operations through mid-February. At Iwo Jima from 16 February to 28 February, she gave her experienced aid in sweeping, patrolling, and screening for the buildup and the subsequent assault.

Fate
Chandler returned to the west coast for overhaul in April. While there, she was reclassified AG-108, on 5 June 1945, and after training, she began a tour of towing targets in gunnery exercises for new ships engaged in shakedown training. While performing this important task, she based on both San Diego and Pearl Harbor. After the end of hostilities, Chandler proceeded to Norfolk, Virginia, arriving on 21 October 1945. There she was decommissioned on 21 November 1945, and sold on 18 November 1946.

Awards
Chandler received eight battle stars for service in World War II.

References

Category:Clemson-class destroyers
Category:World War II mine warfare vessels of the United States
Category:World War II auxiliary ships of the United States
Category:Ships built by William Cramp & Sons
Category:Ships built in Philadelphia
Category:1919 ships


WARNING: Spoilers for both The Witness and Firewatch below. While The Witness, as a puzzle game, is only spoiled on basic concepts, Firewatch, as a plot-driven game, is heavily spoiled here. I suggest you play both before reading this piece.

Oftentimes when I’m just casually gaming, I’ll put the game on, play some tunes on my Bluetooth speaker, and just have a good time. When I get very serious about playing a game, however, I often place myself into a state of solitude depending on the type of game it is. I’ll turn the lights down, put my big headset on, and immerse myself into the experience. If the game is meant to be played this way, I will try very hard to do so. Two such games came out within the last month, and they have me thinking about how I play my games.

First came The Witness, a 3D open-world puzzler developed by Jonathan Blow as his follow-up to the 2008 indie hit Braid. The game takes place on an island and tasks the player with completing maze puzzles. Start at the big circle, drag a line through the maze, and finish at the half circle. This may sound incredibly boring and unimaginative, but The Witness ends up being the most innovative puzzle game I’ve played since Portal and Antichamber. Areas of the island house a distinct identity, from a desert to a terrarium, and from a series of tree houses to a swamp far below. The island feels realistic and alive thanks to gorgeous lighting and vibrant, rich colors.

Each area is also home to a lesson that adds rules to the mazes (pictures of which are found below). Some mazes may simply contain a certain icon on it, such as Tetris shapes that you must trace into the maze to complete the puzzle, or colored stars that must be grouped together with your line. Others complicate it a bit, such as having your line mirrored on the other side of the maze so that both lines must complete the puzzle correctly to advance. Areas even integrate the environment sometimes, such as having the correct route through the maze only be seen when the light is reflecting off of the screen.

The greatest part about The Witness from a gameplay standpoint is that no matter how convoluted and confusing the rules may seem from the outside, the game always teaches the player these rules. The game is not about finishing the puzzles, but more about understanding them. The player is not taught how to correctly perceive these puzzles and the world around them through a text box or guide. Puzzles and rules are introduced gradually and without explanation, so that the player comes to the conclusion on their own, rather than being shown why the solution comes from the process. The only hindrance a player should have when playing is their own thinking.

The thing about The Witness that makes it relevant to my discussion on solitude is how isolated the game actually makes the player. There is no context to why the player is on the island solving these puzzles, and there is no one around to talk to, human or otherwise. There isn’t even music at any point in the game, only sound effects. While you can find recordings of people reading quotes from famous philosophers, this isn’t related to anything within the game itself, but more about the entire experience that the player is having through learning. You are simply left alone with the vague goal of completing enough areas to open the box on the top of the mountain. You’ll occasionally stumble upon a stone statue of a human, but these are never given a straightforward explanation. You are completely alone on the island.

This solitude, however, was both intentional and productive. It is clear that Blow created this serene, distraction-free environment to place full responsibility on the player. They will have as few distractions as possible while playing, so that all attention is placed on the puzzles. This setting makes for easier understanding of the game’s concepts, as well as faster puzzle solving. Think of it like math class in school. If you’re distracted by a side conversation or something going on in the hallway, you won’t be actually retaining what the teacher is saying, even if you get bits and pieces of it. In the same way, players will have the most rewarding time while playing The Witness in as isolated of a state as they can manage.

Exploring the island is a blast, though it might be seen as a distraction. However, the exploration and puzzles go hand in hand. The player cannot advance without completing puzzles, and a little digging in your surroundings will usually turn up the answer the player is looking for. In a similar sense, players will often reach a puzzle that they are having a hard time on or that they do not yet understand the rules of. No hints will be given and there’s no way around them. In this case, the game fully encourages leaving an area behind to explore another. This gives the player a break from a particularly frustrating puzzle, or guides them on the path to the concept that they haven’t learned yet. Players may often return to a puzzle and complete it within seconds because of this freedom and solitude that allows the mind to flow in and out of each idea.

The Witness fully embraces its isolation in its gameplay. The game is designed specifically to put the player on their own, so that each puzzle completed feels rewarding because it was done without help. The gameplay is completely complimented by its remoteness, and the player feels it in every area of the island.

The second game I’m going to talk about is Firewatch. This is the first game by Campo Santo, a group of developers who worked on Telltale’s The Walking Dead and Bioshock, among other games, beforehand. The player takes control of Henry, a man who takes a job as a fire lookout in the Wyoming wilderness in 1989 to try and get away from the world. As Henry spends his summer up in a tower and hiking, he becomes good friends with his supervisor Delilah, only ever experiencing her existence over a radio. However, weird things start to happen as soon as Henry settles in, and it’s a long road of mystery through the summer.

The first ten or so minutes of the game set the stage for Henry’s vacation into the wilderness. The player starts with a bunch of text involving Henry meeting a woman named Julia when they’re in college. From there, you skip forward years at a time as Henry and Julia fall in love, contemplate kids, live together, get a dog, and grow. However, Julia starts developing dementia at a young age, and Henry’s life turns south. The player gets certain choices to make through this segment, akin to games from Telltale, but a lot of who Henry is is already set, and none of this effects the story beyond the player’s own experience. If you choose to make Henry subdue an attacker, he will, but if you choose to have him beat the attacker up, he will end up crying on the sidewalk afterward. After Julia is either in a nursing home and you’ve drifted from her, or she has been taken back to her parents’ home in Australia because you have become a drunk, Henry sees an ad in the newspaper for a fire lookout job, and he takes it.

This introduction is not only very emotional and an effective way to give the player context to the events of the game without bringing up long exposition later on, but it also sets the scene for the exile that Henry and the player have throughout the game. Whereas the isolation in The Witness was to benefit the gameplay, in Firewatch it is used narratively to put Henry on his own to cope with how his life with Julia has ended up. Henry is running from his life by taking this summer alone in the woods, and the player, by being alone, understands Henry’s debacle more easily.

However, both the player and Henry are not fully alone on this adventure. Almost the entire

game is walking from place to place while using your handset radio to talk to Delilah. Delilah is basically Henry’s only human contact throughout the entire summer. Campo Santo does a noticeable job of having five character models besides Henry’s in the entire game, and only 2 are seen up close. You are completely isolated with only Delilah and the wildlife to keep you company, and that is one of the game’s strengths. Henry is out there to try and be alone as he deals with his troubles with Julia, and making the player feel just as alone connects them to the experience. As the player takes in the sound of the wildlife and the trees rustling in the wind, there is a distinct feeling of being alone in the great outdoors that enraptures the viewer. You’re even given a compass and a map to make your way around Shoshone National Park, which you must stop and look at from time to time to effectively navigate the land as if you were there yourself. You’ll truly feel like you are lost in the wilderness, ready for whatever heads Henry’s way.

As the plot thickens and you come closer and closer to figuring out who has been messing with you and stalking you throughout the summer, playing the game in complete isolation also helps you to be pulled into the mystery. Without distractions, you will be devoting all of your mind to thinking up possible theories for the plot ahead. You become invested in these characters and this gorgeous world. Though the final third of the story is probably going to be seen as a let down to most players, as the first two acts are phenomenally executed, it is still amazing how a little alone time can affect your experience. I played through the entirety of the game in one night, and it was completely worth shutting my phone off and plugging in. Firewatch makes use of its solitude in ways that engage the player and compel them to keep playing, as Delilah and Henry are too genuine of characters to put on pause.

Placing myself into my own solitude while playing these games has greatly improved my appreciation for what they bring to the table, and they compliment this style of play very well. Each time I put my headset on and dimmed the lights, the games rewarded me with a much richer experience. Puzzles may have been much more difficult had I been distracted, and keeping me engaged and alone throughout the story by connecting me to the world made all the difference. I don’t always want mindless action and bombastic set pieces. Sometimes I just want to sit back, relax, and play a game when the world gets too loud, and this time, the developers told me that that was okay.


Tyson Beckford, Michael Jai White Cast As Male Strippers In New Film

We’re sure some ladies (and quite a few gents) are going to be super-excited to see this! A new film about the Black male stripper scene is set to hit theaters with Michael Jai White and Tyson Beckford serving as the primary eye candy. How do you think their shirtless, oiled-up gyrations will measure up against Channing Tatum’s? Via Deadline:

Channing Tatum did it with Magic Mike, and his co-star Joe Manganiello sold upcoming docu La Bare on the strength of the tantalizing subject matter. Now indie helmer Jean-Claude LaMarre (Gang Of Roses, Color Of The Cross) is hoping to tap into the world of male strippers with his urban take, Chocolate City, which aims to merge the Magic Mike phenomenon with the recent strength of African-American-themed films at the box office. Black Dynamite star Michael Jai White and model-turned-actor Tyson Beckford are in negotiations to star in the tale of Devin, a college student struggling to make ends meet who meets the owner of a male strip club (White) who convinces him to give amateur night a whirl. Beckford will play Adrian, the club’s former star attraction who finds his popularity fading as the new kid starts to steal the spotlight.

“This movie was in gestation for 2 1/2 years, but after Magic Mike it seemed a natural fit for e African-American female audience,” LaMarr told me. I researched the male exotic club scene and it’s massive across the country, with clubs specifically targeting middle-aged African-American women.”

- See more at: http://bossip.com/968444/black-magic-mike-tyson-beckford-and-michael-jai-white-tapped-to-strip-down-and-shake-sumn-in-new-flick/#sthash.TVDzCwT5.dpuf

I was just thinking about male strippers. They get a lot of flak. I hear straight woman talking how much they hate them. And who wants to see a big dack swanging in their face.

The question is who doesn't

I don't like it lol they're just too much and I'm not even a prude. I'd rather a regular sized guy just whip it out of his boxer briefs in the bedroom.

Male strippers make me uncomfortable. I liked magic Mike, but not because of any sexual attraction toward the stripping. I will like chocolate city if the story is good...gang of roses is one of the worst movies I've ever seen.

Y'all have to tell me why though. I think they are hilarious. I remember the first time I seen male strippers. One of them put their face in a girls vagina, she did have clothes on, but a thin layer though. He was making movements with his mouth like he was eating her out. She just laid there in Ecstasy like no one can see her, we all watched her. It felt weirdly comfortable.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot delete your posts in this forumYou cannot edit your posts in this forumYou cannot create polls in this forumYou cannot vote in polls in this forum


“No Miranda warning to be given” now, the DOJ official said. Terror suspect: 5 legal questions

With Dzhokhar Tsarnaev taken alive, the focus now turns to how the Obama administration is going to seek to bring the Boston Marathon bombing suspect to justice.

Lawyers have already made one potentially critical decision: He hasn’t been read his Miranda rights, at least for now. This means that FBI investigators may have a shot at trying to question him about other potential plots he may be aware of and whether anyone other than his deceased brother was involved in last Monday’s bombing or Thursday night’s crime spree.

But if Tsarnaev’s injuries leave him incapacitated for a protracted period of time, the Miranda issue may be of less significance.

( PHOTOS: Boston celebrates capture)

As soon as he’s coherent, he’s likely to go before a judge or magistrate, even in the hospital. The judicial officer will formally advise Tsarnaev of the preliminary charges used to detain him and tell of his right to an attorney, even if investigators haven’t done that by then.

On Sunday, Boston Police Commissioner Ed Davis said Tsarnaev was still in stable but serious condition and has not been questioned yet. “He’s in no condition to be interrogated at this point in time,” Davis said on “Fox News Sunday.” “He’s progressing, though, and we’re monitoring the situation carefully.”

( Also on POLITICO: Pols celebrate, reflect on capture)

One tricky issue now is how prosecutors and the FBI will balance the duty to get Tsarnaev before a judge promptly with their desire to do the initial public-safety interview.

Meanwhile, a host of other questions are already bubbling up, from whether he’ll be tried in civilian or military court to whether he’ll face the death penalty for crimes that include killing three people in the explosions and a police officer on the MIT campus.

( Also on POLITICO: Obama praises arrest in Boston blasts)

Here’s POLITICO’s guide to the five key questions — and what’s known about the answers — that are ahead.

1. Why does the Miranda issue matter?

After the Justice Department decided not to immediately read Tsarnaev his Miranda rights, a debate broke out among lawmakers, lawyers and political activists over whether the suspect, Dzhokhar Tsarnaev, 19, should be prosecuted in a civilian criminal court or subjected to military interrogation — and over when and whether Tsarnaev should be told about his right to an attorney.

“No Miranda warning to be given” now, a Justice official told POLITICO Friday. “The government will be invoking the public safety exception.”

That may increase the possibility that Tsarnaev will quickly offer up information about whether he and his brother, who was killed in a shootout Thursday, acted alone in the bombings or whether they were directed, supported or trained by forces abroad.

Beginning several hours before Dzhokhar Tsarnaev’s capture, Sen. Lindsey Graham (R-S.C.) wrote on Twitter that the suspect ought to be placed in military custody.

“If captured, I hope Administration will at least consider holding the Boston suspect as enemy combatant for intelligence gathering purposes,” Graham wrote Friday afternoon. “The last thing we may want to do is read Boston suspect Miranda Rights telling him to ‘remain silent.’”

“The Law of War allows us to hold individual in this scenario as potential enemy combatant w/o Miranda warnings or appointment of counsel,” the senator added later in the evening. “I hope the Obama Administration will seriously consider this option … The goal is to gather intelligence and protect our nation which is under threat from radical Islam.”

“NBC reporting Obama admin will treat terrorist as a ‘criminal’ and not enemy combatant,” former State Department official Liz Cheney wrote on Twitter Friday night. “Will Obama allow him to lawyer up?”

The Center for Constitutional Rights condemned the decision in a statement: “The Miranda warnings were put in place because police officers were beating and torturing ‘confessions’ out of people who hadn’t even been formally accused of a crime. We cannot afford to repeat our mistakes. If officials require suspects to incriminate themselves, they are making fair trials and due process merely option and not a requirement. To venture down that road again will make law enforcement accountable to no one.”

Senate Armed Services Committee Chairman Carl Levin said he saw no legal basis for holding the suspect as an enemy combatant.

”I am not aware of any evidence so far that the Boston suspect is part of any organized group, let alone al Qaeda, the Taliban, or one of their affiliates — the only organizations whose members are subject to detention under the Authorization for Use of Military Force, as it has been consistently interpreted by all three branches of our government,” the Michigan Democrat said in a statement on Saturday.

2. How does the public safety exception work?

The Obama administration appeared to be taking a middle course, holding off on advising Tsarnaev of his rights, but still directing him into the criminal justice system for prosecution.

The DOJ signaled that it planned to rely on a 1984 Supreme Court case that said a suspect’s statements can be used against him even if he was not immediately read his rights if police got the answers while asking questions aimed at averting a threat to public safety.

The precise contours of that exception in a terrorism case are not clear, although a judge upheld that exception in connection with questioning of the so-called underwear bomber on a Delta flight bound for Detroit on Christmas Day 2009.

Still, some experts said holding off on reading Tsarnaev his rights was ill-advised, particularly since law enforcement officials declared that after the suspect’s arrest the threat to the public was over.

“The FBI is making a serious mistake by not giving him his Miranda warning … Let’s not give him any excuse to be able to successfully argue that his rights were denied,” Harvard Law professor Alan Dershowitz said on CNN.

If a court found that Tsarnaev was not read his Miranda rights, the usual consequence would be that any statements he made prior to being read his rights could not be admitted at trial. However, prosecutors might not need such statements if they have overwhelming evidence of Tsarnaev’s guilt.

During a news conference shortly after the suspect was captured, U.S. Attorney for Massachusetts Carmen Ortiz did not directly confirm that the suspect was not read his rights. However, she noted the law allows for exceptions. “There is a public safety exemption in cases of national security and potential charges involving acts of terrorism,” Ortiz said.

The American Civil Liberties Union said in a statement: “Every criminal defendant is entitled to be read Miranda rights. The public safety exception should be read narrowly. It applies only when there is a continued threat to public safety and is not an open-ended exception to the Miranda rule. Additionally, every criminal defendant has a right to be brought before a judge and to have access to counsel.”

3. Will prosecutors seek the death penalty — and will Tsarnaev get it?

Under federal law, there’s little doubt Tsarnaev could be eligible for the death penalty. Using a weapon of mass destruction, such as a bomb, in an attack that results in death can lead to capital punishment.

While it might seem a foregone conclusion that the federal government will seek the death penalty in such a high-profile case, one stemming from a terror spree that killed four and left more than 170 injured, that decision is less of a sure thing than many people would think.

Ortiz indicated Friday that call was a long way off.

“Before that kind of a decision is made, in terms of whether or not to seek the death penalty, you review all of the evidence and it’s a very thoughtful, long process that is engaged and it’s the attorney general of the Department of Justice that makes that final decision,” Ortiz said in response to a question at the news conference that followed Tsarnaev’s capture Friday night.

As prosecutors consider whether to seek the death penalty, they’ll consider aggravating and mitigating circumstances. Under federal law, attempting multiple murders, “heinous, cruel, or depraved” acts or those that are the product of “substantial planning and premeditation” can lead to the death penalty. However, Tsarnaev’s lawyers will be able to argue that his mental capacity was impaired, that he may have been under the “duress” of his elder brother or that his participation in the offense was “relatively minor.”

The prosecution might also enter into a plea bargain for a life sentence in order to avoid the risks of a trial, particularly if an insanity defense seems plausible.

Tsarnaev won’t face the death penalty under state law because Massachusetts does not have capital punishment. That could also complicate the DOJ’s thinking on the issue. Under Democratic administrations, the feds have generally been reluctant to pursue the death penalty in states that don’t have capital punishment. However, President George W. Bush’s administration did so.

President Barack Obama supports the death penalty. Attorney General Eric Holder issued guidelines discouraging federal capital cases in states that don’t have the death penalty, but the DOJ is currently pursuing such a case in Puerto Rico.

Of course, prosecutors would also have to get a jury to unanimously agree that death, and not life in prison, was the correct penalty for the crimes.

4. What kind of court will Tsarnaev be tried in and how soon will he show up there?

When Ortiz said her office would “continue to evaluate and file our formal charges,” she also seemed to imply that Tsarnaev would face justice in a civilian federal court.

At the moment, the debate over Tsarnaev’s Miranda rights may be moot because, according to police, he was severely injured and bleeding at the time he was captured. When answering a question about the public safety exemption, Ortiz added: “Right now, I believe though, the suspect has been taken to a hospital.”

A joint FBI/CIA interrogation unit that Obama established to handle terrorism cases has been activated and is on the scene, the DOJ official added. “The high value detained interrogation group is on site,” the official said.

Regardless of when or if Tsarnaev is Mirandized, if he asks for an attorney, questioning of him will be required to stop. Lawyers who attempt to question him or direct questioning of him once he asks for an attorney would be violating legal ethics and DOJ policy.

While some legal experts said Friday that Tsarnaev would most likely make a court appearance by Monday, if investigators want more time to question him, they could ask him to delay his presentation in court. Such waivers have been obtained in a series of recent terrorism cases, including that of Times Square bomber Faisal Shahzad in 2010 and the ongoing prosecution of Osama bin Laden’s son-in-law, Sulaiman Abu Ghaith.

At Tsarnaev’s initial appearance in court, a judge or magistrate will advise him of his rights and make sure he has access to a defense lawyer.

In 2010, the Obama administration floated the idea of legislation that would allow it to delay taking arrested terrorism suspects to court for about two weeks without getting any waiver from the person involved. However, the administration appeared to drop the idea a few months later, apparently satisfied that it had the flexibility it needed in existing law.

5. The FBI says Tsarnaev is a naturalized citizen — what difference will that make?

Graham’s proposal that Tsarnaev be put in military custody faced one significant obstacle: The man reportedly became a U.S. citizen last year. That would preclude prosecuting him under the current military commissions law, since U.S. citizens are explicitly outside its jurisdiction.

Whether Tsarnaev could legally be interrogated or detained by the military raises legal questions the Supreme Cout has never definitively addressed. Under President George W. Bush’s administration, U.S. citizen Jose Padilla was held in military custody as an enemy combatant for more than 3½ years on suspicion he planned to detonate a radioactive “dirty” bomb in Chicago.

The U.S. Court of Appeals for the 4th Circuit upheld Padilla’s detention in 2005, but after his lawyers asked the Supreme Court to take up the case, the Bush administration had Padilla indicted on unrelated criminal charges in an apparent effort to avoid a definitive ruling on the issue of whether citizens can be detained. The Supreme Court eventually declined to consider the issue of Padilla’s military detention.

Graham contends that a 1942 Supreme Court decision upholding a military trial for Nazi saboteurs who landed in Long Island during World War II authorizes the detention of Americans as enemy fighters. One of the men in the WWII case was a U.S. citizen.

However, in a floor debate last year, Senate Intelligence Committee Chairwoman Dianne Feinstein (D-Calif.) argued that the justices never considered the right to hold an American arrested on U.S. soil as an enemy combatant. She also said holding an American in military custody could violate a 1971 law that says citizens can only be imprisoned or detained pursuant to a duly-passed law.

Another potential obstacle to military detention: It’s also unclear whether Tsarnaev is connected with any group related to the Sept. 11, 2001, attacks or to the Taliban in Afghanistan. Those are affiliations that can render someone eligible for detention under the Authorization for Use of Military Force passed soon after the attacks.


From Russia to Nigeria with Love

When I first came to Abuja in May 2009, I had a very strange feeling. It was my first trip to Nigeria and to Africa in general, and everything around me was very different from what I was used to in my own country: the clothes people wore, the language they spoke, the landscapes, the food, the peculiarities of architecture and style. But surprisingly, it was not all that different. It felt like the plane, like some magic time jet, crossed not only the vast distance between Moscow and Abuja, but also a couple of decades of time, and I was back to Russia, end of the eighties – beginning of the nineties. It was a strange and romantic time. The communist regime which dominated the country for more than 70 years had just fallen down, and the nation was awakening, overjoyed with its newly acquired freedom and democracy. New businesses mushroomed all over the country, the first in the whole history of Russia democratic election took place, and the nation felt elated and thrilled. But very soon this nation-wide euphoria began to dissolve. The slow-moving and military-oriented economy, a legacy from the communist times, was not efficient and couldn’t meet the new requirements. Deprived of state support and poorly managed plants began to close down, their staff fired out. Unemployment and crime rates went up high, each region claimed its independence from Moscow and issued its own laws, local conflicts such as in Chechnya unleashed and flared up, and the country was beginning to fall to pieces. Most important consumer goods were in shortest supply ever and rationed, like in war time. Living standards went very low, and people felt confused and even cheated: what was happening around them was too different from what they imagined to be a free society. They were not used to taking care of their own lives and to making their own decisions, they had no idea what to do with this newly acquired liberty fallen upon them from out of the blue sky. And the country fell into chaos and a deep, deep decline…

Can you believe that it all happened to Russia, the world’s greatest power and a member of G8, one of the fastest growing economies in the world, less than 20 years ago? Drastic and at times, very painful measures were taken by the government to overcome this crisis and generally improve the situation, to encourage free enterprise and initiative, but reforms alone couldn’t have been the solution to all problems and bring about miracles. National mentality also changed, slowly. People began to understand that quite a lot depended on them. Nobody owes you anything. If you are not happy, don’t complain; put in at least the smallest effort to improve your life. Nobody will do it for you. Those changes in the people’s mentality were even more painful and slow in time, but we’ve managed it.

One needn’t think that the sky above Russiais clear and cloudless. We also have a lot of problems. Russian economy is still extensive, it depends on exporting raw products such as oil, gas and timber. The climate is notoriously severe and not favourable for agriculture. Local conflicts have subsided, but are not yet suppressed completely. Bribery and corruption still flourish, despite all the efforts undertaken by the government to fight them. The middle class, a backbone of liberty and democracy, is still too small a social group, to exert any real influence upon politics or economy, and the gap between the very rich and the very poor is not narrowing. Quite a few homes, not only in the country, but also in towns have no access to public utilities such as water and gas supply, central heating, modern means of transport and communication. Because of all that, quite a few experts suppose they have all the right to refer to Russia as a Third World country.

But is Russia really the Third World? Tell that to my aunt, kes (62 years old) lives in a country house, gets her drinking and household water from a well dug out in her yard and heats her house 8 months a year with firewood chopped by her husband, nearly 70! You’ll probably drown in floods of indignation coming from her side, and she’ll be supported by a lot of her neighbors all living in the same poor conditions, and by a lot of their compatriots probably lacking in material goods but too proud and patriotic to think of their country as anything other than the world’s greatest power.

That’s what matters. Everything starts in your head, and we are what we think of ourselves.More than that, other people think of us the way we let them do so, and if you think you are Third World, you ARE Third World, until you change your own opinion of yourself.

Is Nigeria Third World? What would most Nigerians reply to this question? Thinking that you are is easier, because this way, you shed the responsibility off your shoulders. We all of us are responsible for whatever happens to and around us. A famous Russian writer Mikhail Bulgakov wrote in one of his books: Chaos and devastation start in your head. Everything that happens to us starts in our heads. You can complain that sanitary conditions are very poor in your area – or you can stop throwing all kinds of litter around, go and collect the litter which has already been thrown, wash your window, give your house a fresh coat of paint. It doesn’t cost a lot, but if everyone does it, your area will soon look completely different. You can complain that the government does too little to provide fresh water supply for all the people (why should it, by the way? You people are not little children! Can’t you take good care of yourselves?) – or you can dig out a well next to your house, like my aunt’s family did, and this way, solve the problem of fresh water for your family once and forever. It is the greatest of all mistakes to do nothing because you can only do a little. Do what you can. And you will soon notice that your life is improving.

You are the most populous black nation in the world. You have a rich history, rich natural resources and a climate most favourable for agriculture, when you can grow crops and fruit all year round. You’ve got a great economic potential, recognized by international investment banks which identify Nigeria, alongside with other countries, as The Next Eleven, the 11 countries which are most likely to become the world’s largest economies in the 21st century. The heaviest task is to make people believe in it and to feel positive and proud of their country.

In 2003, Nigerians were reported to be the happiest people in the world in a scientific survey carried out in 65 nations in 1999-2001.The research was reported by one of the world’s top science magazines, New Scientist.I can believe it, for when I was in Nigeria (and I spent almost the whole of last year there), I didn’t see a gloomy or unhappy face around. I went for a walk in Millennium Park in Abuja, and it reminded me, surprisingly, of Geneva, all those people sitting on the grass, relaxing and enjoying themselves. I can believe it, because I saw it with my own eyes, in the streets, in cafés, in nightclubs, that people around me did not feel they are Third World. I could feel it that they were proud of being Africans and they were proud of being Nigerians – that’s what matters.

You have a great potential and you have great people – that’s what makes me believe that you’ll make it, and that despite all the problems you are facing now, you will soon become one of the greatest nations in the world.


/*******************************************************************************
 * Copyright (c) 1991, 2019 IBM Corp. and others
 *
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/
 * or the Apache License, Version 2.0 which accompanies this distribution and
 * is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * This Source Code may also be made available under the following
 * Secondary Licenses when the conditions for such availability set
 * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
 * General Public License, version 2 with the GNU Classpath
 * Exception [1] and GNU General Public License, version 2 with the
 * OpenJDK Assembly Exception [2].
 *
 * [1] https://www.gnu.org/software/classpath/license.html
 * [2] http://openjdk.java.net/legal/assembly-exception.html
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
 *******************************************************************************/

#include <string.h>
#include "algotest.h"
#include "exelib_api.h"
#include "algorithm_test_internal.h"

J9PortLibrary *algoTestPortLib = NULL;

UDATA signalProtectedMain(struct J9PortLibrary *portLibrary, void *arg)
{
	struct j9cmdlineOptions * args = arg;
#if defined(J9VM_OPT_MEMORY_CHECK_SUPPORT)
	int argc = args->argc;
	char **argv = args->argv;
#endif /* defined(J9VM_OPT_MEMORY_CHECK_SUPPORT) */
	I_32 numSuitesNotRun = 0;
	UDATA passCount = 0;
	UDATA failCount = 0;

	PORT_ACCESS_FROM_PORT(args->portLibrary);

	algoTestPortLib = args->portLibrary;

#ifdef J9VM_OPT_MEMORY_CHECK_SUPPORT
	/* This should happen before anybody allocates memory!  Otherwise, shutdown will not work properly. */
	memoryCheck_parseCmdLine( algoTestPortLib, argc-1, argv );
#endif /* J9VM_OPT_MEMORY_CHECK_SUPPORT */

	j9tty_printf( PORTLIB, "Algorithm Test Start\n");

	if (verifyWildcards(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	if (verifyArgScan(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	if (verifySimplePools(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	if (verifySendSlots(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	if (verifySRPHashtable(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	if (verifyPrimeNumberHelper(PORTLIB, &passCount, &failCount)) {
		numSuitesNotRun++;
	}

	j9tty_printf( PORTLIB, "Algorithm Test Finished\n");
	j9tty_printf( PORTLIB, "total tests: %d\n", passCount + failCount);
	j9tty_printf( PORTLIB, "total passes: %d\n", passCount);
	j9tty_printf( PORTLIB, "total failures: %d\n", failCount);

	if (numSuitesNotRun) {
		j9tty_printf( PORTLIB, "%i SUITE%s NOT RUN!!!\n", numSuitesNotRun, numSuitesNotRun != 1 ? "S" : "");
	} else if ((failCount == 0) && (passCount)) {
		j9tty_printf( PORTLIB, "ALL TESTS COMPLETED AND PASSED.\n");
		return 0;
	}

	/* want to report failures even if suites skipped or failed */
	if (failCount) {
		j9tty_printf( PORTLIB, "THERE WERE FAILURES!!!\n");
	}

	return -1;
}


Fake press release costs company $300 million in one day

A member of the activist group, Front Line Action On Coal, claimed responsibility for the hoax. (Source: Facebook/Front Line Action On Coal)

(RNN) - A 24-year-old environmental activist put out a fake press release that said an Australian coal company was denied a loan from a bank.

The result: the company immediately lost more than $300 million.

Jonathan Moylan, member of an anti-coal group called, "Frontline Action on Coal," bought a domain name with email address that resembled that of ANZ, one of Australia's largest banks, and sent out a fake press release to the media stating that the bank had denied a loan to Whitehaven Coal for a new mining project.

The fake press release said: "We want our customers to be assured that we will not be investing in coal projects that cause significant dislocation of farmers, unacceptable damage to the environment, or social conflict."

The news quickly spread and the price of Whitehaven Coal's shares plummeted by almost 9 percent as investors sold off their shares. The company is reported to have lost more than $300 million and its largest shareholder, Nathan Tinkler, may have lost more than $50 million.

The hoax was eventually uncovered, but not before the damage had already been done. And when the media discovered who was behind the ruse, Moylan was defiant.

"I made the announcement that ANZ should have made," Moylan said, according to The Australian.

"The future of our farmlands, our forests, our health, our climate - these are the biggest threats humanity faces and they are far more important than concerns over liability," he said, reported the BBC.

Although Moylan will likely face legal action as a result of the hoax, he has the support of at least one politician.

However, not everyone is happy with Moylan's actions. With so much money being lost, many small investors also took a financial hit.

On Front Line Action on Coal's Facebook page, a visitor criticized the group for not thinking about the small-time investors who may have lost money.

But Front Line responded: "We feel so sorry for the Leard State Forest and the farming community and those that live along the rail line to Newcastle ... If these mines get the go ahead they will loses sooo much more than Money!!!"

Several media outlets have reported that Moylan was visited by authorities and had his laptop and cell phone seized.

Residents are still taking additional measures to stop the violence in Moss Point. Saturday afternoon, an outreach program on Main Street continued its efforts in the fight that's been going on for the past weeks.

Residents are still taking additional measures to stop the violence in Moss Point. Saturday afternoon, an outreach program on Main Street continued its efforts in the fight that's been going on for the past weeks.


1. Field of the Invention
The present invention relates to a read controller for an image pick-up device that controls reading of charges accumulated in a plurality of sensors disposed in the image pick-up device through predetermined transfer paths and to an image pick-up apparatus that captures object light by the image pick-up device and creates an image signal.
2. Description of the Related Art
A digital camera as one of image pick-up apparatuses widely employs a charge coupled device (hereinafter, abbreviated as CCD) as an image pick-up device. The CCD is the image pick-up device having photoelectric transducers such as photo diodes and the like as a plurality of sensors disposed on a semiconductor substrate, wherein the photoelectric transducers accumulate charges according to an amount of light, and the accumulated charges are read out through predetermined transfer paths.
A substrate bias voltage is applied to the semiconductor substrate constituting the CCD from a bias controller disposed inside or outside the CCD, and the photoelectric transducers have a potential profile for accumulating charges according to the magnitude of the substrate bias voltage applied thereto. Further, the CCD often includes an over drain structure to which an overflow drain voltage (hereinafter, abbreviated as OFD voltage) is applied to discharge the saturated charges accumulated in the photoelectric transducers to the semiconductor substrate. The CCD arranged as described above is controlled such that excessive charges do not overflow to the transfer paths even if pixels mixedly exist in the CCD when a moving picture is recorded by, for example, decreasing the OFD voltage when a still picture is recorded to thereby accumulate a large amount charges in the photoelectric transducers and by increasing the OFD voltage when the moving picture is recorded to thereby accumulate a small amount of charges therein. Further, there are proposed in the CCD a technique for adjusting the OFD voltage by a load means connected to a control terminal (refer to, for example, Japanese Patent Application Laid-Open No. 9-121310) and a technique for making the amount of saturated charges accumulated in the photoelectric transducers uniform by setting a potential barrier in a high state by applying a predetermined OFD voltage (refer to, for example, Japanese Patent Application Laid-Open No. 11-331708).
There are known digital cameras provided with a mechanical shutter as well as a read controller for an image pick-up device that controls reading of charges from a CCD having the over drain structure. When a still picture is picked up with the digital camera, first, exposure is executed. In the exposure, there are executed processing for displaying an object observing through image on an image monitor in the state that the mechanical shutter is opened, and the like. Next, smear is read out to clear transfer paths by reading out the charges remaining in the transfer paths in the state that no light is incident by closing the mechanical shutter. The smear is read out in response to relatively high speed pulses. In general, when the still picture is picked up, the OFD voltage is set to a relatively low level so that charges are sufficiently accumulated in the photoelectric transducers. Accordingly, spike-like noise occurs in the OFD voltage set to the low level because the OFD voltage is affected by the high speed pulses in the smear read-out process. The noise is mixed with the substrate bias voltage that determines the magnitude of the potential profile of the photoelectric transducers. As a result, a problem arises in that the charges accumulated in the photoelectric transducers are discharged to a semiconductor substrate, and the amount of saturated charges of the photoelectric transducers decrease. In particular, when a power supply having a small current capacity is used, this problem arises outstandingly. Accordingly, it is difficult to obtain an image of excellent quality by the digital camera as an image pick-up apparatus.


DUBAI, United Arab Emirates, Nov. 15 (UPI) -- The Pentagon's reported plan to sell the United Arab Emirates nearly 5,000 bunker-buster bombs to counter Iran is part of a move to strengthen Arab monarchies of the Persian Gulf as the U.S. withdrawal from Iraq nears completion.

But it's also a lifesaver for U.S. defense contractors who're having to rely on exports to keep assembly lines running because of hefty cuts in military spending at home after the feeding frenzy of the post-Sept. 11 era.

"The defense industry is coming to the end of what many of its senior figures regard as a golden decade," The Financial Times reported in a September assessment of the sector.

"Ten years ago, in the immediate aftermath of the Sept. 11 attacks, the U.S. government began a huge injection of cash into the Pentagon budget.

"Over the course of the decade, the U.S. annual defense budget has doubled in cash terms to reach nearly $700 billion in 2010.

"The profits of the U.S. defense industry have quadrupled over that period," the FT reported. "The country has come to dwarf all other nations in the amount it spends on military equipment.

"Now, however, the tap has been turned off and defense companies in the United States -- as well as in Europe -- face more challenging times.

"Some senior executive in the industry believe Congress will take out up to $1,000 billion from the core Pentagon budget over the next decade," the business daily said.

U.S. strategists see China emerging as a military power capable of challenging the United States, so countries fearful of the Dragon's fire, such as India, Japan, South Korea and Australia, are in the market for fifth-generation weapons systems.

The Iran threat has also been providential. Major purchases there by Saudi Arabia and its partners in the Gulf Cooperation Council -- the United Arab Emirates, Kuwait, Oman, Qatar and Bahrain -- are likely to continue for some years.

These sales are critical to U.S. defense sector efforts to boost exports.

The GCC states have been preparing to make major arms purchases from the United States, and to a lesser extent from Britain and France, since 2007.

In 2010, Saudi Arabia finalized an unprecedented deal with Boeing and other U.S. majors for advanced F-15 combat jets, helicopters, missiles and warships worth around $67 billion.

It was the biggest single U.S. defense package ever, and it came in the nick of time for American defense companies.

The emirates, which currently have a powerful air force that is challenging the Saudis' long domination of GCC air power, is also moving toward a $7 billion contract for the Theater High Altitude Air Defense system or THAAD.

The system, designed to shoot down short-, medium- and long-range missiles, is developed, built and integrated by Lockheed Martin Space Systems.

Key subcontractors include Boeing, Raytheon, Honeywell, BAE Systems and Aerojet.

U.S. arms sales to GCC members is expected to focus, for the time being at least, on intercepting Iranian strike aircraft, followed by limiting damage from ballistic and cruise missiles.

The Americans are expected to provide early warning systems and an outer screen of missile interceptors, largely on ships from the Bahrain-based 5th Fleet, in the gulf, the Arabian Sea and the Red Sea.

Kuwait has reportedly speeded up plans to deploy a ship-based outer defense ring and to procure land-based interceptions systems like THAAD, while upgrading its 40 Raytheon Patriot MIM-104 PAC-2 air-defense missile units.

Western defense company executives attending the Dubai Air Show last week said that there could be big orders from the United Arab Emirates for early-warning systems manufactured by Boeing, Northrop Grumman and Swedish aerospace group Saab.

The tiny gulf emirate of Qatar is upgrading its air strike capabilities, so there could be orders from Doha in the coming months.

Meantime, the emirates and France are locked in what are billed as final negotiations for the sale of up to 60 Dassault Aviation Rafale multi-role strike jets worth an estimated $10 billion.

If Dassault pulls off the deal, the United Arab Emirates will be the jet's first foreign buyer.

The French have been struggling for years to sign up a major export order to help keep Rafale's production line going to provide aircraft for France's Armee de l'Air.


Q:

Write a query to select columns wrapped in single quotes

I am trying to write a select query which should return the column value wrapped in single quote. Say the column (ABC) has
Values: 123
        567

The query should return the
Output: '123'
        '567'

A:

While dealing with numerical data, you can simply concatenate. NULL values stay NULL. But for character data (or similar) that might need escaping, use proper functions.
quote_nullable() or quote_literal() - depending on whether you have NULL values:
SELECT quote_nullable(val) AS quoted_val FROM tbl;

Details for quoting:

Insert text with single quotes in PostgreSQL


Q:

How to find Facebook Friends using the same app

I am creating an app and would like people using the app to find friends using the same app on Facebook. Any help on this would be great.
I know this can be done. I have seen it on Instagram and Tiger Woods 12.

A:

Once you've authorised the user and obtained an access token, you can quickly determine which of their friends have already authorised your app with a call to /me/friends?fields=installed
For the users' friends who have already authorised the app, the result will look like this:
{
   "installed": true,
   "id": "{USER_ID_GOES_HERE}"
},

and for the users who have not already authorised the app, the result will look like this:
{
  "id": "{USER_ID_GOES_HERE}"
},

If you're doing this in the iOS SDK you won't see that exact return value, but the SDK should put the results into a data structure you can use, and check for the presence of the 'installed' item
You can also request additional User object fields other than just 'installed', but this is just a quick example to show you how to get the list of friends that use the app

A:

I have solved this problem in very easy way
Step 1= first download FbGraph API
Step 2= use this code for authentication
NSString *client_id = @"XXXXXXXXXXXXXX";// App id

//alloc and initalize our FbGraph instance
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];

//begin the authentication process.....
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:)
                     andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];

Step 3= Copy fbGraphCallback: Method from sample code and put in your controller
Step 4= Use this code to get Friends and it will give u the list of friend and who have same app install They look like
{
   "installed": true,
   "id": "{USER_ID_GOES_HERE}"
},

Code is =
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];

[variables setObject:@"installed" forKey:@"fields"];

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/friends" withGetVars:variables];

NSLog(@"getMeinstalled Friends:  %@", fb_graph_response.htmlResponse);

Thats it!!!!!!!!

A:

I know 'iphone' is tagged in the question, but still this answer might help others who will reach here:
The FQL query to get (just) the ids of all user's friends who are also users of the app is:
SELECT uid FROM user WHERE is_app_user=true AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())


Q:

Is there a way to parse a relative date using Moment.js?

Moment.js is a very usefull JavaScript library which provides many functions to manipulate date formatting.
In order to create a Moment object, it is possible to parse a string simply moment("1995-12-25"); or by providing format moment("12-25-1995", "MM-DD-YYYY");.
Another feature allows us to use relative dates : moment("1995-12-25").fromNow() // 19 years ago.
However, I can not find a way to parse such a relative date. When I try moment("19 years ago") it just returns Invalid date, and it does not exist any token to properly format the date.
Is there an easy way to do this? Or is it a missing feature that should be suggested on Github?

A:

Just found chrono wile looking to see if NLP had already been implemented in momentjs.  It looks like it handles parsing NLP to a date, which can be used to create a momentjs date.

Simply pass a string to function chrono.parseDate or chrono.parse.
> var chrono = require('chrono-node')

> chrono.parseDate('An appointment on Sep 12-13')
Fri Sep 12 2014 12:00:00 GMT-0500 (CDT)

And a quick example showing how that would work
Code
const moment = require('moment')
const chrono = require('chrono-node')

let now = moment()
console.log(now)
let yrsAgo = chrono.parseDate("19 years ago")
console.log(yrsAgo)
let yrsAgoMoment = moment(yrsAgo)
console.log(yrsAgoMoment)

Output
$node test.js
moment("2017-06-30T08:29:20.938")
1998-06-30T17:00:00.000Z
moment("1998-06-30T12:00:00.000")

A:

The only way of doing this is moment().sub(19, 'years');
What you are asking imply a Natural language processing which is whole computer science field.