text:
Q: Unit Test for FormErrorSerializer in Symfony 4 - always valid form I am trying to write a unit test for FormErrorSerializer that converts Symfony $form->getErrors() to a readable array.
My current approach is to create the form, give it data, and look for validation errors, but form is always valid. I don't get any errors no matter what data I provide to form.
In normal REST request/response it is working well and I am getting appropriate error message. I need help with getting the error messages in unit test.
namespace App\Tests\Unit;

use App\Form\UserType;
use App\Serializer\FormErrorSerializer;
use Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Translation\Translator;

class FormErrorSerializerTest extends TypeTestCase
{
    /**
     * ValidatorExtensionTrait needed for invalid_options
     * https://github.com/symfony/symfony/issues/22593
     */
    use ValidatorExtensionTrait;

    public function testConvertFormToArray(){
        $form_data = [
            'email' => 'test',
            'plainPassword' => [
                'pass' => '1',
                'pass2' => '2'
            ]
        ];

        $translator = new Translator('de');

        $form = $this->factory->create(UserType::class);

        $form->submit($form_data);

        if( $form->isValid() ) {
            echo  "Form is valid"; exit;
        }

        $formErrorSerializer = new FormErrorSerializer($translator);

        $errors = $formErrorSerializer->convertFormToArray($form);

        print_r($errors); exit;
    }
}

Find below the Serializer:
namespace App\Serializer;

use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Translation\TranslatorInterface;

/**
 * Serializes invalid Form instances.
 */
class FormErrorSerializer
{
    private $translator;

    public function __construct(TranslatorInterface $translator)
    {
        $this->translator = $translator;
    }

    public function convertFormToArray(FormInterface $data)
    {
        $form = $errors = [];

        foreach ($data->getErrors() as $error) {
            $errors[] = $this->getErrorMessage($error);
        }

        if ($errors) {
            $form['errors'] = $errors;
        }

        $children = [];
        foreach ($data->all() as $child) {
            if ($child instanceof FormInterface) {
                $children[$child->getName()] = $this->convertFormToArray($child);
            }
        }

        if ($children) {
            $form['children'] = $children;
        }

        return $form;
    }

    private function getErrorMessage(FormError $error)
    {
        if (null !== $error->getMessagePluralization()) {
            return $this->translator->transChoice(
                $error->getMessageTemplate(),
                $error->getMessagePluralization(),
                $error->getMessageParameters(),
                'validators'
            );
        }

        return $this->translator->trans($error->getMessageTemplate(), $error->getMessageParameters(), 'validators');
    }
}

A: Ok, I was able to do this in 2 different ways.
First solution was to load the validator in getExtensions method. The factory in TypeTestCase doesn't bring the validator with it. So, not only you have to load the validator but you also have to explicitly specify the validations. You can specify validation using methods provided by symfony or you can directly point validator to the YAML or xml file if you are using one.
public function getExtensions()
{
    $validator = (new ValidatorBuilder())
        ->addYamlMapping("path_to_validations.yaml")
        ->setConstraintValidatorFactory(new ConstraintValidatorFactory())
        ->getValidator();

    $extensions[] = new CoreExtension();
    $extensions[] = new ValidatorExtension($validator);

    return $extensions;
}

However, I didn't use the above approach. I went with even better solution. Due to high complexity of my test case (as it needed multiple services), I went with a special container provided by Symfony's KernelTestCase. It provides private services in tests, and the factory it provides comes with validator and validations, just like you code in controller. You do not need to load validator explicitly. Find below my final test that extends KernelTestCase.
namespace App\Tests\Unit\Serializer;

use App\Entity\User;
use App\Form\UserType;
use App\Serializer\FormErrorSerializer;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Translation\TranslatorInterface;

class FormErrorSerializerTest extends KernelTestCase
{
    /**
     * {@inheritDoc}
     */
    protected function setUp()
    {
        $kernel = self::bootKernel();
    }

    public function testConvertFormToArray_invalidData(){
        $form_data = [
            'email' => 'test',
            'plainPassword' => [
                'pass' => '1111',
                'pass2' => ''
            ]
        ];

        $user = new User();
        $user->setEmail($form_data['email']);
        $user->setPlainPassword($form_data['plainPassword']['pass']);

        $factory = self::$container->get(FormFactoryInterface::class);
        /**
         * @var FormInterface $form
         */
        $form = $factory->create(UserType::class, $user);

        $form->submit($form_data);

        $this->assertTrue($form->isSubmitted());
        $this->assertFalse($form->isValid());

        $translator = self::$container->get(TranslatorInterface::class);
        $formErrorSerializer = new FormErrorSerializer($translator);
        $errors = $formErrorSerializer->convertFormToArray($form);

        $this->assertArrayHasKey('errors', $errors['children']['email']);
        $this->assertArrayHasKey('errors', $errors['children']['plainPassword']['children']['pass']);
    }

    public function testConvertFormToArray_validData(){
        $form_data = [
            'email' => 'test@example.com',
            'plainPassword' => [
                'pass' => 'somepassword@slkd12',
                'pass2' => 'somepassword@slkd12'
            ]
        ];

        $user = new User();
        $user->setEmail($form_data['email']);
        $user->setPlainPassword($form_data['plainPassword']['pass']);

        $factory = self::$container->get(FormFactoryInterface::class);
        /**
         * @var FormInterface $form
         */
        $form = $factory->create(UserType::class, $user);

        $form->submit($form_data);

        $this->assertTrue($form->isSubmitted());
        $this->assertTrue($form->isValid());

        $translator = self::$container->get(TranslatorInterface::class);
        $formErrorSerializer = new FormErrorSerializer($translator);
        $errors = $formErrorSerializer->convertFormToArray($form);

        $this->assertArrayNotHasKey('errors', $errors['children']['email']);
        $this->assertArrayNotHasKey('errors', $errors['children']['plainPassword']['children']['pass']);
    }
}

Please note that Symfony 4.1 has a special container that allows fetching private services.
self::$kernel->getContainer(); is not special container. It will not fetch private services.
However, self::$container; is special container that provides private services in testing.
More about this here.


text:
Q: Is it normal that I don't see the webpart I just added? I am creating a page and I don't see the new webpart I just added. When I do gulp serve, I can add the app, and after adding it I see it in the "Apps you can add" section, but when I try to edit a page I just created I don't see it.

A: A simple method of development, is to generate the solution package of the webpart component and to deploy it in the application catalog of the site.
Enter the following command to package your client-side solution that contains the web part:
gulp package-solution

The command creates the package in the sharepoint/solution folder. It's this package that needs to be deployed in the application catalogue. This article in the official Microsoft documentation explains the steps to follow.
Once the webpart component has been deployed on the site, simply run the following command to launch the server and be able to use the webpart in the site :
gulp serve --nobrowser

Any modification made afterwards in the code will be automatically taken care of by the component. This is a more efficient way of coding.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Action bar shown in display of android studio but not in my actual app Hey guys i have an app with two activities, in the second activity i have an action bar with the title of my app displayed without problem.
However in my launcher activity the bar is shown in android studio display but not in the actual app...
Any idea whats happening ?
Here is my xml :
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
    tools:context=".Menu_Activity">

<ListView
    android:id="@+id/list"
    android:layout_width="wrap_content"
    android:layout_height="40dp"
    android:layout_weight="0.99"
    android:dividerHeight="2px">

</ListView>

<ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true" />

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Download content"
    android:textColor="#FFFFFF"
    android:id="@+id/button"
    android:background="@drawable/buttonshape" />

 </LinearLayout>

and here is the xml where the bar is displayed :
   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">

<ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"

    />

<ListView
    android:id="@+id/list"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:divider="#FF000080"
    android:dividerHeight="2px">

</ListView>

 </LinearLayout>

Im not doing anything concerning the bar in the java files except extending AppCompatActivity in both cases.
Here is the styles file :

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.AppBarOverlay"     parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

Thank you for your help.

A: Possibility 1:
If your app extends Activity change it to AppCompatActivity.
Possibility 2:
Are you sure you don't have different files of different versions named "styles.xml"? Make sure that none of the them have a theme named AppTheme.NoActionBar.
The device you are running the app will fetch the more adequate theme for its version. If you have a file named styles.xml(v21) for example, devices with Lollipop or above will use it.

A: I am thinking that you somehow want to display a listView with content in your activity that has fails to display the action bar. Well here is what I did for mine. In the main method I extended AppCompactActivity and in the method itself I declared the listView as a variable like ListView listView; then after that, in the onCreate method of the main object you just simply connect this to the id of your list using listView = (ListView) findViewById(R.id.thelistid) after that I simply called the adapter that should fill the list with content as listView.setAdapter(nameOfYourAdapter) Hope this helps!


text:
Q: unity3d visual studio 2015 unable to create .appxupload Windows10 I am using Unity 5.3.1f1 and vs2015 update 1
I am unable to create .appxupload to submit to store for windows 10 Universal.
Test file are only created and testing(Windows App Certification Kit) works.
I am able to create .appxupload file for windows8,8.1 and for blank Windows10 app created using Visual studio.
No error message

Edit:
After some try and error i found that i can generate .appxupload file if i select Master(so .appxupload is not created if i build release version)

A: After some try and error i found that i can generate .appxupload file if i select Master(so .appxupload is still not created if i build release version)


text:
Q: Is it possible to pass arguments to mr job Given the basic example from the mrJob site for a word count program:
from mrjob.job import MRJob

class MRWordFrequencyCount(MRJob):

    def mapper(self, _, line):
        yield "chars", len(line)
        yield "words", len(line.split())
        yield "lines", 1

    def reducer(self, key, values):
        yield key, sum(values)

if __name__ == '__main__':
    MRWordFrequencyCount.run()

From command line, this example can be run as python mrJobFilename.py mrJobFilename.py. This should run the program on itself and count the words in the file.
So given this example, what if I want to pass in an argument, say minCount = 3. With this argument, the reducer would only return words with counts more than minCount.
from mrjob.job import MRJob

