text:
Q: CodeBloks: Unit test file requires entire address of a file I am using CodeBlocks to write my programs in C++ and I noticed the following. Both my main class and one my Unit Test class are in the same folder (say FolderName). From both of them, I call a method that inputs a file which is in the same folder (FileName.txt). From main I call it like this, and it works fine.
 obj.("FileName.txt");

From the test file, I need to give the whole address of the file for it to work.
 obj.("/home/myName/FolderName/FileName.txt");

I know there must be a way of setting the Unit Test file so that it works like the main but I could not figure it out. I am not sure if this is important but I am working on Linux

A: My apologies if you've already figured this out, but I'll answer for anyone else who may be wondering.
CodeBlocks creates an executable for your unit test and stores it in /home/myName/FolderName/bin/unitTest/. CodeBlocks runs this executable when you execute your unit test. Therefore, your pwd is not /home/myName/FolderName/ but /home/myName/FolderName/bin/unitTest/.
You're using gtest, but regardless of which framework you use, there are a few ways to do what you're asking:
The best option is to use the address obj.("../../FileName.txt")
The other option is to copy FileName.txt to /home/myName/FolderName/bin/unitTest/ (or whatever you named your unit test build option). You can then simply use "FileName.txt" in your unit test.
Cheers.


text:
Q: Drag and Drop not dropping I am a trying to use JS to drag an drop nodes on a family tree. However, the nodes will drag, but will not drop where they are placed. They return to their orginal position.
I am not sure if I am defining the area where they can be dropped correctly.
The JS code is:
function allowDrop(ev){
ev.preventDefault();
}

function drag(ev)
{
ev.dataTransfer.setData("Text",ev.target.id);
}

function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("img");
ev.target.appendChild(document.getElementById(data));
}

I then inserted a DIV within a HTML section to allow the drop:

Then the HTML code to allow elements to be dragged:
++ Annie Johnson 1781-(Tuam)

Thanks
Ciaran

A: Your code is correct, however you are setting 'text' not 'img' in your dragstart so make it like below :
var data = ev.dataTransfer.getData('Text');

This is the jsfiddle.
Edit :
you can also make it easier and do like below:
function drop(ev)
{
    ev.preventDefault();
    var data=ev.srcElement;
    ev.target.appendChild(data);
}

A: Got it, thanks for help, element.parentNode.removeElement(element); plus newParent.appendChild(element) worked

redpajama_set_name: RedPajamaStackExchange


text:
Q: TSQL Materiaized/Indexed View Cluster index with subquery I have two tables: Listings and Media and Media is a child of Listings.  I am trying to create a indexed view that will include the first record from Media.  I would also like to index my view so that this view is as performance as possible.
View
ALTER VIEW GridListings
WITH SCHEMABINDING
AS

SELECT l.ListingId, l.Title,
    (SELECT TOP 1 ThumbnailUrl
        FROM [dbo].Media
        WHERE ListingId = l.ListingId) as Thumbnail
FROM [dbo].Listings l

Index
CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex-20200528-150854] ON [dbo].[GridListings]
(
    [listingid] ASC
)

Error

Cannot create index on view "dbo.GridListings"
  because it contains one or more subqueries. Consider changing the view
  to use only joins instead of subqueries. Alternatively, consider not
  indexing this view.

The view I am going to create will include a lot of fields from Listings table, including a spatial field that I will need to filter on.
I have used the above approach to flatten both of my tables into a single list so that its fast to query and filter on which includes the thumbnail from Media.
Am I using the correct approach or is there a better/more performant way of doing it instead of indexed views
I am using SQL Server 2017
Here is the plan without any indexes on the view
https://www.brentozar.com/pastetheplan/?id=BkdOyq6iL


text:
Q: android modo depuracion mantener la configuracion? Queria saber como puedo mantener una modificacion que le haya hecho al dispositivo atravez del modo depuracion con adb (platform-tools) despues de reiniciarlo?
"Cuando aplico la modificacion si el dispositivo se apaga y vuelve a encender pierde la modificacion hay alguna manera de mantenero sin tener que estar haciendo siempre?"
es un movil samsung y quiero mantener los leds de camara y audio desactivados, pero cuando se reinicia vuelve y apararece


text:
Q: How sql compares date stored in varchar datatype How a comparison between two dates are made if both are stored in varchar?
I came across a table which is written years ago in which the date (DD-MM-YY) is stored in a varchar
format
updated_date varchar(255)

There's a script written for delete operation in following manner
(Temp variable)-
temp_date_tocompare varchar2(255) :=to_char(sysdate-7, 'YYYY-MM-DD')

delete from myTable
    where updated_date < temp_date_tocompare;

I executed this and it works fine.
But curious to understand behind the scenes work, how this varchars are compared.

A: Compare dates as dates.  Store date/times using proper date/time formats.  Do not store them as strings!
Your code will no doubt delete rows.  Whether it deletes the rows you want is another question.  The logic you want seems to be:
delete from myTable
    where to_date(updated_date, 'DD-MM-YY') < trunc(sysdate) - 7;


text:
Q: Semisimple linear algebraic groups in positive characteristic This question concerns the classification of semisimple linear algebraic groups $G$ (over some fixed algebraically closed field $k$), which I am currently learning from Malle and Testerman's book [1].
Below, I list some facts from [1, Section 9.2]. My problem is that I think these facts are contradictory in conjunction, and I would be grateful for any clarification as to what I am misunderstanding.
Facts:

*

*For indecomposable "abstract" root systems $\Phi$ not of type $\operatorname{D}_{2n}$, the (semi)simple algebraic groups $G$ whose root system is isomorphic to $\Phi$ are in bijection with subgroups of the fundamental group of $\Phi$, $\Lambda(\Phi)$, a finite abelian group depending only on $\Phi$ (and not, e.g., on the characteristic of $k$) [1, Theorem 9.13 and text passage afterward]. The $G$ corresponding to the whole fundamental group $\Lambda(\Phi)$ under this correspondence is called simply connected [1, Definition 9.14].

*The simply connected semisimple algebraic group with root system of type $\operatorname{A}_{n-1}$ is $\operatorname{SL}_n$, and the fundamental group $\Lambda(\operatorname{A_{n-1}})$ is cyclic of order $n$ [1, Table 9.2, p. 72].

*If $G$ is any semisimple group with root system $\Phi$, then there is an isogeny (surjective algebraic group homomorphism with finite kernel) from $G_{\operatorname{sc}}$, the simply connected semisimple group with root system isomorphic to $\Phi$, onto $G$ [1, Proposition 9.15]. Moreover, the kernel of that isogeny is a finite central subgroup of $G_{\operatorname{sc}}$ [1, paragraph before Proposition 9.15].

Said contradiction arises when combining these facts in positive characteristic. Let $p$ be a prime, $k=\overline{\mathbb{F}_p}$, and consider simple linear algebraic groups $G$ over $k$ with root system isomorphic to $\operatorname{A}_{p-1}$. By Facts 1 and 2, there should be precisely two such $G$ (as $\mathbb{Z}/p\mathbb{Z}$ has precisely two subgroups). And by Facts 2 and 3, each such $G$ is of the form $\operatorname{SL}_p(k)/N$, where $N$ is some subgroup of the center $\zeta\operatorname{SL}_p(k)$. But this center is trivial, so $\operatorname{SL}_p(k)$ is the only such quotient group, a contradiction.
Reference:
[1] G. Malle and D. Testerman, Linear Algebraic Groups and Finite Groups of Lie Type, Cambridge University Press (Cambridge studies in advanced mathematics, 133), 2011.


text:
Q: How to Transpose rows into columns in SQLite or flutter moor? How can I convert rows into columns.
initial structure
Needed Output:
OrderId -> Product1 -> QuantityOfProduct1 -> ... ProductN -> QuantityOfProductN -> totalAmount -> Date

Please help me to achieve this.
sorry for improper questioning.
Thanks in advance.


text:
Q: Getting stuck in a loop I have written this code, but the problem is for large number for P and SLOT, the code will be stocked in a loop and unfortunately, I do not know how to fix this problem. I would be more than thankful if someone can help me to fix this problem.
I have attached the code below for your further review.
This code is for developing a patient scheduling system based on the patient no-show.
import pandas as pd
import numpy as np
import random
import datetime

SLOT = 12 # Number of slots per day
PHY = 2 # Number of Physicians
P = 36 # Number of Patients
number_OB = np.zeros((PHY, 1)) # Number of overbooked for each physician

Limit_OB = np.zeros((PHY, 1))

for i in range(Limit_OB.shape[0]):
    Limit_OB[i] = 2 # Capacity of each physician is to visit maximum 2 patients in each slot

preference = [random.randint(1, 3) for i in range(P)] # patients' preference for seeing physician 1 and 2: Preference 3 means the patient has no preference for physician 1 or 2
noshowtype = [random.randint(0, 1) for i in range(P)] # 0 means the patient no-show is low and 1 means the patient no-show is high
availability = np.random.randint(2, size=(P,SLOT)) # This matrix shows the availability of each patients for each slot

# Initialization
print(preference)
print(len(preference))
print(noshowtype)
print(len(noshowtype))
print(availability)
availability.shape
totpat = np.zeros((PHY, SLOT))
tot_pat_sch = np.zeros((PHY,1))
assign = np.zeros(shape=(P, SLOT, PHY))
totpatslot = np.zeros((SLOT, 1))
noapp = np.zeros((P, 1))
put = np.zeros((P, SLOT))
unschedule = np.zeros((P,SLOT))
slotcap = [2,1,1,1,2,1,1,1,2,1,1,1]

totpatslot = [0,0,0,0,0,0,0,0,0,0,0,0]
tot_pat_sch = [0,0]
for p in range(P):
    count = 0
    if preference[p] == 3:
        for phy in range(PHY):
            for s in range(SLOT):
                tot_pat_sch[phy] = tot_pat_sch[phy] + totpat[PHY-1,s]
        if  tot_pat_sch[0] == tot_pat_sch[1]:
            preference[p] = random.randint(1, 2)
    trial = 0
    if p == 4 :
        print("patient assigned ",p)
    while trial <=1:
        if noshowtype[p] == 0 & count ==0:
            for s in range(SLOT):
                if totpat[preference[p]-1, s] == 0:
                    if availability[p,s] == 1:
                        assign[p,s,preference[p]-1] = 1
                        put[p,s] = 1
                        count = 1
                        trial = 2
                        totpat[preference[p]-1,s] = totpat[preference[p]-1,s] + 1
                        totpatslot[s] = totpatslot[s] + 1
                        break;
                    print("patient scheduled ",p)
        if count == 0:
            for s in range(SLOT):
                if totpat[preference[p]-1, s] < slotcap[s]:
                    if availability[p,s] == 1:
                        assign[p,s,preference[p]-1] = 1
                        number_OB[PHY-1] = number_OB[PHY-1] + 1
                        put[p,s] = 1
                        count = 1
                        trial = 2
                        totpat[preference[p]-1,s] = totpat[preference[p]-1,s] + 1
                        totpatslot[s] = totpatslot[s] + 1
                    else:
                        unschedule[p,s] = unschedule[p,s] + 1
                        noapp[p] = 1
                        break;
        if noshowtype[p] == 1 & count == 0:
            for s in range(SLOT):
                if totpat[preference[p]-1, s] == 0:
                    if availability[p,s] == 1:
                        assign[p,s,preference[p]-1] = 1
                        put[p,s] = 1
                        count = 1
                        trial = 2
                        totpat[preference[p]-1,s] = totpat[preference[p]-1,s] + 1
                        totpatslot[s] = totpatslot[s] + 1
                        break;
                    print("patient scheduled ",p)
        if count == 0:
            for s in range(SLOT):
                if totpat[preference[p]-1, s] < slotcap[s]:
                    if availability[p,s] == 1:
                        assign[p,s,preference[p]-1] = 1
                        number_OB[PHY-1] = number_OB[PHY-1] + 1
                        put[p,s] = 1
                        count = 1
                        trial = 2
                        totpat[preference[p]-1,s] = totpat[preference[p]-1,s] + 1
                        totpatslot[s] = totpatslot[s] + 1
                    else:
                        unschedule[p,s] = unschedule[p,s] + 1
                        noapp[p] = 1
                        break;

