text:
<?php

namespace DIY\Base;
use DIY\Base\Form\Format;
use DIY\Base\Form\Validate;
use \Exception as Exception;

class Form {

    /**
     * @var object $_format The formatting object. Only instantiated if the method is called.
     */
    private $_format = false;

    /**
     * @var object $_validate The validation object. Only instantiated if the method is called.
     */
    private $_validate = false;

    /**
     * @var array $_inputData Holds the POSTED data inside the object for post-processing
     */
    private $_inputData = array();

    /**
     * @var array $_errorData Holds the VALIDATION errors
     */
    private $_errorData = array();

    /**
     * @var string $_currentRecord Holds the immediate record being handled (To chain validation on the spot)
     */
    private $_currentRecord = null;

    /**
     * @var mixed $_mimicPost Used for passing artificial $_POST requests
     */
    private $_mimicPost = null;

    /**
     * @var string $_mode Sets the mode to POST, GET, or REQUEST
     */
    private $_mode = 'POST';

    /**
     * @var boolean $_storeSession Stores items in an empty session
     */
    private $_storeSession = true;

    /**
     * @var string $_sessionTemp The session variable to store temporary data under
     */
    private $_sessionTemp = 'tmp';

    // ------------------------------------------------------------------------

    /**
     * __construct - Instanatiates the Validate object
     *
     * @param mixed $mimicPost (Optional) Pass an associative array matching the form->post() names to mimic a POST
     */
    public function __construct($mimicPost = null) {
        $this->_mimicPost = $mimicPost;
        $this->storeSession(true);
    }

    // ------------------------------------------------------------------------

    /**
     * useTempSession - Store data in a $_SESSION variable titled $_SESSION[tmp][data]
     *
     * @param boolean $boolean
     */
    public function storeSession($boolean = true) {
        $this->_storeSession = (boolean) $boolean;
    }

    // ------------------------------------------------------------------------

    /**
     * post - Retrieves $_POST data and saves it to the object
     *
     * @param string $name The name of the field to post
     * @param bool|string $required_or_checkbox (Default = false) true/false/checkbox When set to true && the value is NULL: Unset the value internally and do validate.
     * @return Form
     * @throws Exception
     */
    public function post($name, $required_or_checkbox = false) {
        $this->_mode = 'POST';
        return $this->_handle_input($name, $required_or_checkbox);
    }

    // ------------------------------------------------------------------------

    /**
     * get - Retrieves $_GET data and saves it to the object
     *
     * @param string $name The name of the item to get
     * @param bool|string $required (Default = false) When set to true && the value is NULL: Unset the value internally and do validate.
     * @return Form
     * @throws Exception
     */
    public function get($name, $required = false) {
        $this->_mode = 'GET';
        return $this->_handle_input($name, $required);
    }

    // ------------------------------------------------------------------------

    /**
     * request - Handles the $_REQUEST data
     * @param $name
     * @param bool $required
     * @return Form
     * @throws Exception
     */
    public function request($name, $required = false) {
        $this->_mode = 'REQUEST';
        return $this->_handle_input($name, $required);
    }

    // ------------------------------------------------------------------------