class MRWordFrequencyCount(MRJob):

    def mapper(self, _, line):
        yield "chars", len(line)
        yield "words", len(line.split())
        yield "lines", 1

    def reducer(self, key, values):
        X = sum(values)
        if X > minCount:
            yield key, sum(values)

if __name__ == '__main__':
    MRWordFrequencyCount.run()

I tried passing minWord as an argument : python mrJobFilename.py mrJobFilename.py 3, but I get an error OSError: Input path 3 does not exist!
I also tried setting a variable with sysArg:
if __name__ == '__main__':
    minWord = sys.argv[1]
    MRWordFrequencyCount.run()

When run with python mrJobFilename.py mrJobFilename.py < 3 I get an error bash: 3: No such file or directory. If I don't use the < I get the previous input file not found error.
Finally, I tried inputting a second csv file. The csv file is 2 lines and looks like this:
minWord
3

It is meant to pass a parameter to mrJobs since it keeps giving me error that second arugment is not an input file. I use mapper_raw to try and load it, but I get a weird error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8f in position 22: invalid start byte
from mrjob.job import MRJob

class MRWordFrequencyCount(MRJob):

    def mapper_raw(self, input_arg1, input_arg2):
        import csv
        f = open(input_path2)
        reader = csv.reader(f)
        next(reader) # skip header
        yield(next(reader))

    def steps(self):
          return [
              MRStep(mapper_raw=self.mapper_raw)
          ]

if __name__ == '__main__':
    MRWordFrequencyCount.run()

How can I pass an argument to mrJob? Ultimately I need to do this to pass parameters for differential equation systems which I want to solve in parallel.

A: You can follow the mrjob document to add command-line argument like argparse.
So your code should look something like this:
from mrjob.job import MRJob

class MRWordFrequencyCount(MRJob):

    def configure_args(self):
        super(MRWordFrequencyCount, self).configure_args()
        self.add_passthru_arg("-m", "--minCount", help="your argument description")

    def mapper(self, _, line):
        yield "chars", len(line)
        yield "words", len(line.split())
        yield "lines", 1

    def reducer(self, key, values):
        X = sum(values)
        if X > self.options.minCount:
            yield key, sum(values)

if __name__ == '__main__':
    MRWordFrequencyCount.run()

Use your argument with self.options.minCount.
Run command:
python code.py input.txt --minCount 4


text:
Q: How is this array of floats encoded? I am trying to decode an array of data from a piece of legacy equipment in to a more useful format.
I have the following base64 encoded string:
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
kHVrvCtGgz5v5tq8

When adding trailing padding and decoding this from base64, it produces an unknown binary format.
What I know so far based on limited inspection of the application:

*

*It is definitely base64.

*This array describes a series of floating point data (with values between 19 and 50) that consists of 201 points.

*The application that created this was likely written in .NET.

How is this data encoded, and can you provide psuedo-code to decode it?
Update #1:

*

*This data describes a return loss measurement waveform from an old network analyser.

*The expected values above are based on what the instrument displays, and it is possible that they are calculated from real and imaginary components.

Update #2:
I've found there was also a CSV version of the data for this series. Expected values are:
28.6740250379346, 26.031723427971, 26.6849726930916, 27.5095233036572, 27.9755283611409, 28.0419902829292, 27.9918713318024, 28.0331481409078, 28.2620361924923, 29.1899991143532, 30.4746778667205, 31.9841888600965, 32.7562027026775, 32.2032446202011, 31.0251062040461, 30.1158617686259, 29.5968352710132, 29.8991302542384, 30.7711739051407, 32.5985879649759, 35.465787543584, 38.4033014264434, 36.2400347268325, 33.230539516557, 30.816214031517, 29.493776099706, 28.9641221620517, 29.3271399473768, 30.5497479471498, 32.9092924040263, 36.23602780908, 36.6766990656565, 32.9072309537322, 29.8008349575816, 27.8506153462939, 26.8255601987161, 26.7773337706284, 27.6450826739213, 29.6698279365727, 32.925219461411, 34.9915552473819, 31.6841927998324, 28.219566759529, 25.990640197895, 24.8525028738483, 24.6159871249645, 25.2752655673475, 26.9870507463537, 29.9877735491643, 33.2675296198038, 31.6015986278861, 27.8240493530138, 25.2742229688217, 23.9448603205908, 23.5140204346426, 23.9914986842046, 25.5009034820686, 28.1555920133881, 31.3075467263927, 30.7066273219751, 27.2707536503799, 24.7348022011574, 23.2637028240862, 22.7794008043094, 23.1669728824416, 24.5474786226331, 26.9949958437379, 30.2488348819328, 30.6013906923573, 27.3394012893084, 24.6326441335966, 23.0411076555662, 22.4181795795548, 22.7062561945124, 23.8692711954611, 26.163804153602, 29.606819207681, 31.2543679681834, 28.1493119289191, 25.0924674969376, 23.2520785937701, 22.4092737645517, 22.5015858777069, 23.4763598655373, 25.5208843109912, 28.9618678298617, 32.6403317308031, 30.3536019856501, 26.5991532707429, 24.2773569962831, 23.1127901052235, 22.9043583677862, 23.6093457155953, 25.3499073692444, 28.4637157202952, 32.8016120624956, 32.4896370664701, 28.3239184297021, 25.5279166849078, 24.0185490655501, 23.5330605365427, 23.8948677486768, 25.2054578354006, 27.7143031565687, 31.5869657438201, 33.7333955992785, 30.3948949895062, 27.1037601765126, 25.2161101159979, 24.3558529725873, 24.3231491126384, 25.2139427454679, 27.1233066134797, 30.3453761997478, 34.4047437237606, 33.8064220094595, 29.9215033359328, 27.3307978071688, 25.8801149514006, 25.4718657467003, 25.8501031953971, 27.1888665858689, 29.5756748124031, 32.9812339884177, 35.3068159226901, 32.6414213429246, 29.5799546795568, 27.7291120251878, 26.9050286745762, 26.9075167887431, 27.7591889971496, 29.3670540494547, 31.7578198149182, 33.5065256564295, 32.6776622084245, 30.4203840091006, 28.688025867147, 27.7417192975661, 27.4916484304414, 27.9791419175041, 29.2902681126682, 31.4107407957172, 33.4602036884894, 33.9200015192937, 32.1201008630103, 30.1453133278815, 28.7841082718969, 28.136959973426, 28.109171467367, 28.8259362791248, 30.0289196496445, 31.326134345957, 32.0708833202456, 31.4950426416152, 30.1423739250155, 29.0036769811377, 28.2190253962644, 28.1086422581195, 28.4750473325836, 29.1942813484775, 29.7608412256926, 29.6876433997282, 28.689538924267, 27.2407586615062, 26.0067421520125, 25.1638342823008, 24.8250524294419, 24.9395261449731, 25.4584143514754, 25.8777584307235, 25.6465050536004, 24.5707670056442, 23.0511544464452, 21.7615681906835, 20.9761497089273, 20.7854547053249, 21.2816973223554, 22.253260423558, 23.2052378948627, 23.4706372938485, 23.2944515491774, 23.1680235174658, 23.5290621578115, 24.4333231530622, 25.8639616096787, 27.9401749621508, 30.7364242326027, 33.9420488375473, 35.6377896682262, 33.4869702934454, 30.5820901568128, 28.3404467791117, 26.8270077060156, 26.0018669972732, 25.9446717292131, 26.5828002183748, 28.0360464264943, 30.0958735279379, 31.2921110009257, 29.5253906387702, 26.6971475290807

A: To advance the cause,
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