A: I'll put it as an answer so that you can understand what I was commenting about.
for p in range(P):

    ...
    trial = 0
    while trial <=1:
        if ():
            for ():
                if ():
                    if ():
                        ...
                        trial = 2
                        break;
        if ():
            for ():
                if ():
                    if ():
                        ...
                        trial = 2
                    else:
                        ...
                        break;

        #similarly the other ifs

this is the structure of the code right now, which does not seem simple and is probably redundant at many points. the issue that i was asking you to check was what happens when none of the first indentation if conditions are met? the variable trial will not get updated and you will be stuck in an infinite loop inside while. the only way to break out of this while is too make the variable trial>1 or use a break.
anyways i do not see the point of the while loop here.


text:
Q: TeXnicCenter and svg I'm wondering why I can't use the package svg with teXnicCenter. I've seen that one must use shell escape to make it functions. I've also downloaded the latest version of inkscape and of ImageMagick.
So I've written that in my build profile :
--shell-escape -synctex=-1 -max-print-line=120 -interaction=nonstopmode "%wm"

I've put the shell first beacause I've seen that sometimes it would work better.
Here is my minimal code :
\documentclass{article}
\usepackage{svg}
\usepackage{amsmath}

\title{Inkscape package on Overleaf }
\begin{document}
\begin{figure}[htbp]
  \centering
  \includesvg[inkscapelatex=false,width=\linewidth]{test}
  \caption{svg image}
\end{figure}

\end{document}

And I've checked my log file. Here are the parts concerned by escape :

Package svg Info: Calling Inkscape on input line 9. runsystem(inkscape
  -z -D  --file="test.svg" --export-pdf="test_svg-raw.pdf" )...executed.
Package svg Warning: The export with Inkscape failed for file
(svg)                `test.svg'
(svg)                Troubleshooting: Please check in the log file how
(svg)                the invocation of Inkscape took place and try to
(svg)                execute it yourself in the terminal on input line 9.

! Package svg Error: File `test_svg-raw.pdf' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.9 ...inkscapelatex=false,width=\linewidth]{test}

Did you run the export with Inkscape? There's no file
`./svg-inkscape/test_svg-raw.pdf'
although `test.svg' was found.

[1

So, I don't really understand what is faulty here.
Thanks if you can direct me in the right direction to make it work.

A: There are several steps necessary to meet your achievement
1) enable shell escape, you have done that, otherwise you would be reporting a log error of Package svg Warning: You didn't enable 'shell escape' (or 'write18'), ! Package svg Error: File test_svg-raw.pdf is missing.
2) have a valid svg file in a directory you can write a subdirectory to, you don't appear to have that problem otherwise if missing you would see ! Package svg Error: File 'test.svg' is missing. However if the file was found and produced an invalid result or the subdirectory ./svg-inkscape could not be written in the folder with both tex and svg then the message in that case could be the one you see. Lets presume your test.svg file is valid and you can add a folder below the main tex folder (ensuring that main folder has no spaces or accent's etc.)
3) You must have installed Inkscape on path otherwise you will get the messages you report. so going to a command prompt check by trying> inkscape -version if Inkscape is not on path you should see the following

You seem to have checked step 3 so we are left with any issues from step 2 thus you need to recheck if your test.svg or the folders you are running in are questionable.


text:
Q: how to override Reviews Module I'm working on Custom module in which I need to override Magento's reviews Module. I want to add some extra fields in Magento's Review Form. I created Preferences in
adminhtml/di.xml Now whenever I add my custom fields code, all the other fields get removed.
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{

public function __construct(
    \Magento\Backend\Block\Template\Context $context,
    \Magento\Framework\Registry $registry,
    \Magento\Framework\Data\FormFactory $formFactory,
    \Magento\Store\Model\System\Store $systemStore,
    \Magento\Review\Helper\Data $reviewData,
    array $data = []
) {
    $this->_reviewData = $reviewData;
    $this->_systemStore = $systemStore;
    parent::__construct($context, $registry, $formFactory, $data);
}

/**
 * Prepare add review form
 *
 * @return void
 * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
 */
protected function _prepareForm()
{
    /** @var \Magento\Framework\Data\Form $form */
    $form = $this->_formFactory->create();

    $fieldset = $form->addFieldset('add_review_form', ['legend' => __('Review Details')]);

    $fieldset->addField('product_name', 'note', ['label' => __('Product'), 'text' => 'product_name']);

    // $fieldset->addField(
    //     'detailed-rating',
    //     'note',
    //     [
    //         'label' => __('Product Rating'),
    //         'required' => true,
    //         'text' => '
' . $this->getLayout()->createBlock(
    //             \Magento\Review\Block\Adminhtml\Rating\Detailed::class
    //         )->toHtml() . '
'
    //     ]
    // );

    // $fieldset->addField(
    //     'status_id',
    //     'select',
    //     [
    //         'label' => __('Status'),
    //         'required' => true,
    //         'name' => 'status_id',
    //         'values' => $this->_reviewData->getReviewStatusesOptionArray()
    //     ]
    // );

    // /**
    //  * Check is single store mode
    //  */
    // if (!$this->_storeManager->isSingleStoreMode()) {
    //     $field = $fieldset->addField(
    //         'select_stores',
    //         'multiselect',
    //         [
    //             'label' => __('Visibility'),
    //             'required' => true,
    //             'name' => 'select_stores[]',
    //             'values' => $this->_systemStore->getStoreValuesForForm()
    //         ]
    //     );
    //     $renderer = $this->getLayout()->createBlock(
    //         \Magento\Backend\Block\Store\Switcher\Form\Renderer\Fieldset\Element::class
    //     );
    //     $field->setRenderer($renderer);
    // }

    // $fieldset->addField(
    //     'nickname',
    //     'text',
    //     [
    //         'name' => 'nickname',
    //         'title' => __('Nickname'),
    //         'label' => __('Nickname'),
    //         'maxlength' => '50',
    //         'required' => true
    //     ]
    // );

    // $fieldset->addField(
    //     'title',
    //     'text',
    //     [
    //         'name' => 'title',
    //         'title' => __('Summary of Review'),
    //         'label' => __('Summary of Review'),
    //         'maxlength' => '255',
    //         'required' => true
    //     ]
    // );

    // $fieldset->addField(
    //     'detail',
    //     'textarea',
    //     [
    //         'name' => 'detail',
    //         'title' => __('Review'),
    //         'label' => __('Review'),
    //         'required' => true
    //     ]
    // );

     $fieldset->addFieldset(
        'review_comment',
        ['legend' => __('Review Comment'), 'class' => 'fieldset-wide']
    );

    $fieldset->addField(
        'title_comment',
        'text',
        ['label' => __('Title'), 'required' => false, 'name' => 'comment-title']
    );
    $fieldset->addField(
        'comment',
        'textarea',
        ['label' => __('Comment'), 'required' => false, 'name' => 'comment']
    );
    $fieldset->addField(
        'send_customer',
        'checkbox',
        ['label' => __('Send this Comment to customer'), 'required' => false, 'name' => 'show_to_customer']
    );

    $fieldset->addField('product_id', 'hidden', ['name' => 'product_id']);

    /*$gridFieldset = $form->addFieldset('add_review_grid', array('legend' => __('Please select a product')));
      $gridFieldset->addField('products_grid', 'note', array(
      'text' => $this->getLayout()->createBlock(\Magento\Review\Block\Adminhtml\Product\Grid::class)->toHtml(),
      ));*/

    $form->setMethod('post');
    $form->setUseContainer(true);
    $form->setId('edit_form');
    $form->setAction($this->getUrl('review/product/post'));

    $this->setForm($form);
    return parent::_prepareForm();
    }
}

also, whenever I add my fields using this method $fieldset->addField it gives an error.

A: Use plugin for that.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <type name="Magento\Review\Block\Adminhtml\Add\Form">
       <plugin name="review_add_form_custom" type="QaisarSatti\HelloWorld\Plugin\Add\Form" />
   </type>
</config>

Review Add Form
Now Create Form.php file in following directory
app\code\QaisarSatti\HelloWorld\Plugin\Adminhtml\Add
namespace QaisarSatti\HelloWorld\Plugin\Adminhtml\Add;

  class Form extends \Magento\Review\Block\Adminhtml\Add\Form
  {
   public function beforeSetForm(\Magento\Review\Block\Adminhtml\Add\Form $object, $form) {

       $fieldset = $form->addFieldset(
           'review_cusom',
           ['legend' => __('Review Custom Field'), 'class' => 'fieldset-wide']
       );

       $fieldset->addField(
           'test',
           'text',
           ['label' => __('Test'), 'required' => false, 'name' => 'test']
       );

       return [$form];
   }
}

Reference

A: If You need to override Magento's reviews Module. I want to add some extra fields in Magento's Review Form.
MagentoFolder/vendor/magento/module-review/view/frontend/templates/form.phtml
Override the Following in your custom Module Layout File.
https://prnt.sc/kffwcc

A:    *$fieldset->addFieldset(*
      'review_comment',
       ['legend' => __('Review Comment'), 'class' => 'fieldset-wide']
   );

fieldset doesn't have addFieldset() method.So change above code snippet to:
   $fieldset->addField(
      'review_comment',
       ['legend' => __('Review Comment'), 'class' => 'fieldset-wide']
   );


text:
Q: cv2 SimpleBlobDetector difficulties I try to detect some dots on some dice for a hobby project.
The dice are cut free nicely and there are more or less good photos of them.

The photos are then gray-scaled, treated anti-noise with a median filter and made into np.array so that cv2 likes them.
Now I try to count the pips and... well... SimpleBlobDetector finds blobs everywhere depending on the exact adjustments of the parameters, or no blob at all, and never those most obvious pips on top. Especially if I activate "circularity" more than 0.7 or "Inertia", it finds nothing at all.
What's wrong here? Do I have to preprocess my picture further, or is it in the parameters below?
I tried to exchange the filter with Gaussian Blur, I also tried to posterize the image in order to have fairly large areas with exactly the same greyscale value. Nothing helps.
I tried many variants by now, this current variant results in the picture below.
blob_params = cv2.SimpleBlobDetector_Params()
blob_params.minDistBetweenBlobs = 1
blob_params.filterByCircularity = True
blob_params.minCircularity = 0.5

