text:
Q: Bluetooth gets disconnected on opening GUI from Computer. I am pairing the Bluetooth of the pandaboard(which is running on Android ICS) with the PC. Now connection is established and I am able to send/receive the data through hyper terminal without any problem.
On my PC side, I have a GUI. Through this GUI only i want to send/receive the data through BT.
But when I try to open the GUI which is on my PC, the BT connection gets disconnected!!!
Why is this happenning?
Any idea on how to solve it?


text:
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class SQLOffByOneBugs {

    public void checkUpdateThis(ResultSet rs) throws SQLException {
        System.out.println(rs.getString(0));
    }

    public int checkUpdateThis2(ResultSet rs) throws SQLException {
        return rs.getInt(0);
    }

    public List<Object> checkUpdateAll(ResultSet rs) throws SQLException {
        List<Object> objects = new ArrayList<>();
        objects.add(rs.getString(0));
        objects.add(rs.getString(1));
        objects.add(rs.getInt(2));
        objects.add(rs.getObject(3));
        return objects;
    }

    public List<Object> checkUpdateAllMixedString(ResultSet rs) throws SQLException {
        List<Object> objects = new ArrayList<>();
        objects.add(rs.getString(0));
        objects.add(rs.getString(1));
        objects.add(rs.getInt("some_col"));
        objects.add(rs.getObject("other_col"));
        return objects;
    }
}

redpajama_set_name: RedPajamaGithub


text:
{% extends "admin.html" %}

{% block title %} {{_('network')}} {% endblock %}

{% block content_right %}

{{ _('local net access') }}

        {{_('status')}}:
        {% if localnet %}
            {{ _('activated') }}
        {% else %}
            {{ _('deactivated') }}
        {% endif %}

{{ _('Change local net access') }}

    <button class="btn btn-small" id="localnet" data-toggle_localnet_access_url="{{ url_for('.localnet_access') }}">
        {% if localnet %}
            {{ _('deactivate') }}
        {% else %}
            {{ _('activate') }}
        {% endif %}
    </button>
{% endblock %}

{% block javascript %}

{% endblock %}


Chris Chan is one of those people we need more of in healthcare. He's experienced and knowledgeable while also inherently unconventional. Which means he's perfectly positioned to look at both the "legacy" establishment and the new disruptors and find how they can all combine forces. Executives at any healthcare organization can learn from Chris, as can any startup founder.
The show was something of an experiment since Chris is starting to crank out content for his YouTube channel (TheArtOfChan, be sure to check it out). He got the video, I got the audio, and you get to choose how to take in our conversation. Be sure to leave a comment below to let us know what you think.


Is your business positioned to thrive?
The alignment of a multinational company's operating model and its global tax objectives is an important step in enhancing corporate profitability and shareholder value.
Currently, these challenges are compounded by the uncertainty of a changing landscape, the recent US Tax Reform being a prime example. Another challenge arises by way of OECD's Base Erosion Profit Shift (BEPS) project which is bringing widespread regulatory and treaty changes across many jurisdictions.
Value Chain Alignment (VCA) is the process of integrating the operating model and global tax structures into the way a business operates. Value Chain Alignment (VCA) is all about creating value through business transformation.
Even if your business has undertaken a Value Chain Alignment (VCA) project in the past, now is the time to re-evaluate your strategy and choices to confirm you will have a sustainable model, that still makes sense in the new reset tax world.
Developing a tax model that is not based on operations runs the risk of curtailing the bottom line, and a business model that does not take tax into account may end up surrendering some or all of the profit it creates.