Converts to hex dump
89618bbe 052317bd ffb56d3e 100643bd ff9c623e a93f0fbd 60b1633e a6029dbc e0be6e3e 044615bc 1bce7c3e 10b418bc cdd4823e 523b96bc e0ab823e 1d86f5bc cba97d3e 6c6f19bd 898c723e 1dc918bd c8206b3e a278fabc 19e1693e b241adbc 52b36e3e 2d355ebc 76da763e 3d932fbc c8b67e3e 64265bbc fe5f813e b755a3bc 13eb803e 0638dfbc bd527c3e 78e502bd 8b5f753e 265704bd 13b36f3e b3f7e7bc a9e86d3e 306fb2bc ccea703e 51f283bc 4631763e 2ac550bc 79d77c3e c4745ebc cfef803e a54796bc 6b4f813e 901bcebc 3db57e3e 7061ffbc 22d2773e 866b08bd 6105713e fd52fcbc 5e4c6d3e 6125c9bc 4d736e3e 2d458dbc 8f44743e 6ac545bc 30937c3e a6b53fbc 1ab2813e 082189bc 4bc8823e cf5dcdbc a7da803e e08408bd d349793e db5318bd f9e86f3e f1230fbd 0c486a3e 5eb1dfbc 27f36a3e e82391bc e3fc713e a6bd2cbc 63a67c3e 4ae818bc a4fa823e 73987bbc 88a5843e b62bd8bc c23b823e f12818bd 8a92793e ee282ebd 4cb96d3e 637f23bd d860663e 5c70fabc 85da663e 9f1498bc d4246f3e 20e720bc 2cd87b3e 72630abc 2c52833e 998080bc 70fc843e a6cbeabc 23da813e 96d126bd aae8763e e3973cbd 276d693e 09492cbd d4c6613e fb49fabc 8c87633e 47b28bbc 20df6d3e 3728fcbb 28487c3e 3cb4eabb daf1833e b88885bc e837853e 5507fdbc c44d813e 547b33bd 5807743e d52f47bd e9bd653e ae4c31bd 40615e3e eb26f8bc 8319613e a5cf82bc 54b86c3e 1b86d8bb ab087c3e 9a2fe0bb e2da833e 45578cbc d5c5843e 2c7505bd 5542803e b59e3abd bb3e713e c5d34bbd 0eda623e 30f331bd d0d55b3e 4072f6bc 8e245f3e 8b377dbc 87466b3e abadd1bb 2ea77a3e f984e9bb 57f8823e 2d328fbc 5ec1833e 06ab06bd 7b7f7e3e f04b3abd 746d6f3e ddf94abd 966a613e 6bc331bd 677d5a3e bca9f8bc 5a675d3e b30f85bc 67b6683e a464efbb b022773e 85b9f9bb 82fa803e c60c8bbc 3fea813e b542febc bedb7b3e 9c382fbd d8186e3e 137f3fbd ef02613e af7029bd 4c6f5a3e 0fabf1bc a7d55c3e 806585bc eb06673e 707100bc 777a743e 3b88f7bb beb37e3e 05ec80bc b88a803e dedae8bc d53d7a3e 201922bd 00e56d3e cc6c33bd 46af613e f46d21bd f2e85a3e e809ecbc 58495c3e fa5e88bc 2332653e c54e00bc d69c713e 81ead5bb 73057c3e ded255bc 0a8e7f3e 4beac8bc 84bd7a3e 55c811bd 0e19703e d68927bd 5f66643e 0ebc1dbd 72b85c3e 4e69f4bc 213c5c3e bfd797bc c0d3623e b7d81bbc b1996d3e ea9ad1bb 22e7773e a51d2bbc 71f37c3e 9ddda1bc c8c97a3e 7ab3f5bc 8a78723e 1ea114bd 8419683e 993614bd 4b30603e ba3ff2bc 4f025e3e 299da3bc 7169623e 6c1935bc f46b6b3e 93e8d7bb 532c753e 16d908bc d5747b3e f68281bc 07857b3e 843dcebc d9a6753e 79f503bd 97826c3e 0f360bbd 9b6f643e 74f4f3bc 4bb6603e 9e3bb0bc e40f633e 892351bc 44536a3e d6f1e8bb 0ec8733e e2b7e6bb 1a6c7b3e a3c04dbc 13ca7d3e e497afbc 0d377a3e f4a9f3bc bd49723e 71260bbd d381693e cf3905bd 7e85633e fc4ed8bc 5b90623e af3d92bc e533673e 184f2ebc 595a6f3e 4148febb b0b3773e 872324bc 1eb27c3e e7a489bc 8b647c3e 6ae1cebc 77e2763e 1d4401bd c8956e3e a61208bd f408673e 349ff2bc 1927633e ee08b7bc 64c4643e e01165bc ff356b3e 427e04bc ddec733e e437e4bb 40e07b3e 165039bc 36977f3e 05e59ebc 9ba67d3e 8d41e6bc 9a95763e 004a0abd bb6c6d3e 10130cbd e6ec653e 6f65ebbc e258633e 547ba3bc e2d6663e 363035bc 72a16f3e b5b9b4bb ecaa7a3e 1393d4bb 1da5813e 27cc68bc f0cb823e 9dbdd4bc 2eab7f3e 154c18bd d783733e 1ff22ebd a5f3653e 98f221bd 16f05c3e 5099e8bc a6255d3e 6a955cbc 4881673e ff146dba f71b793e 2b61313b f448853e f880dbbb 2000893e 769fdbbc 9644843e fa1445bd 8502713e 09926bbd 7489583e bb3243bd 9f6d4e3e 6052bbbc 7ae2593e 577de73a f83e743e b4aa293c 86c6853e 0ffb0bbb 15b4883e 331bcfbc 9d37833e 57ac30bd fc51753e b6a844bd 63d4673e 6bd62dbd 9a93613e b06804bd 6634623e f3a8b6bc 7a7f673e 3ff17abc 85e86e3e 447247bc a95b763e f16356bc d37d7c3e 97298fbc 91817f3e 3f2ec8bc bb3b7e3e 226904bd c471783e 9c561ebd dbb56f3e 0f7c27bd 2abe663e 8d2e19bd 8d5d613e 869fefbc f010623e f4c59abc c47a693e 25902cbc 1773753e c47f08bc d677803e 90756bbc 2b46833e 6fe6dabc

402 32-bits.
Or more nicely formatted and re-endian-ized.
Looks like values are encoded as IEEE 32-bit float scaled up by about 122 or some magic number - depending on which values  first expected value is 28.62 and the last is 31.32 map to.
  0 BE8B6189 BD172305 -0.272229  -0.036899*
  1 3E6DB5FF BD430610  0.232140* -0.047613
  2 3E629CFF BD0F3FA9  0.221302  -0.034973
  3 3E63B160 BC9D02A6  0.222356  -0.019166
  4 3E6EBEE0 BC154604  0.233150  -0.009111
  5 3E7CCE1B BC18B410  0.246880  -0.009320
  6 3E82D4CD BC963B52  0.255530  -0.018339
  7 3E82ABE0 BCF5861D  0.255218  -0.029971
  8 3E7DA9CB BD196F6C  0.247718  -0.037460
  9 3E728C89 BD18C91D  0.236864  -0.037301
 10 3E6B20C8 BCFA78A2  0.229617  -0.030575
...
195 3E615D8D BCEF9F86  0.220083  -0.029251
196 3E6210F0 BC9AC5F4  0.220768  -0.018893
197 3E697AC4 BC2C9025  0.228007  -0.010532
198 3E757317 BC087FC4  0.239697  -0.008331
199 3E8077D6 BC6B7590  0.250914  -0.014371*
200 3E83462B BCDAE66F  0.256395* -0.026721

... it is possible that they are calculated from real and imaginary components.

Note, with ignoring the first data value:
last complex pair  magnitude / first complex pair magnitude
|-0.014371 + 0.256395 * i| / | -0.036899 + 0.232140 * i| is 1.093...
Much like 31.32/28.62 is 1.094...


text:
Q: Sublime Text Case insensitive Highlight multiple words on double click When you double click or just highlight a word in sublime it matches the case. is there any way to ignore the case on highlighting a word?

A: Unfortunately, there is not. The behavior of this feature seems to be hard-coded, and is not accessible via the API or the documented preferences. Changing the options in the Find or Find and Replace search functions doesn't seem to have any effect, either. Even the color of the outline box can't be changed.


text:
Q: SharePoint DLL'S missing in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI
*

*Dear All,   I have no SharePoint installed in my PC except visual
studio and designer 2013.

*But want to program for Infopath and get the requirement done.I had installed
.MSI file from the below url and I see no dll's installed in ISAPI folder except the below existing dll's from image.

*Can any one help me where does the dll's should have got installed

https://www.microsoft.com/en-sa/download/details.aspx?id=35585

A: What you installed is SharePoint client components SDK, in order to write any managed code for InfoPath you need to install visual studio tools for applications VSTA.


text:
Q: how to add multiple command buttons inside of xamarin listview using MVVM? I am trying to create a listview where users can select the list item to view the store and also be able to click on the image to take them to the product detail.
How can I add a command in the ViewCell?
    <ListView ItemsSource="{Binding myData}" x:Name="myListView" SelectedItem="{Binding SelectedStore}" >
<ListView.ItemTemplate>
    <DataTemplate>
        <ViewCell>
        <Grid>
              <Label Text="{Binding Title}" />
              <Image Source="product.png" >
                    <Image.GestureRecognizers>
                         <TapGestureRecognizer Command="{Binding ItemTapCommand}" CommandParameter="Id" />
                    </Image.GestureRecognizers>
                </Image>
           </Grid>
        </ViewCell>
    </DataTemplate>
</ListView.ItemTemplate>

    public ICommand ItemTapCommand => new Command(ShowSelectedProductAsync());

    private async Task ShowSelectedProductAsync()
    {
      //take them to view the item detail
    }

A: The problem is that you are attempting to bind to a command that is not located on the individual item within the ListView; the BindingContext on your Image is the individual items inside your myData collection.
With other frameworks, for example, Wpf, you would simply use the RelativeSource part of binding to tell the control to look for your command on the BindingContext of another control, however this isn't possible in Xamarin Forms (RelativeSource is not supported).
What you can do is the following, but it requires your UserControl to have an x:Name:
<TapGestureRecognizer Command="{Bindind Path=BindingContext.ItemTapCommand,
                                        Source={x:Reference MyUserControl}}"
                      CommandParameter="{Binding Id}" />

What this says is to use the UserControl as the source for the binding, and the property is a nested property on that UserControl composed of BindingContext.ItemTapCommand.
As a bonus, I updated the code because I felt that you probably meant to bind the value of the Id property of each record as the command parameter, and not merely to send the string "Id" as the command parameter.


text:
Q: Return JSONP via AWS Lambda/API Gateway I'm trying to return jsonp as in callbackname(data.strified)
callback( null,
    ( !!event.cb && event.cb.length > 0 )
    ? event.cb.replace( /[^a-z0-9_]/i, '' ) + '(' + JSON.stringify( data ) + ')'
    : data
);

My quick and dirty way now returns the data and if ?cb=test is given it returns:
"test({\"valid\":false,\"data\":false})"

Is there anyway to get rid of the quotes and escape characters?
The API should work with and without callback set.

A: Given that you have this type of lambda function:
exports.handler = function(event, context) {
    var data={"test":"data"};
    context.done( null,
            ( !!event.cb && event.cb.length > 0 )
            ? event.cb.replace( /[^a-z0-9_]/i, '' ) + '(' + JSON.stringify( data ) + ')'
            : data
    );
};

When you give it an event like
{
  "cb": "callback"
}

It will give this output:
"callback({\"test\":\"data\"})"

So far, so good. Now you come to API Gateway and in Integration Response part you write this
$util.parseJson($input.json('$'))

Than you will get callback({"test":"data"}) as output when you invoke the API Gateway endpoint.