blob_params.minThreshold = 1
blob_params.thresholdStep = 1
blob_params.maxThreshold = 255
#blob_params.filterByInertia = False
#blob_params.minInertiaRatio = 0.2

blob_params.minArea = 6
blob_params.maxArea = 10000
detector = cv2.SimpleBlobDetector_create(blob_params)

keypoints = detector.detect(die_np) # detect blobs... just it doesn't work

image = cv2.drawKeypoints(die_np,
                                   keypoints,
                                   np.array([]),
                                   (255,255,0),
                                         cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)

im = Image.fromarray(image)
im

A: Okay, and the solution is:
There are some parameters set before you even start. Those parameters are optimized for finding dark and round blobs in a light background. Not the case in my image! This was taking me by surprise - after printing out every single parameter and correcting everything what was not fitting to my use case, I was finally able to use this function. Now it easily finds the dice pips on several different kind of dice, I've tried.
This would have been easier if the openCV parameter list would have been a little bit more accessible, as dict for example, or better commented.
I'll leave my code here - it contains a comprehensive list of parameters that this function uses, in the comments also remarks how to use some of these, and a function to use the function. I also leave the link to the simpleBlobDetector documentation here, as it is somewhat difficult to find in the net.
Coming from C/C++ background, this function totally not pythonic. It does not accept every image format as it would be normal in python context, instead it wants a very specific data type. In python at least it would tell you what it wants instead, but this function keeps quiet in order not to destroy the riddle. It then goes on to throw an exception without explanation.
So I was making a function that at least accepts numpy in colored and in black/white format, and PIL.Image. That opens the usability of this function up a little bit.
OpenCV, when you read this - normally in python a readable text is provided for each function in '''triple marks'''. Emphasis on "readable".
import cv2
import numpy as np
from PIL import Image

def blobize(im, blob_params):
    '''
    Takes an image and tries to find blobs on this image.

    Parameters
    ----------
    im : nd.array, single colored. In case of several colors, the first
    color channel is taken. Alternatively you can provide an
    PIL.Image, which is then converted to "L" and used directly.

    blob_params : a cv2.SimpleBlobDetector_Params() parameter list

    Returns
    -------
    blobbed_im : A greyscale image with the found blobs circled in red
    keypoints : an OpenCV keypoint list.

    '''
    if Image.isImageType(im):
        im = np.array(im.convert("L"))
    if isinstance(im, np.ndarray):
        if (len(im.shape) >= 3
        and im.shape[2] > 1):
            im = im[:,:,0]

    detector = cv2.SimpleBlobDetector_create(blob_params)
    try:
        keypoints = detector.detect(im)
    except:
        keypoints = None
    if keypoints:
        blobbed_im = cv2.drawKeypoints(im, keypoints, np.array([]),
                    (255,0,0), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
    else:
        blobbed_im = im
    return blobbed_im, keypoints

blob_params = cv2.SimpleBlobDetector_Params()

# images are converted to many binary b/w layers. Then 0 searches for dark blobs, 255 searches for bright blobs. Or you set the filter to "false", then it finds bright and dark blobs, both.
blob_params.filterByColor = False
blob_params.blobColor = 0

# Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive).
blob_params.filterByArea = True
blob_params.minArea = 3. # Highly depending on image resolution and dice size
blob_params.maxArea = 400. # float! Highly depending on image resolution.

blob_params.filterByCircularity = True
blob_params.minCircularity = 0. # 0.7 could be rectangular, too. 1 is round. Not set because the dots are not always round when they are damaged, for example.
blob_params.maxCircularity = 3.4028234663852886e+38 # infinity.

blob_params.filterByConvexity = False
blob_params.minConvexity = 0.
blob_params.maxConvexity = 3.4028234663852886e+38

blob_params.filterByInertia = True # a second way to find round blobs.
blob_params.minInertiaRatio = 0.55 # 1 is round, 0 is anywhat
blob_params.maxInertiaRatio = 3.4028234663852886e+38 # infinity again

blob_params.minThreshold = 0 # from where to start filtering the image
blob_params.maxThreshold = 255.0 # where to end filtering the image
blob_params.thresholdStep = 5 # steps to go through
blob_params.minDistBetweenBlobs = 3.0 # avoid overlapping blobs. must be bigger than 0. Highly depending on image resolution!
blob_params.minRepeatability = 2 # if the same blob center is found at different threshold values (within a minDistBetweenBlobs), then it (basically) increases a counter for that blob. if the counter for each blob is >= minRepeatability, then it's a stable blob, and produces a KeyPoint, otherwise the blob is discarded.

res, keypoints = blobize(im2, blob_params)


text:
Q: delete verbatimtextOutput ran into this weird issue when teaching a student about shiny programming.
What i wanted was to make code that deletes the verbatimtextOuput element, rather than print an empty value
This is the code he wrote, but it deletes all buttons, the whole UI basically. Can this be done? I know more complex options like conditional panels etc, but just trying to figure out why removeUI doesn't do what I expected here.
Thanks!
app:
library(shiny)

ui<-fluidPage(  h5("Hello there"),      #First text on the window
               br(),                            #empty line
               actionButton(inputId = "ClickonMe", label = "Make data"),  # button 1
               actionButton(inputId = "ClickonMe2", label = "Print data"), # button 2
               actionButton(inputId = "ClickonMe3", label = "Transform data"),

               verbatimTextOutput("Response_text")  #reactive text output    )

server <- function(input,output) {
     values <- reactiveValues()
     observeEvent(input$ClickonMe,
               values$name <- TRUE   )
     observeEvent(input$ClickonMe3,
               if (values$name == TRUE) { values$name <- FALSE}
               else { values$name <- TRUE}   )
     observeEvent(input$ClickonMe2,
               if (values$name == TRUE) { output$Response_text <- renderPrint( isolate({values$name}) ) }
               else  if (values$name == FALSE)  {  removeUI(
                 selector = "div:has(> #Response_text)"
               )
               }

  )    }

shinyApp(ui, server)

EDIT VERSION:
changed pork chops answer a little so that this version removes and remakes the verbatim element in the ui.
What i now try to fully understand is, is why the piece req(....) has such an impact. the print(values$name) proofs that the variable exist, and the observer sees it, yet if you # the req( ) line, suddenly the app stops recreating the verbatimtextouput after it has been removed the first time.
Hope I can learn why this is the case. Thank you!
library(shiny)

ui <- fluidPage(
  h5("Hello there"),                                          # First text on the window
  br(),                                                       # empty line
  actionButton(inputId = "ClickonMe", label = "Make data"),   # button 1
  actionButton(inputId = "ClickonMe2", label = "Print data"), # button 2
  actionButton(inputId = "ClickonMe3", label = "Transform data"),
  mainPanel(verbatimTextOutput("Response_text"))
)

server <- function(input,output,session) {
  values <- reactiveValues()
  values$name <- T

  observeEvent(input$ClickonMe,{
    values$name <- T
  })

  observeEvent(input$ClickonMe3,{
    if (values$name){ values$name <- F}
    else{ values$name <- T }
  })

  observeEvent(input$ClickonMe2,{

    print(values$name)
  output$Response_text <- renderPrint({ isolate({

    req(values$name)
    if(!values$name){
      removeUI(
        selector = "div:has(> #Response_text)"
      )
    }else {
    as.character(values$name)}
  })
      })

})
}

A: 1) First of all please have a look at the Google's R Style Guide when writing code and try to stick to it I think both you and your students will benefit from it.
2) Use curly braces too when using functions such as observeEvent and renderPrint
3) Familiarise yourself with req function which is very handy
Sample Code how to remove UI:
library(shiny)

ui <- fluidPage(
  h5("Hello there"),                                          # First text on the window
  br(),                                                       # empty line
  actionButton(inputId = "ClickonMe", label = "Make data"),   # button 1
  actionButton(inputId = "ClickonMe2", label = "Print data"), # button 2
  actionButton(inputId = "ClickonMe3", label = "Transform data"),
  mainPanel(verbatimTextOutput("Response_text"))
)

server <- function(input,output,session) {
  values <- reactiveValues()
  values$name <- NULL

  observeEvent(input$ClickonMe,{
    values$name <- T
  })

  observeEvent(input$ClickonMe3,{
    if (values$name){
      values$name <- F}
    else{
      values$name <- T
    }
  })

  observeEvent(input$ClickonMe2,{
    if (values$name){
      values$name <- F
      }
    else{
      values$name <- T
    }
  })

  output$Response_text <- renderPrint({
    req(values$name)
    if(!values$name){
      removeUI(
        selector = "div:has(> #Response_text)"
      )
    }
    as.character(values$name)})
}

shinyApp(ui, server)


text:
Q: Hang Man Python Ok so me and my partner are trying to make a hang man game, but the problem we're running into is detecting if the correct letter is pressed, we have little tiny details that we need to fix as well, but that's the big issue. Our idea was to make x equal a different value when buttons are pressed, and then check if that's correct and play hang man of course, but now it's not doing anything when the buttons are pressed. Ideas?
from tkinter import *
import random as r

#Hang Man

class menu:
    def __init__(self):
        global game
        global play
        global canvas
        game = Tk()
        game.geometry('600x600+50+50')
        game.title("Hang Man")

        canvas = Canvas(game,height=400,width=800,bg='light goldenrod yellow')
        canvas.pack()
        play = Button(game,text="Play",command=self.playbt)
        play.pack(side=BOTTOM)

def playbt(self):
    self.difs()

def difs(self):
    global easy
    global medium
    global hard
    play.destroy()

    easy = Button(game,text="Easy",command=self.easy)
    medium = Button(game,text="Medium",command=self.medium)
    hard = Button(game,text="Hard",command=self.hard)

    easy.pack(side=BOTTOM)
    medium.pack(side=BOTTOM)
    hard.pack(side=BOTTOM)
def letters(self):

    A = Button(game, text="A", command=self.A)
    B = Button(game, text="B", command=self.B)
    C = Button(game, text="C", command=self.C)
    D = Button(game, text="D", command=self.D)
    E = Button(game, text="E", command=self.E)
    F = Button(game, text="F", command=self.F)
    G = Button(game, text="G", command=self.G)
    H = Button(game, text="H", command=self.H)
    I = Button(game, text="I", command=self.I)
    J = Button(game, text="J", command=self.J)
    K = Button(game, text="K", command=self.K)
    L = Button(game, text="L", command=self.L)
    M = Button(game, text="M", command=self.M)
    N = Button(game, text="N", command=self.N)
    O = Button(game, text="O", command=self.O)
    P = Button(game, text="P", command=self.P)
    Q = Button(game, text="Q", command=self.Q)
    R = Button(game, text="R", command=self.R)
    S = Button(game, text="S", command=self.S)
    T = Button(game, text="T", command=self.T)
    U = Button(game, text="U", command=self.U)
    V = Button(game, text="V", command=self.V)
    W = Button(game, text="W", command=self.W)
    X = Button(game, text="X", command=self.X)
    Y = Button(game, text="Y", command=self.Y)
    Z = Button(game, text="Z", command=self.Z)

    A.place(x = 80, y = 550)
    B.place(x = 98, y = 550)
    C.place(x = 116, y = 550)
    D.place(x = 134, y = 550)
    E.place(x = 152, y = 550)
    F.place(x = 170, y = 550)
    G.place(x = 188, y = 550)
    H.place(x = 206, y = 550)
    I.place(x = 222, y = 550)
    J.place(x = 240, y = 550)
    K.place(x = 256, y = 550)
    L.place(x = 278, y = 550)
    M.place(x = 296, y = 550)
    N.place(x = 314, y = 550)
    O.place(x = 332, y = 550)
    P.place(x = 350, y = 550)
    Q.place(x = 368, y = 550)
    R.place(x = 386, y = 550)
    S.place(x = 404, y = 550)
    T.place(x = 422, y = 550)
    U.place(x = 440, y = 550)
    V.place(x = 458, y = 550)
    W.place(x = 476, y = 550)
    X.place(x = 494, y = 550)
    Y.place(x = 512, y = 550)
    Z.place(x = 530, y = 550)