text:
Some of the code in this project has been adapted from the
AWS SDK for Go (https://github.com/aws/aws-sdk-go).

The AWS SDK for Go is licensed under the Apache license V2.0, January 2004
(http://www.apache.org/licenses/).

## WSDL to Go

The types in the `wsdl.go` file were initially generated
using WSDL to Go (https://github.com/hooklift/gowsdl). In addition,
some of the SOAP code in `soap.go` has been adapted from this package.

WSDL to Go is licensed under the Mozilla Public License Version 2.0
(https://github.com/hooklift/gowsdl/blob/master/LICENSE).


There are a lot of toys currently available on the market that will bring out a kids creative side – many times, that's what toy makers aim for. What good is a toy if it doesn't make room for imagination and creativity? If you're looking for a special play set, then the K'NE Flying: Rotor-Powered 10-Model Building System seems pretty cool. Today, we are here to give you an honest review on this building system so that you can decide whether or not it is a viable option for your little one.
What Does the Set Come with?
This set comes with a total of 480 K'NEX parts and pieces – that is a whole lot of pieces for a little one, right? With that, they can build quite a few things. Amongst these pieces, you'll also find connectors and robs that are attached to one another in a variety of ways.
There's snap-fit pieces that stick together securely, but you can easily reassemble them in order to build other creations.
This K'NEX building set stands out from the crowd, because with it, the little ones will be able to not only create a variety of models, but the models will move. That's right – this set will allow the users to build interactive toys and figures like airplanes, helicopters, trucks and auto parts like wings, rotors, wheels, and tracks.
Don't worry, your little one won't be on his/her own with this building set – it comes with an instruction manual that is easy to follow. This instruction manual will show them how to build a total of 35 unique models. Each one has a step-by-step guidelines and as we said before, it is easy to follow.
This set has been designed for children that are ages 7 and up. This set is great for those children that like to build, enjoy challenging moments and have a wild imagination (isn't that all kids?).
Surely, many children wonder how the building system works, right? Well, with this set, they can place different parts together and learn how the building system works.
While this set is fun and exciting, there's much more to it. It can help strengthen hand-eye coordination, improve problem-solving skills, fine motor skills and spatial awareness. Also, of course, it exercises their imagination.
There's no need to worry about this toy – the connectors and rods were responsibly made in the United States at a zero-waste green manufacturing facility in Pennsylvania. The company tests the safety standards in order to make sure the little ones have a trouble-free building experience. The company has a guarantee on their parts – if for some reason a part is missing or broken, all you have to do is give them a call and they'll send the missing or broken part to you as soon as possible.
This is a company that is all about having fun with top of the line toys – they put a lot of focus on their quality and make sure it's built with safety in mind. Children enjoy this set due to the imagination and the fact that once they build something, it practically comes to life.


text:
Melanie Susan "Mel" Appleby (11 July 1966 – 18 January 1990) was one half of the 1980s English duo Mel and Kim. They had a number one hit on the UK Singles Chart in March 1987, with the song "Respectable".

Career
Appleby was born in Hackney, London, to a Jamaican father and a British mother. She initially worked as a glamour model, before joining her sister Kim Appleby to form Mel and Kim. The duo enjoyed considerable chart success in the late 1980s, achieving four UK top ten hits, including the number one "Respectable" (1987), while their debut album, F.L.M. (1987) spent 25 weeks on the UK chart and was certified platinum in the UK.

Death
Appleby died in Westminster, London, of pneumonia following treatment for metastatic paraganglioma on 18 January 1990. She died at the age of 23 and is buried in East Finchley Cemetery.

References

1966 births
1990 deaths
English people of Jamaican descent
English female models
Deaths from cancer in England
People from Hackney Central
20th-century Black British women singers
Burials at East Finchley Cemetery
Mel and Kim members

redpajama_set_name: RedPajamaWikipedia


Looking for a trusted Glenquarry electrician that will provide you with the best solution to your needs?
Get a personalised solution to your electrical needs in Glenquarry & within your budget.
Glenquarry is a locality in the Southern Highlands of New South Wales, Australia, in Wingecarribee Shire. It is a scattered village on the banks of the Wingecarribee River. At the 2016 census, it had a population of 222. If you are looking for electrical and powerpoint upgrades for your home or a preventative maintenance program for your office, please give us a call. We will be more than happy to help you with your new electrical project in Glenquarry and have the electrical skills and knowledge to help you with any size job in Glenquarry.


text:
Q: How to include PHP files that require an absolute path? I have a directory structure like the following;

script.php
inc/include1.php
  inc/include2.php
objects/object1.php
  objects/object2.php
soap/soap.php

Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structure like that for a specific reason. When executing script.php the include path is inc/include.php and when executing /soap/soap.php it's ../inc, absolute paths work, /mnt/webdev/[project name]/inc/include1.php... But it's an ugly solution if I ever want to move the directory to a different location.
So is there a way to use relative paths, or a way to programmatically generate the "/mnt/webdev/[project name]/"?

A: have a look at http://au.php.net/reserved.variables
I think the variable you are looking for is: $_SERVER["DOCUMENT_ROOT"]

A: Another way to handle this that removes any need for includes at all is to use the autoload feature. Including everything your script needs "Just in Case" can impede performance. If your includes are all class or interface definitions, and you want to load them only when needed, you can overload the __autoload() function with your own code to find the appropriate class file and load it only when it's called. Here is the example from the manual:
function __autoload($class_name) {
    require_once $class_name . '.php';
}

$obj  = new MyClass1();
$obj2 = new MyClass2();

As long as you set your include_path variables accordingly, you never need to include a class file again.

A: You could define a constant with the path to the root directory of your project, and then put that at the beginning of the path.

A: You can use relative paths. Try __FILE__.  This is a PHP constant which always returns the path/filename of the script it is in.  So, in soap.php, you could do:
include dirname(__FILE__).'/../inc/include.php';

The full path and filename of the
  file. If used inside an include, the
  name of the included file is returned.
  Since PHP 4.0.2, __FILE__ always
  contains an absolute path with
  symlinks resolved whereas in older
  versions it contained relative path
  under some circumstances.
  (source)

Another solution would be to set an include path in your httpd.conf or an .htaccess file.

A: Another option, related to Kevin's, is use __FILE__, but instead replace the php file name from within it:
<?php

$docRoot = str_replace($_SERVER['SCRIPT_NAME'], '', __FILE__);
require_once($docRoot . '/lib/include.php');

?>

I've been using this for a while. The only problem is sometimes you don't have $_SERVER['SCRIPT_NAME'], but sometimes there is another variable similar.

A: I found this to work very well!
function findRoot() {
    return(substr($_SERVER["SCRIPT_FILENAME"], 0, (stripos($_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"])+1)));
}

Use:
<?php

function findRoot() {
    return(substr($_SERVER["SCRIPT_FILENAME"], 0, (stripos($_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"])+1)));
}

include(findRoot() . 'Post.php');
$posts = getPosts(findRoot() . 'posts_content');

include(findRoot() . 'includes/head.php');

for ($i=(sizeof($posts)-1); 0 <= $i; $i--) {
    $posts[$i]->displayArticle();
}

include(findRoot() . 'includes/footer.php');

?>

A: This should work
$root = realpath($_SERVER["DOCUMENT_ROOT"]);

include "$root/inc/include1.php";

Edit: added imporvement by aussieviking

A: I think the best way is to put your includes in your PHP include path. There are various ways to do this depending on your setup.
Then you can simply refer to
require_once 'inc1.php';

from inside any file regardless of where it is whether in your includes or in your web accessible files, or any level of nested subdirectories.
This allows you to have your include files outside the web server root, which is a best practice.
e.g.
site directory
    html (web root)
        your web-accessible files
    includes
        your include files

Also, check out __autoload for lazy loading of class files
http://www.google.com/search?q=setting+php+include+path
http://www.google.com/search?q=__autoload

A: require(str_repeat('../',(substr_count(getenv('SCRIPT_URL'),'/')-1))."/path/to/file.php");

I use this line of code. It goes back to the "top" of the site tree, then goes to the file desired.
For example, let's say i have this file tree:

domain.com/aaa/index.php
  domain.com/bbb/ccc/ddd/index.php
  domain.com/_resources/functions.php

I can include the functions.php file from wherever i am, just by copy pasting
require(str_repeat('../',(substr_count(getenv('SCRIPT_URL'),'/')-1))."/_resources/functions.php");

If you need to use this code many times, you may create a function that returns the str_repeat('../',(substr_count(getenv('SCRIPT_URL'),'/')-1)) part. Then just insert this function in the first file you include. I have an "initialize.php" file that i include at the very top of each php page and which contains this function. The next time i have to include files, i in fact just use the function (named path_back):
require(path_back()."/_resources/another_php_file.php");

A:

@Flubba, does this allow me to have folders inside my include directory? flat include directories give me nightmares. as the whole objects directory should be in the inc directory.

Oh yes, absolutely. So for example, we use a single layer of subfolders, generally:
require_once('library/string.class.php')

You need to be careful with relying on the include path too much in really high traffic sites, because php has to hunt through the current directory and then all the directories on the include path in order to see if your file is there and this can slow things up if you're getting hammered.
So for example if you're doing MVC, you'd put the path to your application directoy in the include path and then specify refer to things in the form
'model/user.class'
'controllers/front.php'

or whatever.
But generally speaking, it just lets you work with really short paths in your PHP that will work from anywhere and it's a lot easier to read than all that realpath document root malarkey.
The benefit of those script-based alternatives others have suggested is they work anywhere, even on shared boxes; setting the include path requires a little more thought and effort but as I mentioned lets you start using __autoload which just the coolest.

A: If you are going to include specific path in most of the files in your application, create a Global variable to your root folder.
define("APPLICATION_PATH", realpath(dirname(__FILE__) . '/../app'));
or
define("APPLICATION_PATH", realpath(DIR(__FILE__) . '/../app'));

Now this Global variable "APPLICATION_PATH" can be used to include all the files instead of calling realpath() everytime you include a new file.
EX:
include(APPLICATION_PATH ."/config/config.ini";

Hope it helps ;-)

redpajama_set_name: RedPajamaStackExchange


text:
Cerebral palsy is a clinical diagnosis, diagnosed based on a combination of clinical signs, neurological symptoms and physical limitations. Cerebral palsy or high-risk of cerebral palsy can now be detected accurately and early using a combination of standardized assessment tools. Early detection enables timely early intervention when the greatest gains are possible from neuroplasticity.
Care pathway for early detection of cerebral palsy
Synopsis of resource
This Care Pathway describes why early detection of cerebral palsy is necessary. The evidence indicates that there are two major pathways to accurate and early detection of cerebral palsy depending on the infant's age at the time of assessment using different tests in combination with the clinical examination. This pathway outlines both processes: 1) for infants under 5 months and 2) for infants over 5 months of age. For each it describes a "most accurate method" and a method "in context where MRI is not safe or affordable"
This is a guide on how to make an early diagnosis of cerebral palsy from the neonatal age, both in resource rich and resource limited settings. It proposes early simple yet effective interventions to change infant's motor behaviour utilizing the period of neuro and muscle plasticity. This evidence summary of the early detection of CP pathway has special considerations and recommendations to low- and middle-income countries as well, and it can be practised anywhere with the right training on the specified tools of assessment.
Key learning outcome
Describe the importance of early detection of cerebral palsy (CP)
Describe a systematic approach to early identification for infants younger than 5 months of age.
Describe a systematic approach to early identification for infants older than 5 months of age
Professor Iona Novak is Co-founder and Head of the Cerebral Palsy Alliance Research Institute. She manages the strategic development of research into the prevention and cure of cerebral palsy and supports the Australian Cerebral Palsy Register. Professor Novak is a Fulbright Scholar focused on conducting a research program of neuro-protective, neuro-regenerative and neuro-rehabilitative clinical trials in cerebral palsy.
Professor Novak conducts clinical research into effective interventions for people living with cerebral palsy, including evidence-based practice initiatives and collaborative international and inter-agency research work. She has extensive clinical experience as an Occupational Therapist and holds: a Bachelor of Applied Science (Occupational Therapy) from the University of Sydney; a Master of Science (Hons) and a PhD from the Western Sydney University.
Click here to access the resource
Feeding back to feed forward. Lessons from adults' experiences should impact children and families November 30, 2021
Care Pathway: Hip Surveillance in Cerebral Palsy November 24, 2021
Care pathway for early detection of cerebral palsy November 22, 2021

redpajama_set_name: RedPajamaCommonCrawl


text:
£448k Awarded to Six Companies
Merseyside based recruitment agency awarded £103k
The company strive to make simple technology alongside clear rates for all and inclusive rewards. Their team has over 40 years of combined experience in education recruitment. Their technology allows them to reduce their costs which allows them to pass these savings directly onto its clients with reduced charges. Striving for a clear and transparent process, their pricing model is a core element of this.
Leicestershire based manufacturing company received £67k taking total claims to £844k
The company was founded in 1972 and has an excellent reputation for developing and manufacturing investment cast components for both industrial and retail applications. During recent years, much of the R&D has focussed on specific, troublesome components. This year, many of the new products have pushed the process to the limit, allowing the R&D to focus on process developments, which should ensure the company's prosperity in the future.
Greater Manchester based IT company awarded £76k
Incorporated in 2000 the company works exclusively with agencies; they have developed around 2000 systems. The breadth of work carried out by WPS and the speed at which technical developments and client requirements move forward ensures that the company is permanently engaged in research and development work as they iterate towards adhering together cutting-edge software, applications, open source products, front & back office requirements and the like to finalise unique, easy to integrate, easy to use, fast client solutions.
Norfolk based renovation and conversion company received £86k
The company specialises in the renovation and conversion of older buildings to meet current building standards. The company adopts a bespoke approach to project development, including researching and commissioning architects. The company identify as being best suited to fulfil ensure that plans integrate with and complement its immediate environment, and make a long-term positive contribution to local life.
London based Architecture and design studio awarded £22k
The company strives to deliver beautifully crafted, thoughtfully designed projects which exceed their client's expectations and enhance their setting. The work is characterised by a rigorous analytical design process, irrespective of scale or setting. The architectural approach begins with a deep analysis of the cultural and physical context to understand the spirit of the place in which they will build.
London based It company received £92k in first claim
Established almost 10 years, CloudAttribution offers cloud-based investment management software. Working with some of the world's leading financial institutions, they empower fund and performance managers with tailored investment management software to drive better investments by delivering total transparency and visibility on the source of their returns.


text:
Test connection attributes for formatting money data (feature request issue 415)
--DESCRIPTION--
Test how money data in the fetched values can be formatted by using the connection attributes PDO::SQLSRV_ATTR_FORMAT_DECIMALS and PDO::SQLSRV_ATTR_DECIMAL_PLACES, the latter works only with integer values. No effect on other operations like insertion or update.

The PDO::SQLSRV_ATTR_DECIMAL_PLACES attribute only affects money/smallmoney fields. If its value is out of range, for example, it's negative or larger than the original scale, then its value will be ignored.

The underlying data will not be altered, but formatted results may likely be rounded up (e.g. .2954 will be displayed as 0.30 if the user wants only two decimals). For this reason, it is not recommended to use formatted money values as inputs to any calculation.

The corresponding statement attributes always override the inherited values from the connection object. Setting PDO::SQLSRV_ATTR_FORMAT_DECIMALS to false will automatically turn off any formatting of decimal data in the result set, ignoring PDO::SQLSRV_ATTR_DECIMAL_PLACES value.

By only setting PDO::SQLSRV_ATTR_FORMAT_DECIMALS to true will add the leading zeroes, if missing.

Do not support output params.
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?>
--FILE--
<?php
require_once("MsCommon_mid-refactor.inc");

function numberFormat($value, $numDecimals)
{
    return number_format($value, $numDecimals, '.', '');
}

function testFloatTypes($conn, $numDigits)
{
    // This test with the float types of various number of bits, which are retrieved
    // as numbers by default. When fetched as strings, no formatting is done,
    // because the connection attributes for formatting have no effect
    $epsilon = 0.001;
    $nColumns = 5;

    $values = array();
    for ($i = 0; $i < $nColumns; $i++) {
        $n1 = rand(1, 100);
        $n2 = rand(1, 100);
        $neg = ($i % 2 == 0) ? -1 : 1;

        $n = $neg * $n1 / $n2;
        array_push($values, $n);
    }

    $query = "SELECT CONVERT(float(1), $values[0]),
                     CONVERT(float(12), $values[1]),
                     CONVERT(float(24), $values[2]),
                     CONVERT(float(36), $values[3]),
                     CONVERT(float(53), $values[4])";

    $stmt = $conn->query($query);
    $floats = $stmt->fetch(PDO::FETCH_NUM);
    unset($stmt);

    // By default the floating point numbers are fetched as strings
    $stmt = $conn->prepare($query);
    for ($i = 0; $i < 5; $i++) {
        $stmt->execute();
        $floatStr = $stmt->fetchColumn($i);

        $floatVal = floatVal($floats[$i]);
        $floatVal1 = floatval($floatStr);

        trace("testFloatTypes: $floatVal1, $floatVal\n");

        $diff = abs($floatVal1 - $floatVal) / $floatVal;
        if ($diff > $epsilon) {
            echo "$diff: Expected $floatVal but $floatVal1 returned. \n";
        }
    }
}

function verifyMoneyFormatting($conn, $query, $values, $format)
{
    if ($format) {
        // Set SQLSRV_ATTR_FORMAT_DECIMALS to true but
        // set SQLSRV_ATTR_DECIMAL_PLACES to a negative number
        // to override the inherited attribute
        $options = array(PDO::SQLSRV_ATTR_DECIMAL_PLACES => -1, PDO::SQLSRV_ATTR_FORMAT_DECIMALS => true);
    } else {
        // Set SQLSRV_ATTR_FORMAT_DECIMALS to false will
        // turn off any formatting -- overriding the inherited
        // attributes
        $options = array(PDO::SQLSRV_ATTR_FORMAT_DECIMALS => false);
    }

    $stmt = $conn->prepare($query, $options);
    $stmt->execute();
    $results = $stmt->fetch(PDO::FETCH_NUM);

    trace("\verifyMoneyFormatting:\n");
    for ($i = 0; $i < count($values); $i++) {
        // money types have a scale of 4
        $default = numberFormat($values[$i], 4);
        if (!$format) {
            // No formatting - should drop the leading zero, if exists
            if (abs($values[$i]) < 1) {
                $default = str_replace('0.', '.', $default);
            }
        }
        if ($default !== $results[$i]) {
            echo "verifyMoneyFormatting ($format): Expected $default but got $results[$i]\n";
        }
    }
}

function verifyMoneyValues($conn, $numDigits, $query, $values, $override)
{
    if ($override) {
        $options = array(PDO::SQLSRV_ATTR_DECIMAL_PLACES => $numDigits);
        $stmt = $conn->prepare($query, $options);
    } else {
        // Use the connection defaults
        $stmt = $conn->prepare($query);
    }
    $stmt->execute();
    $results = $stmt->fetch(PDO::FETCH_NUM);

    trace("\nverifyMoneyValues:\n");
    for ($i = 0; $i < count($values); $i++) {
        $value = numberFormat($values[$i], $numDigits);
        trace("$results[$i], $value\n");

        if ($value !== $results[$i]) {
            echo "testMoneyTypes ($override, $numDigits): Expected $value but got $results[$i]\n";
        }
    }
}

function testMoneyTypes($conn, $numDigits)
{
    // With money and smallmoney types, which are essentially decimal types
    // As of today, ODBC driver does not support Always Encrypted feature with money / smallmoney
    $values = array();
    $nColumns = 6;
    for ($i = 0; $i < $nColumns; $i++) {
        // First get a random number
        $n = rand(0, 10);
        $neg = ($n % 2 == 0) ? -1 : 1;

        // $n1 may or may not be negative
        $max = 10;
        $n1 = rand(0, $max) * $neg;
        $n2 = rand(1, $max * 1000);

        $number = sprintf("%d.%d", $n1, $n2);
        array_push($values, $number);
    }

    $query = "SELECT CONVERT(smallmoney, $values[0]),
                     CONVERT(money, $values[1]),
                     CONVERT(smallmoney, $values[2]),
                     CONVERT(money, $values[3]),
                     CONVERT(smallmoney, $values[4]),
                     CONVERT(money, $values[5])";

    // Do not override the connection attributes
    verifyMoneyValues($conn, $numDigits, $query, $values, false);
    // Next, override statement attribute to set number of
    // decimal places
    verifyMoneyValues($conn, 0, $query, $values, true);

    // Set Formatting attribute to true then false
    verifyMoneyFormatting($conn, $query, $values, true);
    verifyMoneyFormatting($conn, $query, $values, false);
}

function connGetAttributes($conn, $numDigits)
{
    $format = $conn->getAttribute(PDO::SQLSRV_ATTR_FORMAT_DECIMALS);
    if ($format !== true) {
        echo "The returned value of SQLSRV_ATTR_FORMAT_DECIMALS, $format, is wrong\n";

        return false;
    }

    $digits = $conn->getAttribute(PDO::SQLSRV_ATTR_DECIMAL_PLACES);
    if ($digits != $numDigits) {
        echo "The returned value of SQLSRV_ATTR_DECIMAL_PLACES, $digits, is wrong\n";

        return false;
    }

    return true;
}

function connectWithAttrs($numDigits)
{
    $attr = array(PDO::SQLSRV_ATTR_FORMAT_DECIMALS => true,
                  PDO::SQLSRV_ATTR_DECIMAL_PLACES => $numDigits);

    // This helper method sets PDO::ATTR_ERRMODE to PDO::ERRMODE_EXCEPTION
    $conn = connect('', $attr);

    if (connGetAttributes($conn, $numDigits)) {
        // First test with money types
        testMoneyTypes($conn, $numDigits);

        // Also test using regular floats
        testFloatTypes($conn, $numDigits);
    }
    unset($conn);
}

function connectSetAttrs($numDigits)
{
    // This helper method sets PDO::ATTR_ERRMODE to PDO::ERRMODE_EXCEPTION
    $conn = connect();
    $conn->setAttribute(PDO::SQLSRV_ATTR_FORMAT_DECIMALS, true);
    $conn->setAttribute(PDO::SQLSRV_ATTR_DECIMAL_PLACES, $numDigits);

    if (connGetAttributes($conn, $numDigits)) {
        // First test with money types
        testMoneyTypes($conn, $numDigits);

        // Also test using regular floats
        testFloatTypes($conn, $numDigits);
    }

    unset($conn);
}

try {
    connectWithAttrs(2);
    connectSetAttrs(3);

    echo "Done\n";

    unset($conn);
} catch (PdoException $e) {
    echo $e->getMessage() . PHP_EOL;
}
?>
--EXPECT--
Done