A: You can use an integration mapping template to do this. Something like this should help you to parse the Json.
$util.parseJson($input.json('$'))

Here are more details about mapping templates.

A: As Çağatay Gürtürk pointed out, you stringify your result and return it.
However, if your lambda also accepts non callbacks, you can check in the VTL template:
API Gateway and in Integration Response part:
#if($input.params('callback') != "")
$util.parseJson($input.json('$'))
#else
$input.json('$')
#end


text:
Q: Can´t deploy my .war file in tomcat 7 using ANT and via the tomcat-manager I'm having problems when deploying my web application in my tomcat 7 web server. I've tried by deploying my war file via ant and I get the following error:
 java.lang.NoClassDefFoundError: Could not initialize class java.nio.file.TempFileHelper
 [java]     at java.nio.file.Files.createTempFile(Unknown Source)
 [java]     at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
 [java]     at sun.net.www.protocol.jar.URLJarFile$1.run(Unknown Source)
 [java]     at java.security.AccessController.doPrivileged(Native Method)
 [java]     at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
 [java]     at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
 [java]     at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
 [java]     at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
 [java]     at sun.net.www.protocol.jar.JarURLConnection.getJarFile(Unknown Source)
 [java]     at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:507)
 [java]     at org.apache.catalina.startup.TldConfig.access$100(TldConfig.java:59)
 [java]     at org.apache.catalina.startup.TldConfig$TldJarScannerCallback.scan(TldConfig.java:332)
 [java]     at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:234)
 [java]     at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:159)
 [java]     at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:306)
 [java]     at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:585)
 [java]     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 [java]     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
 [java]     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4974)
 [java]     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
 [java]     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
 [java]     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
 [java]     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
 [java]     at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:925)
 [java]     at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
 [java]     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
 [java]     at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1343)
 [java]     at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:294)
 [java]     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 [java]     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
 [java]     at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1235)
 [java]     at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1393)
 [java]     at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1403)
 [java]     at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1382)
 [java]     at java.lang.Thread.run(Unknown Source)

The web application's folder is created in my tomcat webapps folder, but when trying to access the application via:

http://localhost:8080/Natura_WEB

I get a 404 error telling that the application doesn't exist.
I also tried deploying my application via the tomcat-manager and it says that the application was deployed correctly, but it doesn't come in the tomcat application listing, but the folder is also created in the webapps directory and when I try to access in the browser I get the same error that before.
I know this is definitively a tomcat failure because I try to deploy exactly the same war file in another computer and it worked perfectly.
Any suggestions about how I can fix this problem?

A: it is not getting deployed properly, because it is not able to locate the dependency jars.
it is not able to find this class "java.nio.file.TempFileHelper"
Try to locate that class, figure out which jar contains that file.
and put that jar in WEB-INF/lib and try deploying again. it should work.


text:
Q: 'No module named flask', when I run through a URL My files are placed as below in the apache shared hosting server -
/public_html/cgi-bin
 --- myenv (directory - virtual env)
 --- hello.cgi
 --- myapp.py

the .htaccess is in the root directory.
Now when I activate the virtual environment and run the myapp.py file  -
python myapp.py

this works fine. I get this -
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

But now when I try to launch my page in the web browser, I get the below Import error in the logs (on the web page its 500 - Internal Server Error) -
 'No module named flask'

Please suggest if I need to give the path of the flask package anywhere in the .cgi or the .py file.
flask is installed in the myenv : myenv/lib/python2.6/site-packages
myapp.py file:
#!/usr/bin/env python
import sys

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello Ejaz"

if __name__ == "__main__":
    app.run()

hello.cgi file:
#!/usr/bin/env python

import os
from wsgiref.handlers import CGIHandler
from myapp import app

os.environ['SERVER_NAME'] = "www.mypage.com"
os.environ['SERVER_PORT'] = ""
os.environ['REQUEST_METHOD'] = 'GET'
os.environ['PATH_INFO'] = ""

CGIHandler().run(app)

Thank you.

A: You've specified the system python in the first line of your cgi file. Instead, point it to the python executable of your virtualenv.

A: Refer here - http://www.comfycoder.com/home/how_to_deploy_a_flask_app_in_apache_shared_hosting
updated my hello.cgi to this-
#!/usr/bin/env python

import os
from wsgiref.handlers import CGIHandler
from myapp import app

CGIHandler().run(app)

and added these lines in myapp.py -
import os
import sys
sys.path.insert(0, '/home/username/public_html/cgi-bin/myenv/lib/python2.6/site-packages')

It works fine.


text:
Q: ODBC Doesn't want to connect with pdo I'm currently trying to make a connection between an SQL server and php website. I tried with odbc_connect and everything is working "fine" but i would like to use "PDO" but i have an error with it.

    $server = 'SRV';
    $database = 'NOUVO_DB';
    $user = 'tUSERNAME';
    $password = 'XXXXX';

    $connection = odbc_connect("Driver={SQL Server Native Client 11.0};Server=$server;Database=$database;", $user, $password);
    print_r($connection);

    $sql = 'SELECT * FROM personnelVisiteur';
    $result = odbc_exec($connection, $sql);  //returns data

    while(odbc_fetch_row($result)){

        for($i=1;$i<=odbc_num_fields($result);$i++){
            echo "Result is ".odbc_result($result,$i) .'
';
        }
    }

    echo '
PDO:
';

    try {
        $pdo_con = new PDO("odbc:Driver={SQL Server Native Client 11.0}", $user, $password);
        print_r($pdo_con);
    } catch (PDOException $exception) {
      echo $exception->getMessage();
      exit;
    }

Output :
ODBC CONNECT:

Resource id #2

PDO:
SQLSTATE[HY090] SQLConnect: 0 [Microsoft][Gestionnaire de pilotes ODBC] Longueur de cha�ne ou de m�moire tampon non valide =>  Invalid string or buffer length

Thanks.
Maybe an error with 64bits server ?

A: That was my bad, i guess :
If anyone has an issue :
$pdo_con = new PDO("odbc:Driver={SQL Server Native Client 11.0};server=$server;database=$database", $user, $password);

You need to specify in first param :
"odbc:Driver{DRIVER NAME};server=$server;database=$database"


text:
Q: Minimum of $\sqrt {{x^2} + \frac{1}{{{x^2}}}} + \sqrt {{y^2} + \frac{1}{{{y^2}}}} + \sqrt {{z^2} + \frac{1}{{{z^2}}}} $? I have been ponder around a difficult Vietnamese University entrance exam of the year 2003
that is to find the minimum of $\sqrt {{x^2} + \frac{1}{{{x^2}}}}  + \sqrt {{y^2} + \frac{1}{{{y^2}}}}  + \sqrt {{z^2} + \frac{1}{{{z^2}}}} $  given that $x + y + z \le 1$ ?  and x,y,z are all greater of equal to zero
The answer for this problem $\sqrt {82}$, is there anyway we could find the minimum of this problem from the convex optimization point of view because the term $\sqrt {{x^2} + \frac{1}{{{x^2}}}}$ is convex on the interval [0,1]
Also is there any underlying hidden convex structure in this problem (least square, second order cone , quadratic...) ?
Thank you very much for your enthusiasm !

A: As you point out, the function is convex on the standard simplex $\Delta^2$. Therefore, for all $(x,y,z) \in \Delta^2$, the function value at the average is less than or equal to the average of the function values:
$$f(m,m,m) \leq (f(x,y,z) + f(x,z,y) + f(y,x,z) + f(y,z,x) + f(z,x,y) + f(z,y,x))/6,$$
with $m=(x+y+z)/3$.
Due to symmetry:
$$f(x,y,z) = f(x,z,y) = f(y,x,z) = f(y,z,x) = f(z,x,y) = f(z,y,x),$$
and therefore:
$f(m,m,m) \leq f(x,y,z)$
for all $(x,y,z) \in \Delta^2$. The minimum is therefore attained at $x=y=z=1/3$.


text:
Q: Page content does not display in frame instead it shows the page object name I am trying to implement basic navigation in UWP, all according to https://learn.microsoft.com/en-us/windows/uwp/design/basics/navigate-between-two-pages.
I've made the example as simple as possible. Made a main application window, with a frame and 2 buttons in it. Clicking a button will navigate the frame to display the content of page 1 or 2 respectively. The page contain as simple textblock
Code compiles and runs, navigating the frame works, however instead of the content of the page (the XAML content that is), it shows the name of the page object (i.e. ConceptTestApp.Page1 resp. ConceptTestApp.Page2) instead of the content of the page (i.e. the textblock 'This is Page 1' resp. 'This is Page 2').
I cannot see what I am doing wrong here. Any help greatly appreciated.
Application XAML
<Window x:Class="ConceptTestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ConceptTestApp"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <Button x:Name="btnPage1" FontSize="14" Height="20" Width="120" Content="Ga naar Pagina 1" Click="BtnPage1_Click" Margin="10,0"  />
                <Button x:Name="btnPage2" FontSize="14" Height="20" Width="120" Content="Ga naar Pagina 2" Click="BtnPage2_Click" Margin="10,0"  />
            </StackPanel>
            <Frame x:Name="rootFrame" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" NavigationUIVisibility="Hidden" Width="600" Height="450"/>
        </StackPanel>

    </Grid>
</Window>

Application code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ConceptTestApp
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.rootFrame.Navigate(typeof(Page1));

        }

        private void BtnPage1_Click(object sender, RoutedEventArgs e)
        {
            // go to Pagina 1

            this.rootFrame.Navigate(typeof(Page1));
        }

        private void BtnPage2_Click(object sender, RoutedEventArgs e)
        {
            // go to Pagina 2

            this.rootFrame.Navigate(typeof(Page2));
        }
    }
}