def A(self):
    global x
    x = 'A'
def B(self):
    x = 'B'
def C(self):
    x = 'C'
def D(self):
    x = 'D'
def E(self):
    x = 'E'
def F(self):
    x = 'F'
def G(self):
    x = 'G'
def H(self):
    x = 'H'
def I(self):
    x = 'I'
def J(self):
    x = 'J'
def K(self):
    x = 'K'
def L(self):
    x = 'L'
def M(self):
    x = 'M'
def N(self):
    x = 'N'
def O(self):
    x = 'O'
def P(self):
    x = 'P'
def Q(self):
    x = 'Q'
def R(self):
    x = 'R'
def S(self):
    x = 'S'
def T(self):
    x = 'T'
def U(self):
    x = 'U'
def V(self):
    x = 'V'
def W(self):
    x = 'W'
def X(self):
    x = 'X'
def Y(self):
    x = 'Y'
def Z(self):
    x = 'Z'

def easy(self):
    ewords = r.choice(["TABLE","CHAIR","DESK","PHONE","LIGHT","MAN"])
    self.play(ewords)
def medium(self):
    mwords = r.choice(["PYTHON","LAPTOP","JACKET","VIDEO","MODULE","LIBRARY"])
    self.play(mwords)
def hard(self):
    hwords = r.choice(["PROGRAM","TOLEDO","UNIVERSITY","ENGINEER","FOOTBALL","LANGUAGE"])
    self.play(hwords)

def play(self,words):
    easy.destroy()
    medium.destroy()
    hard.destroy()
    canvas.create_line(100,50,100,500,tags="Line") #Vertical
    canvas.create_line(20,500,80,500,tags="Line") #Lower Horizontal
    canvas.create_line(100,50,150,50,tags="Line") #Horizontal Line
    self.letters()

    lwords = []
    for j in range(len(words)):
        lwords.append(" _")

    canvas.create_text(300,300,text=( "".join( repr(e) for e in lwords ) ),font="Times 16",tags="text")

    hm = 0
    x = 0

    for i in range(len(words)):
        if x == 0:
            continue
        else:
            if words[i] == x:
                words.replace(lwords[i],words[i])
            else:
                hm += 1
                if hm == 1:
                  canvas.create_oval(125,50,175,100) #HEad
                  canvas.update()
                elif hm == 2:
                  canvas.create_line(150,100,150,150) #Body
                  canvas.update()
                elif hm == 3:
                  canvas.create_line(150,125,125,100) #Left Arm
                  canvas.update()
                elif hm == 4:
                  canvas.create_line(150, 125, 175, 100) #Right Arm
                  canvas.update()
                elif hm == 5:
                  canvas.create_line(125,150,100,125) #Left Leg
                  canvas.update()
                elif hm == 6:
                  canvas.create_line(125,150,100,175)
                  canvas.update()

menu()

A: As a general rule, whenever you have lots of repetitive code, use a loop or call a function repeatedly.  Here is an alternative using a loop to create the buttons using a command to call a function, and using partial to send the letter pressed to the function, so you only use one function.
import sys
if sys.version_info[0] < 3:
    import Tkinter as tk     ## Python 2.x
else:
    import tkinter as tk     ## Python 3.x

from functools import partial
import string

def button_pressed(ltr):
    print(ltr)

game=tk.Tk()
game.geometry("1000x600")
this_x=80
for b_ltr in string.ascii_uppercase:
    tk.Button(game, text=b_ltr, bg="lightblue",
              command=partial(button_pressed, b_ltr)).place(x=this_x, y=550)
    this_x += 33
game.mainloop()


text:
Q: Using java gnu serialport classes Is there any way that I can import gnu.io.serialport classes?
I trying to do a serial communication and looks a bit hard to figure it out.

A: i had good luck with rxtx on windows. supposed to work on linux also.


text:
Q: Singularities of $z\mapsto\frac{z}{\mathrm e^z-1}$ and the Bernoulli numbers of its expansion
Characterize all singularities of $$z\mapsto\frac{z}{\mathrm e^z-1}.$$
What is the radius of convergence of the taylor expansion of $$\frac{z}{\mathrm e^z-1}=\sum_{n=0}^\infty B_n\frac{z^n}{n!}$$ and deduce whether the $B_n$ are bounded?

Obviously $z=2n\pi\mathrm i$ for all $n\in\mathbb Z$ are singularities. First let's take a look at $z=2n\pi\mathrm i$ for all $n\in\mathbb Z\setminus\{0\}$. From l'Hôpital we obtain
$$
\lim_{z\to 2n\pi\mathrm i}\frac{(z-2n\pi\mathrm i)z}{\mathrm e^z-1}
= \lim_{z\to 2n\pi\mathrm i}\frac{2z - 2n\pi\mathrm i}{\mathrm e^z}
= \lim_{z\to 2n\pi\mathrm i}\frac{2}{\mathrm e^z}
= 2
$$
which is finite hence for all $n\in\mathbb Z\setminus\{0\}$ those $z$ are simple poles.
But what about $z=0$? Can this same argument be applied to this as well?
(Edit. What about analytic continuation - is it possible for $z=0$?)

Furthermore from Cauchy's differentiation formula it follows with $\gamma=\partial B_\rho(0)$ that $$B_n=\frac{n!}{2\pi\mathrm i}\oint_{\gamma}\frac{z}{\mathrm e^z-1}\cdot\frac{\mathrm dz}{z^{n+1}}$$ with $\rho\in(0,2\pi)$ since the curve would otherwise enclose one or more singularities. Therefore I assume that the radius is at most $2\pi$ and therefore all $B_n$ bounded as well. Unfortunately I did not come up with a proper proof why this may be true.

A: Since
$$
\lim_{z\to0}\frac{e^z-1}{z}=1
$$
you also have
$$
\lim_{z\to0}\frac{z}{e^z-1}=1
$$
so the point $0$ is a removable singularity for $f$; call $\hat{f}$ the extended function. Since $2\pi i$ is the nearest singularity to $0$ for $\hat{f}$ and it is a pole, we know that the Taylor series at $0$ has radius of convergence $|2\pi i|=2\pi$.
The points $2n\pi i$ ($n\ne0$) are simple poles for $f$, but you're computing the residue wrongly:
$$
\lim_{z\to 2n\pi i}\frac{z(z-2n\pi i)}{e^z-1}=
\lim_{z\to 2n\pi i}\frac{2(z-n\pi i)}{e^z}=2n\pi i
$$
(you can't further apply l'Hôpital). Alternatively, use the substitution $z=w+2n\pi i$, so the limit is
$$
\lim_{z\to 2n\pi i}\frac{z(z-2n\pi i)}{e^z-1}=
\lim_{w\to 0}\frac{w}{e^w-1}(w+2n\pi i)
$$