    /**
     * The master method which handles a POST/GET/REQUEST
     *
     * @param string $name The name of the item to get
     * @param boolean $required Is this field required?
     *
     * @return Form
     * @throws Exception
     */
    private function _handle_input($name, $required) {
        /**
         * Sanitize the post data (Only allow ASCII up to 127 for now)
         */
        if (is_array($this->_mimicPost) && isset($this->_mimicPost[$name])) {
            if (isset($this->_mimicPost[$name])) {
                $input = $this->_mimicPost[$name];
            } else {
                throw new \Exception('Mimic value not found in your POST/GET/REQUEST');
            }
        } else {

            switch ($this->_mode) {
                case 'POST':
                    /**
                     * Make sure checkboxes are always passed, and set them as strings
                     */
                    if ($required === 'checkbox') {

                        $input = isset($_POST[$name]) && ($_POST[$name] == 'on' || $_POST[$name] == 'true') ? (string) 1 : (string) 0;
                    } else {
                        $input = isset($_POST[$name]) ? $_POST[$name] : null;
                    }
                    break;
                case 'GET':
                    $input = isset($_GET[$name]) ? urldecode($_GET[$name]) : null;
                    break;
                case 'REQUEST':
                    $input = isset($_REQUEST[$name]) ? urldecode($_REQUEST[$name]) : null;
                    break;
            }
        }

        /**
         * If this is not required, we skip it when the value is null
         * This is so something can post and someone can EDIT on a few fields at a time
         */
        /** @var mixed $input */
        if ($required == false && $input == null) {
            /** An internal flag to prevent the validator from running */
            $this->_currentRecord = null;
            return $this;
        }

        /**
         * If the field is required and empty
         * Mark the error field is required
         */
        if ($required == true && $input == null) {
            $this->_errorData[$name] = 'is required';
        }

        /**
         * Set a new record in this object
         */
        $this->_inputData[$name] = $input;

        /**
         * Hold on to the immediate record in case validation is called next
         */
        $this->_currentRecord['key'] = &$name;
        $this->_currentRecord['value'] = &$this->_inputData[$name];

        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * set - Set an internal record manually
     *
     * @param string $name
     * @param string $value
     * @return boolean
     */
    public function set($name, $value) {
        /** I want this to override stuff */
        $this->_inputData[$name] = $value;

        /**
         * Hold on to the immediate record incase validation is called next
         */
        $this->_currentRecord['key'] = &$name;
        $this->_currentRecord['value'] = &$value;

        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * format - Format the Input contents internally
     *
     * @param string $type The name of a function such as md5, trim, etc
     * @param mixed $param Additional parameters for formatting
     * @return $this
     */
    public function format($type, $param = null) {
        /** Instantiate the format class only if it's used */
        if ($this->_format == false) {
            $this->_format = new Format();
        }
        /** Prevent nulls from creating blank arrays */
        if ($this->_currentRecord == null) {
            return $this;
        }

        $key = $this->_currentRecord['key'];

        if ($param == null) {
            $this->_inputData[$key] = $this->_format->{$type}($this->_currentRecord['value']);
        } else {
            $this->_inputData[$key] = $this->_format->{$type}($this->_currentRecord['value'], $param);
        }

        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * validate - Validates the current POST item
     *
     * @param string $action
     * @param array $param If validating length, do .. ->validate('length', array(1, 4));
     * @param mixed $option If validating matchany lowercase, do .. ->validate('matchany', array('Jesse', 'Joe'), false);
     * @return $this
     */
    public function validate($action, $param = array(), $option = null) {
        /**
         * From the "post() method" if this is null then then this is not required.
         */
        if ($this->_currentRecord == null) {
            return $this;
        }

        /** Instantiate the validate class only if it's used */
        if ($this->_validate == false) {
            $this->_validate = new Validate();
        }

        $key = $this->_currentRecord['key'];
        $value = $this->_currentRecord['value'];

        /** Make sure the option absolutely is null to skip an option */
        if ($option === null) {
            $validateStatus = $this->_validate->{$action}($value, $param);
        } else {
            $validateStatus = $this->_validate->{$action}($value, $param, $option);
        }

        if ($validateStatus == true) {
            $this->_errorData[$key] = $validateStatus;
        }

        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * error - Set a custom error message immediately after calling validate()
     *
     * @param string $msg The text to display if an error fires
     *
     * @return object
     */
    public function error($msg) {
        $key = $this->_currentRecord['key'];
        if (isset($this->_errorData[$key])) {
            $this->_errorData[$key] = $msg;
        }

        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * setError - Set a custom error message for any field at anytime
     * This will prevent me from throwing an exception and not having the other errors.
     *
     * @param string $name Name of the field
     * @param string $msg Error Message
     *
     * @return object
     */
    public function setError($name, $msg) {
        $this->_errorData[$name] = $msg;
        return $this;
    }

    // ------------------------------------------------------------------------

    /**
     * setSessionTemp - Renames the temporary Session variable for form data being preserved
     * for page refreshes. The default value is 'tmp'.
     *
     * @param string $name
     */
    public function setSessionTemp($name) {
        $this->_sessionTemp = $name;
    }

    // ------------------------------------------------------------------------

    /**
     * submit - Processes the entire form and gather errors if any exist
     * @return mixed False for no errors, True (With data) for errors.
     * @throws Exception
     * @internal param bool $preserveTemp Keep the previous post data inside a Session
     *
     */
    public function submit() {
        if (session_id() != '' && $this->_storeSession == true) {
            $_SESSION[$this->_sessionTemp]['input'] = $this->_inputData;
        }

        if (count($this->_errorData) > 0) {
            throw new  Exception("There are errors in the form. Please wrap the form in a try/catch and call \$form->fetchErrors() in the catch.\n");
        }
    }

    // ------------------------------------------------------------------------

    /**
     * clearSessionTemp - Remove the temporary data from a session, this should be placed at
     * the very end of a systems operations.
     */
    public static function clearSessionTemp() {
        if (isset($_SESSION[Form::_sessionTemp])) {
            unset($_SESSION[Form::_sessionTemp]);
        }
    }

    // ------------------------------------------------------------------------

    /**
     * fetchErrors - Returns the errors
     *
     * @return array
     */
    public function fetchErrors() {
        return $this->_errorData;
    }

    // ------------------------------------------------------------------------

    /**
     * fetch - Return a value from the POSTED records stored internally
     *
     * @param string $key (Optional) Returns a specific value
     * @return mixed Either a string or all items
     */
    public function fetch($key = null) {
        if ($key != null) {
            if (isset($this->_inputData[$key])) {
                return $this->_inputData[$key];
            } else {
                return false;
            }
        } else {
            /**
             * Make sure no empty items get placed
             */
            return array_filter($this->_inputData, 'strlen');
        }
    }

    // ------------------------------------------------------------------------

    /**
     * remove - Remove an internal record
     *
     * @param string(s) Pass as many function arguments as needed to unset
     *          eg: form->remove('field', 'field2', 'field3');
     *
     * @return object
     */
    public function remove($unlimited) {
        foreach (func_get_args() as $key => $value) {
            if (isset($this->_inputData[$value])) {
                unset($this->_inputData[$value]);
            }
        }

        return $this;
    }

    // ------------------------------------------------------------------------
}

/** eof */

redpajama_set_name: RedPajamaGithub


text:
Nokia losing sales because of Skype? We call shenanigans.
Daniel Rubino
Business Insider is reporting that Skype is causing Microsoft and by extension Nokia problems in terms of sales of their Lumia line. The information comes from the shareholder meeting held yesterday in Finland but since it was not open to the public or recorded, there's a lot of second hand "reporting" going, some of it dubious.
Reportedly a question was raised about Skype from a shareholder. From BI:
"Nokia seems to be having a problem with the distribution channel due to Skype" asking how will Nokia deal with this problem. Elop answered "If the operator doesn't want us, it doesn't want us. We will appeal to them with other arguments. We have more to offer to them. It is a good point to start the discussion from Skype."
Both BI and an awfully written personal blog called 'Communities Dominates Brands' spin this as Nokia having problems selling Lumias because of carrier opposition to Skype.
While we have little doubt that carriers don't like Skype and are concerned about how Microsoft pushes it on them, it seems like flat out ignorance to claim this is why Nokia may be having trouble selling their Lumia line.
As anyone on Windows Phone who has used Skype knows, it's far from a threat to carriers especially at its current stage. Let's go over the reasons why this story is dubious and reeks of shoddy reporting:
Skype on Windows Phone doesn't run in the background and can't receive calls
Skype is widely available on the much more ubiquitous iOS and Android platforms where it can run in the background
Tango Video Call is also now widely available on all platforms and can receive calls in the background on Windows Phone, making it more of a "threat" than Skype
Skype doesn't come pre-installed on any Windows Phone; Tango Video Call does
The carriers are gearing up for Skype by capping data and raising costs as voice-usage starts to decline
Certainly we can see carriers being concerned with how Microsoft integrates Skype into Windows Phone 8 but that seems like something that could be negotiated by the OEMs and carriers on a per-device level. Microsoft has been very, very good at working with carriers (and cable providers) on content delivery and not stepping on their toes. In fact it's a core reason why the Xbox 360 is doing so well as a general entertainment device over Google TV.
The notion that Android and iOS get a pass on Skype with the carriers but Nokia (and only Nokia) are being singled out seems ludicrous, especially since Windows Phone is a drop in the bucket compared to Apple and Google's systems right now. In other words, while Nokia may be having problems getting traction in the smartphone market with Windows Phone, we don't think it's because of Skype.

redpajama_set_name: RedPajamaCommonCrawl


text:
NSA Cracked Into Encrypted UN Video Conferences
By timothy from Slashdot's for-the-greater-good department:
McGruber writes "According to documents seen by Germany's Der Spiegel, the U.S. National Security Agency (NSA) successfully cracked the encryption code protecting the United Nations' internal videoconferencing system. NSA first breached the UN system in the summer of 2012 and, within three weeks of initially gaining access to the UN system, the NSA had increased the number of such decrypted communications from 12 to 458. On one occasion, according to the report, while the American NSA were attempting to break into UN communications, they discovered the Chinese were attempting to crack the encryption code as well."
Cookieless Web Tracking Using HTTP's ETag
By timothy from Slashdot's ah-there-you-are-again department:
An anonymous reader writes "There is a growing interest in who tracks us, and many folks are restricting the use of web cookies and Flash to cut down how advertisers (and others) can track them. Those things are fine as far as they go, but some sites are using the ETag header as an identifier: Attentive readers might have noticed already how you can use this to track people: the browser sends the information back to the server that it previously received (the ETag). That sounds an awful lot like cookies, doesn't it? The server can simply give each browser an unique ETag, and when they connect again it can look it up in its database. Neither JavaScript, nor any other plugin, has to be enabled for this to work either, and changing your IP is useless as well. The only usable workaround seems to be clearing one's cache, or using private browsing with HTTPS on sites where you don't want to be tracked. The Firefox add-on SecretAgent also does ETag overwriting."
Windows 8.1 RTM Trickling Out, With Start Menu and Boot-to-Desktop
By timothy from Slashdot's year-of-the-windows-desktop department:
poofmeisterp writes "It's about time. Windows 8.1 will be released to end users in October, and RTM is being released now: 'Windows 8.1, codenamed "Blue," is introducing a number of changes designed to make the new operating system more palatable to current Windows users. Windows 8.1 is adding a Start Button, a boot-straight-to-desktop option; the ability to unpin all Metro apps; built-in tutorials; an improved Windows Store and a host of other consumer- and business-focused features. Microsoft launched its one and only Windows 8.1 consumer preview test build in late June.'"
Former Lockeed Skunkworks Engineer Auctioning a Prototype "Spy Rock"
By timothy from Slashdot's for-that-price-I'd-expect-at-least-two-rocks department:
ilikenwf writes "For a cool $10,000,000.00, the prototype of a surveillance rock full of spy gadgets could be yours! More importantly, server backups from the gentleman's time at Lockheed are included, being the real valuable in this auction, as it contains schematics and such. The seller seems to think that the current xBee radio products are actually based on his work with Lockheed. The proceeds will go towards legal action the seller is apparently taking against his former employer." This may be the most unusual eBay product description I've ever encountered, and one of the most interesting, too.
International Effort Could Put First Canadian On the Moon
By timothy from Slashdot's mayor-ford-the-obvious-choice department:
A long-term plan created by 14 cooperating space agencies around the world could mean that a Canadian astronaut may get to visit the moon sometime close to 2030. The International Space Exploration Coordination Group, of which Canada is a part, released last week an updated roadmap laying out intended projects, including a lunar visit.
"[CSA space exploration director Jean-Claude Piedboeuf] suggested astronauts could again be moon-bound in about 15 years. It would be the first human visit to the shining orb since 1972, when NASA astronauts Eugene Cernan and Harrison Schmidt spent 75 hours there.
This time, there could well be Canadian visitors.
Their specialty: robotics. 'We're proposing a vision where Canada could have an astronaut, effectively a Canadian who will be in lunar space, either in orbit or on the moon and could operate a Canadian rover in the same way that Canadians operate a Canadarm on the space station,' Piedboeuf said."
Sources Say Amazon Testing Its Own Wireless Networking Service
By timothy from Slashdot's sweet-data-from-above department:
Google has captured lots of attention with its municipal fiber efforts in Kansas City and Austin; Amazon, say some anonymous sources, is experimenting with a networking project of its own (distinct from its Whispernet 3G content delivery service) to connect users' devices to the internet. Rather than fiber, though, Amazon's tests involve spectrum controlled by satellite communications company Globalstar Inc., according to sources "who asked not to be identified because the test was private. ... Amazon continually tries various technologies, and it's unclear if the wireless network testing is still taking place, said the people. The trial was in the vicinity of Amazon's Lab126 research facilities in Cupertino, the people said. Lab126 designs and engineers Kindle devices."
This Satellite Could Be Beaming Solar Power Down From Space By 2025
By timothy from Slashdot's your-popcorn-isn't-safe department:
Daniel_Stuckey writes "A NASA veteran, aerospace entrepreneur, and space-based solar power (SBSP) expert, [John] Mankins designed the world's first practical orbital solar plant. It's called the Solar Power Satellite via Arbitrarily Large PHased Array, or SPS-ALPHA for short. If all goes to plan, it could be launched as early as 2025, which is sooner than it sounds when it comes to space-based solar power timelines. Scientists have been aware of the edge the "space-down" approach holds over terrestrial panels for decades. An orbiting plant would be unaffected by weather, atmospheric filtering of light, and the sun's inconvenient habit of setting every evening. SBSP also has the potential to dramatically increase the availability of renewable energy."
ilikenwf writes "For a cool $10,000,000.00, the prototype of a surveillance rock full of spy gadgets could be yours! More importantly, server backups from the gentleman's time at Lockheed are included, being the real valuable in this auction, as it contains schematics and such. The seller seems to think that the current xBee radio products are actually based on his work with Lockeed. The proceeds will go towards legal action the seller is apparently taking against his former employer." This may be the most unusual eBay product description I've ever encountered, and one of the most interesting, too.
Calibre Version 1.0 Released After 7 Years of Development
By timothy from Slashdot's that-is-some-conservative-numbering department:
Calibre is a feature-laden, open source e-book manager; many readers mentioned in light of the recently posted news about Barnes & Noble's Nook that they use Calibre to deal with their reading material. Reader Trashcan Romeo writes with some news on it's new 1.0 release, summing it up thus: "The new version of the premier e-book management application boasts a completely re-written database backend and PDF output engine as well a new book-cover grid view."
Australian University Unveils New Carbon-Trapping Bricks
By timothy from Slashdot's why-not-an-infinite-supply-of-graphene? department:
FirephoxRising writes "A research pilot plant in Newcastle will trial world-first technology that turns carbon emissions into bricks and pavers for the construction industry. More efficient and stable than storing gas in the ground, the new method will sequester carbon and can work anywhere, unlike geo-sequestration which is site specific."
Microsoft Needs a Catch-Up Artist
By timothy from Slashdot's chairs-are-expensive department:
The New York Times says that what Microsoft needs now isn't just a CEO, but a catch-up artist, to regain the footing that it had a few years ago as the biggest name in software. There's a lot of catching up, too: An anonymous reader reminds us that a year ago, Vanity Fair gave a scathing review of Steve Ballmer's performance:"Once upon a time, Microsoft dominated the tech industry; indeed, it was the wealthiest corporation in the world. But since 2000, as Apple, Google, and Facebook whizzed by, it has fallen flat in every arena it entered: e-books, music, search, social networking, etc., etc. Talking to former and current Microsoft executives, Kurt Eichenwald finds the fingers pointing at C.E.O. Steve Ballmer, Bill Gates's successor, as the man who led them astray."
Wildfire Threatens Water and Power To San Francisco
By timothy from Slashdot's keep-your-batteries-charged department:
Hugh Pickens DOT Com writes "Retuers reports that firefighters are battling to gain control of a fast-moving wildfire raging on the edge of Yosemite National Park that is threatening power and water supplies to San Francisco, about 200 miles to the west. 'We are making progress but unfortunately the steep terrain definitely has posed a major challenge,' says Daniel Berlant, a spokesman for the California Department of Forestry and Fire Protection. 'Today we're continuing to see warm weather that could allow this fire to continue to grow very rapidly as it has over the last several days.' California Governor Jerry Brown has declared a state of emergency, warning that the fire had damaged the electrical infrastructure serving the city, and forced the San Francisco Public Utilities Commission to shut down power lines. The blaze in the western Sierra Nevada Mountains is now the fastest-moving of 50 large wildfires raging across the drought-parched U.S. West that have strained resources and prompted fire managers to open talks with Pentagon commanders and Canadian officials about possible reinforcements. Firefighters have been hampered by a lack of moisture from the sky and on the ground. 'The wind today is going to be better for firefighting, but we are still dealing with bone dry grass and brush,' says Tina Rose, spokeswoman for the multi-agency incident command. 'This fire is very dynamic.'"
Van Gogh Prints In 3D: Almost the Real Thing For $34,000
By timothy from Slashdot's I'll-take-the-poster-and-the-change department:
dryriver writes "The Van Gogh museum in Amsterdam has developed high-quality 3D reproductions of some of its finest paintings, with what it describes as the most advanced copying technique ever seen. Axel Rüger, the museum's director, said: "It really is the next generation of reproductions because they go into the third dimension. If you're a layman, they are pretty indistinguishable [from the originals]. Of course, if you're a connoisseur and you look more closely, you can see the difference. Each reproduction is priced £22,000 – somewhat more than the cost of a postcard or poster. But the museum is hoping to increase access to pictures which, if they were sold, would go for tens of millions of pounds to Russian oligarchs or American billionaires. The replicas, called Relievos, are being created by the museum in partnership with Fujifilm, with which it has had an exclusive deal for three years. Such is the complexity of the technology, known as Reliefography, that it has taken more than seven years to develop and only three a day can be made. It combines a 3D scan of the painting with a high-resolution print. The "super-accurate" reproduction even extends to the frame and the back of the painting. Every Relievo is numbered and approved by a museum curator. There is a limited edition of 260 copies per painting."
Teens Actually Care About Online Privacy
By timothy from Slashdot's contrary-to-popular-belief department:
CowboyRobot writes "According to a new report by Pew Research Center's Internet & American Life Project, more than half of American teenagers have steered clear of a mobile app due to worries about privacy. Some 56 percent of younger teens (ages 12 to 14) who use mobile apps avoid some apps after learning they had to share personal information to use it, while 49 percent of older teens (14 to 17) have. Also, teens who had at some point sought outside advice about privacy management were considerably more likely than those who had not sought advice to say that they had disabled location tracking features."
Ask Slashdot: 4G Networking Advice For Large Outdoor Festival?
By timothy from Slashdot's ok-are-there-any-starbucks-locations-nearby department:
New submitter xanadu113 writes "I help out with a large outdoor festival each year (Seattle Hempfest), and we use 4G hotspots on-site for our internet needs. Due to being at the bottom of the hill (in Myrtle Edwards park in downtown Seattle, WA right on the sound), we have problems with loss of signal, bandwidth switching (going between 4G/3G/2G, etc.). As wireless internet is our only option on site, we need to do something about improving the signals. What would be the best way to do a site survey of the 4G signals to select the best locations for hotspots, as well as the best carrier to use? We need potentially up to 10 devices per hotspot, and up to 10 hotspots or so. Also, would putting up a 4G repeater be a good option to solve this problem?"
How Engineers and Scientists Cluster In the U.S.
By timothy from Slashdot's you-forgot-seattle department:
First time accepted submitter DERoss writes "The National Science Foundation has published a research paper titled Regional Concentrations of Scientists and Engineers In the United States. The lead paragraph contains the sentence 'The three most populous states — California, Texas, and New York — together accounted for more than one-fourth of all S&E employment in the United States.' According to the 2010 census, however, those three states also contain more than one-fourth (26.5%) percent of the U.S. population. In other words, there is no concentration beyond how the general population is concentrated." The clustering is studied with finer granularity than the per-state level, though, and the paper names several places (like the Santa Clara area, and Houston) where such jobs are particularly prevalent.
How To Monitor Leaky Radioactive Water Tanks
By timothy from Slashdot's for-fun-and-profit department:
freaklabs writes "The radioactive water leaks are getting worse at Fukushima Dai-Ichi. In a recent New York Times article, it was mentioned that TEPCO didn't have a reliable way to monitor the water storage tanks for leaks. I decided to write a tutorial on how to wirelessly monitor water levels in storage tanks."
Barnes & Noble Won't Give Up On the Nook
By timothy from Slashdot's there's-a-niche-for-the-nook department:
jfruh writes "Barnes & Noble's Nook e-reader line has largerly been regarded as a botched attempt to compete with the Kindle, whose failure has contributed to the bookseller's financial woes. Well, despite earlier statements that the company was abandoning it as a hardware platform, now the B&N CEO insists that the company is committed to the product line and the new Nooks are in development."
NASA Testing Frickin' Laser Communications
By timothy from Slashdot's beam-it-up-scotty department:
itwbennett writes "The lunar laser communications demonstration will be part of the agency's Lunar Atmosphere and Dust Environment Explorer (LADEE) mission, which is scheduled to launch on Sept. 6. Here's how the system will work: When the satellite is in orbit around the moon and visible from Earth, one of three ground stations will shoot a laser towards its approximate location. The laser beam from Earth will scan a patch of sky and should illuminate the spacecraft at some point. When that happens, the spacecraft will begin transmitting its own laser towards the ground station and the two will lock on to each other. The technology should allow an upstream data rate, from the Earth to the spacecraft, of around 20Mbps and a much faster downstream rate of 622Mbps. That's roughly six times the speed that's currently possible with radio-based transmission, said Don Cornwell, mission manager for the lunar laser communications demonstration."


text:
Q: Dart: inferring non-nullable type in generics I have two generic classes, and StreamProcessor needs to accept a nullable type as a generic parameter, while also maintaining a parametrized property which isn't nullable:
/// [T] must not be nullable (the data can not be null).
class DataProcessor<T extends Object> { /* ... */ }

/// [T] can be nullable if stream sends a checkpoint without any data attached.
class StreamProcessor<T extends Object?> {
  final DataProcessor<T> dataStream;
  //                  ^
  // Error: 'T' doesn't conform to the bound 'Object' of the type parameter 'T'.

  /// These events may be nullable or non-nullable, depending on the
  /// type of object passed to the constructor.
  final Stream<T> bareEventsStream;

  StreamProcessor(Stream<T> events) :
    dataStream = DataProcessor(events.where((e) => e != null)) { /* ... */ }
}

The compiler is rightfully unhappy about this situation (see the "Error" comment).  I can make it happier by restricting the StreamProcessor type argument to a non-nullable type (extends Object) and then declaring bareEventsStream as Stream<T?>.  But in that case, if the user of StreamProcessor uses a non-nullable type (e.g.: StreamProcessor<int>), the bareEventsStream will be a Stream<int?>, forcing them to use ! (null check operator) all over the code without a good reason, which seems backwards to sound null safety.
Is there a syntax which would, similarly to how T? infers a nullable type, infer a non-nullable type (when possible) from a generic parameter?
P.S. This is somewhat related to dart-lang/language#143 but I need "an opposite" of what's being discussed there.

redpajama_set_name: RedPajamaStackExchange


During last night's Heat-Bobcats game, Dwyane Wade was pissed at Ramon Sessions, so he kicked Sessions in the balls. No, seriously.
And the craziest part? SESSIONS GOT CALLED FOR THE FOUL.
Then Ramon Sessions fell down in a ball*.
Then Sessions, the man grabbing his junk, rolling around the floor, got called for the foul. Wow. How do you pull that off, Dwyane?


text:
Filling California's jobs gap
By Cindy L. Miles / Sunita Cooke August 2, 2019 Print
Nineteen-year-old Nick Soultanian has been building his own personal computers since the ninth grade, and was adept in code by his senior year of high school. He's currently preparing for his future career in San Diego's booming computer science industry, and couldn't be happier with his choice to pursue it through a community college education.
"The environment here is excellent, I feel like I'm able to talk to people, and I have yet to find a bad instructor," explains Soultanian, a student at MiraCosta College in Oceanside.
Soultanian, who didn't want the burden of student loans needed to put him through a four-year degree, is enrolled in courses through MiraCosta's computer science program, which offers detailed instruction in basic and advanced programming, problem-solving, data structures and computer architecture. Once he's earned his associate degree or certificate, no matter what path he chooses after, he'll likely join the hundreds of fellow graduates who have secured jobs from quality assurance analyst to software engineer.
Soultanian has joined what the National Skills Coalition calls the middle-skills workforce, people holding well-paying and high-demand jobs that require more than a high school diploma and less than a four-year degree. These comprise more than half of America's jobs, yet only about 40 percent of the country's workers are trained up to the middle-skill level.
A regional approach
California is not immune to this middle-skills job gap. In San Diego and Imperial counties, employers are struggling to find qualified machinists, laboratory technicians, computer network architects and other middle-skills workers.
Three years ago, the state invested in the California Strong Workforce Program and called on community colleges to use innovative regional approaches to revamp technical and vocational training to help close this employment gap. About $16.5 million was allocated to the 10 community colleges in San Diego and Imperial counties. The funding was divided into two pots: nearly $10 million went directly to the region's colleges to invest in their career education programs, and $6.5 million was allocated to supporting the regional priorities.
College leaders knew their best way to success was to work and think together as a region — not as individual colleges competing for students. Working together through the San Diego and Imperial Counties Community Colleges Association, the colleges stepped up their efforts by collecting regional market data, pulling together career education experts across the region, and revamping programs with an eye on collective impact.
College programs are aligning with the local economy so that students can get the education they need to succeed in high-demand careers that provide a sustainable wage. The colleges are also partnering with area high school districts, local businesses, and workforce and employer organizations, such as economic development councils and chambers of commerce, to better engage with employers and address the skills needed across the education-to-career pipeline.
Career awareness
One of the greatest obstacles to success is that many prospective students are unaware of these opportunities and how to access them. To this end, the colleges created a website, CareerEd.org, where prospective students can learn about all of the career education programs and jobs offered in the two-county area, and launched a joint marketing campaign to highlight career education and the impact it has on students' lives.
The intense collaboration between the colleges has meant major changes in how career education programs are planned, designed and delivered, but we are already seeing positive results. A recent report, "Leveraging Strong Workforce Funding to Build an Innovative Infrastructure," highlights what has worked so far and why. Our first key to success was ensuring that this was a unified effort among all 10 colleges: Cuyamaca College; Grossmont College; Imperial Valley College; MiraCosta College; Palomar College; San Diego City College; San Diego Continuing Education; San Diego Mesa College; San Diego Miramar College; and Southwestern College.
The colleges all shared the goal of promoting career education and the premise that community college can be a first-choice career ladder – not a fallback. We are redesigning the community college experience from a student-centric lens and listening to our students' calls for more help with preparing for and getting good jobs.
We also have expanded work-based learning options and job placement services at all our colleges to provide these critical links to learning and landing a good job. We are ensuring that our students have clear roadmaps or "guided pathways" to their certificates/degrees and ultimately to employment.
Reaching into schools
The state's investment is paying off by creating more value for students and employers. A more proactive approach on guiding students toward their education goals is helping all of our students earn a degree or certificate in a timely manner, especially low-income students who have not been well-served by traditional education systems.
We are working with employers in the region to design courses that prepare students for the local job market, and developing connections that result in hands-on work experience, internships and networking.
We are also working with high schools and middle schools in the region, visiting classrooms to talk about career education opportunities and bringing students to our campuses so they can envision the kinds of careers they could have. With our help, local high schools are updating their career education course offerings so that students can arrive on day one at a community college ready for more advanced coursework in their career path.
California's community colleges have a bold and broad mission to prepare students for both middle-skills jobs and university transfers. By working together, the 10 community colleges in San Diego and Imperial counties are uniquely prepared to ensure that our state's workforce remains one of our greatest assets for generations to come.
Soultanian can't say enough about his community college education as a career launchpad: "It's a great place to start, and the instruction is first-rate."
Cindy L. Miles / Sunita Cooke
Cindy L. Miles is chancellor of the Grossmont-Cuyamaca Community College District. Sunita Cooke is superintendent/president of the MiraCosta Community College District.


text:
Spacewalks shelved as Russian ISS module springs a significant leak
Astronauts and mission control on the ground are busy investigating a leak aboard the Russian Soyuz MS-22 spacecraft docked to the International Space Station, after a mysterious plume erupted from its exterior on Wednesday.
Russia to walk away from International Space Station after 2024
In a major upset, Roscosmos Chief Yury Borisov announced in a meeting with Russian President Vladimir Putin that Russia will formally withdraw from the International Space Station (ISS) after 2024, putting the future of the space lab in jeopardy.
ESA looks for new ride to Mars for its Rosalind Franklin rover
With the invasion of Ukraine severing its cooperations with Russia's Roscosmos, the European Space Agency (ESA) is now considering alternatives to get its ExoMars Rosalind Franklin rover to Mars without Russian support hardware.
Ukraine invasion could delay ExoMars rover mission by two years
The war in Ukraine is having an interplanetary impact. Deteriorating relations between Russia and Europe mean the joint ESA/Roscosmos ExoMars rover mission faces a launch delay that could set back its Red Planet landing by at least two years.
ISS air leak isolated to Russian module ahead of cargo launch
Flight controllers and station crew have isolated an air leak to the Russian-built Zvezda Service Module of the ISS, but have yet to pinpoint the breach ahead of the arrival of an uncrewed cargo spacecraft later this week.
Energia and Space Adventures plan first tourist space walk
RSC Energia and Space Adventures, Inc plan to fly two tourists to the Russian section of the International Space Station in 2023, with one of them embarking on a space walk with a cosmonaut during the short visit.
ExoMars mission launch delayed two years until 2022
Europe's ExoMars mission has suffered a setback and will not launch until 2022. The mission has been pushed back from its 2020 launch date due to the need for further component testing and the disruption caused by the COVID-19 outbreak.
Moon, Mars and beyond: Space exploration highlights coming up in 2020
Science stands still for no one, and with a new year comes a new calendar of exciting events in spaceflight and exploration. New Atlas rounds up some of the most important milestones to look forward to in 2020.
Alexey Leonov, the first spacewalker, passes away
Alexy Leonov, the world's first spacewalker, has died at age 85. He was the first person to leave a spacecraft in orbit on March 18, 1965.
Australian Outback to aid in search for life on Mars
Scientists from NASA, ESA, and Roscosmos went to Outback in Australia to learn more about how to find signs of fossil life on Mars.
ExoMars 2020 lander gets official moniker
The landing craft that will deliver Europe's first rover to the planet Mars has arrived for assembly and testing in Turin, Italy, and has been officially named. A key component of the ExoMars 2020 mission, the Roscosmos landing platform has been christened "Kazachok" (Cossack).
Simulated space journeys to help keep the peace on manned trips to Mars
The first manned, round-trip to Mars could involve up to three years of travel time, so researchers from Northwestern University will be monitoring the crew of two simulated flights to the Red Planet to learn how to help astronauts work and live together in the equivalent to one small room.


Palm Strings will be playing a collection of music from their repertoire that is sure to warm up your Friday night on the 25th of July 2014. End your week on the right note.
Their passion for music, the energy they exude and the pleasure they share provides entertainment that's the perfect accompaniment for your dinner at Dutchies.
From 6pm. Please book to avoid disappointment.


It was a rainy and an uber-cold day, but nothing was stopping us ex-219ers from going to the Noodle Night Market.
The place was full of Asian favorites and lots of food options ranging from Thai, Japanese, HK, Indian, Malaysian, and many more. It exuded an outdoorsy, no-frills hawker center vibe in the center of the city. Just good food and company, and you're all set.
With all the options available and the "noodle market" theme, you would think we went noodle-crazy. But nope, we headed to the Hoy Pinoy stall, filled ourselves up with chicken and pork barbeque, yum! The lechon (roast pig) sounded crispy from afar too, but we never got to try it.
More on the Melbourne Noodle Night Market here.


I recently wrote a guest article for GuitarCoachMag.com called Guitar Triads – Part 1. The link to the article is HERE. The topic is music theory / guitar theory and I take a look at how to build triads using Major 3rds and minor 3rds, and how triads are found on the guitar fretboard.
I plan to submit Part 2 within a month or so.


text:
Self Injury Support Ltd
Self-Injury Support from a Gendered Perspective
Get Support Donate
Direct support services
Self-help info and resources
Supporting someone who self-injures
UK Support Groups and Other Services
Recommending Resources
About self-injury
What is self-injury?
Bespoke Training Sessions
Consultancy and Reflective Practice
Give to an appeal
Stories & Blogs
Self-injury Insights
Stories of Change
Stories of Us
About Us - Our Vision, Our Mission, Our Values
"Self injury support is a fantastic and unique resource.
They always listen, even if you aren't able to talk about self-injury."
That anyone who uses self-injury knows they are not alone;
that everyone understands that self-injury is a complex and important issue we should all care about;
and that together we tackle both the causes and stigma of self-injury.
I couldn't have got through without the helpline, it means the world to me
to have someone listen and believe me….
We focus on improving support and knowledge around self-injury
How We Do This
offering safe spaces where we listen and never judge, and demonstrating the impact of this support;
creating experience-led tools and information on topics clients tell us they want to know about;
promoting better models of support through training health and social care workers of the future;
working with researchers and policy makers to make sure what people tell us they want is put into practice
What We Do To Make This Happen
We run a UK-wide multi-channel support service for women & girls affected by self-injury, trauma and abuse
We develop up-to-date, reliable and free information and self help tools for anyone to use
We run training and consultancy to share knowledge and expertise with a wide range of staff, especially in health, social care and education
We partner with other organisations and researchers to find out directly from those with lived experience of self-injury find helpful in their lives
"It enabled me to move on at a time
when nothing else felt safe enough to allow me to do this."
These are the values that ensure we never lose sight of what we are trying to achieve:
Providing non-judgemental support
Self-injury is often experienced alongside feelings of shame or self-blame. Responses from others who do not understand self–injury can reinforce these feelings. We aim to offer and model acceptance which increases chance of people feeling more accepting towards themselves.
Offering a positive experience of reaching out for help
Some people contacting us may not have reached out for help in relation to self-injury before or may have had negative responses when looking for support. The issue is highly stigmatised and a person's first experience of disclosing is very significant in how they subsequently seek support.
Respecting an individual's relationship with self-injury and to avoid being prescriptive in our support
We recognise the role and function that self-injury can play in people's lives at different times. We aim to foster feelings of autonomy and empowerment in the people we support. Our aim is to give people access to clear and objective information designed to help them make the right choices for them at different times in their lives. We do not tell people to stop using self-injury, as this is not our choice to make.
Published: 2nd August, 2016
Updated: 5th February, 2019
The awful truth is that attitudes like these show we still aren't taking young people's mental health seriously
After 30 years supporting people who use self-harm we still find that these are some of the most enduring myths, and it is both saddening and frustrating to see them being parroted in a national newspaper by a medical professional who should know better.
Bristol Women's Groups Celebrate Decades of Grassroots Activism with Cake, Improv Theatre and Speed Dating
Self injury Support and Bristol Women's Voice hosted a city-wide celebration of women's grassroots health activism on 25th April in Bristol.
Self injury Support discusses the impact of social media on Woman's Hour 8/2/19
Listen to our Director, Naomi Salisbury and Jane Garvey, BBC Radio 4 Woman's Hour presenter, discuss the decision by instagram to ban images of self harm.
Want to recommend a resource?
If you have a resource you would like displayed on our website please send us the information here.
Please click here for details of how to access our support services.
Understand more about self-harm and self-injury
Find out some of the reasons behind self-harm and self-injury
Comprehensive listing of local and national self-harm and self-injury support groups and organisations
Rainbow Journal - Personal Self-Help Diary
Helpful responses to self-injury
Short and long term helpful responses to self-injury
Learn about the factors that increase the risk of self-harm and self-injury
Read more about our vision that anyone who uses self-injury knows they are not alone; that everyone understands that self-injury is a complex and important issue we should all care about and that together we tackle both the causes and stigma of self-injury.
Distractions and alternatives
Launch of Self-Harm Prevention App distrACT
Self injury Support was involved in the development of the distrACT a self-harm prevention app launched in Bristol in November 2017.
Please select all the ways you would like to hear from Self injury Support:
Self injury Support
BS2 2EF
Office/Admin Number:
Our support services


text:
Q: Is using $rootScope.$broadcast() still good practice? There are quite some advantages I see in flexibility and code reduction (you do not have to bind values across many layers of components) in using events but it could also complicate debugging.
My question
Is using $rootScope.$broadcast() in AngularJS 1.6 still a good practice to react on changes in models for example?

A: In angluar framework itself, there are only few events. So you can get an idea about why not to depend heavily on events, there is definitely other and better ways to do it.
You may face problems like
An event based approach can get really messy to track, maintain and debug. It makes it very asynchronous, with no real easy way to track the flow of an application.
It would be much difficult to work in team environment following broadcast approach. And your code may/can error prone most of the times.
Moreover, there are very few cases when you need to Dispatches an event name downwards to all child scopes and if there is, you must know that
when you add an event listener on the $scope of a controller, when the controller is destroy (you navigate away from the page, or close a section), the listeners also get destroyed. When you add it to the $rootScope, when you navigate away from a controller, the listener remains and keeps triggering. So you have to manually deregister it, or be safe and just not add it on $rootScope.

A: I can't say for all angular developers, but I will try to use my own experience.
Using $broadcast and especially $rootScope.$broadcast can have several negative side effects.

*

*Performance. $rootScope broadcast will run through each component. It will rise and re-rise $digest that can cause freezes if you have to much $watchers.

*Readability. Events break readability of your code.

*Debug. Event driven model is a bit harder to maintain and debug. You should know your solution very well to find subscribers and debug them.
And angular gives you way to avoid this.
If you need to react on child node (scope, controller, etc) you can pass your model and use $onChanges method on controller

$onChanges?(changesObj: {[property:string]: IChangesObject}): void;

If you need to react on parent node, pass method to child and invoke it when something changes.
There is only one reason when you may use $broadcast - when you need to react on sibling node. Than it is much easier to broadcast event than make a chain with update -> update -> update.
Using $broadcast is a bit easier solution at the start but than it will hit your development performance. So it is just a meter of the price you are ready to pay and your current needs.
Hope this helps.


text:
The US ban: Why these seven countries?
The circular issued by the US Department of Homeland Security (DHS) could not be clearer.
"For the next 90 days, nearly all travelers, except US citizens, traveling from Iraq. Syria, Sudan, Iran, Somalia, Libya and Yemen will be temporarily suspended from entry to the United States."
But why this mixed bag of countries?
The Trump administration points out that all were previously on a list of "countries of concern." This is true.
Trump's travel ban: Companies and executives speak out
The DHS compiled the list last year, following the passage of the Visa Waiver Program Improvement and Terrorist Travel Prevention Act.
On January 21, 2016, Iran, Iraq, Sudan and Syria were the first countries put on the list. The following month, the DHS added Libya, Somalia and Yemen after consulting the director of national intelligence and the State Department.
But — and it's a substantial "but" — those new restrictions were not aimed at citizens of these countries. They were aimed at those eligible for the Visa Waiver Program (VWP): people of dual nationality or — for example — someone of French or Belgian nationality who'd been to Yemen or Iraq. Those restrictions did not amount to a ban on entry but demanded much more information from applicants.
The main reason, according to the US Customs and Border Patrol, was "the risks posed by the situation in Syria and Iraq, where instability has attracted thousands of foreign fighters, including many from VWP countries. Such individuals could travel to the United States." (The US maintains a Visa Waiver Program with 38 countries.)
By contrast, President Trump's executive order is specifically aimed at nationals of the seven countries, not those who have traveled to those states, and it is an outright ban.
Trump ban is boon for ISIS recruitment, former jihadists and experts say
The executive order does not explain why these countries have been selected and others not, except to say that "deteriorating conditions in certain countries due to war, strife, disaster, and civil unrest increase the likelihood that terrorists will use any means possible to enter the United States."
The conditions in these countries offer at least some reasons for their inclusion, if not a complete picture.
Syria and Iraq
There are still thousands of foreign fighters in Iraq and Syria. ISIS has a substantial presence in both countries and is pledged to take its fight to western Europe and the United States, especially as its core territory shrinks.
Airports becoming legal war rooms after Trump's immigration order
In most instances, ISIS has used its pool of foreign fighters — especially Belgian and French citizens — to plan and carry out its overseas attacks, or sought to encourage others already living in the West to launch terror attacks. However, in October, a Syrian refugee allegedly with links to ISIS was arrested in Germany after explosives were found in his apartment. Two other Syrians turned him in to authorities.
Another Syrian who had applied for asylum in Germany blew himself up in July in an attack in Ansbach.
Al Qaeda is strong in Syria and Yemen and has repeatedly demonstrated its intent to launch attacks on the West. But not — so far — by trying to send Syrians or Yemenis abroad. The brothers who attacked the Charlie Hebdo offices were French but had spent time with al Qaeda in the Arabian Peninsula (AQAP).
Other AQAP conspiracies have focused on trying to smuggle bombs on board civilian aircraft bound for the US.
AQAP is explicit in making the US its number one target — but largely by encouraging lone-wolf attacks. And it's not, by any means, exclusively a Yemeni organization. The group's master bomb-maker is a Saudi, Ibrahim al Asiri, and AQAP's "underwear bomber" in 2009 was a Nigerian.
Both ISIS and al Qaeda are "trans-national" in nature, with members from dozens of countries.
Somalia has endured nearly three decades of civil war and terrorism. Al Shabaab, an al Qaeda affiliate, regularly launches suicide attacks in the capital, Mogadishu, and across the country, as well as in neighboring Kenya. An unknown number of Americans of Somali descent — probably in the dozens — have joined the group; many have been killed in Somalia. But much as Shabaab would like to launch an attack in the West, there is no evidence that it has tried to.
Libya has become a base for ISIS in the last two years, but the group has lost its urban footholds in Derna and Sirte and retreated to the desert. In any case, many of its more important figures are not Libyan but Tunisian. There are also plenty of Tunisians in ISIS ranks in Syria and Iraq, and the Berlin Christmas market attacker was Tunisian, but it's not one of the countries covered in the new executive order.
Sudan was a base for al Qaeda in the 1990s, when Osama bin Laden lived there, and has been designated a state sponsor of terrorism by the US for more than 20 years. But nowadays the Sudanese regime, while still embracing conservative Sunni Islam, tries to combat jihadist groups. President Obama recognized the change last year; he lifted some sanctions because of Sudan's "cooperation with the United States on addressing regional conflicts and the threat of terrorism."
Unlike the other six, Iran is a predominantly Shia Muslim country that's been involved in fighting ISIS in both Syria and Iraq. But the US says it remains the leading state sponsor of terrorism through its "support for (the Lebanese militia) Hezbollah, Palestinian terrorist groups in Gaza, and various groups in Iraq and throughout the Middle East."
In only one instance have elements from Iran been allegedly involved in a plot in the US. In 2011, an Iranian-American who had lived in the US for decades hatched a plan to assassinate the Saudi Ambassador in Washington. Then US Attorney General Eric Holder said the plot had been endorsed by parts of the Iranian government, but Iran denied any involvement.
What about other countries?
In 2014, more than 55 percent of terror attacks worldwide occurred in five countries, according to the State Department. Only one of those countries — Iraq — is covered in the executive order. The other four — India, Pakistan, Afghanistan and Nigeria — are not.
Nor are other countries — such as Morocco, Tunisia and Saudi Arabia — thousands of whose citizens are active in jihadist groups around the world. The executive order mentions the failure to properly scrutinize visa applications of the 9/11 hijackers, but most of them were Saudis.
In its comprehensive review of terror cases in the US since 9/11, the New America Foundation notes that "every jihadist who conducted a lethal attack inside the United States since 9/11 was (an American) citizen or legal resident."
Some have had no confirmed links with terror groups; others have associated themselves with ISIS. Some appear to have been driven primarily by personal issues.
Some have had training overseas — such as Najibullah Zazi — others have not.
There have been a handful of non-lethal attacks in the US by migrants, including two last year by men of Somali origin. One of them had come to the US from Pakistan; the other had been born in Kenya. There was no evidence of any link to terror groups in either case.
Shutting down any terror "pipeline" in an age of transnational jihad and online radicalization has to be driven by sophisticated intelligence networks. The record of terror conspiracies and attacks suggests that a blanket ban on travel or immigration from any one country is — at best – a blunt instrument.
As al Qaeda ideologue Anwar al-Awlaki put it in 2010, "Jihad is becoming as American as apple pie and as British as afternoon tea."
Filed in: News, Politics
Topics: countries, Donald Trump, US Travel Ban
President Trump on strike that killed Soleimani: 'We did not take action to start a war'
President Trump says 'Iran appears to be standing down' following its retaliatory attacks against Iraqi bases housing US troops
US citizens urged to depart Iraq after airstrike kills Iranian commander
US troops were injured in Iran missile attack despite Pentagon initially saying there were no casualties
Several U.S. troops were injured in Iran missile attack despite Pentagon initially saying there were no casualties
The monumental scope of the U.S. strike that killed top Iranian general
Iran attacks two Iraqi bases housing US forces in revenge for Soleimani's death
US sending additional forces to protect embassy threatened by protesters in Iraq
Crisis in Middle East tests potency of Sanders' criticism of Biden's Iraq vote
President Trump orders killing of key Iranian commander in Baghdad airport strike
U.S.-Iran tensions remain despite de-escalation
Chevron pulls oil workers from Iraq
Vice-President Pence makes unannounced visit to troops


Yesterday the Department of Health announced a new rating for GP surgeries – marks out of 10 for 'patient experience'. The rating is designed to enable people to make comparisons between surgeries when deciding which surgery to register with. A score of 10 is high and it is based on information given in the patient's survey, a questionnaire given to a random selection of people visiting their GP after their consultation. You can see the ratings on the NHS Choices website.
A key new factor included in the rating is 'whether doctors and nurses are good at explaining things and listening to people' – part of the job description of a health professional, you might think, and certainly this factor is welcomed by the Patient's Association who say they hear increasingly from people who are not listened to effectively. However, this seemingly straightforward aspect of a consultation being rated has raised some strong feelings among healthcare staff. A comment from a practice manager in the health professional online magazine 'Pulse' yesterday was that maybe patients should be rated on their ability to listen as many problems arose because of people 'failing to remember the basic information they have been told'. This comment drew a number of 'well said's from other contributors, among them a GP who felt that 'It's about time patients' responsibilities were highlighted as well as doctor's'.
It sounds from all this, as though both patients and doctors feel frustrated – patients because they don't get enough time to take in information properly, and doctors and other health professionals because their attempts to give the best care are hijacked by government pressure and targets, for example having to deal with a number of medical issues in only a 10 minute consultation. When stressed like this, it's not surprising that both parties are tempted to blame the other.
But could there be another suspect entirely that is to blame for the mismatch between expectations and reality? namely the system in which care is delivered. For example, we have often heard from health professionals who have been given extended consultation time alongside undertaking a course, to help people manage their diabetes more effectively ('Insulin for Life': Chaplin, Widdowson and Reeve, 2012). They report that they found the benefits of conversing with people in a more relaxed way about their lives, challenges and hopes and dreams was incredibly useful, not to mention satisfying. Even more importantly, this approach improved outcomes for both patient and health professional.
This would seem to suggest that, in long term conditions at least, that systems need to change to accommodate the needs. In the above example, many GP surgeries also began dedicated clinics for diabetes as a result of their experiences, and have found it a really effective way of meeting the needs of people with diabetes. This suggests that there needs to be a practical and meaningful stimulus to make change happen.
By coincidence, an editorial in recent edition of Diabetic Medicine (Cradock and Cranston, 2012), addresses just this point. The authors suggest that much more 'emotional mastery' - support for people with diabetes to deal with the stress caused by taking care of their diabetes - is needed alongside 'insulin mastery' (dealing with the practical aspects). This suggestion is based on research showing that at least some diabetes-related stress may actually come from the diabetes consultation itself. This is because traditionally, the consultation places medically-based expectations on the person with diabetes, causing feelings of anxiety and guilt and thus contributing to raised HbA1c levels. Creating a system of care which places much less emphasis on insulin and much more on reducing the emotional effects of diabetes may well be an important factor in reducing HbA1c – the 'holy grail' of most current diabetes services.
Perhaps the findings of such a model could be shared with health services as a whole and adapted so that both health professionals and people using their services can feel less pressured, less blamed and become more healthy as a result? After all, as Einstein himself said: 'doing the same experiment over and over, and expecting different outcomes… is the definition of insanity'. Perhaps given its benefits, healthcare professionals may not be so defensive about changing the experiment to include more listening?


Just come to the landing page to instant booking with the saving of up to 70%. Agoda provides the comfortable, best price, marvelous rental stays in the Trat Province, Thailand.
Come to the landing page to instant booking. Reserve today the best price rooms in Rayong Province Hotels with better savings of up to 80%.
Enjoy Flat 10% Discount on rental rooms in Hostal Marenostrum, Spain. Limited time deal for all the customers. Come to the landing page now and book easily.
Spend your good time in Koh Yao Nai and enjoy your holiday. Book now rooms in Koh Yao Noi, Thailand and save up to 50%. Come to the Agoda landing page!
Book today an ideal rental stays in Naithon hotels online with the saving of up to 60%.
Go to the curated page section to reserve online the excessive rental stays in Kathu with the mindblowing discount of up to 60%.
Grab up to 75% discount on Bang Thao Hotels when you book through the landing page of Agoda.
Visit the landing page now and reserve Karon hotels with up to 70% discount. Check out the huge range quickly.
Visit the curated page and choose Capsule Hotels in Malaysia and save up to 60%. Come to Agoda and choose from the hundreds of rental properties. Don't Miss The Deal!
The wide new range of Malaysia's Loving Hotel's stays are ready to book with the perfect discount of up to 50%.
Reserve right now the best rental rooms in Yilan, Taiwan with the saving of up to 80%. Fix your travel date right now!
With the mindblowing saving of up to 60%, book now Hualien Hotels at more amazing amenities.
Reserve online the satisfactory and best amenities included Nantou hotels with the amazing saving of up to 70%. Jump to the landing page right now!
Chiayi hotel's rooms are available to book with the saving of up to 60%. Never miss the deal to get the heavy discount.
Enjoy your holiday in Venice, and book a room in Dona Palace Hotel to with more comfort. Book now and grab up to 15% discount. Visit the landing page right now!
Reserve today the quality passed rental rooms in Austria hotels and enjoy an amazing saving of up to 65%.
Never miss out to grab the superb saving of up to 75% on fantastic Hotels In Canada. Don't miss the deal.


VIGYAN GURUKUL CLASSES Provides BBA Tuition , Class XI-XII Tuition (PUC) , Class IX-X Tuition to all Students.
VIGYAN GURUKUL CLASSES conducts classes in BBA Tuition, Class 10 Tuition and Class 11 Tuition. It is located in Nehru Nagar, Ghaziabad. It takes Regular Classes- at the Institute.


Ralph S. JANVEY, In His Capacity as Court Appointed Receiver for the Stanford International Bank Limited, et al; Official Stanford Investors Committee, Plaintiffs–Appellants, v. The GOLF CHANNEL, Incorporated; Golf Channel, L.L.C., doing business as Golf Channel, Defendants–Appellees.
Before REAVLEY, ELROD, and SOUTHWICK, Circuit Judges. Kevin M. Sadler, Baker Botts, L.L.P., Palo Alto, CA, Stephanie Frederique Cagniart, Attorney, Scott Daniel Powers, Baker Botts, L.L .P., Austin, TX, Timothy Stuart Durst, Esq., Baker Botts, L.L.P., Douglas J. Buncher, Nicholas A. Foley, Esq., Neligan Foley, L.L.P., Dallas, TX, Edward C. Snyder, Castillo Snyder, P.C., Edward Frazer Valdespino, Strasburger PriceOppenheimer Blend, San Antonio, TX, for Plaintiffs–Appellants. Theodore W. Daniel, Esq., Kyle Morris Schindler, Norton Rose Fulbright U.S. LLP, Dallas, TX, for Defendants–Appellees.
This case requires us to interpret and apply the Texas Uniform Fraudulent Transfer Act (TUFTA) to determine whether the court-appointed receiver of a failed Ponzi scheme can recover nearly six million dollars that the scheme spent advertising on a major cable network. Because Golf Channel failed to proffer any evidence showing that its advertising services provided reasonably equivalent value from the standpoint of Stanford's creditors, and we have previously held that services furthering a debtor's Ponzi scheme provide no value to the debtor's creditors, we REVERSE the district court's judgment and RENDER judgment in favor of the receiver.
The facts are undisputed. For nearly two decades, Stanford International Bank, Limited (Stanford) operated a multi-billion dollar Ponzi scheme1 through more than 130 affiliated entities.2 To sustain the scheme, Stanford promised investors exceptionally high rates of return on certificates of deposit (CD), and sold these investments through advisors employed at the affiliated entities. Some early investors received the promised returns, but, as was later discovered, these returns were merely other investors' principal. Before collapsing, Stanford had raised over $7 billion selling these fraudulent CDs.
Beginning in 2005, Stanford developed a plan to increase awareness of its brand among sports audiences. It targeted this group because of its large proportion of high-net-worth individuals, the people most likely to invest with Stanford. Stanford became a title sponsor of the Stanford St. Jude's Championship, an annual PGA Tour event held in Memphis, Tennessee. Upon hearing of Stanford's sponsorship, The Golf Channel, Inc., which broadcasted the tournament, offered Stanford an advertising package to augment its marketing efforts. In October 2006, Stanford entered into a two-year agreement with Golf Channel for a range of marketing services including but not limited to: commercial airtime (682 commercials per year); live coverage of the Stanford St. Jude's Championship with interspersed messaging regarding Stanford's charitable contributions, products, and brand; display of the Stanford Logo throughout the event; promotion of Stanford as the sponsor of tournament-update segments that included video highlights every half-hour; and identification of Stanford as a sponsor of Golf Channel's coverage of the U.S. Open (one of the four major annual golf tournaments in the world). Golf Channel did not design Stanford's media strategy or develop the content of the advertisements. However, the agreement required Golf Channel's final approval. Stanford satisfied most of its monthly payment obligations to Golf Channel and, before the agreement expired, entered into a four-year renewal. By the time this lawsuit was initiated, Stanford had paid at least $5.9 million to Golf Channel pursuant to the agreement.
In February 2009, the SEC uncovered Stanford's Ponzi scheme and filed a lawsuit in the Northern District of Texas against Stanford and related entities requesting the district court to appoint a receiver over Stanford. The district court assumed exclusive jurisdiction, seized Stanford's assets, and appointed Ralph S. Janvey to serve as receiver. Pursuant to his powers, the receiver took custody of any and all assets owned by or traceable to the receivership estate, which included recovering any voidable transfers made by Stanford before going into receivership.
We review a grant of summary judgment de novo, "applying the same standard on appeal that is applied by the district court." Tiblier v. Dlabal, 743 F.3d 1004, 1007 (5th Cir.2014) (internal quotation marks omitted). Summary judgment is proper "if the movant shows that there is no genuine dispute as to any material fact and the movant is entitled to judgment as a matter of law." Fed.R.Civ.P. 56. Because both parties filed motions for summary judgment, we evaluate each party's motion independently and view the evidence in the light most favorable to the nonmoving party. Ford Motor Co. v. Texas Dep't of Transp., 264 F.3d 493, 498 (5th Cir.2001).
Fraudulent transfer laws like TUFTA3 were enacted to protect creditors against depletion of the debtor's estate. SEC v. Res. Dev. Int'l, LLC, 487 F.3d 295, 301 (5th Cir.2007). To that end, TUFTA allows creditors to void fraudulent transfers made by a debtor and force the transferee to return the transfer to the debtor's estate. Tex. Bus. & Com.Code § 24.008. A transfer is fraudulent if made "with actual intent to hinder, delay, or defraud any creditor of the debtor." Id. § 24.005(a)(1). "In this circuit, proving that [a debtor/transferor] operated as a Ponzi scheme establishes the fraudulent intent behind the transfers it made." Janvey v. Brown, 767 F.3d 430, 439 (5th Cir.2014) (quoting Janvey v. Alguire, 647 F.3d 585, 598 (5th Cir.2011)); accord Warfield v. Byron, 436 F.3d 551, 558 (5th Cir.2006) (citing Scholes v. Lehmann, 56 F.3d 750, 757 (7th Cir.1995)).
However, TUFTA provides an affirmative defense that transferees may use to prevent creditors from voiding transfers. Even where a transfer is fraudulent under TUFTA, a creditor cannot void the transfer if the transferee proves two elements: (1) that it took the transfer in good faith; and (2) that, in return for the transfer, it gave the debtor something of "reasonably equivalent value." Bus. & Com. § 24.009(a).
Given the undisputed fact that Stanford was engaged in a Ponzi scheme, the parties stipulated that the $5.9 million dollar transfer to Golf Channel was fraudulent. See Brown, 767 F.3d at 439. In addition, the district court held, and the receiver did not challenge on appeal, that Golf Channel took the transfer in good faith. Therefore, at issue here is whether Golf Channel has proven the second element of its affirmative defense-that its advertising services provided "reasonably equivalent value" as defined under TUFTA.
"Value" is defined in TUFTA as "property [ ]transferred or an antecedent debt [ ]secured or satisfied, but value does not include an unperformed promise made otherwise than in the ordinary course of the promisor's business to furnish support to the debtor or another person." Tex. Bus. & Com.Code § 24.004(a). We must make an "Erie guess" as to how Texas would interpret this definition of "value" in TUFTA. See Warfield, 436 F.3d at 558 (citing Mayo v. Hartford Life Ins. Co., 354 F.3d 400, 406 (5th Cir.2004)). TUFTA itself instructs us to apply and construe its provisions so as "to effectuate [UFTA's] general purpose to make uniform the law with respect to the subject of [UFTA] among states enacting it." Tex. Bus. & Com.Code § 24.012. To that end, we may consider the comments to UFTA, authorities interpreting other states' UFTA provisions, and interpretations of section 548 of the Bankruptcy Code (upon which UFTA's definition of value is based). Nathan v. Whittington, 408 S.W.3d 870, 873–74 (Tex.2013); First Nat. Bank of Seminole v. Hooper, 104 S.W.3d 83, 86 (Tex.2003); In re Hinsley, 201 F.3d 638, 643 (5th Cir.2000); see also Bowman v. El Paso CGP Co., L.L.C., 431 S.W.3d 781, 786 n. 6 (Tex.App.-Houston [14th Dist.] 2014, pet. filed) (explaining the persuasiveness of these sources).
[A]dapted from § 548(d)(2)(A) of the Bankruptcy Code․ The definition [ ]is not exclusive [and] is to be determined in light of the purpose of the Act to protect a debtor's estate from being depleted to the prejudice of the debtor's unsecured creditors. Consideration having no utility from a creditor's viewpoint does not satisfy the statutory definition.
Unif. Fraudulent Transfer Act § 3 cmt. 2 (emphasis added). UFTA offers only one specific example of an exchanged benefit that fails the value test-love and affection. See id. (citing United States v. West, 299 F.Supp. 661, 666 (D.Del.1969)). Therefore, courts are left to define the contours of "value" and "[t]he primary consideration ․ is the degree to which the transferor's net worth is preserved." Warfield, 436 F.3d at 558 (citing Butler Aviation Int'l, Inc. v. Whyte (Matter of Fairchild Aircraft Corp.), 6 F.3d 1119, 1127 (5th Cir.1993)).5 Importantly, we measure value "from the standpoint of the creditors," not from that of a buyer in the marketplace. Stanley v. U.S. Bank Nat'l Assoc. (In re TransTexas Gas Corp.), 597 F.3d 298, 306 (5th Cir.2010) (citing In re Hinsley, 201 F.3d 638, 644 (5th Cir.2000)).
In Warfield, we held that commissions paid to a broker in exchange for securing new investments into a Ponzi scheme are voidable, even assuming the broker was unaware of the fraud. 436 F.3d at 560. Because the debtor's business was inherently illegitimate (a Ponzi scheme), the broker's services, which furthered the scheme, had no value as a matter of law.6 Id. It made no difference whether those same broker services would have been valuable to legitimate businesses in the marketplace.
On summary judgment in the instant case, Golf Channel put forward no evidence that its services preserved the value of Stanford's estate or had any utility from the creditors' perspective.7 Golf Channel only brought forth evidence showing the market value of its services. This was insufficient to satisfy its burden under TUFTA of proving value to the creditors. See Unif. Fraudulent Transfer Act § 8 cmt. 1 ("The person who invokes this defense carries the burden of establishing good faith and the reasonable equivalence of the consideration exchanged.").
Moreover, Golf Channel's services did not, as a matter of law, provide any value to Stanford's creditors. Just like the broker's (unknowing) efforts to extend the Ponzi scheme in Warfield, Golf Channel's (unknowing) efforts to extend Stanford's scheme had no value to the creditors. While Golf Channel's services may have been quite valuable to the creditors of a legitimate business, they have no value to the creditors of a Ponzi scheme.8 Ponzi schemes by definition create greater liabilities than assets with each subsequent transaction. Each new investment in the Stanford Ponzi scheme decreased the value of the estate by creating a new liability that the insolvent business could never legitimately repay. See Brown, 767 F.3d at 439 (describing the insolvency of Stanford's Ponzi scheme); Janvey v. Democratic Senatorial Campaign Comm., Inc., 712 F.3d 185, 196 (5th Cir.2013) ( "[A] Ponzi scheme is, as a matter of law, insolvent from its inception." (internal quotation marks omitted)); see also Hirsch v. Arthur Andersen & Co. ., 72 F.3d 1085, 1088 n. 3 (2d Cir.1995) ("The effect of such a scheme is to put the corporation farther and farther into debt․"). Services rendered to encourage investment in such a scheme do not provide value to the creditors.
Golf Channel argues that its advertising services did not further the Stanford Ponzi scheme and that the $5.9 million reasonably represents the market value of those services. It tries to distinguish its services from the broker services in Warfield on the ground that a broker directly secures new investment in to a Ponzi scheme, whereas an advertiser is an innocent "trade creditor" generally promoting a business's brand. This distinction has no significance under TUFTA. TUFTA makes no distinction between different types of services or different types of transferees, but requires us to look at the value of any services from the creditors' perspective. We have no authority to create an exception for "trade creditors." See Truong v. Bank of Am., N.A., 717 F.3d 377, 387 (5th Cir.2013) (refusing to recognize a statutory exception on the basis of policy concerns or the wisdom of the legislature in adopting a Louisiana statute).
We note that our conclusion here does not rest upon a conclusion that the advertising services themselves lacked value in the abstract. In granting Golf Channel's motion for summary judgment, the district court compared Golf Channel's services to consumables and speculative investments which have been held to have value under UFTA. The district court stated that "[i]t seems wrong ․ to hold that every transaction in which a debtor acquires consumables is a fraudulent transfer." We agree. As the district court explained, we have held that a debtor purchasing jet fuel to keep an affiliated airline in business is an exchange for reasonably equivalent value even though the value to the debtor is merely the potential proceeds of a possible sale of that affiliated airline.9 Matter of Fairchild, 6 F.3d at 1123–27 (interpreting "value" in section 548 of the Bankruptcy Code). In fact, the investment in Fairchild was ultimately unsuccessful, yet, when measured at the time of the investment, we held that the increased possibility of selling the business had value. Id. at 1126–27. We explicitly rejected a definition of value that would exclude speculative or potential gains. Id. Here, however, the advertising services did not provide even a speculative economic benefit to Stanford's creditors.
Accordingly, we REVERSE the district court's judgment and RENDER judgment in favor of the receiver.
1. " 'A 'Ponzi scheme' typically describes a pyramid scheme where earlier investors are paid from the investments of more recent investors, rather than from any underlying business concern, until the scheme ceases to attract new investors and the pyramid collapses .' " Janvey v. Democratic Senatorial Campaign Comm., Inc., 712 F.3d 185, 188 n. 1 (5th Cir.2013) (quoting Eberhard v. Marcu, 530 F.3d 122, 132 n. 7 (2d Cir.2008).
2. Stanford marketed itself as the "Stanford Financial Group" and sometimes entered into contracts through an affiliate, the Stanford Foundation. Given the large number of affiliated entities, for simplicity, we use "Stanford" throughout this opinion to refer to the whole enterprise.
3. TUFTA, rather than another state's codification of the Uniform Fraudulent Transfer Act (UFTA), governs this dispute. See Tex. Bus. & Com.Code §§ 24.001–24.013. Before the district court, the parties argued whether Texas's or Florida's version of UFTA applied, but conceded before our court that it is a nonissue given that Texas and Florida have enacted nearly identical UFTA provisions. See Stewart v. United States, 512 F.2d 269, 272 n. 10 (5th Cir.1975) ("[N]o choice of law problem [is] present" where two states' laws "are essentially identical."). In such a scenario, the forum state's substantive law should apply. See Schneider Nat'l Transp. v. Ford Motor Co., 280 F.3d 532, 536 (5th Cir.2002).
4. If there is some value, we review for clear error whether the value exchanged is reasonably equivalent to the value of the transfer. Matter of Dunham, 110 F.3d 286, 289 (5th Cir.1997) (abrogating Butler Aviation Int'l, Inc. v. Whyte (Matter of Fairchild Aircraft Corp.), 6 F.3d 1119, 1125 (5th Cir.1993)).
6. This conclusion is consistent with our circuit precedent and other circuits that have considered the meaning of "value" in UFTA and section 548 of the Bankruptcy Code in the context of a debtor engaged in a Ponzi scheme. See Brown, 767 F.3d at 441 (holding that because a contract promising returns on investment in a Ponzi scheme is void, payment of such returns does not reduce an antecedent contractual debt or compensate an investor for the time value of his money); Donell v. Kowell, 533 F.3d 762, 777–78 (9th Cir.2008) (reasoning that interest payments to an investor in a Ponzi scheme "are merely used to keep the fraud going by giving the false impression that the scheme is a profitable, legitimate business" and do not compensate for the time value of money); Scholes v. Lehmann, 56 F.3d 750, 757–58 (7th Cir.1995) (holding that the time value of money that is invested in a Ponzi scheme has no value); SEC v. Harris, No. 3:09–CV–1809–B, 2010 WL 3719318, at * 2 (N.D.Tex.2010) (holding that the goodwill received from promotional materials that a charity purchased in exchange for a donation from the Ponzi scheme had no value) rev'd on other grounds, Am. Cancer Soc'y v. Cook, 675 F.3d 524, 528–29 (5th Cir.2012); Ramirez v. Dunson (In re Ramirez Rodriguez), 209 B.R. 424, 434 (Bankr.S.D.Tex.1997) (holding that the time value of money invested in a Ponzi scheme is not an exchange of value); In re Indep. Clearing House Co., 77 B.R. 843, 859 (D.Utah 1987) (same).
7. Such evidence might exist even in the context of a debtor engaged in a Ponzi scheme. Hypothetically, one can imagine an electricity provider putting on evidence that its services helped preserve the building in which the debtor operated, preventing the building's deterioration to the benefit of the debtors' creditors. But here, Golf Channel has not put forth any evidence that its advertising services accrued any benefit to Stanford's creditors.
8. Without any authority, Golf Channel argues that its own status as a creditor requires that we resolve this case in its favor. From its perspective, the advertising services are of substantial value. However, Golf Channel is not the only creditor we must consider. It is one among many who have unsecured claims, and must wait its turn for a pro rata share of whatever remains in the Stanford estate.
9. Similarly, the Fourth Circuit held that ownership in a company whose only asset was a 1 in 22 chance of winning a cellular license in an FCC lottery had value. See Cooper v. Ashley Commc'ns, Inc. (In re Morris Commc'ns NC, Inc.), 914 F.2d 458, 466, 474–75 (4th Cir.1990) (interpreting "value" in section 548 of the Bankruptcy Code). And the Third Circuit has held that a commitment letter that had only a small chance of maturing into financing had value. See Mellon Bank, N.A. v. Official Comm. of Unsecured Creditors of R.M.L., Inc. (In re R.M.L., Inc.), 92 F.3d 139, 152–53 (3d Cir.1996). In addition, the Sixth Circuit has held that the chance of winning on a bet in a casino had value. In re Chomakos, 69 F.3d 769, 770–71 (6th Cir.1995). We agree with the district court and Golf Channel that consummables and speculative investments can have value. But the case before us is different because Stanford was engaged in a Ponzi scheme, not a legitimate enterprise. The issue is not whether Golf Channel's services have value in the abstract, but whether they provided reasonably equivalent value to Stanford's creditors.


On November 10, 1775, the Continental Congress passed a resolution stating that "two battalions of Marines be raised" for service as landing forces with the fleet. This established the Continental Marines and marked the birth of the United States Marine Corps. Serving on land and at sea, early Marines distinguished themselves in a number of important operations, including their first amphibious raid on foreign soil in the Bahamas in March 1776, under the command of the Corps' first commandant, Capt. Samuel Nicholas. The 1783 Treaty of Paris ended the Revolutionary War and as the last of the Navy's ships were sold, the Continental Navy and Marines disbanded.
Following the formal re-establishment of the Marine Corps on July 11, 1798, Marines fought in conflicts with France, landed in Santo Domingo and conducted operations against the Barbary pirates along the "Shores of Tripoli."
Marines participated in numerous operations during the War of 1812, including the defense of Washington at Bladensburg, Md. They also fought alongside Andrew Jackson in the defeat of the British at New Orleans. Following the War of 1812, Marines protected American interests around the world in areas like the Caribbean, the Falkland Islands, Sumatra and off the coast of West Africa, and close to home in operations against the Seminole Indians in Florida.
During the Mexican War, Marines seized enemy seaports on both the Gulf and Pacific coasts. While landing parties of Marines and Sailors were seizing enemy ports, a battalion of Marines joined General Winfield Scott's army at Pueblo and marched and fought all the way to the "Halls of Montezuma," Mexico City.


text:
"use strict";

var Database = {};

var databaseSendPost = function (url, params, successCallback, errCallback) {
    var request = new XMLHttpRequest();
    request.open('POST', url, true);
    request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    request.send(params);
    request.onreadystatechange = function () {
        if (request.readyState === 4 && request.status === 200) {
            var type = request.getResponseHeader('Content-Type');
            if (type.indexOf("text") !== 1) {
                successCallback(request.responseText);
            }
        } else if (request.readyState === 4 && request.status === 500) {
            errCallback("Database Error");
        }
    };
};

Database.rawQuery = function (query) {
    return new Promise (function (resolve, reject) {
        function successCallback (data) {
            resolve(data);
        }
        function errCallback () {
            reject("Database Error");
        }
        databaseSendPost('/db', "query=" + encodeURIComponent(query), successCallback, errCallback);
    });
};

Database.getMetadata = function () {
    return new Promise (function (resolve, reject) {
        var timeQuery =
            "SELECT MIN(time), MAX(time) \
            FROM trace",
            timeQueryPromise = new Promise (function (resolve, reject) {
                function successCallback (data) {
                    if (!data) {
                        reject("No values");
                    }

                    var info = data.split(" ");
                    resolve({
                        startTime: info[0],
                        endTime: info[1].trim()
                    });
                }
                function errCallback () {
                    reject("Database Error");
                }
                databaseSendPost('/db', "query="+timeQuery, successCallback, errCallback);
            }),
            tidQuery =
                "SELECT COUNT(*) \
                FROM (SELECT DISTINCT tid FROM trace) tids",
            tidQueryPromise = new Promise (function (resolve, reject) {
                function successCallback (data) {
                    if (!data) {
                        reject("No values");
                    }

                    var info = data.split(" ");
                    resolve({
                        numThreads: info[0],
                    });
                }
                function errCallback () {
                    reject("Database Error");
                }
                databaseSendPost('/db', "query="+tidQuery, successCallback, errCallback);
            }),
            eventsQuery =
                "SELECT COUNT(*) \
                FROM trace",
            eventsQueryPromise = new Promise (function (resolve, reject) {
                function successCallback (data) {
                    if (!data) {
                        reject("No values");
                    }

                    var info = data.split(" ");
                    resolve({
                        numEvents: info[0],
                    });
                }
                function errCallback () {
                    reject("Database Error");
                }
                databaseSendPost('/db', "query="+eventsQuery, successCallback, errCallback);
            });

        Promise.all([timeQueryPromise, tidQueryPromise, eventsQueryPromise])
            .then(function (values) {
                resolve(Object.assign(values[0], values[1], values[2]));
            })
            .catch(function (err) {
                reject(err);
            });
    });
};

Database.getEventStats = function (tid, func, time) {
    return new Promise (function (resolve, reject) {
        var avgStdevQuery =
            "SELECT stdev, avg\
            FROM avg_stdev \
            WHERE func = '" + func + "' LIMIT 1",
            avgStdevPromise = new Promise (function (resolve, reject) {
                function successCallback (data) {
                    if (!data) {
                        reject("No values");
                    }

                    var info = data.split(" ");
                    resolve({
                        avg: parseInt(info[0], 10),
                        stddev: parseInt(info[1], 10)
                    });
                }
                function errCallback () {
                    reject("Database Error");
                }
                databaseSendPost('/db', "query="+avgStdevQuery, successCallback, errCallback);
            }),
            // TODO: Clean this up
            // May 4 2017: Derek Chan
            // Sasha had an issue where her database associated all durations
            // with the t1.dir=1 tuple (ie. the exit event in the trace)
            //
            // The purpose of this query is:
            // Input: The user's mouse location on the screen, translated to absolute time, function name, and thread number
            // Output: The matching trace event ID and duration associated with that mouse location
            //
            // The top eventQuery finds the matching ENTER event (-->) and extracts
            // the event ID and duration from that tuple
            //
            // The second eventQuery finds the matching EXIT event (<--) and extracts
            // the event ID and duration from that tuple
            //
            // To fix Sasha's issue, the second query is only used.
            // Some smarter logic would probably run both queries and determine
            // which query is correct (it's not as trivial as you may think)

            // TODO: May 4 2017: unused.
            eventQuery =
                "SELECT t1.id, t1.duration \
                FROM trace t1 \
                WHERE t1.dir = 0 \
                AND t1.func = '" + func + "' \
                AND t1.tid = '" + tid + "' \
                AND t1.time <= " + time + "\
                ORDER BY t1.time DESC LIMIT 1",
            // TODO: May 4 2017: used.
            eventQuery =
                "SELECT t1.id, t1.duration \
                FROM trace t1 \
                WHERE t1.dir = 1 \
                AND t1.func = '" + func + "' \
                AND t1.tid = '" + tid + "' \
                AND t1.time >= " + time + "\
                ORDER BY t1.time ASC LIMIT 1",
            eventPromise = new Promise (function (resolve, reject) {
                function successCallback (data) {
                    if (!data) {
                        reject("No values");
                    }

                    var info = data.split(" ");
                    resolve({
                        id: parseInt(info[0], 10),
                        duration: parseInt(info[1], 10)
                    });
                }
                function errCallback () {
                    reject("Database Error");
                }
                databaseSendPost('/db', "query="+eventQuery, successCallback, errCallback);
            });

        Promise.all([avgStdevPromise, eventPromise])
            .then(function (values) {
                resolve(Object.assign(values[0], values[1]));
            })
            .catch(function (err) {
                reject(err);
            });
    });

};