Page1 XAML
<Page x:Class="ConceptTestApp.Page1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ConceptTestApp"
      mc:Ignorable="d"
      d:DesignHeight="400" d:DesignWidth="600"
      Title="Page1">

    <Grid>
        <TextBlock x:Name="pageTitle" FontSize="36" >This is Page 1</TextBlock>
    </Grid>

</Page>

Page2 XAML
<Page x:Class="ConceptTestApp.Page2"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ConceptTestApp"
      mc:Ignorable="d"
      d:DesignHeight="400" d:DesignWidth="600"
      Title="Page2">

    <Grid>
        <TextBlock x:Name="pageTitle" Text="This is Page 2" FontSize="24" />
    </Grid>
</Page>

(both pages don't have any code behind, only default init code)

A: It looks like you doing a WPF application rather than a UWP application. This does work in a UWP application if you use MainPage
For example,
<Page
    x:Class="PageIssueSOF.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PageIssueSOF"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    >

    <Grid>
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <Button x:Name="btnPage1" FontSize="14" Height="20" Width="120" Content="Ga naar Pagina 1" Click="BtnPage1_Click" Margin="10,0"  />
                <Button x:Name="btnPage2" FontSize="14" Height="20" Width="120" Content="Ga naar Pagina 2" Click="BtnPage2_Click" Margin="10,0"  />
            </StackPanel>
            <Frame x:Name="rootFrame" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="600" Height="450"/>
        </StackPanel>

    </Grid>
</Page>

On a side note NavigationUIVisibility="Hidden" is not available in UWP so has been removed in the example above.

A: It seems you create a WPF application. And in WPF, when you use Frame.Navigate, it is different with UWP, you need to pass the page object instead of Type.
private void BtnPage1_Click(object sender, RoutedEventArgs e)
{
    // go to Pagina 1
    this.rootFrame.Navigate(new Page1());
}

private void BtnPage2_Click(object sender, RoutedEventArgs e)
{
    // go to Pagina 2
    this.rootFrame.Navigate(new Page2());
}


text:
Q: Running setTimeout indefinitely in JavaScript as an event handler I building a page that will depend entirely on JavaScript.
Whenever a user clicks a link or button, it changes the hash value of the URL (#doSomething).
I have setup a function the check the hash value every 200ms for changes, in other words a custom event handler, and run some code depending on what the value is. Right now it seems to be fine since I am still in the development process and my page is pretty light.
Here is my question is it ok to have a script run indefinitely checking this value? or is going to affect performance when the page has more content and stuff to work with?
Is there  a better way to setup a script to detect the changes of the URL hash?
Here is my script:
var currenthash = (window.location.hash)?window.location.hash: '';
addEvent(window,'load',function () {
    if (currenthash != ''){
        hashChanged();
    }
    var timeInterval = setInterval(function () {
        if (window.location.hash != currenthash) {
            hashChanged();
            currenthash = window.location.hash;
        }
    },1000);
});

var hashChanged = function (str) {
    var id = window.location.hash.replace("#",'');
    var selected = $id(id);
    // do some more stuff

    }
}

A: It shouldn't be an issue if it is checking every 1000 milliseconds (I usually run mine at 100), but consider using the native event handler (hashchange) if it exists...
if ('onhashchange' in window) {
    addEvent(window, 'hashchange', hashChanged);
} else {
   // Poll like normal.
}

This will be save you having to poll in modern browsers supporting this event.

A: If the hash only changes on clicks, why not a click listener on the document, no need for setInterval or setTimeout at all and your function only runs when it needs to.

A: As long as the interval isn't too short, there is no problem with it.


text:
Q: What might be the best way to implement an XML API with 10000+ parallel sync and async calls per second in Python I'm developing a client and a server in Python 3.9 to implement an existing XML API. The system should be able to handle up to 15k requests per second. The system is a middle link between two other servers which communicate with each other using it. Some of the API calls are synchronous, and the others are asynchronous. Another abnormal part of the system is that on some of the requests, it should first return an HTTP response and then send data as a separate message.
I am thinking of using AIOHTTP as a base to implement this system. I've built a test client/server system where the server continuously sends requests to the client, and the client does some basic operations and returns a response. Using a default configuration, I only got up to 1300 calls per second.
Is there a right way to handle this problem? Is AIOHTTP the best solution? Should I consider using multiprocessing? Thanks!
I'm adding portions of code where I initialize servers and send requests.
The first node, which currently only gets requests and counts them.
count = 0

async def handle(request):
    data = await request.text()
    api = await parse(data)  # dummy function
    return web.Response(status=200)

async def init():
    app = web.Application()
    app.add_routes([web.post('/etc/', handle)])
    app_runner = web.AppRunner(app)
    await app_runner.setup()
    site = web.TCPSite(runner=app_runner, host='127.0.0.1', port=8002)
    await site.start()

async def calc_reqs():
    global count
    while True:
        count = 0
        await asyncio.sleep(1)
        print(count)

loop = asyncio.get_event_loop()
loop.run_until_complete(init())
loop.run_until_complete(calc_reqs())
loop.run_forever()

The second node that sends requests.
async def init():
    app = web.Application()
    app.add_routes([web.post('/etc/', handle)])
    app_runner = web.AppRunner(app)
    await app_runner.setup()
    site = web.TCPSite(runner=app_runner, host='127.0.0.1', port=8001)
    await site.start()

async def send_request(session):
    await session.post('http://localhost:8002/etc/',
                       data=data,
                       headers={'Content-Type': 'application/xml'})

async def task():
    connector = aiohttp.TCPConnector(limit=10000000, limit_per_host=10000000)
    async with aiohttp.ClientSession(connector=connector) as session:
        while True:
            tasks = []
            for x in range(0, 15000):
                tasks.append(asyncio.create_task(send_request(session)))
            task = asyncio.gather(*tasks)
            await task

loop = asyncio.get_event_loop()
loop.run_until_complete(init())
loop.run_until_complete(task())


text:
Q: How to edit Columns in GraphFrame Aggregate Messages? I am pretty new to GraphFrames and Scala. I am writing some sort of label propagation algorithm (very different from the library one). Essentially each vertex has an array "memVector" and the edge has a float value "floatWeights". I want to update each vertex's memVector to the be the sum of (floatWeights * memVector) from all of its neighbors. This is the code I have written for the same:
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.SQLContext
import org.apache.spark.SparkContext
import org.graphframes._
import org.graphframes.lib.AggregateMessages
import org.apache.spark.sql.functions.udf

val sqlContext = new SQLContext(sc)

val edges = spark.read.parquet("code/SampleGraphEdge")
val vertices = spark.read.parquet("code/SampleGraphVer")

val toInteger: String => Int = _.toInt
val toIntegerUDF = udf(toInteger)
val newEdges = edges.withColumn("floatWeights", toIntegerUDF('weights)).drop("weights")

val graph = GraphFrame(vertices, newEdges)
val AM = AggregateMessages

val msgToSrc = AM.dst("memVector")
val msgToDst = AM.src("memVector")
val msgFromEdge = AM.edge("floatWeights")

def aggfunc(msg: org.apache.spark.sql.Column) = sum(msg.getField("weights") * AM.msg.getField("memVector"))

val agg = graph.aggregateMessages.sendToSrc(msgToSrc).sendToDst(msgToDst).sendToSrc(sendFromEdge).sendToDst(sendFromEdge).agg(aggfunc(AM.msg).as("UpdatedVector"))

Now the aggfunc I wrote is not right as I cannot multiply an array and a float directly. I am running the above in spark-shell and I am getting the following error at the last line:
org.apache.spark.sql.AnalysisException: Can't extract value from MSG#750;
at org.apache.spark.sql.catalyst.expressions.ExtractValue$.apply(complexTypeExtractors.scala:73)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$apply$9$$anonfun$applyOrElse$5.applyOrElse(Analyzer.scala:613)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$apply$9$$anonfun$applyOrElse$5.applyOrElse(Analyzer.scala:605)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$2.apply(TreeNode.scala:312)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$2.apply(TreeNode.scala:312)
at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:69)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:311)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:328)
at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:186)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformChildren(TreeNode.scala:326)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:328)
at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:186)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformChildren(TreeNode.scala:326)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:328)
at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:186)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformChildren(TreeNode.scala:326)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$4.apply(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$5.apply(TreeNode.scala:328)
at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:186)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformChildren(TreeNode.scala:326)
at org.apache.spark.sql.catalyst.trees.TreeNode.transformUp(TreeNode.scala:305)
at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionUp$1(QueryPlan.scala:269)
at org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2(QueryPlan.scala:279)
at org.apache.spark.sql.catalyst.plans.QueryPlan$$anonfun$org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2$1.apply(QueryPlan.scala:283)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at org.apache.spark.sql.catalyst.plans.QueryPlan.org$apache$spark$sql$catalyst$plans$QueryPlan$$recursiveTransform$2(QueryPlan.scala:283)
at org.apache.spark.sql.catalyst.plans.QueryPlan$$anonfun$8.apply(QueryPlan.scala:288)
at org.apache.spark.sql.catalyst.trees.TreeNode.mapProductIterator(TreeNode.scala:186)
at org.apache.spark.sql.catalyst.plans.QueryPlan.transformExpressionsUp(QueryPlan.scala:288)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$apply$9.applyOrElse(Analyzer.scala:605)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$apply$9.applyOrElse(Analyzer.scala:547)
at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan$$anonfun$resolveOperators$1.apply(LogicalPlan.scala:61)
at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan$$anonfun$resolveOperators$1.apply(LogicalPlan.scala:61)
at org.apache.spark.sql.catalyst.trees.CurrentOrigin$.withOrigin(TreeNode.scala:69)
at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveOperators(LogicalPlan.scala:60)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$.apply(Analyzer.scala:547)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$.apply(Analyzer.scala:484)
at org.apache.spark.sql.catalyst.rules.RuleExecutor$$anonfun$execute$1$$anonfun$apply$1.apply(RuleExecutor.scala:85)
at org.apache.spark.sql.catalyst.rules.RuleExecutor$$anonfun$execute$1$$anonfun$apply$1.apply(RuleExecutor.scala:82)
at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
at scala.collection.immutable.List.foldLeft(List.scala:84)
at org.apache.spark.sql.catalyst.rules.RuleExecutor$$anonfun$execute$1.apply(RuleExecutor.scala:82)
at org.apache.spark.sql.catalyst.rules.RuleExecutor$$anonfun$execute$1.apply(RuleExecutor.scala:74)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:74)
at org.apache.spark.sql.execution.QueryExecution.analyzed$lzycompute(QueryExecution.scala:65)
at org.apache.spark.sql.execution.QueryExecution.analyzed(QueryExecution.scala:63)
at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:51)
at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:64)
at org.apache.spark.sql.RelationalGroupedDataset.toDF(RelationalGroupedDataset.scala:62)
at org.apache.spark.sql.RelationalGroupedDataset.agg(RelationalGroupedDataset.scala:222)
at org.graphframes.lib.AggregateMessages.agg(AggregateMessages.scala:127)
... 50 elided