text:
Q: Cannot connect to SonarQube from Eclipse I'm trying to connect my Eclipse IDE to my company's sonar server instance, but I can't figure out why it doesn't work.
When I access the server (https://mycompany.com/sonar, for example purposes) through the browser, it works perfectly. In Eclipse, I added the url to the servers section of SonarQube and the same credentials I used in the browser. When I hit Test Connection, I get the error message:

Unable to connect: Query: https://mycompany.com/sonar//api/authentication/validate

I'm using the native option in Eclipse's network settings, since I'm not behind any proxy. The company SonarQube server version is 4.5.5.
Am I doing something wrong? Does anyone know how to fix this?
Edit: the certificate is also added to JRE

A: I suspect the /api/aut is due to some UI truncation, just expand the 'Add SonarQube Server' window to verify that.
You are trying to connect to an HTTPS URL, is the server certificate trusted by Java ? Use keytool to do that, as explained in this post.

A: Check the sonar link you have configured in eclipse - https://mycompany.com/sonar**//**api/authentication/validate
You need to give the url https://mycompany.com/sonar and not https://mycompany.com/sonar/


text:
Q: sudo kubectl get nodes - The connection to the server localhost:8080 was refused Following this documentation I was able to setup a master node and three worker nodes. However, when I run the command sudo kubectl get nodes after being able to SSH to the master node, I get the following error:
The connection to the server localhost:8080 was refused - did you specify the right host or port?

I also checked /etc/kubernetes/admin.conf for admin.conf file if that was causing the error, the file does not exist. In fact, I couldn't find the /kubernets directory inside /etc directory. Why is there no kubernetes/admin.conf folder and file in the first place and how can I solve this issue? Or am I looking at wrong etc directory?

A: I solved this issue. Even though the error was with regard to connection refusal, the actual issue was with resource allocation. I noticed that the worker nodes have actually failed to launch. So I went back and edited the cluster-settings.tfvars file and allocated 2046 MiB of memory to each node as it is specified in Kubernetes official documentation. Hope this will help anyone who runs into similar issue to mine.


text:
Q: Do Rumbles Auto-Attacks when OverHeated affect structures? I like to play Rumble and one thing I do out of instinct is overheating at the turret (after killing the other toplaner) and auto-attack it while overheated for the bonus AD.
It makes me slightly vulnerable there under turret.
But do Rumbles overheated auto-attacks really affect structures(I can't really tell from looking at the screen)? Or do they only work on minions/champions?

A: No, Rumbles abilities don't affect the damage dealt to structures.
They damage dealt to turrets is calculated is a special way:

Damage to a turret is based on your base attack damage plus the higher of your bonus attack damage or 40% of your ability power. It is not affected by any kind of armor or magic penetration

There are some abilities that deal bonus damage to turrets, Rumble is not in that list.
read this answer for additional information why you should not overheat when attacking a turret.

A: No, the turrets will not be affected.
Also a thing to note: You don't gain bonus AD. Overheating is an on-hit effect that scales off with 25% of your AP and your level while dealing magic damage (not physical). You should only use the overheating if you can win a melee trade against another champion or if you want more damage on your auto attacks if jungling or farming. Using it while pushing a turret is more or less counterproductive since it silences you and resets your heat meter which basically puts you in a bad spot if you're getting ganked.
Rumble was released in a time where damaging a turret with spells or on-hit effects was an extremely rare ability and they didn't rework his passive since.


text:
Q: Android RSS reader using SimpleXml and Retrofit - media:thumbnail parse issue How to parse the media:thumbnail url value from an RSSItem using simpleXml?
Here is my RSSItem class:
 @Root(name = "item", strict = false)
public class FeedItem {
    @Element(name = "pubDate")
    private String pubDate;
    @Element(name = "title")
    private String title;
    @Element(name = "link")
    private String link;
    @Element(name = "description")
    private String description;

    public FeedItem() {
    }

    public FeedItem(String description, String link, String title, String pubDate) {
        this.description = description;
        this.link = link;
        this.title = title;
        this.pubDate = pubDate;
    }

    public String getPubDate() {
        return pubDate;
    }

    public void setPubDate(String pubDate) {
        this.pubDate = pubDate;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

}

it all works ok, but I need to parse also the image url from the xml (media:thumbnail) here:
<media:thumbnail url="https://tctechcrunch2011.files.wordpress.com/2016/12/gettyimages-591407481.jpg" />

A: You need to use @Attribute annotation to get this.
In <media:thumbnail ...>, the media is a namespace and you only need to use thumbnail to access the content.
Example:
@Element(name = "thumbnail", required = false)
private Thumbnail thumbnail;

@Root(name = "thumbnail", strict = false)
static class Thumbnail {

    @Attribute(name = "url")
    private String url;
}


text:
Q: Bluetooh hci0: command 0x1009 tx timeout I have a problem with kali linux boot proccess
I got this message when the system boot up
 bluetooth : hci0: command 0x1009 tx timeout

I have searched for a soultion for this problem over this site and on google and I didn't find any answer that works with me

A: I've fixed this issue with the following command systemctl restart bluetooth


text:
Q: Which Expression trees to be included in a block expression I'm confused on which expression trees need to be added to a blockexpression when wanting code to be executed.
For example, if I have ConditionalExpression, that has a reference to an IsTrue and IsFalse. Do I need to include the expressions that are for IsTrue and IsFalse. or just the Conditional Expression?
Is there a guideline, i.e. how do the IEnumerable of Expressions get executed? Do they get executed in the order they appear in the IEnumerable?

A: Expression trees work very similarly to C# code: there all the statements inside a block (delimited by {}) are executed in order. So, that's exactly how Expression.Block() is evaluated too: all the expressions in its Expressions collection are evaluated in order. If you want to have a ConditionalExpression inside the block, then you shouldn't put them directly into the block (unless you also want them evaluated separately, outside of the ConditionalExpression).


text:
Q: Converting from literal escape sequence to represented character I'm attempting to read a desired line terminator from a configuration file.
If the parsing were working the way I want, the output from print(val) would be a blank line, and print(repr(val)) would print '\r' because val would contain a carriage return character. Instead print(val) outputs \r and print(repr(val)) outputs '\\r', which I understand means val contains a backslash character and a 'r' character.
How do I convert from a string that contains literal representations of escape sequences to one that contains the characters those escape sequences represent?


text:
Q: sqlite3 square brackets in a select statement In the following piece of code, what is the purpose of the square?
SELECT Value, [Default] AS Selected FROM SKUOptVal WHERE SKUOptID = ?

Cheers.
This code is written for SQLite3.

A: It's an identifier. It's the same as saying "Default". It's included for compatibility with MS Access. Since Default is a keyword in SQL, it needs to be quoted if used as an identifier, as it is here.

A: The column is named default, which is the same as an SQL keyword.  Thus, the brackets are used to denote we are referring to the column default and not the keyword default.


text:
Q: Complex Variable Book Suggestion What book should I choose to learn complex analysis as a physics Undergrad. I only want to use one book which will contain everything I need.

A: I used Visual Complex Analysis by T. Needham. Not only this book introduces reader to the intricacies of the Complex Analysis, but it gives a very intuitive picture and reasoning for visual representation of the subject. Well written, concise, and clear.

A: I'd recommend
Complex Variable and Applications, by Ruel V. Churchill & James Ward Brown. It's known as "Churchill". It starts from the very beginning (what complex numebrs are) but it quickly steps into analytical functions, integrals and series. It covers everything quickly but enough. I'd say it's the main book for physicists about this subject.

A: My course at the TU Delft used Applied Complex Variables for Scientists and Engineers by Yue Kuen Kwok. I liked it because as such books go it is relatively short, quite readable, and full of examples and problems. What I especially liked is that it always stays very close to real applications but it refuses to sacrifice rigor to do this.
I also liked the pacing. Coming into section 1 you are introduced from-scratch to complex numbers, with defined terms like "modulus" and "argument". You are shown how they densely summarize cosine and sine rules, how they can be used for electrical circuits (impedances, basically) and their connection to stereographic projections. In section 2 you start to learn how to differentiate complex numbers and you are introduced to the Cauchy-Riemann conditions and the notion of an analytic function -- but also how they can be used to solve the heat equation and other places where harmonic functions are useful. Then section 3 gently guides the reader to the correct complex understanding of the exponential function, the logarithm, the trigonometric functions, and the hyperbolic trigonometric functions, as well as to fractional (and real) powers. The Riemann surfaces that a multivalued function is "really" defined over are discussed, as are the "branch cuts" that slice-and-dice them down into the more familiar "branch sheets" that work as little well-behaved complex planes. Only after all of this gradual buildup to we get to the really "intense" stuff in section 4 about complex integration, the Cauchy integral theorem and contour deformation, the Cauchy integral formula and its implication that complex-differentiable-once (in a neighborhood) implies infinitely-often-complex-differentiable (in that neighborhood), and the theorems of Liouville (analytic over all of $\mathbb C$= either unbounded or constant) and of maximums (analytic on a bounded domain = maximum is on the boundary). There are some applications to vector fields as well in there.
As if aware that our minds are blown, section 5 returns back to the more tame idea of Taylor series and extends it to Laurent series and their convergence, and analytically continuing a power series outside of its radius of convergence to cover its entire Riemann surface, and section 6 returns to the Cauchy integral theorem with the residue calculus and the classification of poles, so there is some time for the dense mathematics to sink in. One recurring theme is trying to describe 2D fluid flow. There is also some discussion in these chapters about Fourier transforms and the like, with practice on adding contours that integrate to zero so that we can use the contour-deformation tricks that Cauchy gives us to get sums of residues. Section 7 was somewhat forgettable but introduced the Laplace transform which was nice, but section 8 on conformal mappings actually became very useful for me later on, as it turns out that the mathematics of bilinear transformations discussed in section 8.2 can be reappropriated to describe proper Lorentz transformations -- in 2-spinor calculus you find out that every Lorentz transform acts on the incoming and outgoing light rays from an observer as a bilinear tranform of a point on the complex plane, this point turns out to be a stereographic projection (see section 1!) of its location on the sphere of the sky. You get a really slick derivation both that accelerating observers must see the distant stars and galaxies all "crowd into" one point in the sky, and that their emitted light must "crowd into" the direction that they're going (so-called "relativistic beaming"). That was beyond the scope of the course, but the point is that I've seen this mathematics recur in a couple places now. (The latest was a use in continued-fraction calculators.)


text:
Q: Failed to register Prometheus Gauge to Flink I am trying to expose a Prometheus Gauge in a Flink app:
@transient def metricGroup: MetricGroup = getRuntimeContext.getMetricGroup
    .addGroup("site", site)
    .addGroup("sink", counterBaseName)
@transient var failedCounter: Counter = _

def expose(metricName: String, gaugeValue: Int, context: SinkFunction.Context[_]): Unit = {

    try {
         metricGroup.addGroup("hostname", metricName).gauge[Int, ScalaGauge[Int]]("test", ScalaGauge[Int](() => gaugeValue))
       }
    } catch {
      case _: Throwable => failedCounter.inc()
    }
  }

The app runs locally just fine and expose the metrics without any problem.
While trying to move to production I encounter the following exception in Flink task manager:
WARN  org.apache.flink.runtime.metrics.MetricRegistryImpl - Error while registering metric. java.lang.NullPointerException
Not sure, what am I missing here.
Why does the local app expose metrics while on the cluster it fails to register gauge?
I use Prometheus in order to expose other metrics from Flink, for example, failedCounter (in the code) which is a counter.
This is the first time I exposed gauge in Flink so I bet something in my implementation is broken.
Please help.


text:
Q: Easiest way to access SOAP web service if I've SOAP envelope ready? I've a complete SOAP envelope (XML) ready. What would be the easiest way to send this envelope in php? I know about SoapClient and Zend_Soap_Client but please consider this particular case, where I just want to send this envelope and print the xml response.
//Pseudo function for what I wanna do
public function sendEnvelope($xmlEnvelope, $url)
{
  //send this envelope to $url
  //return response
}

A: If you've got the Zend Framework to hand you could perhaps do something like:
$client = new Zend_Http_Client();
$client->setUri($url);
$client->setMethod(Zend_Http_Client::POST);
$client->setRawData($xmlEnvelope, 'application/soap+xml');
$response = $client->request();

Alternatively you can use cURL with a good introduction available at
Techniques for Mastering cURL from Nettus+


text:
Q: How to create a json file from csv file where csv file has following format Name,abc
Title,teacher
Email,abc.edu
Phone,000-000-0000
Office,21building
About,"abc is teacher"
Name,def
Title,plumber
Email,plumber@plumber.com
Phone,111-111-1111
Office,22building
About,"The best plumber in the town"
Name,ghi
Title,producer
Phone,333-333-3333
Office,33building
About,"The best producer"

A: I would use pandas library to read the .csv (foo.csv in this example) data and then convert it to json using to_json.
In this case you have a dictionary
import pandas as pd
pd.read_csv('aaa.csv', header=None, index_col=0, squeeze=True)\
    .to_json(orient='columns')

If you want to export a .json file
import pandas as pd
with open('exported_file.json', 'w') as f:
    pd.read_csv('foo.csv', header=None, index_col=0, squeeze=True)\
        .to_json(f, orient='columns')

A: I suppose that the CSV-file containes a sequentional records about personal in a format "Label,Value" and you'd like to reorganize it in the separated records for each person with labels along the second dimension as a column names. The output is going to be stored as a JSON-file.
If this is the case, then we can use pandas.DataFrame.pivot to change the scructure of data. But before that we have to group labes by person. For this purpose, I will assume that the Name label is obligatory for each person, and each unique label appears at most once between names:
data = '''Name,abc
Title,teacher
Email,abc.edu
Phone,000-000-0000
Office,21building
About,"abc is teacher"
Name,def
Title,plumber
Email,plumber@plumber.com
Phone,111-111-1111
Office,22building
About,"The best plumber in the town"
Name,ghi
Title,producer
Phone,333-333-3333
Office,33building
About,"The best producer"'''

df = pd.read_csv(StringIO(data), names=['label','value'])
df['grouper'] = (df['label'] == 'Name').cumsum()
df = df.pivot(index='grouper', columns='label', values='value')

Having this data we can save it as:
df.to_json('test.json', orient='records', lines=True)


text:
Q: Handmade POCO with Entity Framework 6? I'm looking into using EF 6 for an upcoming small project I will be doing at a very large organization. Having POCO business objects is essential to me, but all of the options I can find for how to do POCO with EF all seem to rely on auto-generating tools that try to map an entire database structure to POCO objects. We have many databases, hundreds of tables, and hundreds of views, and I'm only looking to use a few of these tables for the time being (and any one project would only hope to use a small subset of them).
Additionally I don't want to necessarily map out the many foreign properties or even some of the normal properties that these tables store. So I'd really like to make these POCO objects by hand and then connect them to EF and let it do the mapping - I'd like to still be able to use an EDMX file and not have to make my own ObjectContext, if possible.
I feel as though this has to be dead simple, but I can't really find any resources on it! If anyone can point me in the right direction that would really be helpful.

A: Entity Framework has a Code First aspect that can just map to existing tables as well. This allows you to use POCOs to represent your tables. You can create Mapping Classes that allow you to separate your POCOs from your database mapping logic.
You can specify if there is a different naming of the table column from the POCO. If there is no difference between the two however, you can omit it.
using ProjectName.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class ProfileMapping : EntityTypeConfiguration<Profile>
{
    public ProfileMapping()
    {
        // Primary Key
        this.HasKey(t => t.Id);

        // Map POCO name to Column Name
        this.Property(t => t.Firstname)
            .HasColumnName("First_Name")
            .HasMaxLength("256");

        // Table Mapping
        this.ToTable("Profiles");

        // Relationships
        this.HasRequired(t => t.Roles);
    }
}

Using the DbContext you can register these mappings.
I would recommend using the Entity Framework Power Tools to generate your DbContext from an existing database.
http://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d

A: Check out http://www.asp.net/mvc/tutorials/mvc-5/database-first-development/setting-up-database
Create a edmx for each database and you can select which objects you want to import.
If you have an existing database look at database first.


text:
Q: Problem with scraping data from the web. How to use XPath in Google Sheets correctly? I am trying to create monitoring table where tracking number of the parcel from one cell concatenates with the tracking website URL and imports current status.
On another site I use such construction and it works:
=IMPORTXML(CONCATENATE("https://site.url/tracking/?cargo_number=",A2), "//div[@class='status']")

But it is not working on this site: https://t.17track.net/en#nums=RP033693154CN
I tried to use the whole XPath by copying it from Google developer Tools:
/html/body/main/div/article/div[2]/div[1]/div/div/div[2]/div[2]/div[1]/dl[1]/dd[1]/div/p

Also I tried to use the and of the Xpath tail like in the first example but it response #N/A anyway.
I need to get such a response in one cell:
2018-10-13 17:05

and in another:
UKRAINE, KYIV 232, Attempted/Unsuccessful (physical) delivery : other reasons

Or at least the latest status.
By the way, I was trying to use "Copy XPath" function from Developer Tools in Google Sheets and it never worked without additional modification. What is the reason?

A: You may want to look into Xpath Finder and Xpath Helper. They are extensions on Chrome which can help when writing Xpaths. Some Xpaths don't work. You have to write them yourself. It sounds like you may want to check out Vlookup on Google Sheets/Excel, too. Good luck!


text:
Q: How to load a REST call through a script tag I understand that this a bit odd of a question but here I go. I am writing an application that will be switching environments (dev, test, prod, etc). I need the base URL for my REST calls to change as I switch environments. Well, our current solution (and I am all ears for better solutions) is a local REST call asking the server what environment I am in and what URL I should be using for my base. The external REST calls are separated from the front end completely.
With the local REST call I could do an ajax call to get the data somewhere in my javascript or I could include the REST call as follows:
<script src="/rest/configs"></script>

The problem with the above solution is that it returns an object that is not assigned to a variable thus throwing errors. So my over all question is, Can you load a REST call through a script tag straight into a variable and if so, how?

A: If you do this with a script tag the response of the request ( not AJAX at all ) will be parsed and executed as javascript.
What you could do is to return valid Javascript, rather than JSON object. Something like
window.config = {"env":"test"};

rather than
{"env":"test"}

Other option is not to do this with script tag and just write inline javascript with an ajax call. If you use jQuery it would look like :
<script>$.get("/rest/configs", function(config) { window.config = config; });</script>

This will do the Ajax call and assign it to a global variable config. Of course you should make some adjustments and execute the rest of your javascript after this is executed.
Anyway as a standard, this value is usually hard-coded in the scripts. I would suggest to create a script that is modified for test/dev/production environments.

A: Can't your rest call just return a Javascript object, like so:

var env = "experimental";

Your webpage should be able to interpret this as Javascript and the env variable should be usable in the rest of your page:
<html>
    <head>
        <script type="text/javascript" src="/rest/configs"></script>
        <script type="text/javascript">
            console.log("env: " + env); // prints env: experimental
        </script>
    </head>
    <body></body>
</html>


text:
Q: Why does TextAppearance and TextAppearance.Small has the same text size? I am developing a android app and i believe using the official text style can give user the best experience across all kinds of platforms and devices. But i found that TextAppearance.Large has the bigger text size but TextAppearance and TextAppearance.Small has the same size but only different in color, i don't know why.

A: They are not the same size. If you look at the styles.xml in the sdk\platforms\android-4.2\data\res\values\ you will see how they are defined.
As to why they are the same text size (which they are not), you will want to ask Google. ;-)
<style name="TextAppearance">
    <item name="android:textColor">?textColorPrimary</item>
    <item name="android:textColorHighlight">?textColorHighlight</item>
    <item name="android:textColorHint">?textColorHint</item>
    <item name="android:textColorLink">?textColorLink</item>
    <item name="android:textSize">16sp</item>
    <item name="android:textStyle">normal</item>
</style>

<style name="TextAppearance.Small">
    <item name="android:textSize">14sp</item>
    <item name="android:textColor">?textColorSecondary</item>
</style>

I believe using the official text style can give user the best
  experience across all kinds of platforms and devices

The best you can do is define your own styles in styles.xml. That, in my view is better than relying solely on the default themes. They do change from manufacturer to manufacturer. Your idea is true only in cases of devices using the stock Android OS.


text:
Q: Send email php with Arabic support I have feedback form. I want to send the content in HTML mail. When user enter Arabic character it don't show right. something like تجربة
PHP code:
function send_email($fromPerson, $fromEmail, $to, $subject, $message) {
    $headers = "From: $fromPerson<$fromEmail> \n";
    $headers .= "Reply-To: $eMail \r\n";
    $headers .= "X-Mailer: PHP/". phpversion();
    $headers .= "X-Priority: 3 \n";
    $headers .= "MIME-version: 1.0\n";
    $headers .= "Content-Type: text/html; charset=UTF-8\n";
    $headers .= "Bcc:log@tazbeta.com\n";
    $msg=$message;
    @mail($to, $subject, $msg, $headers);

I tried to send Arabic directly from the php code and it arrived correctly, some thing like $msg = "مثال";
The problem is when I submit the content from the feedback code.
<form name="feedb" method="post" action="subscribe.php" onsubmit="return validate_forms();">
    <input type="hidden" name="feedback_action" value="feed" />

Give Us Your Valuable Feedback

      <input name="firstName" id="firstName" type="text" style=" background:#fff; padding:5px; border:none; width:174px; color:#000; font-size:13px;" value="Full Name" onfocus="if(this.value=='Full Name')this.value=''" onblur="if(this.value=='')this.value='Full Name'" />
      <input name="email" id="email" type="text" style=" background:#fff; padding:5px; border:none; width:174px; color:#000; font-size:13px; margin-left:5px;" value="Email ID" onfocus="if(this.value=='Email ID')this.value=''" onblur="if(this.value=='')this.value='Email ID'" />

      <textarea name="comments" id="comments" rows="3" cols="50" style=" background:#fff; padding:5px; border:none; width:366px; color:#000; font-size:13px;" onfocus="if(this.value=='Feedback')this.value=''" onblur="if(this.value=='')this.value='Feedback'">Feedback</textarea>

      <input type="hidden" name="source" value="feedback" />
        <input name="submit" type="image" src="images/sbmt.gif" />

    </form>

Please, any ideas ?

A:   /**
   * Simple UTF-8 mail sender function. This function also encode subject and
   * plain-text message to UTF-8. If you need HTML mail sender, change the code
   * in line 2 from text/plain to text/html, but this function is usable the
   * most cases without any modification.
   */

  function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
      $_header = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
      mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $_header . $header);
  }

For more information check this link

A: I think you have to add this to the phpmailer
$mail->CharSet = 'UTF-8';
$mail->Encoding     = "base64";

A: add this head tag in your html page:

     <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<form name="feedb" method="post" action="subscribe.php">
...
</form>

A: Make your database encoded with utf8_general_ci in mysql setting.


text:
Q: Using Rhino Mocks' Expect.Call for a Mock Property in VB.NET The following C# code works just fine and the test passes as expected.
using NUnit.Framework;
using Rhino.Mocks;

namespace RhinoMocksTesting
{
    public interface ITesting
    {
        string Test { get; }
    }

    [TestFixture]
    public class MocksTest
    {

        [Test]
        public void TestMockExpect()
        {
            var mocks = new MockRepository();
            var testMock = mocks.StrictMock<ITesting>();
            Expect.Call(testMock.Test).Return("testing");
            mocks.ReplayAll();
            Assert.AreEqual("testing", testMock.Test);
        }
    }
}

However, trying to do the same thing in VB.NET won't even compile!
Imports NUnit.Framework
Imports Rhino.Mocks

Public Interface ITesting
    ReadOnly Property Test() As String
End Interface

<TestFixture()> _
Public Class MocksTest

    <Test()> _
    Public Sub TestMockExpect()
        Dim mocks = New MockRepository
        Dim testMock = mocks.StrictMock(Of ITesting)()
        Expect.Call(testMock.Test).Return("testing")
        mocks.ReplayAll()
        Assert.AreEqual("testing", testMock.Test)
    End Sub

End Class

The Expect.Call line produces the following build error: "Overload resolution failed because no accessible 'Expect' accepts this number of arguments."
What is the proper way to use Expect.Call with a mocked property in VB.NET? I've seen a couple posts that say Rhino Mocks works better in VB10, but I'm stuck with Visual Studio 2008 for this current project.

A: Try
Rhino.Mocks.Expect.Call(testMock.Test).Return("testing")

Source

Now we switch to Rhino mocks 3.5 and
  see that we get an error on Expect
  saying that the signature is not
  correct. No worry this is because it
  is choosing the wrong Expect. It is
  namely trying to use the extension
  method there. Just add Rhino.Mocks.
  before the Expect and all is well
  again. Look how the imports doesn't do
  the same thing.


text:
Q: Values retrieved from firestore only after hot reload in flutter I am new to flutter. This is what I have done so far(This is not the whole code).As you can see I am trying get some data from firestore in flutter. The problem is that the number value is always zero when I entering to the page. But if I hot reload the page it gives me the correct value. I Why is that? I think it has something to do with future and async. But I don't understand them yet properly.
Widget build(BuildContext context) {

someMethod() {
  return Firestore.instance
      .collection('comments')
      .where("Post", isEqualTo: widget.snapshot.documentID)
      .getDocuments();
}

someMethod().then((QuerySnapshot snapshot) {
  if (snapshot.documents.isNotEmpty) {
    db = snapshot.documents;
  }
});

int number = db?.length ?? 0;
print(number);
}

A: You have to use setState() to Notify the framework that the internal state of this object has changed.
someMethod().then((QuerySnapshot snapshot) {
  if (snapshot.documents.isNotEmpty) {
    setState(() {
      db = snapshot.documents;
    });
  }
});