Am I approaching it right? Any workarounds/solutions will be greatly appreciated.


text:
Q: file-based NoSql database? I am interested in building a web app (PHP5) based on a NoSql database (with structs storage, like MongoDB).
But I am also a big fan of SQLite spirit and not having to bother about configuring a separate server.
Do you know of any file-based NoSQL database ?
Thanks in advance,
Raphael

A: you can use unqlite + php-ext-unqlite

UnQLite is a in-process software library which implements a self-contained, serverless, zero-configuration, transactional NoSQL database engine. UnQLite is a document store database similar to MongoDB, Redis, CouchDB etc. as well a standard Key/Value store similar to BerkeleyDB, LevelDB, etc.
A complete database with multiple collections, is contained in a single disk file. The database file format is cross-platform, you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.

or use MongoLite

Schemaless database on top of SqLite

or use SDB

A: There are many key-value open-source databases that can be linked directly into your application. Here are a few:

*

*BerkeleyDB (now Oracle embedded database)

*Tokyo cabinet (hash table based)

*hamsterdb (disclaimer: i'm the author)

I'm not sure if BDB or TC offer PHP bindings. hamsterdb does not (yet).


text:
Q: How to scale a movie clip in flash with buttons on top of it my question is:
Is there a way to fix a button's position in flash, in relation to a movie clip?
The thing is, I want to be able to zoom in and out of a movie clip, which has some buttons on top, but the buttons have to be placed in specific parts of the movie clip. When the clip is resized, the buttons don't change their position/scale in relation to the clip. Help please!

A: If you nest the buttons on the timeline of the movieclip you are scaling they should scale with it because they are parts of that symbol.


text:
Q: Setting up Cairo Project I am trying to set up the Cairo-0.3 project and my rserver.sh, receiver.sh and transmitter.sh are successfully running but when i try to run execute the demo-recog.sh (A demo program in cairo) i get :
Received an unhandled SIP response status code (ignoring it): 183 : Session progress

2012-07-16 18:01:31,931 INFO  {main} org.speechforge.cairo.demo.recog.RecognitionClient
 Received the SIP Response.
2012-07-16 18:01:31,931 INFO  {main} org.speechforge.cairo.demo.recog.RecognitionClient
  invite : org.speechforge.cairo.sip.SdpMessage@1e61363
java.lang.NullPointerException
2012-07-16 18:01:32,067 WARN  {Thread-7} org.speechforge.cairo.rtp.RTPPlayer
 playSource(): encountered unexpected exception:
javax.media.NoDataSourceException: Error instantiating class:   com.sun.media.protocol.dsound.DataSource : java.lang.NullPointerException
    at javax.media.Manager.createDataSource(Manager.java:1012)
    at org.speechforge.cairo.rtp.RTPPlayer.playSource(RTPPlayer.java:110)
    at org.speechforge.cairo.rtp.NativeMediaClient$TransmitThread.run(NativeMediaClient.java:105)
 Exception in thread "Thread-7" java.lang.RuntimeException: playSource() encountered unexpected exception
    at org.speechforge.cairo.rtp.RTPPlayer.playSource(RTPPlayer.java:153)
    at org.speechforge.cairo.rtp.NativeMediaClient$TransmitThread.run(NativeMediaClient.java:105)
Caused by: javax.media.NoDataSourceException: Error instantiating class:   com.sun.media.protocol.dsound.DataSource : java.lang.NullPointerException
    at javax.media.Manager.createDataSource(Manager.java:1012)
    at org.speechforge.cairo.rtp.RTPPlayer.playSource(RTPPlayer.java:110)
    ... 1 more
2012-07-16 18:01:42,085 WARN  {main} org.speechforge.cairo.demo.recog.RecognitionClient
 org.mrcp4j.client.MrcpInvocationException: MRCP response contains an error code, the request invocation did not complete successfully.

org.mrcp4j.client.MrcpInvocationException: MRCP response contains an error code, the request invocation did not complete successfully.
    at org.mrcp4j.client.MrcpChannel.sendRequest(MrcpChannel.java:143)
    at   org.speechforge.cairo.demo.recog.RecognitionClient.doRecognize(RecognitionClient.java:163)
    at   org.speechforge.cairo.demo.recog.RecognitionClient.main(RecognitionClient.java:346)

2012-07-16 18:01:42,091 INFO  {main} org.speechforge.cairo.sip.SimpleSipAgent
 Sent a SIP BYE.

I am not able to understand what i am doing wrong here.

A: You need to install and configure Java Media Framework in order to run this software. See installation instructions in README:

Installation

*

*Extract Cairo
  To install Cairo, extract all files from the binary distribution archive to a directory of your ch

*Download and Install JMF 2.1.1   Cairo requires Java Media Framework (JMF) version 2.1.1. which can be downloaded here:
http://java.sun.com/products/java-media/jmf/2.1.1/download.html
  Download and run the JMF installer that corresponds to your specific
  operating system.  This will


text:
Q: Unable to load content in iframe, " X-frame options to deny." Ideally in our project, a third party application is hosting Visual force pages in a iframe. Is it failing on all the browsers, saying unable to load the content or X-FRAME OPTIONS TO DENY.
Can someone please guide me over this.


text:
Q: Where is RESTful API parameter URL-decoded? I have a Spring-based RESTful API which is deployed to a Tomcat server. When I call this API like below (value of "para" has been URL-encoded) and debug it, value of "para" in controller method is "aaa bbb" which has already been URL-decoded.

*

*GET http://MY-TOMCAT-SERVER/SOME-PATH?para=aaa%20bbb
However, when I run a SpringBoot-based local Test Automation case (not deployed anywhere) to test the same API, the value of "para" in controller method hasn't been URL-decoded.
Question is, what is the difference between the two scenarios and where is "para" URL-decoded in the first scenario?

A: Hopefully I can give you a hint for the first part of your question:
The Apache Tomcat server.xml contains an tag Connector, this tag can have an optional attribute URIEncoding. Example:
<Connector connectionTimeout="20000"
           port="8080"
           protocol="HTTP/1.1"
           redirectPort="8443"
           URIEncoding="UTF-8" />

So I think that Tomcat is responsible for the URI encoding. But I do not know how this is activated in an Embedded-Spring-Boot-Tomcat.

*

*@See: How does URIEncoding = 'UTF-8' work?

*@See: Apache Tomcat 8 Configuration Reference / The HTTP Connector


text:
Q: play pause multiple vimeo videos I have found a solution to starting/pausing multiple vimeo videos from seperate buttons, but I would like to use images for the play and pause buttons.
Can anyone help me ammend the code? I guess I need to replace the html button code with images and then reference them in the javascript, but I can't seem to get it to work.
Many thanks.
my html is:

Player 1

            <button class="simple" id="api_play">Play</button>
            <button class="simple" id="api_pause">Pause</button>

Player 2

            <button class="simple" id="api_play">Play</button>
            <button class="simple" id="api_pause">Pause</button>

The javascript is:
 var VimeoEmbed = {};

        VimeoEmbed.init = function(e)
        {
            //Listen to the load event for all the iframes on the page
            $('iframe').each(function(index, iframe){
                iframe.addEvent('onLoad', VimeoEmbed.vimeo_player_loaded);
            });
        };

        VimeoEmbed.vimeo_player_loaded = function(player_id)
        {
            $('#'+player_id).prev('.api_output').append('VimeoEmbed.vimeo_player_loaded ' + player_id+'
');

            var loop = 0;
            var volume = 100;

            //Simple Buttons
            $('#'+player_id).nextAll('button.simple').bind('click', {'player_id': player_id}, function(e){
                var iframe = $('#'+e.data.player_id).get(0);
                iframe.api( $(e.target).attr('id'), null );
            });

            //API EVENT LISTENERS
            VimeoEmbed.setupAPIEventListeners($('#'+player_id).get(0));
        };

        //On document ready
        $(document).ready(VimeoEmbed.init);

A: I think it'll be something like this

Player 1

And in the js
     VimeoEmbed.vimeo_player_loaded = function(player_id)
    {
        $('#'+player_id).prev('.api_output').append('VimeoEmbed.vimeo_player_loaded ' + player_id+'
');

        var loop = 0;
        var volume = 100;

        //Simple Buttons
        $('#'+player_id).nextAll('img.simple').bind('click', {'player_id': player_id}, function(e){
            var iframe = $('#'+e.data.player_id).get(0);
            iframe.api( $(e.target).attr('id'), null );
        });

        //API EVENT LISTENERS
        VimeoEmbed.setupAPIEventListeners($('#'+player_id).get(0));
    };


text:
Q: Bizarre Behavior with REGEXP_MATCH in Google Big Query I'm seeing very bizarre behavior with the REGEXP_MATCH function in google big query. The function appears to work perfectly fine for public data but is not working on my dataset. I have a dataset imported from the csv with the first two lines (first is header row which all becomes the schema where everything is a string), there's a lot more but the following is the only relevant data for this case.
"id","common_name","botanical_name","low_hardiness_zone","high_hardiness_zone","type","exposure_min","exposure_max","moisture_min","moisture_max"
"plant1","Abelia","Abelia zanderi 'Conti (Confetti)'","5b","9a","Shrub","Partial Sun","Full Sun","Dry","Dry"

When I run the query:
SELECT * FROM [PlantLink_Plant_Types.plant_data_set]
WHERE REGEXP_MATCH('common_name',r'.*')

I get every result.
However, when I run the query:
SELECT * FROM [PlantLink_Plant_Types.plant_data_set]
WHERE REGEXP_MATCH('common_name',r'A.*')

I get no results, which is really weird because the plant common name Abelia starts with an A.
Now my regex magic is not that strong, but I am pretty sure the pattern is not at fault. Additionally I've run the public dataset test queries with REGEXP_MATCH and they run correctly. Does anyone have any clue why REGEXP_MATCH would not always function as advertised?

A: Issue is the string 'common_name' does not start with 'A'.
Check this:

*

*REGEXP_MATCH('common_name',r'.*'): All results.

*REGEXP_MATCH('common_name',r'A.*'): No results.

*REGEXP_MATCH('common_name',r'c.*'): All results.

*REGEXP_MATCH(common_name,r'A.*'): All results that somewhere have an 'A'.

:)

A: Note:

*

*REGEXP_MATCH('common_name',r'.*') matches the string 'common_name'

while

*

*REGEXP_MATCH(common_name,r'.*') matches a field in your table that is called common_name

the 1st one is always true and therefore you get all results.
I guess you wanted to refer the content of the field, so you need to use the second one.

*

*REGEXP_MATCH(common_name,r'A.*') should return all records that field common_name contains "A".

hope this helps.


text:
Q: Maven based example throws exception I'm getting a very similar problem to some others who are trying to use the spring-cloud-contract-oa3 plugin and contracts in an openapi YAML spec.
I'm using maven with 2.1.2.0 of the plugin and 3.0.3 of SCC -
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-contract-maven-plugin</artifactId>
                <version>3.0.3</version>
                <extensions>true</extensions>
                <configuration>
                    <testFramework>JUNIT5</testFramework>
                    <baseClassForTests>com.bt.b2c.oa3cdc.contracts.BaseTestClass</baseClassForTests>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>guru.springframework</groupId>
                        <artifactId>spring-cloud-contract-oa3</artifactId>
                        <version>2.1.2.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

What I'm a bit suspicious of is that the errors kind of imply the default parser is used (and hence will break). In the log below wouldn't we expect to see OpenApiContractConverter being used?
    [DEBUG] Parsed rootNode: {"openapi":"3.0.1", ..... }
    [ERROR] Unexpected error in reading contract file
    [ERROR] Cannot compare java.util.ArrayList with value '[null, null]' and java.lang.Integer with value '0'
    [WARNING] Error Processing yaml file. Skipping Contract Generation
    java.lang.IllegalStateException: Exception occurred while processing the file [E:\git\selfserve\oa3cdc\src\test\resources\contracts\incidents_openapi.yaml]
        at org.springframework.cloud.contract.verifier.converter.YamlToContracts.convertFrom(YamlToContracts.java:94)
        at org.springframework.cloud.contract.verifier.converter.YamlContractConverter.isAccepted(YamlContractConverter.java:63)
        at org.springframework.cloud.contract.verifier.file.ContractFileScanner.tryConvert(ContractFileScanner.java:320)
        at org.springframework.cloud.contract.verifier.file.ContractFileScanner.addContractToTestGeneration(ContractFileScanner.java:302)
        at org.springframework.cloud.contract.verifier.file.ContractFileScanner.appendRecursively(ContractFileScanner.java:268)
        at org.springframework.cloud.contract.verifier.file.ContractFileScanner.findContractsRecursively(ContractFileScanner.java:237)
        at org.springframework.cloud.contract.verifier.TestGenerator.generateTestClasses(TestGenerator.java:131)
        at org.springframework.cloud.contract.verifier.TestGenerator.generate(TestGenerator.java:111)
        at org.springframework.cloud.contract.maven.verifier.GenerateTestsMojo.execute(GenerateTestsMojo.java:300)

Any ideas? I suspect I've done something dumb but I don't see it

A: You are using Spring Cloud Contract in version 3.0.3 and the openapi plugin in versoin 2.1.2.0 that is incompatible with SCC 3.0.3. In my fork of the plugin at the upgrade branch I've upgraded the plugin to be compatible with SCC 3.0.x. To use it you should use jitpack.io in the following way
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-contract-maven-plugin</artifactId>
            <version>3.0.3</version>
            <extensions>true</extensions>
            <configuration>
                <testFramework>JUNIT5</testFramework>
                <baseClassForTests>com.bt.b2c.oa3cdc.contracts.BaseTestClass</baseClassForTests>
            </configuration>
            <dependencies>
                <!-- Until a Spring Cloud Contract 3.0.x compatible version gets released -->
                <dependency>
                    <groupId>com.github.marcingrzejszczak</groupId>
                    <artifactId>spring-cloud-contract-oa3</artifactId>
                    <version>upgrade-SNAPSHOT</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

<pluginRepositories>
    <pluginRepository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </pluginRepository>
</pluginRepositories>


text:
Q: generating LaTeX tabular code during compilation I use LaTeX for scientific reporting in brain imaging (fMRI). I have a tabular array in LaTeX, that contains quite a lot of rows and columns, which both are brain regions and in the each intersecting cell there is some data about their connections.
The content of this tabular array is defined separately in another .tex file that is loaded using \input command. In this another .tex file the content of each cell of the tabular array is defined separately using hundreds of \newcommand commands. In tabular array there is no other content except these \newcommand commands. tabular array is inside \begin{spreadtab} to permit some basic calculations of cells values (although this is not a requirement). Everything works fine so far.
So, the \newcommand definitions look like this:
\newcommand{\origREGIONONEdestREGIONONE}{ NA } % NA for cells on the diagonal.
\newcommand{\origREGIONONEdestREGIONTWO}{ - } % this is the default case.

...
\newcommand{\origREGINOTWOdestREGIONTWO}{ NA }
\newcommand{\origREGIONTWOdestREGIONONE}{ \ref{Spielberg1981} }
\newcommand{\origREGIONTWOdestREGIONTHREE}{ bilateral \ref{Cameron1989} }

...
There is a specific \newcommand definition for all column x row intersections.
The tabular array code looks like this (a 3x3 example but in reality it is bigger than 20x20):
\tiny
\begin{table}
    \scalebox{0.6}{
        \begin{spreadtab}{{tabular}{*{3}{c}}}
            \hline
            \to/from :={} & REGION 1 :={} & REGION 2 :={} & REGION 3 :={} \\
            \hline
            to REGIONONE :={} & \origREGIONONEdestREGIONONE :={} & \origREGIONTWOdestREGIONONE :={} &\origREGIONTHREEdestREGIONONE :={} \\
            to REGIONTWO :={} & \origREGIONONEdestREGIONTWO :={} & \origREGIONTWOdestREGIONTWO :={} &\origREGIONTHREEdestREGIONTWO :={} \\
            to REGIONTHREE :={} & \origREGIONONEdestREGIONTHREE :={} & \origREGIONTWOdestREGIONTHREE :={} &\origREGIONTHREEdestREGIONTHREE :={} \\
            \hline
        \end{spreadtab}
    } % end scalebox
    \caption{A table of connections between brain regions 1, 2 & 3}
    \begin{enumerate}
        \item \cite{Spielberg1981}\label{Spielberg1981}
        \item \cite{Cameron1989}\label{Cameron1989}
    \end{enumerate}
\end{table}
\normalsize

Now what I want is to be able to generate a similar tabular definition dynamically according to a list or an array of strings (or using any possible datatype):
in MATLAB syntax it would be: ListOfBrainRegions = { 'BRAINREGIONABC', 'BRAINREGIONDEF', 'BRAINREGIONXYZ' }
In Python syntax: ListOfBrainRegions = [ 'BRAINREGIONABC', 'BRAINREGIONDEF', 'BRAINREGIONXYZ' ]
The list or array would be translated into a code like this inside spreadtab (or without spreadtab if it causes some problems):
            \hline
            to REGIONABC :={} & \origREGIONABCdestREGIONABC :={} & \origREGIONDEFdestREGIONABC :={} &\origREGIONXYZdestREGIONABC :={} \\
            to REGIONDEF :={} & \origREGIONABCdestREGIONDEF :={} & \origREGIONDEFdestREGIONDEF :={} &\origREGIONXYZdestREGIONDEF :={} \\
            to REGIONXYZ :={} & \origREGIONABCdestREGIONXYZ :={} & \origREGIONDEFdestREGIONXYZ :={} &\origREGIONXYZdestREGIONXYZ :={} \\
            \hline

So, how should I define ListOfBrainRegions in LaTeX? And then how can I generate LaTeX code during compiling of a .tex file? If I was to program this in some other programming language, for example in MATLAB, Common Lisp or awk the task (generating program code) would not be difficult at all. It seems that LaTeX does not have built-in arrays, if ... elseif ... else commands nor for or while loops, although some packages provide some added functionality. So, how this could be implemented? Or, which LaTeX commands, packages and/or extra tools should I use for this task?
Thank you for any help :)


text:
Q: What is the expected value of rolling $n$ dice and keeping the best $k$ of them? Recently a friend posed me a problem:
You have $n$ dice, all of which have integer values ranging from $1$ to $j$, take on each of those values with probability $\frac{1}{j}$, and are independent of each other. If you roll those $n$ dice, then take the $k$ highest values that appear and sum them together, what is the expected value of this sum?
Now, when $k = 1$, this is simply the expected value of the maximum of $n$ i.i.d. random variables, which is not difficult to compute. But it becomes significantly trickier for even $k = 2$ (as then you are trying to maximize over the sum of two dice, which need not be independent), and so I am curious if anyone here has any good ideas.
Thank you in advance for your help!

A: The term you're looking for is "order statistics". The expectation of the sum of the largest $k$ values is equal (by linearity of expectation) to the sum of the expectations of the highest $k$ order statistics.
Calculating those expectations in closed form is not trivial, but for your specific dice setup one could certainly write the answer as a summation and calculate it. Another example of estimating expectations of order statistics can be found in these notes.

A: Thank goodness for Wikipedia and for Greg Martin letting me know what to look for. Using this page -- https://en.m.wikipedia.org/wiki/Order_statistic#Dealing_with_discrete_variables -- one can arrive at this answer:
$$\mathbb{E}(\text{Roll } X \text{ d}Y \text{ and keep } Z) =$$ $$\sum_{k=0}^{Z-1} \sum_{j=1}^Y j \sum_{l=0}^k \binom{X}{l}\Big(\Big(\frac{Y-j}{Y}\Big)^l\Big(\frac{j}{Y}\Big)^{X-l} - \Big(\frac{Y-j+1}{Y}\Big)^l\Big(\frac{j-1}{Y}\Big)^{X-l}\Big).$$
One quickly notices that $0^0$ is encountered in this sum - for our purposes, this is assigned a value of $1$.
Thank you for your help, all!

A: We have $n$ iid variables $X = (X_1, \ldots, X_n)$ with $X_i$ uniform over $\{1,2, \ldots, d\}$. Let $U_i$ be the $i$-th smallest value of $\{X_1, \ldots, X_n\}$; fix $j$ and $k$. We will find $P(U_j = k)$. This completely determines the distributions of $U_j$; then we can determine the expectation of $U_j$ and finally the expectation of the sum of the $k$ largest, $U_{n-k+1} + \cdots + U_n$.
The strategy is divide-and-conquer.  We look at all the possible ways we can have the $j-$th order statistic $U_j$ be $k$ and sum the probabilities.
Given samples $x = (x_1, \ldots, x_n)$, let $L_x = \{i: x_i < k\}$ and $R_x = \{i: x_i > k\}$, so that $x_i = k$ if $i \notin L, R$. Letting $|L_x| = l, |R_x| = r$, the $\operatorname{sorted}(x) = u = (u_1, u_2, \ldots, u_n)$ looks like
$$(\underbrace{u_1, \ldots, u_l}_{<k}, \underbrace{u_{l+1}, \ldots, u_{n-r}}_{=k}, \underbrace{u_{n-r+1} , \ldots, u_n}_{>k})$$ So we have $u_j = k$ iff $l +1 \leq j \leq n - r$, or: $l\leq j-1$, $r \leq n - j$. Since each $x$ uniquely determines $L_x, R_x$ we can write
\begin{align*}P(U_j = k) &= \sum_{L,R:|L| + 1 \leq j \leq n - |R|} P(L_X = L, R_X = R)\\
&= \sum_{l=0}^{j-1} \sum_{r=0}^{n - j} \binom{n}{l, r, n-l-r} p_{l,r}\end{align*}
where $p_{l,r} = P(L_X = L, R_X = R)$ for any $L,R$ with $|L| = l$, $|R| = r$ (the probability is the same for each by the iid assumption) and the multinomial coefficient $$\binom{n}{l, r, n-l-r}$$ is the number of possible disjoint $L,R$ with $|L| = l, |R| = r$.
For fixed, disjoint $L,R$ we have \begin{align*}
P(L_X = L, R_X = R) &= P(X_i < k\, \forall i \in L,\, X_i > k\, \forall i \in R, X_i =k \forall i \notin L,R)\\
&= P(X_i < k\, \forall i \in L) \cdot P( X_i > k\, \forall i \in R) \cdot P(X_i =k\,\forall i \notin L,R)\\
\end{align*}
by independence.  Then if $|L| = l, |R| = r$, we have $$P(X_i < k\, \forall i \in L) = ((k-1)/d)^l,$$
$$P(X_i = k\, \forall i \notin L,R) = (1/d)^{n - l -r},$$
$$P(X_i > k\, \forall i \in R) = ((d-k)/d)^r.$$
Thus $$P(U_j = k) = \sum_{l=0}^{j-1} \sum_{r=0}^{n - j} \binom{n}{l, r, n-l-r}  \frac{(k-1)^l (d-k)^r}{d^n}. $$


text:
Q: Calling StateHasChanged vs returning Task I'm working with the basic template for a Blazor web assembly project. I am trying to understand what's going on in two different approaches that seem to reach the same result.
In my first attempt, I created a method that would post a new WeatherForecast model to my web api endpoint and then from the response, add that newly created WeatherForecast to a list. Here is that first method:
private async void ValidSubmitHandler()
{
    var response = await Http.PostAsJsonAsync<WeatherForecast>(Configuration["APIBaseUrl"] + "/WeatherForecast", newForecast);

    var forecast = await response.Content.ReadFromJsonAsync<WeatherForecast>();
    forecasts.Add(forecast);
}

I was expecting the UI to update with the newly added forecast but instead the page didn't update despite the forecasts list having the new object added. I put a breakpoint and observed that the new forecast was indeed added to the list but just the UI was not rendering the change to the list's state.
I read  that you can call
StateHasChanged()

to initiate the change to render the list's new forecast and for the moment that was fine. After reading around a bit about StateHasChanged it seems like I shouldn't use that very often and it would show signs of bad practices so I tried a suggestion from a colleague who said I need to add Task as the return type rather than void to the function like so:
private async Task ValidSubmitHandler()
{
    var response = await Http.PostAsJsonAsync<WeatherForecast>(Configuration["APIBaseUrl"] + "/WeatherForecast", newForecast);

    var forecast = await response.Content.ReadFromJsonAsync<WeatherForecast>();
    forecasts.Add(forecast);
}

This indeed did allow for the UI to pick up on the updates and I can only assume that ValidSubmitHandler() was exiting before the new forecast was added to the list.
Does anyone have an explanation as to why StateHasChanged seemed to work if my method was not awaiting the results from the async operations?
thanks

A: Blazor automatically call StateHasChanged when the event handler completes. Here's the relevant code from GitHub:
    // https://github.com/dotnet/aspnetcore/blob/547de595414d6ebb9ddeaa4a231815449c9f3c60/src/Components/Components/src/ComponentBase.cs#L301
    Task IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, object? arg)
    {
        var task = callback.InvokeAsync(arg);
        var shouldAwaitTask = task.Status != TaskStatus.RanToCompletion &&
            task.Status != TaskStatus.Canceled;

        // After each event, we synchronously re-render (unless !ShouldRender())
        // This just saves the developer the trouble of putting "StateHasChanged();"
        // at the end of every event callback.
        StateHasChanged();

        return shouldAwaitTask ?
            CallStateHasChangedOnAsyncCompletion(task) :
            Task.CompletedTask;
    }