text:
Q: Laravel Blade Undefined variable: I am completely new into Laravel, but keep getting this error. I did follow an tutorial, and did exactly the same as the video, but it doesn't work.
In my /controllers/users.php i have:
<?php
class Users_Controller extends Base_Controller {
 public $restful = true;

 public function get_create(){
     return View::make('users.create')->with("title","Bum bum!");

 }
}
?>

And in my /views/users/create.blade.php i have:

Wallah {{$title}}

But i keep getting this error?
Unhandled Exception
 Message:

  Error rendering view: [users.create]

  Undefined variable: title
  Location:


text:
Q: Openapi - duplicate operationID and extra parameter I'm documenting my Django API using Swagger.When I generate my Openapi schema, a second route with an additional parameter {format} is added for each of my paths, with the same operation ID as the "correct" route.
I read that the generator may generate duplicate operationId if I have several views with the same model, but this is not my case I think.
Overall, my views (resource/api/views.py) are all organized like this:
class ResourceList(APIView):

    """
    View to list Resources.
    """

    def get(self, request, parameter1):
       ...

class ResourceDetail(APIView):

    """
    View to retrieve information of a Resource.
    """

    def get(self, request, parameter1, parameter2):
        ...

For these two views, I have these two paths:
urlpatterns = ([
    path('<str:parameter1>', views.ResourceList.as_view()),
    path('<str:parameter1>/details/<str:parameter2>', views.ResourceDetail.as_view())
])

And the schema generator generates two routes for each.
For the first path:
Route: /api/resource/{parameter1}, Method: get
Route: /api/resource/{parameter1}{format}, Method: get

For the second path:
Route: /api/resource/{parameter1}/details/{parameter2}, Method: get
Route: /api/resource/{parameter1}/details/{parameter2}{format}, Method: get

A warning like this appears:
Route: /api/resource/{parameter1}, Method: get
Route: /api/resource/{parameter1}{format}, Method: get
An operationId has to be unique across your schema. Your schema may not work in other tools.

The warning obviously makes sense, because both routes have the same operationID,(retrieveResourceList in this case). What I don't understand is why the second route is being generated and where that format parameter comes from.
Is this a normal behaviour? If not, what am I doing wrong?

A: I'm using Autoschema to overide operation_id
from rest_framework.schemas.openapi import AutoSchema
class CandidateAssignToMeList(CandidateMixins,generics.ListAPIView):
    schema = AutoSchema(
        tags=['LISTVIEW'],
        component_name='Assign To Me',
        operation_id_base='CandidateAssignToMeList',
    )
class CandidateList(CandidateMixins,generics.ListAPIView):
     schema = AutoSchema(
        tags=['LISTVIEW'],
        component_name='Candidate ListView',
        operation_id_base='CandidateList',
    )

A: This might not be the way to resolve this fully but in my case, I try commenting the format_suffix_patterns and the format parameter disappear. Here is how I manage the urls:
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = [...]

urlpatterns = format_suffix_patterns(urlpatterns) # Comment this


text:
Q: Automatic summing of dummy indices I have:
$$test1=t_{1,2} \delta _{1,a} x_{2,b} \left(-\frac{\partial L}{\partial x_{a,b}}\right)-t_{1,2} x_{1,a} \delta _{2,b} \frac{\partial L}{\partial x_{a,b}}$$
$$test2=t_{1,2} x_{2,a} \delta _{1,b} \frac{\partial L}{\partial x_{a,b}}+t_{1,2} \delta _{2,a} x_{1,b} \frac{\partial L}{\partial x_{a,b}}$$
I have to calculate:
$$test = test2 + test3$$
I am expecting the answer:
$$test=2 t_{1,2} x_{2,a} \delta _{1,b} \frac{\partial L}{\partial x_{a,b}}+2 t_{1,2} \delta _{2,a} x_{1,b} \frac{\partial L}{\partial x_{a,b}}$$
For that I am using following code right now,
 ClearAll[\[Delta]]

    Format[\[Delta][a_, b_]] := Subscript[\[Delta], a, b]

 \[Delta][\[Beta], a_] := \[Delta][a, \[Beta]]

 \[Delta][\[Alpha], a_] := \[Delta][a, \[Alpha]]

 \[Delta][1, 1] = 1;

 \[Delta][2, 2] = 1;

 \[Delta][3, 3] = 1;

 \[Delta][4, 4] = 1;

 \[Delta][1, 2] = 0; \[Delta][2, 1] = 0;
\[Delta][1, 3] = 0; \[Delta][3, 1] = 0;
\[Delta][1, 4] = 0; \[Delta][4, 1] = 0;
\[Delta][2, 3] = 0; \[Delta][3, 2] = 0;
\[Delta][2, 4] = 0; \[Delta][4, 2] = 0;
\[Delta][3, 4] = 0; \[Delta][4, 3] = 0;

 Format[t[a_, b_]] := Subscript[t, a, b]
$Assumptions = t \[Element] Matrices[{4, 4}, Reals, Antisymmetric[{1, 2}]];
t[arg__] /; SameQ[arg] := 0
t[arg__] /; ! OrderedQ@{arg} := Signature@{arg} t @@ Sort@{arg}

 Format[x[a_, b_]] := Subscript[x, a, b]
$Assumptions = x \[Element] Matrices[{4, 4}, Reals, Antisymmetric[{1, 2}]];
x[arg__] /; SameQ[arg] := 0
x[arg__] /; ! OrderedQ@{arg} := Signature@{arg} x @@ Sort@{arg}

 test1 = -t[1, 2] myD[L, x[a, b]]*x[2, b]*\[Delta][1, a] -
  t[1, 2] myD[L, x[a, b]]*x[1, a]*\[Delta][2, b]

 test2 = t[1, 2] myD[L, x[a, b]]*x[2, a]*\[Delta][1, b] +
  t[1, 2] myD[L, x[a, b]]*x[1, b]*\[Delta][2, a]

 test3 = test1 /. {a -> b, b -> a}

 test = test2 + test3

 Can I use an easier way such that mathematica detect it automatically without replacing indices:

I have a code as follows:
    dummyunify[expr_Plus,
      possibledummylst_] := (term |->
        Module[{indexlstold, indexlstnew,
          varlst = DeleteCases[List @@ term, _?AtomQ]},
         indexlstold =
          DeleteDuplicates@
           Cases[SortBy[Last]@varlst,
            Alternatives @@ possibledummylst, \[Infinity]];
         indexlstnew = possibledummylst[[;; Length@indexlstold]];
         term /. Thread[indexlstold -> indexlstnew]]) /@ expr

But this is not summing automatically!
dummyunify[test1 + test2, {a, b}]
Can anyone help?

A: Clean-up
It's hard to read your code and it's hard to guess what you're asking for.
We can make things a lot cleaner with a few tweaks. Firstly, you're defining $\delta$ by hand, when it's clearly just the KroneckerDelta.
Next, in your definitions of t and x, Signature already handles whether the arguments are equal and/or ordered. So you can delete these. Furthermore, I believe these definitions contain an error, namely that it sorts the arguments while they still contain the dummy variables. I.e. t[b,a] will become -t[a,b]. We can avoid this by requiring the arguments are numeric before applying the definitions. Better yet, we can do everything first and enforce the symmetry at the end.
We can also delete the assumptions since you're explicitly giving these properties to $x$ and $t$ and furthermore not using any tensor operations. I'll lastly add a formatting line for myD. Putting this altogether we can replace your entire top block of code with
δ = KroneckerDelta[#1, #2] &;
(*t[arg__?NumericQ] /; ! OrderedQ@{arg} := Signature@{arg} t @@ Sort@{arg}
x[arg__?NumericQ] /; ! OrderedQ@{arg} := Signature@{arg} x @@ Sort@{arg}*)
Format[t[a_, b_]] := Subscript[t, a, b]
Format[x[a_, b_]] := Subscript[x, a, b]
Format[myD[a_, b_]] := "\[PartialD]" <> ToString[a, TraditionalForm]/
 "\[PartialD]" <> ToString[b, TraditionalForm]

test1 = -t[1, 2] myD[L, x[a, b]]*x[2, b]*δ[1, a] - t[1, 2] myD[L, x[a, b]]*x[1, a]*δ[2, b]
test2 = t[1, 2] myD[L, x[a, b]]*x[2, a]*δ[1, b] + t[1, 2] myD[L, x[a, b]]*x[1, b]*δ[2, a]
test3 = test1 /. {a -> b, b -> a}
test = test2 + test3

which gives

Summation
If I understand correctly, you want a function that takes in expressions like above and returns an expression which has been summed over all variables appearing in it. For this example, I am going to assume that the dummy variables always appear as an argument to x or t. It's not terribly hard to generalize if need be. I'm also going to assume that myD[a,b]=-myD[a,-b] and that the user should specify a global max index for the variables.
We begin by getting a list of the variables to be summed.
getVars[exp_] :=
 Union@Flatten@Cases[exp, ten_[a_?(And[AtomQ[#], ! NumericQ[#]] &),
b_?(And[AtomQ[#], ! NumericQ[#]] &)] :> {a, b}, ∞]

We then make a function that enforces the anti-symmetry of $x$ and $t$, and myD while we're at it
sort[exp_] := exp /. (p : x | t)[a__?NumericQ] :> (Signature[{a}] p @@ Sort[{a}])
myD[a_, -b_] := -myD[a, b]

We finally define our auto sum function
sum[exp_, max_, min_ : 1] := Block[{vars},
  vars = getVars[exp];
  sort[Sum @@ Prepend[Evaluate@Table[{v, min, max}, {v, vars}], exp]]
  ]

which gives

in which you can see the dummy variables have been summed over, as requested.


text:
Q: writing output to a file with subprocess in python I have a code which spawns at the max 4 processes at a go. It looks for any news jobs submitted and if it exists  it runs the python code
for index,row in enumerate(rows):
    if index < 4:
        dirs=row[0]
        dirName=os.path.join(homeFolder,dirs)
        logFile=os.path.join(dirName,(dirs+".log"))
        proc=subprocess.Popen(["python","test.py",dirs],stdout=open(logFile,'w'))

I have few questions:

*

*When I try to write the output or errors in log file it does not write into the file until the process finishes.Is it possible to write the output in the file as the process runs as this will help to know at what stage it is running.

*When one process finishes, I want the next job in the queue to be run rather than waiting for all child processes to finish and then the daemon starts any new.

Any help will be appreciated.Thanks!

A: For 2. you can take a look at http://docs.python.org/library/multiprocessing.html

A: Concerning point 1, try to adjust the buffering used for the log file:
open(logFile,'w', 1) # line-buffered (writes to the file after each logged line)
open(logFile,'w', 0) # unbuffered (should immediately write to the file)

If it suits your need, you should choose line-buffered instead of unbuffered.
Concerning your general problem, as @Tichodroma suggests, you should have a try with Python's multiprocessing module.


text:
Q: Google Sheets script executes outdated version. How can I get the sheet to load the latest script? I'm writing a script to execute from a menu item in a Google spreadsheet using the onOpen() trigger. I am using the script editor from the menu in the spreadsheet. I have been working on this for a few days, adding features and trying them out via execution from the menu. Today, my script changes are not reflected in what happens when I execute the menu pick I added. An older version of the script seems to have become embedded in the sheet and it never updates when I save my script changes in the script editor. I've tried closing everything and re-opening the browser and then the spreadsheet, but the old code continues to execute.
How can I connect the updated code to the spreadsheet and get back to where saving the code in the editor enables the spreadsheet to access that updated code?

A: I had made a copy of my code file, and it was that copy which was running. Obviously, it had to be something stupid, and it was.


text:
Q: How to protect routes in core ui react I have downloaded react admin dashboard from core ui, now I need to protect the dashboard routes defined in it, so how can I do that,
routes.js
import React from 'react';
import Loadable from 'react-loadable'

import DefaultLayout from './containers/DefaultLayout';

function Loading() {
  return
Loading...
;
}

const Breadcrumbs = Loadable({
  loader: () => import('./views/Base/Breadcrumbs'),
  loading: Loading,
});

const Cards = Loadable({
  loader: () => import('./views/Base/Cards'),
  loading: Loading,
});

const Carousels = Loadable({
  loader: () => import('./views/Base/Carousels'),
  loading: Loading,
});

const Collapses = Loadable({
  loader: () => import('./views/Base/Collapses'),
  loading: Loading,
});

const Dropdowns = Loadable({
  loader: () => import('./views/Base/Dropdowns'),
  loading: Loading,
});

const Forms = Loadable({
  loader: () => import('./views/Base/Forms'),
  loading: Loading,
});

const Jumbotrons = Loadable({
  loader: () => import('./views/Base/Jumbotrons'),
  loading: Loading,
});

const ListGroups = Loadable({
  loader: () => import('./views/Base/ListGroups'),
  loading: Loading,
});

const Navbars = Loadable({
  loader: () => import('./views/Base/Navbars'),
  loading: Loading,
});

const Navs = Loadable({
  loader: () => import('./views/Base/Navs'),
  loading: Loading,
});

const Paginations = Loadable({
  loader: () => import('./views/Base/Paginations'),
  loading: Loading,
});

const Popovers = Loadable({
  loader: () => import('./views/Base/Popovers'),
  loading: Loading,
});

const ProgressBar = Loadable({
  loader: () => import('./views/Base/ProgressBar'),
  loading: Loading,
});

const Switches = Loadable({
  loader: () => import('./views/Base/Switches'),
  loading: Loading,
});

const Tables = Loadable({
  loader: () => import('./views/Base/Tables'),
  loading: Loading,
});

const Tabs = Loadable({
  loader: () => import('./views/Base/Tabs'),
  loading: Loading,
});

const Tooltips = Loadable({
  loader: () => import('./views/Base/Tooltips'),
  loading: Loading,
});

const BrandButtons = Loadable({
  loader: () => import('./views/Buttons/BrandButtons'),
  loading: Loading,
});

const ButtonDropdowns = Loadable({
  loader: () => import('./views/Buttons/ButtonDropdowns'),
  loading: Loading,
});

const ButtonGroups = Loadable({
  loader: () => import('./views/Buttons/ButtonGroups'),
  loading: Loading,
});

const Buttons = Loadable({
  loader: () => import('./views/Buttons/Buttons'),
  loading: Loading,
});

const Charts = Loadable({
  loader: () => import('./views/Charts'),
  loading: Loading,
});

const Dashboard = Loadable({
  loader: () => import('./views/Dashboard'),
  loading: Loading,
});

const CoreUIIcons = Loadable({
  loader: () => import('./views/Icons/CoreUIIcons'),
  loading: Loading,
});

const Flags = Loadable({
  loader: () => import('./views/Icons/Flags'),
  loading: Loading,
});

const FontAwesome = Loadable({
  loader: () => import('./views/Icons/FontAwesome'),
  loading: Loading,
});

const SimpleLineIcons = Loadable({
  loader: () => import('./views/Icons/SimpleLineIcons'),
  loading: Loading,
});

const Alerts = Loadable({
  loader: () => import('./views/Notifications/Alerts'),
  loading: Loading,
});

const Badges = Loadable({
  loader: () => import('./views/Notifications/Badges'),
  loading: Loading,
});

const Modals = Loadable({
  loader: () => import('./views/Notifications/Modals'),
  loading: Loading,
});

const Colors = Loadable({
  loader: () => import('./views/Theme/Colors'),
  loading: Loading,
});

const Typography = Loadable({
  loader: () => import('./views/Theme/Typography'),
  loading: Loading,
});

const Widgets = Loadable({
  loader: () => import('./views/Widgets/Widgets'),
  loading: Loading,
});

// https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config
const routes = [
  { path: '/', exact: true, name: 'Home', component: DefaultLayout },
  { path: '/dashboard', name: 'Dashboard', component: Dashboard },
  { path: '/theme', exact: true, name: 'Theme', component: Colors },
  { path: '/theme/colors', name: 'Colors', component: Colors },
  { path: '/theme/typography', name: 'Typography', component: Typography },
  { path: '/base', exact: true, name: 'Base', component: Cards },
  { path: '/base/cards', name: 'Cards', component: Cards },
  { path: '/base/forms', name: 'Forms', component: Forms },
  { path: '/base/switches', name: 'Switches', component: Switches },
  { path: '/base/tables', name: 'Tables', component: Tables },
  { path: '/base/tabs', name: 'Tabs', component: Tabs },
  { path: '/base/breadcrumbs', name: 'Breadcrumbs', component: Breadcrumbs },
  { path: '/base/carousels', name: 'Carousel', component: Carousels },
  { path: '/base/collapses', name: 'Collapse', component: Collapses },
  { path: '/base/dropdowns', name: 'Dropdowns', component: Dropdowns },
  { path: '/base/jumbotrons', name: 'Jumbotrons', component: Jumbotrons },
  { path: '/base/list-groups', name: 'List Groups', component: ListGroups },
  { path: '/base/navbars', name: 'Navbars', component: Navbars },
  { path: '/base/navs', name: 'Navs', component: Navs },
  { path: '/base/paginations', name: 'Paginations', component: Paginations },
  { path: '/base/popovers', name: 'Popovers', component: Popovers },
  { path: '/base/progress-bar', name: 'Progress Bar', component: ProgressBar },
  { path: '/base/tooltips', name: 'Tooltips', component: Tooltips },
  { path: '/buttons', exact: true, name: 'Buttons', component: Buttons },
  { path: '/buttons/buttons', name: 'Buttons', component: Buttons },
  { path: '/buttons/button-dropdowns', name: 'Button Dropdowns', component: ButtonDropdowns },
  { path: '/buttons/button-groups', name: 'Button Groups', component: ButtonGroups },
  { path: '/buttons/brand-buttons', name: 'Brand Buttons', component: BrandButtons },
  { path: '/icons', exact: true, name: 'Icons', component: CoreUIIcons },
  { path: '/icons/coreui-icons', name: 'CoreUI Icons', component: CoreUIIcons },
  { path: '/icons/flags', name: 'Flags', component: Flags },
  { path: '/icons/font-awesome', name: 'Font Awesome', component: FontAwesome },
  { path: '/icons/simple-line-icons', name: 'Simple Line Icons', component: SimpleLineIcons },
  { path: '/notifications', exact: true, name: 'Notifications', component: Alerts },
  { path: '/notifications/alerts', name: 'Alerts', component: Alerts },
  { path: '/notifications/badges', name: 'Badges', component: Badges },
  { path: '/notifications/modals', name: 'Modals', component: Modals },
  { path: '/widgets', name: 'Widgets', component: Widgets },
  { path: '/charts', name: 'Charts', component: Charts },
];

export default routes;

Here is the source for core ui react admin dashboard
I know protecting routes defined in App.js ,but here they routes are placed in constant, can anyone please tell me how to protect routes if and only if token is there then routing should happen otherwise don't.

A: You probably have already solved this. But in case you are still stuck, you can define the protecting routes in App.js or DefaultLayout inside container folder.
Assuming that you are storing tokens in localstorage/ cookie, use the following code in DefaultLayout inside Switch block:
{routes.map((route, idx) => {
  return route.component ? (
    <Route
      key={idx}
      path={route.path}
      exact={route.exact}
      name={route.name}
      render={props =>
        get_token_from_storage_or_cookie("tokenName") !== null
       ? (
          <route.component {...props} />
        ) : (
          <Redirect to={{ pathname: "/login" }} />
        )
      }
    />
  ) : null;
})}
<Redirect from="/" to="/dashboard" />

A: In react route v6 and core UI 4 work for me:
<Route
  key={idx}
  path={route.path}
  exact={route.exact}
  name={route.name}
  element={
    localStorage.getItem("loginUser") !== null ? (
      <route.element />
    ) : (
      <Navigate to="/login" />
    )
  }
/>


text:
Q: Making footer in one page for whole website I am new in PHP. Is it possible to make footer in one file and whole website will share this single file, so that If I want to change a website footer. So I make change in only one file so whole website footer changes automatically.
Here is sample of code of my footer :
<footer>
<!-- Here will be markup -->
</fotter>

A: Yes, create a php file called footer, this file looks like:
    <footer>
    <!-- Here will be markup -->
    </footer>

At the bottom of each page do a PHP include:
    include('footer.php');

A: Absolutely. Put your footer code in a separate file, then in the page you want to add it to use the following code:
<?php include('includes/footer.html'); ?>
(In this case the file is in a folder called 'includes' in the same folder as the main file. In that folder is footer.html)
If your main page is all PHP, you can leave out the  tags.

A: Yes. Create your footer in one file like so:
footer.php:
<footer>
    <!-- Here will be markup -->
</fotter>

and then include it in all of your other files:
index.php:
        ... some mark-up ...
        <?php include_once('footer.php'); ?>
    </body>
</html>

A: You can actually cheat the system to add a footer to all pages, without the need to actually add it to every file.
Firstly, find a file that is global and loads on ALL pages. Normally a config file, settings file or database connection.
If you have a globally called file, you can use a class to do it all for you, using the __destruct attribute.
In the global file, add the contents of the code below;
class globalFunctions
{
    function __destruct()
    {
        echo '<footer>
            © 2013 - Site name.
        </footer>';
    }
}

$globalFunctions = new globalFunctions;

Beats editing lots of files, when you can just add this.
PS: This also appends the page, to include the footer, if you use exit; or die() functions.

A: Yes its possible you can do this in many ways :
I always prefer by making function. (It will help you to understands PHP more)
footer.php
<?php
 function place_footer()
 {
?>
  <footer>
   <!-- Here will be markup -->
  </fotter>
<?php
 }
?>

file.php
include('footer.php');

and at the end of file just call
<?php  place_footer(); ?>

A: I think there is no necessity to create a function for it. Simply create a php file called footer.php
<footer>
   My Company 2014
</footer>

Then use php built in function require_once wherever you want.
require_once('footer.php');

A: If your footer DOES CONTAIN PHP CODE (and the file is "footer.php"), then at the end of every php page, write following one line of code:
<?php include_once 'footer.php'; ?>

However, if your footer is just a normal text file (such as, "footer.txt") and DOES NOT CONTAIN ANY PHP CODE, then it will be slightly faster if you use this code instead of the above shown:
<?php echo file_get_contents('footer.txt'); ?>