Blazor waits for the event handler to return. Then, it calls StateHasChanged. If the returned Task is not completed, it awaits the task and call StateHasChanged again.
In the case of async void, the returned task is always completed, so it will never await it and call the second StateHasChanged. In this case, you would need to manually call it. But a better way is to avoid async void which are almost always a bad thing.
I've also written a more in-depth blog post about component lifecycle ASP.NET Core Blazor components lifecycle


text:
Q: How can I deploy ruby on rails application to mochahost using capistrano? I am new to ruby on rails deployment.  I have created my first simple ruby on rails application, but I am struggling to properly get it onto my server.
In my research, I learned about the various ways to deploy a ror app to my own server, and it seems that using capistrano would be the way to do it.  However, it is not clear to me how to use capistrano to launch my app.
What are the steps that I need to take in order to launch my app?  Do I need to use git, I prefer not to..  I don't want to use Heroku.
It just seems that deploying the application should be really easy and I am struggling with it.  If I am using the non-optimal tools let me know.
thanks

A: Capistrano is primarily used to deploy apps, not to launch them. Capistrano is of course capable of launching Rails apps, but how to do that depends on how your app is set up.
You should do some research on using nginx (HTTP server) and Unicorn (Rack server) together with Capistrano. It might take some time setting everything up, but once in working condition, they'll make deploying your app close to enjoyable.
Regarding actually deploying your app: Heroku is not required in order to use Git, but if you really don't want to use any kind of versions system (though I highly recommend that you do), this blog post might help you on your way: http://www.maxkpage.com/blog/capistrano-rails-deploy-without-svn-or-git/


text:
Q: What's the recommended approach for hierarchical URLs in Orchard? I'd like to have a hierarchical URL structure in my site. Something on these lines:

*

*tutorials

*

*javascript

*

*jquery

There should be a page at each level (tutorials, tutorials/javascript and tutorials/javascript/jquery). Obviously, using Taxonomies would help me organize my content in this manner, but how do I get Autoroute URLs generated for this scenario?
Bertrand Le Roy made a comment on this SO answer about using taxonomy terms as pages but it still doesn't seem to create the right URL structure for me. Am I missing something? Is there something specific I need to configure or enable to make this happen?
Are there any other approaches I can look at?
I was thinking of specifying the default route as something like {Content.Fields.Page.TaxonomyName}. It appears that this isn't really possible right now according to this bug report.

A: Here's an approach that seems to work without having to use taxonomies:
I added a Content Picker field called ParentPage to the Page content type and updated the Page's Autoroute default to
{Content.Fields.Page.ParentPage.Content.Path}/{Content.Slug}

Now in each page I get to pick what the parent page is and the URL is constructed how I expect it. From what I remember of working with WordPress, I think this is pretty close to how it allows you to do this parent page thing, too.