text:
Q: IBM Integration BUS v10 get data from WebService input, in ESQL I'm newbie in IBM Integrarion Bus. I don't understand, why I don't see id field (this fileld is in wsdl), in ESQL:
I watched this course: https://youtu.be/uQv6IF4glM4
This is my project: https://mega.nz/#!RFASHYqT!Qb4F93lrCldfWgp0h0BDhAhSPhWWP8vf0jWJTWlKU_4
BROKER SCHEMA gen
DECLARE ns1 NAMESPACE 'http://www.example.org/Employee';
DECLARE ns NAMESPACE 'http://EmployeeService';

CREATE COMPUTE MODULE getEmployeeDetails_Request_Response_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        -- CALL CopyMessageHeaders();
        -- CALL CopyEntireMessage();

        DECLARE name CHARACTER;
        DECLARE city CHARACTER;
        DECLARE empID INTEGER;

        SET name = 'Emilian';
        SET city = 'Wroclaw';
        SET empID = InputRoot.XMLNSC.ns:getEmployeeDetails.ns1:EmployeeRequest.

        SET OutputRoot.XMLNSC.ns1:EmployeeRespone.ns1:name = name;
        SET OutputRoot.XMLNSC.ns1:EmployeeResponse.ns1:city = city;
        SET OutputRoot.XMLNSC.ns1:EmployeeResponse.ns1:id = empID;

        RETURN TRUE;
    END;

    CREATE PROCEDURE CopyMessageHeaders() BEGIN
        DECLARE I INTEGER 1;
        DECLARE J INTEGER;
        SET J = CARDINALITY(InputRoot.*[]);
        WHILE I < J DO
            SET OutputRoot.*[I] = InputRoot.*[I];
            SET I = I + 1;
        END WHILE;
    END;

    CREATE PROCEDURE CopyEntireMessage() BEGIN
        SET OutputRoot = InputRoot;
    END;
END MODULE;

A: I had to add again type to message type:
IBM Integration Tool


text:
Q: Difference between Multistage Sampling and Stratified Random Sampling? I know the question is a very elementary one, but I simply cannot understand the difference other than the fact that an SRS is a form of Multi-Stage Sampling. Can anyone provide a simple example(s) to help me understand the critical difference between these two sampling designs?

A: Multi-Stage Sampling:
Population: USA elementary school students
First stage sampling: 10 States from total of 50 States.
Second Stage: 20 Counties from total XX counties in selected XXXXX state in the first stage.
Third stage: 50 elementary schools from total yy elementary schools in the selected ZZZ county in the second stage
Fourth stage: 10 students from each selected school.
Finally, I got 10 * 50 * 20 * 10 = 100,000 students.
Stratified sampling:
Population: USA elementary school students
Geographically stratify USA into ten regions
Region I: Connecticut, Maine, Massachusetts, New Hampshire, Rhode Island, Vermont
Region II: New Jersey, New York, Puerto Rico, US Virgin Islands
Region III: Delaware, District of Columbia, Maryland, Pennsylvania, Virginia, West Virginia
Region IV: Alabama, Florida, Georgia, Kentucky, Mississippi, North Carolina, South Carolina, Tennessee
Region V: Illinois, Indiana, Michigan, Minnesota, Ohio, Wisconsin
Region VI: Arkansas, Louisiana, New Mexico, Oklahoma, Texas
Region VII: Iowa, Kansas, Missouri, Nebraska
Region VIII: Colorado, Montana, North Dakota, South Dakota, Utah, Wyoming
Region IX: Arizona, California, Hawaii, Nevada, American Samoa, Guam, Northern Mariana Islands
Region X: Alaska, Idaho, Oregon, Washington

Randomly select 10,000 students from elementary schools from each region. I got a sample with 100,000 students.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Find elements which exists in the most of the lists Input:
[[1,2,3],[1,5,7],[1,9,3],[4,3,8]]

Expected result:
[1,3]

(add element to result if it exists in over 50% of input lists).
I'm looking for elegant, pythonic solution :). Sorry for my bad english.

A: How about:
>>> from collections import Counter
>>> s = [[1,2,3],[1,5,7],[1,9,3],[4,3,8]]
>>> count = Counter(term for subseq in s for term in set(subseq))
>>> [k for k,v in count.items() if v > len(s)//2]
[1, 3]

Counter is a handy tool which, well, counts things:
>>> Counter([1,2,3,3,2])
Counter({2: 2, 3: 2, 1: 1})

[.. oops, just noticed you're using Python 3, so we need .items()].


text:
Q: Cookies while using Node Currently working on a small chat like system. I am trying to save the username of a user whenever they enter it. I figured the best option would be to use cookies. So far I have tried a few things and failed. Below is some of the code that I have tried using(didn't work). Any insight on this would be greatly appreciated. Right now I am just trying to save a cookie and it isn't working for some reason. Here is the code:
var express = require('express');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var morgan = require('morgan');

var app = express();

var incomingMessage;

app.use(morgan('dev'));
app.use(cookieParser());

app.use(expressSession({secret:'somesecrettokenhere', saveUnititialized: true, resave: true}));

app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use('/', express.static(__dirname + '/public'));

app.get('/', function(req, res){
    res.cookie('name', 'express').send('cookie set');
});

I have tried to console.log(document.cookie); and it does not return what I tried setting for some reason.


text:
Q: Convert -130 to a 16 bits binary two's complement number I know (130)base10 = 10000010,
Not sure how to go about the rest.

A: What you want is complement(x) + 1, basically an xor and a sum:
#include <stdio.h>

int main(void)
{
    short mask = 0xFFFF; // 1111111111111111
    short data = 130;    // 0000000010000010
         // Complement      1111111101111101
         // Complement + 1  1111111101111110 = -130

    printf("%d\n", (mask ^ data) + 1);
    return 0;
}

Output:
-130


text:
Q: How to deal with with result of org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs() I am running posenet (which is a CNN) on android with tflite.
The model has multiple output arrays with the following dimensions:
1x14x14x17, 1x14x14x34, 1x14x14x32, 1x14x14x32
Therefore running the java tflite interpreter with
import org.tensorflow.lite.Interpreter;
Interpreter tflite;
...
tflite.runForMultipleInputsOutputs(inputs,outputs)

i can access the four output tensors with tflite.getOutputTensor(i) or with outputs.get(i) (with i el. [0,3]) as outputs is a HashMap filled with java.nio.HeapByteBuffer objects.
How can I convert these outputs or tflite tensors to java multi-dimensional arrays (something like float[][][][];) to be able to perform mathematical computations on them?

A: // The shape of *1* output's tensor
int[] OutputShape;
// The type of the *1* output's tensor
DataType OutputDataType;
// The multi-tensor ready storage
outputProbabilityBuffers = new HashMap<>();

ByteBuffer x;
// For each model's tensors (there are getOutputTensorCount() of them for this tflite model)
for (int i = 0; i < tflite.getOutputTensorCount(); i++) {
    OutputShape = tflite.getOutputTensor(i).shape();
    OutputDataType = tflite.getOutputTensor(i).dataType();
    x = TensorBuffer.createFixedSize(OutputShape, OutputDataType).getBuffer();
    outputProbabilityBuffers.put(i, x);
    LOGGER.d("Created a buffer of %d bytes for tensor %d.", x.limit(), i);
}

LOGGER.d("Created a tflite output of %d output tensors.", outputProbabilityBuffers.size());

Example output:
Classifier: Created a buffer of 11264 bytes for tensor 0.
Classifier: Created a buffer of 11264 bytes for tensor 1.
Classifier: Created a buffer of 4 bytes for tensor 2.
Classifier: Created a buffer of 11264 bytes for tensor 3.
Classifier: Created a tflite output of 4 output tensors.

And use it that way:
Object[] inputs = { your_regular_input };
tflite.runForMultipleInputsOutputs(inputs, outputProbabilityBuffers);

A: Defining the outputs like the following lets you work with native java arrays, which is what i wanted:
out1 = new float[1][14][14][17];
out2 = new float[1][14][14][34];
out3 = new float[1][14][14][32];
out4 = new float[1][14][14][32];
Map<Integer, Object> outputs = new HashMap<>();
outputs.put(0, out1);
outputs.put(1, out2);
outputs.put(2, out3);
outputs.put(3, out4);

A: Output: https://www.tensorflow.org/lite/models/object_detection/overview#output
val locations = outputs.getValue(0).asFlowArray(),
val classes = outputs.getValue(1).asFlowArray(),
val scores = outputs.getValue(2).asFlowArray(),
val detections = outputs.getValue(3).asFlowArray()


text:
Q: Invalid block tag : 'endblock'. Did you forget to register or load this tag? l get stuck in this error. l'm fresh user of Django and l m learning it by following steps on Youtube channel. l did everything same but l got this block tag error.
here is layout1 html content:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>{ % block title %}{% endblock %}</title>

{ % block content %}   {% endblock %}

index html content:
{% extends "layout/layout1.html"%}

{% block title %}The Video page{% endblock %}

{ % block content %}

This is a html

This is a p tag

Click me!

{% endblock % }

views.py content:
from django.template.response   import TemplateResponse

# Create your views here.
def video(request):

    return TemplateResponse (request,"video/index.html",{})

how can l handle this problem? as l did double-check to make sure everything is typed same like Youtube channel and normally ,l did not get where l did a mistake.

A: Django didn't recognise your starting block tag, because you have a space between the { and the %.
You also have the same error in both start and end tags in the other template file.

A: For me it was emacs breaking the lines up when I copied the template over, so
{% endif

was on one line and
%}

was on the next line.  These need to be together on one line, and
{{ variable_name }}

too.

A: For me it was the issue of using i18n without putting the {% load i18n %} inside the template file (I only put it in the base template)

A: For me the problem was with {% extends %}, it was extend.

A: In your Html template, ensure you {% load static %} just after your {% block content %}
before using it in the template

A: In my case,
{% csrf token %} instead of this {% csrf_token %} solved.
If you are missed _ (underscore) in code then also you will got this error.

A: in my case use {% load static %} after {% extends 'base.html' %} solved.

A: I got this error because I mixed up {% %} and {{ }}. I had:
<title>{% user.name %} ({% user.id %})</title>

When I should have had:
<title>{{ user.name }} ({{ user.id }})</title>

A: You simply have typos.
You should have {% not { %, and you got those typos in both of templates.
So you need to have
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>{% block title %}{% endblock %}</title>

    {% block content %}   {% endblock %}

and
{% extends "layout/layout1.html"%}

{% block title %}The Video page{% endblock %}

{% block content %}

This is a html

This is a p tag

  Click me!

{% endblock %}

NOTE: don't forget about identations in html files, it makes code more readable.

A: If none of the previous answers worked for you, try the following:
You are most likely using a base.html file and have the static css being loaded on the top {% load static %} and the problem for me was that I needed to also load this in my other template file.
I'm using Django 2.0.3 and this solved the issue for me.

A: Similar to @gal-bracha answer, for me the problem was caused by including a template inside another (through the {% include %} tag) and both templates making use of a {% trans "some text" %} tag. In this case, the {% load i18n %} must be written in both the including and in the included templates.

A: Not to answer this specific question, but to share my case which gave the same error:
In my case this same error been caused because I forgot to add the url in the link  reference name:
href="{% url 'allblogs' %}".  worked.

while error was received when url was missed like below:
href="{% 'allblogs' %}". Error been generated.

A: if you encounter this:
Invalid block tag on line 172: 'endfor'. Did you forget to register or load this tag?
Check:
Any part of your code commented, check if {% endfor %} has been repeated.
If it is repeated delete one especially the commented section.
Thank you.

A: in my case i used replaced {% csrf token %} with {% csrf_token %} and it seemed to work.
In any template that uses a POST form, use the csrf_token tag inside the <form> element if the form is for an internal URL, e.g.:
<form method="post">{% csrf_token %}

This should not be done for POST forms that target external URLs, since that would cause the CSRF token to be leaked, leading to a vulnerability.

A: This also happens when you forget putting your phrase between quotes.
{% trans My phrase %}

instead of
{% trans "My phrase" %}


text:
Q: Can ordered list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with css? Can an ordered list produce results that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with CSS? So far, using list-style-type:decimal has produced only 1, 2, 3,  not 1.1, 1.2., 1.3.

A: Note: Use CSS counters to create nested numbering in a modern browser. See the accepted answer. The following is for historical interest only.

If the browser supports content and counter,

.foo {
  counter-reset: foo;
}
.foo li {
  list-style-type: none;
}
.foo li::before {
  counter-increment: foo;
  content: "1." counter(foo) " ";
}

uno

dos

tres

cuatro

A: The chosen answer is a great start, but it essentially forces list-style-position: inside; styling on the list items, making wrapped text hard to read. Here's a simple workaround that also gives control over the margin between the number and text, and right-aligns the number as per the default behaviour.
ol {
    counter-reset: item;
}
ol li {
    display: block;
    position: relative;
}
ol li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

JSFiddle: http://jsfiddle.net/3J4Bu/

A: In the near future you may be able to use the ::marker psuedo-element to achieve the same result as other solutions in just one line of code.
Remember to check the Browser Compatibility Table as this is still an experimental technology.
At the moment of writing only Firefox and Firefox for Android, starting from version 68, support this.
Here is a snippet that will render correctly if tried in a compatible browser:

::marker { content: counters(list-item,'.') ':' }
li { padding-left: 0.5em }

li element

sub li element

sub li element

sub li element

li element

li element

sub li element

sub li element

sub li element

You may also want to check out this great article by smashingmagazine on the topic.

A: The following worked for me:
ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

ol > li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

ol > li:before {
  content: counters(item, ".") ") ";
  display: table-cell;
  padding-right: 0.6em;
}

li ol > li {
  margin: 0;
}

li ol > li:before {
  content: counters(item, ".") ") ";
}

Look at: http://jsfiddle.net/rLebz84u/2/
or this one http://jsfiddle.net/rLebz84u/3/
with more and justified text

A: You can use counters to do so:

The following style sheet numbers nested list items as "1", "1.1", "1.1.1", etc.
OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }

Example

ol { counter-reset: item }
li{ display: block }
li:before { content: counters(item, ".") " "; counter-increment: item }

li element

sub li element

sub li element

sub li element

li element

li element

sub li element

sub li element

sub li element

See Nested counters and scope for more information.

A: None of solutions on this page works correctly and universally for all levels and long (wrapped) paragraphs. It's really tricky to achieve a consistent indentation due to variable size of marker (1., 1.2, 1.10, 1.10.5, …); it can't be just "faked," not even with a precomputed margin/padding for each possible indentation level.

I finally figured out a solution that actually works and doesn't need any JavaScript.
It's tested on Firefox 32, Chromium 37, IE 9 and Android Browser. Doesn't work on IE 7 and previous.
CSS:
ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

ol > li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

ol > li:before {
  content: counters(item, ".") ". ";
  display: table-cell;
  padding-right: 0.6em;
}

li ol > li {
  margin: 0;
}

li ol > li:before {
  content: counters(item, ".") " ";
}

Example:

Try it on JSFiddle, fork it on Gist.

A: The solutions posted here did not work well for me, so I did a mixture of the ones of this question and the following question: Is it possible to create multi-level ordered list in HTML?
/* Numbered lists like 1, 1.1, 2.2.1... */
ol li {display:block;} /* hide original list counter */
ol > li:first-child {counter-reset: item;} /* reset counter */
ol > li {counter-increment: item; position: relative;} /* increment counter */
ol > li:before {content:counters(item, ".") ". "; position: absolute; margin-right: 100%; right: 10px;} /* print counter */

Result:

Note: the screenshot, if you wish to see the source code or whatever is from this post: http://estiloasertivo.blogspot.com.es/2014/08/introduccion-running-lean-y-lean.html

A:

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="author" content="Sandro Alvares - KingRider">

TITLE ONE

text 1 one

text 1 two

text 1 three

text 1 four

TITLE TWO

text 2 one

text 2 two

text 2 three

text 2 four

TITLE THREE

text 3 one

text 3 two

text 3 three

text 3 four

Result:
http://i.stack.imgur.com/78bN8.jpg

A: I have some problem when there are two lists and second one is inside DIV
Second list should start at 1. not 2.1

lorem

lorem ipsum

lorem (should be 1.)

lorem ipsum ( should be 2.)

http://jsfiddle.net/3J4Bu/364/
EDIT:
I solved the problem by this
http://jsfiddle.net/hy5f6161/

A: this is proper code if you want to first child li resize of other css.

in html file.

Acceptance of Terms.

                            my text 1.

                            my text 2.

A: I needed to add this to the solution posted in 12 as I was using a list with a mixture of ordered list and unordered lists components. content: no-close-quote seems like an odd thing to add I know, but it works...
ol ul li:before {
  content: no-close-quote;
  counter-increment: none;
  display: list-item;
  margin-right: 100%;
  position: absolute;
  right: 10px;
}

A: I was after adding numbered list to Python Markdown's TOC Extension.
I did something like this:
.toc ul { counter-reset: outItem; list-style: none }
.toc ul > li{ counter-reset: nestedItem }
.toc ul > li:before { content: counters(outItem, ".") ". "; counter-increment: outItem; margin-left: -2em; }

I am not sure it is the correct way, but it worked for me.


text:
Q: No comma after question mark in title of article in references I replicated the Journal of Finance reference standard and when I have an article title with a question mark, I also get a comma after it in the references. However, I try to remove the comma if there is a question mark.
Here I created a simple example:
@article{examplesource,
  title={Title of article with question mark?},
  author={LastName1, FirstName1 and LastName2, FirstName2 and LastName3, FirstName3},
  journal={Journal of Finance},
  volume={40},
  number={1},
  pages={3--73},
  year={2005}}

\documentclass{article}

\usepackage[style=ext-authoryear, backend=biber, giveninits=true, uniquelist = false, uniquename=init, isbn=false, maxcitenames=3, dashed=false, maxbibnames=999, doi=false, url=false,giveninits=false]{biblatex}

%Bibliography file with sources
\addbibresource{biblatex-examples.bib}

%Indent of following references rows
\setlength{\bibhang}{15pt}

\renewcommand*{\labelnamepunct}{\addspace}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1}

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}

%Article definition
\renewbibmacro*{in:}{%
  \ifentrytype{article}
    {\setunit{\addcomma\space}}
    {\printtext{\bibstring{in}\intitlepunct}}}

%Title of Journal
\DeclareFieldFormat{journaltitlecase}{#1}
\renewbibmacro*{journal}{%
  \ifboolexpr{
    test {\iffieldundef{journaltitle}}and
    test {\iffieldundef{journalsubtitle}}}{}
    {\printtext[journaltitle]{%
       \printfield[journaltitlecase]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[journaltitlecase]{journalsubtitle}}}}

%Article number, volume & page
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article,periodical]{volume}{{#1}}
\DeclareFieldFormat{pages}{#1}

%Parentheses instead of commas in text
\UndeclareInnerCiteDelims{parencite}
\DeclareInnerCiteDelims{parencite}{(}{)}

%Commas instead of parentheses for years in references
\DeclareFieldFormat{biblabeldate}{#1}
\DeclareDelimFormat[bib]{nameyeardelim}{\addcomma\space}

\ExecuteBibliographyOptions{innamebeforetitle=true} \DeclareDelimFormat[bib]{nametitledelim}{\addcomma\space}

\begin{document}
\textcite{examplesource} lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.\\

\printbibliography
\end{document}

I get a comma after the question mark, but I want to only remove the comma in case the title includes a question mark.
Thanks a lot for the suggestions!

A: tl;dr
You need to (1) use \addcomma in the macro in: – as you are already doing – and to (2) teach \addcomma not to print a comma following ?, which can be done via \DeclarePunctuationPairs{comma}{*!}.

Here are two approaches, one global and one local. Both are based on the feature \DeclarePunctuationPairs (§4.7.5 of the biblatex documentation). This is intended to customize the behavior of \addcomma and of the \add- commands in general.
\addcomma is designed to print a comma, unless it follows certain punctuation marks. There are exceptions, though:

commas after abbreviation dots, exclamation marks, and question marks are permitted.

The way to specify such a list of exceptions for an \add- command is via \DeclarePunctuationPairs, with the default setting for \addcomma in biblatex.def being:
\DeclarePunctuationPairs{comma}{*!?}

where * stands for the abbreviation dot. (In the US localization, this is the only symbol on the list, meaning no comma after question or exclamation marks.)
Global approach
If we remove the question mark from the list, we are effectively barring biblatex from ever adding a comma after a question mark. This is much broader than what you are asking for, since it affects all entry types (you are looking for article) and potentially all field delimiters (not just between title and journal).
\AtBeginBibliography{\DeclarePunctuationPairs{comma}{*!}}

Note that I chose to activate this setting at the beginning of the bibliography, so as not to affect the main document. (F.i., both commas around "however" in The essay \citetitle{my-article}, however, appeared... are important, regardless of question marks. Something like "The essay "Was ist Aufklärung?" however, appeared" is incorrect.)
Pro: Clear-cut implementation.
Con: This is broader than what you have asked for – though it might be in the spirit of what you are trying to achieve, which is why I chose to demonstrate it.
Local approach
We can edit the bibmacro in: to include a redefinition of the behavior of \addcomma – locally, within the scope of the single entry – so as to affect only the title of journal articles.
\renewbibmacro*{in:}{%
  \ifentrytype{article}
    {\DeclarePunctuationPairs{comma}{*!}        % if article, no comma after "?"
    \setunit{\addcomma\space}}
    {\printtext{\bibstring{in}\intitlepunct}}}

This answers your specific request, it affects only the relevant entry types and fields and doesn't spill over to the main document. And you can always extend the approach to other entry types ("incollection"?) and punctuation (exclamation mark?).
Pro: Answers your specific question.
Con: A bit hacky and inelegant. I don't see any technical problems lurking in this solution, but more expert users might find fault with it.
The result:

And here's a simple MWE:
\documentclass{article}

\begin{filecontents}{questionable-articles.bib}
@article{kant-kopf,
  title={Versuch über die Krankheiten des Kopfes},
  author={Kant, Immanuel},
  journal={Königsbergsche Gelehrte und Politische Zeitungen},
  pages={13-27},
  year={1764}}
@article{kant-aufklaerung,
  title={Beantwortung der Frage: Was ist Aufklärung?},
  author={Kant, Immanuel},
  journal={Berlinische Monatsschrift},
  pages={481-494},
  year={1784}}
\end{filecontents}

\usepackage{biblatex}

\addbibresource{questionable-articles.bib}

\renewbibmacro*{in:}{%
  \ifentrytype{article}
    {\DeclarePunctuationPairs{comma}{*!}        % if article, no comma after "?"
    \setunit{\addcomma\space}}
    {\printtext{\bibstring{in}\intitlepunct}}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}


text:
Q: Combinatorics questions about binary strings of length $10$ I'm just running through my midterm review.. I'm usually pretty bad at applying simple combinatorics to word problems.. So I just was wondering if anyone could confirm the following answers.
We're dealing with binary strings of length 10.
a) How many binary strings of length 10 have at least three 0's?
So, this is equal to the total number of binary strings of length 10 minus the number of binary strings of length 10 with zero, one, and two 0's.
zero 0's: There is only 1 string like this: 1111111111
one 0: There are ten places to place the one 0, and thus there are ten of such cases
two 0's: There are ten places to place the first 0 and nine places to place the second 0.  However, there is an overlap so we divide by $2!$.
b)How many binary strings of length 10 have an even number of 1's?
So here I just applied the method I used for the number of strings with two 0's.
zero 1's: 1 string
two 1's: $\dfrac{10*9}{2!}$
four 1's: $\dfrac{10*9*8*7}{4!}$
six 1's: $\dfrac{10*9*8*7*6*5}{6!}$
eight 1's: $\dfrac{10*9*8*7*6*5*4*3}{8!}$
ten 1's: $\dfrac{10!}{10!}$
So if you sum all of that up, you get 512 strings which makes sense because $2^{10} = 1024$..
c) The number of binary strings of length 10 with alternating 0's and 1's
This one's really easy... There are only two options: $1010..$ and $0101..$
d) Four consecutive 0's
Here, there are $7$ places to put the block of zeros, then $2$ ways to fill in each remaining space, for a total of $7 * 2^6$ possible strings.
Any help / comments are greatly appreciated.
Cheers

A: d) needs a bit elaboration.
(i) If the question is about a run of exactly 4 $0$'s (though possibly a longer run elsewhere), we can count like this:
There are $2^5$ strings starting with $00001$.
There are $2^5$ strings ending with $10000$.
For $0\le k\le 4$ there are $2^4$ strings $\alpha100001\beta$, where $\alpha$ is $k$ digits and $\beta$ is $4-k$ digits long. Note that we need the "sentinel" $1$s to prevent the block from being longer  than 4.
That gives $2^5+2^5+5\cdot2^4=144$ strings.
However, $0000100001$, $0000110000$, $1000010000$ are counted twice, thus the answer is: 141.
Note that e.g. $0000100000$ is counted even though it has (also) a run of 5 0's.
(ii) If the question is about a run of at least 4 $0$'s, we can do this:
There are $2^6$ strings beginning with $0000$, i.e. with the block starting at the first digit.
For $2\le k\le 6$, there are $2^5$ strings of the form $\alpha10000\beta$ with $\alpha$ of length $k-1$ and $\beta$ of length $6-k$, i.e. with the block starting at the $k$th digit.
This give $2^6+5\cdot2^5=224$ strings.
However, we counted solutions with two blocks twice, namely $0000100001$, $0000110000$, $1000010000$, $0000100000$, $0000010000$. (Fortunately, there is not much room for two blocks).
Thus the answer is: 219.


text:
Q: Triangle areas within circle (AMC 10A 2017 #22) I've attempted various solutions for the problem below, to no avail:
Sides $\overline{AB}$ and $\overline{AC}$ of equilateral triangle $ABC$ are tangent to a circle at points $B$ and $C$ respectively. What fraction of the area of $\triangle ABC$ lies outside the circle?
Methods attempted:

*

*First, I tried drawing the problem "bare-bones". I tried finding the area of the segment using: $\frac { \theta  }{ 360 } *\pi { r }^{ 2 }-[\triangle BOC]\quad =\quad area\quad of\quad segment$. I would divide this by the area of an equilateral triangle ($\frac { { s }^{ 2 }\sqrt { 3 }  }{ 4 } $).

*I then tried extending the tangent lines to form another equilateral triangle, as such:

*Lastly, (very similar to previous), I tried making similar triangles ($\triangle ADE\sim \triangle ABC$), as shown below, but quickly realized it wouldn't help.

A: I take your second figure as reference, for the naming of points. But this naming doesn't coincide with the naming in the statement of the initial question (where $B$ and $C$ are for the points of tangency).
Let $a$ be the side of the equailateral triangle, and $r$ the radius of the circle, with:
$$\tag{0}a=r\sqrt{3}$$
The area of equilateral triangle ADE is
$$\tag{1}\sqrt{3}a^2/4.$$
The value of the area of triangle ADE minus the circular segment is
$$\tag{2}\underbrace{ar}_{\text{area of quadrilateral ODEA}}-\underbrace{(2 \pi/3)r^2}_{\text{area of circ. sector with angle 120°}}$$
Note the use of radians, without reference to degrees.
It suffices now to take the ratio between (2) and (1), and take (0) into account, yielding a unit-free result (a constant, independent of $r$ or $a$).


text:
Q: How do I run a command in a different, already existing, systemd scope or session? How do I run a command in a different already existing systemd session or scope?
As far as I can tell there is no difference between a session and the session's scope unit, as far as processes being in one or the other is concerned.
This question comes up because in Gnome, commands run from the terminal are seen as part of the gnome-terminal-server.service, not as part of the session-xx.scope. If I want to run a command in my session (or in another session for that matter) how do I do that?
(NB: this is the reverse of this question, which asks to create a new scope around existing processes.)

A: @GammaFunction points to the right direction, and I managed to succeed with the following command:
$ systemd-run --user --scope --unit="app-sleep" --property=Delegate=yes sleep 9999 &
$ disown
$ sleep 8888 &
$ pid=$(jobs -p)
$ busctl --user call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager AttachProcessesToUnit ssau "app-sleep.scope" / 1 "$pid"

The ssau (I think it means string, string, array of unsigned) here denotes the parameter types passed to function AttachProcessesToUnit, the documentation of this function can be found in man:org.freedesktop.systemd1(5).
Notes:

*

*The unit to be attached should set Delegate=yes (see man:systemd.resource-control(5))

*To pass an array of pids, you should pass the length of the array before the pids (which is 1 in the above example).

After attaching it to the given scope, you can see the scope's child processes via systemd-cgls or systemctl --user status app-sleep.scope.


text:
Q: Append value to JDBC connection property Looking for an example (or suggestions) on how to use ByteBuddy to intercept and append a value on a JDBC connection property.  The goal is to be able to use a JavaAgent to append a unique value for transaction correlation WITHOUT client code changes.  Example:
    Properties props = new Properties();
    props.put("user", user);
    props.put("password", password);
    props.put("ClientCorrelationToken", "MyToken1");

Want ClientCorrelaionToken to result as "MyToken1appendedValue"
Looked any many examples but cannot find a suitable method.
Ultimately need to be able to pull in a unique token from a web header and place that into the JDBC property, but want to get the intercept working first.

A: You probably need to intercept the JDBC constructor and mutate or exchange the properties argument upon invocation.
For example, you can use the AgentBuilder to intercept all types that are a subtype of a JDBC driver and adjust their constructors using Advice. If there is a standard API that you know of, you can also implement a more fine-grained interception.


text:
Q: How can I cancel my vote?
Possible Duplicate:
Are there any voting limits?
Cancel a vote so that the tally goes back to zero and not minus
Cancel Vote (Up Vote/Down Vote)

Is it possible to cancel vote?
Suppose I voted on a question. But later I realise that this question does not deserve vote. So how can I cancel my vote?

A: If you realise it soon enough, you can simply remove your vote by clicking the arrow again. If it is too late for that, you can remove your vote only after the question has been edited.

A: Yes, you simply click the arrow again.
That is, to remove an upvote, click the up arrow and to remove a downvote click the down arrow. You should already see it highlighted — clicking again will remove the vote and highlight.

However, there is a time limit on this. You only have about 5 minutes in which to change your mind unless the question or answer has been edited in the meantime. This is to prevent gaming of the system whereby you down-vote all competing answers and then when your answer is accepted or clearly ahead in votes revoke the down-votes.


text:
Q: Creating a responsive wordpress contact page like this picture: I'm trying to reproduce this page on my wordpress website.(http://lilyvalley.co/previews/)
The page should be responsive.
I don't know if my approach is wrong, but what I tried are the following:
- To have this centered effect, I tried to use the image as a background and put the text and the form over it. the result: everything is off position when I resize the window.
- I tried to create a table where each row and columns contains something( image,text,form)
  also with no good results.
I need help to determine what approach to take in this case to have all the element in their place and when I resize the window, they are resized accordingly.
The gold bar that you see is also part of that page.( the picture says it all).
Appreciate the help here.
Cheers!

A: You should checkout learnlayout.com to learn the basics of div based markup
Learn the Basics, Terminology, and Responsive Design Too:

*

*CSS Glossary

*CSS Basics

*CSS Beginner

*Guide to Responsive Design for Beginners

*10 Basic Responsive Design Tips

*Creating a Mobile First Responsive Design


text:
Q: When does the @ become useful? As you know, the @ characters before a php istruction suppress every eventual warning, error or notice from being raised.
Personally, i dont like this tecnique, becose i prefer to handle those errors, and in a real life, the error must no happen or have to be managed.
By the way, i find this tecnique to be applied in many scripts (cms plugins, open-source classes).
So, could the @ really be useful (in this case, an example would be appreciated), or is just for lazy developers?

A: Just think of, for example, a failed mysql_connect call. You may want to suppress the error message otherwise shown to the user (also showing some details you usually don't want anybody else to see) in this case.
Though the PHP warning was suppressed via the @-sign, you can perform certain actions like showing a friendly error message to the user afterwards.
However "misusing" @ for things like in the example below is definitely not a good idea:
@$undefinedVariable .= 'some text';

There are far more examples for bad use of the error-suppression sign out there than the one above, you should only use it when there is no other, better way to achieve what you want.

A: The answer to your question is simple and direct: no, @ is useless, and in fact harmful, and should not be used. Never.
The only exception I can think about are quick "run-once" scripts, when you really don't care about code quality and correctness.
In production scripts, I'd suggest using set_error_handler that converts errors into exceptions, and try with empty catch block in rare cases when an error should be ignored:
 try {
    unlink('tempfile');
 } catch(Exception $e) {
   // i don't care
 }

A: There's one use case: If you want to test scream, a PECL extension that disables the @ operator. :)

A: I'm a bit late, but using @ in PHP is normally not a good idea. I'd use it only for test code and surely not for production.
A much better way of handling errors is using the set_error_handler function (http://ch.php.net/set_error_handler). If something goes wrong you can just log the error (and maybe notify the admin) and then display a custom error message to the user or you may just ignore it if it's only a notice/warning. (You're probably doing this already.)
And this is where the @ comes in handy again. If you append an @ to a command and it causes any kind of error, the error handler will be called anyway, but with the parameter 'errno' set to zero. Have a look at the list of the different values of php error levels (http://ch.php.net/manual/en/errorfunc.constants.php). None of them equals zero, so you can identify errors which occured in functions with a prepending @. You could for example use it to "flag" unimportant errors (when you don't want to abort execution, but make sure to log it anyway as it can be helpful for debugging) or use it for some other purpose.

A: The only usefull situation would be:
if you do not have access to php/apache config and the errors are displayed to the user.
Otherwise, NEVER use @... and redirect the errors (in the php/apache config) to some log system (file, database, etc.).
PS: In some official PHP documentation, you can see that instead of checking if a file exists and then deletes it, they simply @unlink it. But I do not like it: I prefer to get the error in my logs in case of issue (access rights, etc.).

A: I really dislike @, but sometimes in some setups it's unavoidable.
Personally I prefer to set PHP at the config to just log errors and silently fail on production setups rather than use the @ crutch to suppress messages.
Good use: warnings. Sometimes functions throw warnings and there just isn't anything you can do without redesign, but it still works properly. @ will suppress it.


text:
Q: Can't find a way to install gettext from PIP virtualenv Overall I'm trying to use a module in Django that helps with translating pages, but I don't have installed and can't do it through pip install package.
I've tried the fllowing:
pip install gettext

That returns that could not find a version that requires the...
I also downloaded the tar.gz file from the official website, yet when I try to install it localy the error:
python setup.py egg_info failed with error code 1 windows

Comes up. Been reading, trying to fix the second error or possible solutions, installed ez_update, updatade all packages, made a rollback and I don't know what to do anymore, any help?

A: The package gettext is available as python-gettext in Python pypi
Please use
pip install python-gettext

A: I was struggling with the same issue and what worked for me eventually is the following:

*

*download gettext-runtime-0.17.zip and gettext-tools-0.17.zip (or the latest version) from here:
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/

*Place both directories in your project directory (say myProject)

*Now, in each of these folders there is a bin folder. Go into it and copy the address. Each would look sth like:

*

*C:\myProject\gettext-runtime-0.17\bin

*C:\myProject\gettext-tools-0.17\bin

*Go into: control panel > System > Advanced System settings > Environment variables. In system variables, choose Path and click
'edit'.

*Paste both addresses at the end, like this:

;C:\myProject\gettext-runtime-0.17\bin;C:\myProject\gettext-tools-0.17\bin
(don't forget the semicolon after the last existing item)

*Activate your virtualenv and run the makemessages command. It should work.


text:
Q: AngularJS - Cannot add formServices factory into Controller as parameter I'm trying to save the data from multistep form using ui-route in AngularJS to MongoDB.
In Postman, I can send data to MongoDB and it can save it. My problem is now, getting the data that the user created and saving it to MongoDB.
I have formServices to handle post request. But when I add to controller as angular.module('formApp', ['ngAnimate', 'ui.router', 'formServices']) and uses 'Form' inside of controller I get this error:
angular.js:36 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=formApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.16%2F%24injector%2Fmodulerr%3Fp0%3DformServices%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.2.16%252F%2524injector%252Fnomod%253Fp0%253DformServices%250A%2520%2520%2520%2520at%2520http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A6%253A450%250A%2520%2520%2520%2520at%2520http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A20%253A260%250A%2520%2520%2520%2520at%2520http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A21%253A262%250A%2520%2520%2520%2520at%2520http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A33%253A1%250A%2520%2520%2520%2520at%2520Array.forEach%2520(%253Canonymous%253E)%250A%2520%2520%2520%2520at%2520q%2520(http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A7%253A280)%250A%2520%2520%2520%2520at%2520e%2520(http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A32%253A445)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A33%253A18%250A%2520%2520%2520%2520at%2520Array.forEach%2520(%253Canonymous%253E)%250A%2520%2520%2520%2520at%2520q%2520(http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.2.16%252Fangular.min.js%253A7%253A280)%0A%20%20%20%20at%20http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A6%3A450%0A%20%20%20%20at%20http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A33%3A332%0A%20%20%20%20at%20Array.forEach%20(%3Canonymous%3E)%0A%20%20%20%20at%20q%20(http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A7%3A280)%0A%20%20%20%20at%20e%20(http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A32%3A445)%0A%20%20%20%20at%20http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A33%3A18%0A%20%20%20%20at%20Array.forEach%20(%3Canonymous%3E)%0A%20%20%20%20at%20q%20(http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A7%3A280)%0A%20%20%20%20at%20e%20(http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A32%3A445)%0A%20%20%20%20at%20ac%20(http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.16%2Fangular.min.js%3A36%3A34)
    at angular.js:36:1
    at angular.js:3809:15
    at Array.forEach (<anonymous>)
    at q (angular.js:323:7)
    at e (angular.js:3775:5)
    at ac (angular.js:3715:11)
    at c (angular.js:1379:20)
    at $b (angular.js:1394:12)
    at Wc (angular.js:1307:5)
    at angular.js:21459:5

repo who wants to dig in further: https://github.com/Edifie/yedy-final
I'm pretty sure the error pops up because of formService because when i take it out, it works fine.
formServices.js
angular.module('formServices', [])
.factory('Form', function($http){
    formFactory = {};

    formFactory.create = function(formData){
        return $http.post('/api/forms', formData);
    }
    return formFactory;
});

formCtrl.js
angular.module('formApp', ['ngAnimate', 'ui.router', 'formServices']).
.controller('formController', function($scope, $http, Form) {

    // we will store all of our form data in this object
    $scope.formData = {};

    // function to process the form
    // $scope.processForm = function() {

    // };

    var app = this;

    this.regForm = function(formData){

        app.loading = true;
        app.errorMsg = false;

        Form.create(app.regForm).then(function(formData){
            if(formData.data.success){
                app.loading = false;

                //create success message
                app.successMsg = formData.data.message = "...Redirecting";

                $timeout(function(){
                    //delay for 2 seconds after submitting the form
                    $location.path("/"); //send to home page after submitting
                }, 2000);
            }else{
                //crete error message
                app.loading = false;
                app.errorMsg = formData.data.message;
            }
        });
    }

});


text:
Q: Generalization of matrix product If I have a vector $v$ of length $n_1\times n_2\times n_3$ and a matrix $M$ of shape $(n_1\times n_2\times n_3, n_1\times n_2\times n_3)$, I can do matrix vector multiplication of $Mv$ to get a resulting vector $v'$ of size $n_1\times n_2\times n_3$.
So far so good.
Question
Let's say I reshape $v, v'$ into a matrices each with three dimensions (i.e., have size $(n_1, n_2, n_3)$). Is there:

*

*an operation I can perform on $M$

*a way to apply $M$ to vector $v$
so that $M$ applied to 3d matrix $v$ gives 3d matrix $v'$?
Initial thoughts
It seems it should be possible because if I write things as a vector then I know how to do matrix multiplication.
But if I rewrite $v, v'$ as matrices, the problem is $M$ somehow needs to be applied to $n_1, n_2, n_3$ dimensions correctly. I suspect this is related to Kronecker products/tensor products because I know that is one way to build bigger spaces from smaller spaces, but I am not sure what I would take the tensor product of $M$ with.


text:
Q: Laravel Query builder, not returning the correct results So I have the following query done in Query builder on a GraphQL Query
return LearningPath::query()
            ->selectRaw('learning_paths.id,learning_paths.name, count(*) as completed_nodes')
            ->selectRaw('(SELECT count(*) FROM learning_path_levels WHERE learning_path_levels.learning_path_id = learning_paths.id) as total_levels')
            ->selectRaw('(SELECT count(*) FROM learning_path_level_nodes WHERE learning_path_level_nodes.learning_path_level_id = learning_path_levels.id) as total_nodes')
            ->selectRaw('(count(*) * 100) / (SELECT count(*) FROM learning_path_level_nodes WHERE learning_path_level_nodes.learning_path_level_id = learning_path_levels.id) as percentage')
            ->join('learning_path_levels', 'learning_path_levels.learning_path_id', '=', 'learning_paths.id')
            ->join('learning_path_level_nodes', 'learning_path_level_nodes.learning_path_level_id', '=', 'learning_path_levels.id')
            ->leftJoin('learning_path_node_users', 'learning_path_node_users.learning_path_level_node_id', '=', 'learning_path_level_nodes.id')
            ->where('learning_path_node_users.user_id', auth()->id())
            ->orWhereNull('learning_path_node_users.user_id')
            ->groupBy('learning_paths.id','learning_path_levels.id')
            ->get();

Which returns the following
{
  "data": {
    "learning_path_completed_levels": [
      {
        "id": "1",
        "name": "Frontend",
        "completed_nodes": 1,
        "total_nodes": 3,
        "percentage": 33
      },
      {
        "id": "3",
        "name": "Devops",
        "completed_nodes": 5,
        "total_nodes": 7,
        "percentage": 71
      },
      {
        "id": "6",
        "name": "Project Manager",
        "completed_nodes": 3,
        "total_nodes": 6,
        "percentage": 50
      }
    ]
  }
}

But this is not the correct result it should fetch, as it is returning me only the Learning Paths that have at least one level completed ( with the field is_successful marked as true )
It shoud query something like this:
{
  "data": {
    "learning_path_completed_levels": [
      {
        "id": "1",
        "name": "Frontend",
        "completed_nodes": 1,
        "total_nodes": 3,
        "percentage": 33
      },
      {
        "id": "3",
        "name": "Devops",
        "completed_nodes": 1,
        "total_nodes": 5,
        "percentage": 20
      },
      {
        "id": "4",
        "name": "QA",
        "completed_nodes": 0,
        "total_nodes": 1,
        "percentage": 0
      },
      {
        "id": "5",
        "name": "AI",
        "completed_nodes": 0,
        "total_nodes": 5,
        "percentage": 0
      },
      {
        "id": "6",
        "name": "Project Manager",
        "completed_nodes": 3,
        "total_nodes": 6,
        "percentage": 50
      }
    ]
  }
}

How can I modify my query so it returns the expected values?


text:
Q: Alterar a qualidade de um Stream de vídeo c# Estou precisando alterar a qualidade de um vídeo que esta sendo stremado pela minha Api, eu já estou enviando o arquivo, agora estou precisando alterar a qualidade dele na hora da transmissão, segue o meu código abaixo:
               var buffer = new byte[65536];

                using (var video = File.Open(_filename, FileMode.Open, FileAccess.Read))
                {
                    var length = (int)video.Length;
                    var bytesRead = 1;

                    while (length > 0 && bytesRead > 0)
                    {
                        bytesRead = video.Read(buffer, 0, Math.Min(length, buffer.Length));
                        await outputStream.WriteAsync(buffer, 0, bytesRead);
                        length -= bytesRead;
                    }
                }

Existe alguma forma de alterar na hora do streaming ou eu preciso ter ele fisicamente nas outras qualidades?

A: Como o Cigano Morrison comentou. A qualidade do vídeo não definida na hora de transmitir o stream, mas sim no encode do video.
Se você está usando arquivos físicos precisará ter "copias" deles encodados com as características que você espera. Pode até automatizar o processo usando a biblioteca do FFmpeg
Para transmissões ao vivo você pode configurar em seu enconder os profiles, diversos endpoints para as variações de qualidade ou entregar o conteúdo em tracks apresentados em um manifesto para Adaptative bitrate Streaming ou Smooth Stream.


text:
Q: Package Stata Enhanced in Sublime Text - not working with Stata 15 I am not able to get the package Stata Enhanced for Sublime Text to work with Stata 15 (on a Mac). I've uninstalled Stata 14 and rebooted, and I also tried to direct Stata Enhanced to the application file with User Settings:
{
"stata_name": "/Applications/Stata/StataSE.app/Contents/MacOS/stata-se",
"switch_focus_to_stata": false
}

Or substituting stata-se with StataSE in the User Settings.

A: I have been in contact with the developer, Andrew Heiss, and together we identified the problem. He has now updated the package with a new version check. So, if you experience problems, try to update the Stata Enhanced package.
In Sublime Editor do the following:
Press Command-Shift-P,
start writing Package Control,
select "Package Control: Update Package",
then select Stata Enhanced.


text:
Q: Unable to get checkbox/radio button state using SendMessage Situation:
I am trying to use a third-party program using User32.dll's SendMessage. I need to be able to get the state of a checkbox and a radio button.
Using Spy++ to watch the messages, when it is an unchecked checkbox I see "S BM_GETCHECK" and "R BM_GETCHECK fCheck:BST_UNCHECKED" and if I send the command again on a checked checkbox it still says BST_UNCHECKED
retVal is 0 and Marshal.GetLastWin32Error() returns 0 as well
Ideally anything I use would be compatible with WinXP and .NET 2.0
Any help would be appreciated!
Relevant Code:
using System;
using System.Runtime.InteropServices;

[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);

int retValB = (int)SendMessage(hWnd, 0x00F0, IntPtr.Zero, IntPtr.Zero);

hWnd is the window handle for the checkbox/radiobox (confirmed using Spy++), I have also tried 0x00F2 and 0xF0F0 as the second arguments.

A: Is it a requirement to use SendMessage? This works for me (I used https://bytes.com/topic/net/answers/637107-how-find-out-if-check-box-checked as inspiration):
using Accessibility;

[DllImport("oleacc.dll", PreserveSig = false)]
[return: MarshalAs(UnmanagedType.Interface)]
public static extern object AccessibleObjectFromWindow(IntPtr hwnd, uint dwId, ref Guid riid);

public static Nullable<bool> isCheckBoxChecked(IntPtr checkBoxHandle)
{
    const UInt32 OBJID_CLIENT = 0xFFFFFFFC;
    const int UNCHECKED       = 1048576;
    const int CHECKED         = 1048592;
    Guid uid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");

    IAccessible accObj = (IAccessible)AccessibleObjectFromWindow(checkBoxHandle, OBJID_CLIENT, ref uid);
    object o2 = accObj.get_accState(0);
    if ((int)o2 == UNCHECKED)
    {
        return false;
    }
    else if ((int)o2 == CHECKED)
    {
        return true;
    }
    else
    {
        return null;
    }
}


text:
Q: How can we fix following error " InternalError: Unable to get element as bytes"? I am a student, and I am trying to implement text classification using elmo on keras. I imported elmo layer from tensorflow-hub.
def ELMoEmbedding(x):
    return embed(inputs={ "tokens": tf.squeeze(tf.cast(x, tf.string)), "sequence_len": tf.constant(100*[max_len])}, signature="tokens", as_dict=True)["elmo"]

url = "https://tfhub.dev/google/elmo/2"
embed = hub.Module(url)

Model :

inpt = Input(shape=(max_len,), dtype = tf.string)
emb_layer = Lambda(ELMoEmbedding, output_shape=(max_len,1024))(inpt)
bdlstm1 = Bidirectional(LSTM(1024))
drp = Dropout(0.5)(bdlstm1)
dns1 = Dense(2, activation='relu')(drp)
dns2 = Dense(no_labels, activation='softmax')(dns1)
model = Model(inpt, dns2)
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(x, y, batch_size = 100, epochs=10)

x and y are int32 numpy arrays
x = [[0,0,1,2,3],[0,0,4,5,6]]
y = [[0,1],[1,0]]

On implementing above code I am getting following error
c_api.TF_GetCode(self.status.status))

InternalError: Unable to get element as bytes.

Updated code
import tensorflow as tf
import tensorflow_hub as hub
from tensorflow.keras.layers import Input, Bidirectional, Lambda, Dropout, Dense, LSTM
from tensorflow.keras.models import Model
def ELMoEmbedding(x):
    return embed(inputs={ "tokens": tf.squeeze(tf.cast(x, tf.string)), "sequence_len": tf.constant(100*[max_len])}, signature="tokens", as_dict=True)["elmo"]

url = "https://tfhub.dev/google/elmo/2"
embed = hub.Module(url)

inpt = Input(shape=(max_len,))
emb_layer = Lambda(ELMoEmbedding, output_shape=(max_len,1024))(inpt)
bdlstm1 = Bidirectional(LSTM(1024))
drp = Dropout(0.5)(bdlstm1)
dns1 = Dense(2, activation='softmax')(drp)
model = Model(inpt, dns1)
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
model.fit(x, y, batch_size = 100, epochs=10)

New Error
TypeError: Failed to convert object of type <class 'tensorflow.python.keras.layers.wrappers.Bidirectional'> to Tensor. Contents: <tensorflow.python.keras.layers.wrappers.Bidirectional object at 0x7fc724d042d0>. Consider casting elements to a supported type.


text:
Q: Printf Format Issue. Won't Align I've looked into a bunch of questions on here about my problem, and even on Java, but I have not been able to figure it out. Here is my code
System.out.printf(
    "%-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s\n",
    "Record #",
    "Inventory",
    "Size", "Color", "Cost", "Markup", "Sale Price", "QTY", "SKU #");

    for (int x = 0; x < StoreInventory.inventory.length; ++x) {
        System.out.printf(
           "%-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s\n", x + 1,
            StoreInventory.inventory[x][0],
            StoreInventory.inventory[x][1],
            StoreInventory.inventory[x][2],
            StoreInventory.buyPrice[x],
            StoreInventory.markUp[x],
            StoreInventory.storeSalePrice[x],
            StoreInventory.quantity[x],
            StoreInventory.skuNumber[x]);
}

The Output Is:
Record #             Inventory            Size                           Color                Cost                 Markup               Sale Price           QTY                  SKU #
1                    SHORTS               XL                   BLACK                5.0                  10.0                 50.0                 10                   SL-1234AE

All the fields are user input.
What do I need to change to align the output regardless of the size of the input?


text:
Q: Get Keyword Arguments for Function, Python def thefunction(a=1,b=2,c=3):
    pass

print allkeywordsof(thefunction) #allkeywordsof doesnt exist

which would give [a,b,c]
Is there a function like allkeywordsof?
I cant change anything inside, thefunction

A: I think you are looking for inspect.getargspec:
import inspect

def thefunction(a=1,b=2,c=3):
    pass

argspec = inspect.getargspec(thefunction)
print(argspec.args)

yields
['a', 'b', 'c']

If your function contains both positional and keyword arguments, then finding the names of the keyword arguments is a bit more complicated, but not too hard:
def thefunction(pos1, pos2, a=1,b=2,c=3, *args, **kwargs):
    pass

argspec = inspect.getargspec(thefunction)

print(argspec)
# ArgSpec(args=['pos1', 'pos2', 'a', 'b', 'c'], varargs='args', keywords='kwargs', defaults=(1, 2, 3))

print(argspec.args)
# ['pos1', 'pos2', 'a', 'b', 'c']

print(argspec.args[-len(argspec.defaults):])
# ['a', 'b', 'c']

A: Do you want something like this:
>>> def func(x,y,z,a=1,b=2,c=3):
    pass

>>> func.func_code.co_varnames[-len(func.func_defaults):]
('a', 'b', 'c')

A: You can do the following in order to get exactly what you are looking for.
>>>
>>> def funct(a=1,b=2,c=3):
...     pass
...
>>> import inspect
>>> inspect.getargspec(funct)[0]
['a', 'b', 'c']
>>>


text:
Q: How to Get Pass Attribute value in Another Component After Navigation This code Navigate to another component perfectly but i don't understand how to get this passed attribute value in component2
NavigateToComponent2: function(component, event, helper) {
    var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
                componentDef: "Component2",
                componentAttributes: {
                myAttribute: component.get("v.id")
            }
        });
    evt.fire();
}

A: @Pankaj I forgot mention the second step in my previous post,

*

*you should define the attribute (that you are passing along with the
event) in the target component i.e. your component2 should have
'accountid' attribute defined in it
<aura:component implements="force:appHostable">
 <aura:attribute name="accountid" type="String" />
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
   Hello
</aura:component>

*also, along with the above change in the controller of your target
component you will be able to access it in following
manner(note: not from the event but from the component)
doInit : function(component, event, helper) {
        alert(component.get("v.accountid")) ;
    },

Being said that, let me clarify that it is not recommended to use this event as, it is not yet documented in the developer guide and could be subject to any changes in the future releases with out any notice
Do confirm if the above approach worked for you.


text:
Q: instantiate oc create -f abc.yaml from a microservice already running in Openshift I am working on a use case and got stuck here, wanted to run oc create -f abc.yaml , from a microservice which is already running on Openshift, So , when we run oc create -f abc.yaml , few workloads need to be created on same Openshift cluster.
Any idea how to do it. Please

A: Does "oc replace ..." do what you want instead?


text:
Q: Using OPENROWSET in an INSERT statement while specifying the values of another column? I'm using OPENROWSET(BULK ...) to insert the contents of a file into my table.  The problem is that I also need to specify the value of another column in the same INSERT statement.
I have something like this:
INSERT INTO MyTable
SELECT *
FROM OPENROWSET(BULK 'c:\foo.bin', SINGLE_BLOB)

I'm sure there's a way to also specify the value of a different column here, but I don't know how.

A: Found it, it was in the link posted by astandar, but under example D:
INSERT INTO MyTable (col1, col2)
SELECT 'foo' AS col1, *
FROM OPENROWSET(BULK N'c:\foo.bin', SINGLE_BLOB) AS col2


text:
Q: Push dropped item to Array using jQuery UI? I'm trying to push a word's ID to a list once it's dropped using jQuery UI's droppable feature. When I drag and drop the word the console.log() gives me the correct ID. However my .push() call below does nothing. How do I push the given ID?
Goal:
Before drop: One, Two,
After drop: One, Two, Three,
JavaScript:
var words = ["One,Two,"];
document.getElementById("demo").innerHTML = words.toString();

$(move);

function move() {
  $('#moving').draggable();
  $('#drop').droppable({
    drop: handleDropEvent
  });
}

function handleDropEvent(event, ui) {
  var draggable = ui.draggable;
  var droppable = ui.droppable;
  var word = ui.draggable.attr('id')
  words.push(word)
  console.log(word)
  $('#moving').hide(draggable.attr);
}

HTML:

       Three

A: The #demo element doesn't automagically update when you change the words variable. You have to manually update it:
var words = ["One,Two,"];
document.getElementById("demo").innerHTML = words.toString();

$(move);

function move() {
  $('#moving').draggable();
  $('#drop').droppable({
    drop: handleDropEvent
  });
}

function handleDropEvent(event, ui) {
  var draggable = ui.draggable;
  var droppable = ui.droppable;
  var word = ui.draggable.attr('id')
  words.push(word)
  document.getElementById("demo").innerHTML = words.toString();
  console.log(word)
  $('#moving').hide(draggable.attr);
}


text:
Q: Pricing when updating more than one field of the same document within a Firestore transaction I have the following transaction using Firestore:
mDb.runTransaction(new Transaction.Function<Void>() {
    @Override
    public Void apply(final Transaction transaction) throws FirebaseFirestoreException {
        DocumentReference documentReference = mDb.collection("collectionOne").document("documentOne");
        /*
            some code
        */
        transaction.update(documentReference, App.getResourses().getString(R.string.field_one), FieldValue.increment(1));
        transaction.update(documentReference, App.getResourses().getString(R.string.field_two), FieldValue.increment(1));
        return null;
    }
}).addOnSuccessListener(new OnSuccessListener<Void>() {
    @Override
    public void onSuccess(Void aVoid) {
        Log.d("Debugging", "Transaction correctly executed.");
    }
}).addOnFailureListener(new OnFailureListener() {
    @Override
    public void onFailure(@NonNull Exception e) {
        Log.w("Debugging", "Transaction failure.", e);
    }
});

My question is: when updating, for example, two fields of the same document within the same transaction, will such a transaction yield to one or two documents reads?

A:
when updating, for example, two fields of the same document within the same transaction, will such a transaction yield to one or two documents reads?

Doesn't matter how many fields you change in a document in one operation, you'll always be charged with one write operation. If you make the writes, one after the other, you'll be charged with two write operations.


text:
Q: Scope variables settled and loaded from AJAX calls are not being rendered I'm trying to load a form using Angular with the following process :

*

*Load values from a PHP script

*Load the template on which values have to be rendered
HTML
<form ng-controller="formularCtrl" ng-init="initForm()">

</form>

ANGULAR
angular
    .module('exampleFormular', ['formular.module', 'ngSanitize'])
    .controller('formularCtrl', function ($scope, $http) {

        $scope.form = {};

        $scope.initForm = function () {
            $http.get('ajax/loadForm.php')
            .success(function (data) {
                $scope.form.content = data;
            })
            .then(function() {
                $http.get('templates/formTemplate.html')
                .success(function (data) {
                   $scope.form.template = data;
                });
            });
        };

    })
    .filter('unsafe', function($sce) { return $sce.trustAsHtml; });

PHP
$form = new StdClass();
$form->name->id = 'name';
$form->name->type = 'text';
$form->name->value = 'Test';
echo json_encode($form);
// {"name": {"id":"name", "type":"text", "value":"Test"}}

TEMPLATE
<input
  type="{{form.content.name.type}}"
  id="{{form.content.name.id}}"
  value="{{form.content.name.value}}" />

The current result is my HTML being well formed, and my values being settled.
console.log($scope.form.content.name.value); // Test

But the values are not being rendered in the HTML, resulting on an input with {{form.content.name.value}} inside, instead of 'Test'
I'm not comfortable yet with scope things, but I tried to $scope.$apply() during the AJAX calls or after, with no success (and absolutly no change).
(I also tried to load the template, and then load the values, still not working.)

A: Inside the Ajax success function, do $scope.$apply(function() { $scope.form.template = data; });


text:
Q: How do I create my own world seed? I really want a superflat seed with a ton of useful ores which are easy to find. How do I create a seed, and what programs do I use?

A: Seeds are not "created", they are found by trying them. The seed is called that because it is the seed value for a pseudorandom number generator which is then used to determine all of the attributes of the world; it is computationally infeasible to design a seed to produce a desired result.
Type something for the seed, see if you like the world, and if not, try again with a different seed. Or look for seeds other people have tried; there are many web sites which claim to provide such information.

A: Get pocketinveditor off of for shared. Do edit terrain and click slect whole worl replace blocks then click the top browse button and click air. Then the bottom browse button and click what ever youwant to be super flat like diamonds grass sand stone all of that hope this helped!

A: You may be looking for a superflat preset instead of a seed (those have seeds, too, but are not affected as drastically).
If you choose the world type "Superflat" you can select options - there are some presets, but you can in fact change it to your liking. Here is an example preset from the Minecraft Wiki page:
minecraft:bedrock,230*minecraft:stone,5*minecraft:dirt,minecraft:grass_block;minecraft:mountains;biome_1,decoration,stronghold,mineshaft,dungeon

A preset consists of 3 things more or less, separated by semicolons:

*

*A list of block layers, starting from the bottom. Multiples of the same layer can be shortened by putting the number and the * before the block name. Blocks are specified by their names and are comma separated. In this preset, there is one layer of bedrock, then 230 layers of stone, the 5 of dirt and one of grass.

*The biome used for the superflat world - you can only choose one as far as I can tell, here it is minecraft:mountains for that nice bluegreen.

*A list of structure generation options: here, most are self-explanatory, like stronghold or dungeon, but special mention goes to biome_1 which means biome specific features like witch huts in swamps. This also must be on for desert temples (as well as having the biome set to minecraft:desert, of course), but desert temples also require the dedicated desert_pyramid option to be enabled.
More documentation can be found on the corresponding wiki page, but it is not fully up to date, and some documentation is not fully clear (for example, it mentions that structure options used to have parameters before 1.13 which got removed, but other parts of the page imply that the structure options are ignored altogether, not just those parameters.
Furthermore, if you do not feel like tinkering with the format, there are apparently superflat preset generators available online. I will not link any specific ones here as they seem to be very susceptible to link rot - searching up the phrase is likely to bring up a working one anytime in the future, though.

A: Well if your looking for a super flat world then you've come to the right person!
Seed:blank
This seed allows you to enter a super flat world so try it!


text:
Q: How to access indications with swift's core bluetooth I've been attempting to integrate the Contour Next glucose meter using corebluetooth I've run into a limitation of core bluetooth that appears to prevent me from receiving blood glucose indications.

If the specified characteristic's configuration allows both
  notifications and indications, calling this method enables
  notifications only.

(source: https://developer.apple.com/documentation/corebluetooth/cbperipheral/1518949-setnotifyvalue)
Unfortunately, the Contour Next does in fact allow both notifications and indications for the blood glucose measurements characteristic. So while I am able to successfully receive new measurements (via notifications) there doesn't appear to be any way to receive historical measurements (via indications).
You can see the an integration for android at https://github.com/jamorham/xDrip-plus/blob/master/app/src/main/java/com/eveningoutpost/dexdrip/Services/BluetoothGlucoseMeter.java#L227 which enables both notifications and indications for that blood glucose measurements characteristic.
Is there some way to work around this limitation of core bluetooth or perhaps there's another way to integrate with bluetooth that doesn't use core bluetooth?

A: @paulw was correct, the issue was not in fact with the indications at all. It turned out that the command I was using wasn't working as expected ("Request all" command didn't work but "Request all records from first to last" did).


text:
Q: .Net SQL updateScript I am new to .net programming and I have a question.
I need to update table Route based on VehicleID.
The point is I don`t know how to make this query work.
This is what I have tried so far:
CREATE PROCEDURE UpdateRouteWithVendorIdAndVehicleTypeId
AS
  (
    SELECT
      vh.VendorId,
      vh.VehicleTypeId,
      r.Id
    FROM Vehicle vh WITH ( NOLOCK )
      INNER JOIN [dbo].Route r WITH ( NOLOCK ) ON r.VehicleId = vh.Id
  )
  UPDATE Route
  SET VehicleTypeId = vh.VehicleTypeId, VendorId = vh.VendorId
  WHERE Id = r.Id

How to make this part "SET VehicleTypeId = vh.VehicleTypeId, VendorId = vh.VendorId" to be seen outside the first query?
Thank you in advance.

A: Use the below script
 CREATE PROCEDURE UpdateRouteWithVendorIdAndVehicleTypeId
  AS
  BEGIN
   UPDATE r
  SET  r.VehicleTypeId = vh.VehicleTypeId
      , r.VendorId = vh.VendorId
  FROM Vehicle vh WITH (NOLOCK)
  INNER JOIN [dbo].Route r WITH (NOLOCK) ON r.VehicleId = vh.Id
  END


text:
Q: How to assign List values to list ValueTuples? I have method which return List and I wanna try to populate ValueTuple from another standard list I get error:
Cannot implicitly convert type 'System.Collections.Generic.List<(long PaymentId, long TransactionId)>' to 'System.Collections.Generic.List>'
The code looks like below:
public async Task<List<ValueTuple<(long, long)>>> CreditTransactionAsync(CancellationToken cancellationToken)
{
 List<(long PaymentId, long TransactionId)> paymentTransactionList = new List<ValueTuple<long, long>>();

 var paymentTransactions = _dbContext.PaymentTransactions
                                .AsEnumerable()
                                .Where(x => transactionIdsList.Any(a => a.TransactionId == x.TransactionId))
                                .Select(x => new
                                 {
                                   PaymentId = x.PaymentId,
                                   TransactionId = x.TransactionId
                                 })
                                .ToList();
// This line shows error..
 paymentTransactionList = paymentTransactions.Select(x => (PaymentId: x.PaymentId, TransactionId: x.TransactionId));

 return paymentTransactionList;
}

A: You can rewrite your Select statement a little bit and map transactions to list of tuple (long, long) directly, without intermediate anonymous type
.Select(x => (x.PaymentId, x.TransactionId))

The full code
var paymentTransactions = _dbContext.PaymentTransactions
                                .AsEnumerable()
                                .Where(x => transactionIdsList.Any(a => a.TransactionId == x.TransactionId))
                                .Select(x => (x.PaymentId, x.TransactionId))
                                .ToList();
return paymentTransactions;

You also should properly declare the return type of your method, like Task<List<(long paymentId, long transactionId)>>

A: ValueTuple<(long, long)> is a value tuple that contains a single element that is a value tuple that contains two elements.
You probably meant List<(long, long)>, not List<ValueTuple<(long, long)>>, however personally I'd say "don't use ValueTuple<...> on public APIs", but if you do: at least name them.
Also: AsEnumerable() on a db-context is usually a terrible mistake - especially before a Where:

public async Task<List<(long PaymentId, long TransactionId)>> CreditTransactionAsync(CancellationToken cancellationToken = default)
{
    var localList = transactionIdsList.Select(a => a.TransactionId).ToList();
    return _dbContext.PaymentTransactions
                .Where(x => localList.Contains(x.TransactionId))
                .Select(x => new { x.PaymentId, x.TransactionId })
                .AsEnumerable()
                .Select(x => (x.PaymentId, x.TransactionId))
                .ToList();
}


text:
Q: mailto not working with android jellybean I'm working on a mobile site using JQM and I'm having trouble setting the body text for Android version 4 and up. The address and subject work.
This is the code.
var shareEmail = "mailto:"+thisAddress+"?&subject=" + encodeURIComponent(+thisSubject) + "&body=" + encodeURIComponent(thisBody);

It works fine in earlier versions.
Any suggestions.

A: Try doing it like this, works fine for me :)
Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"EMAIL ADRESS"});
        i.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT");
        i.putExtra(Intent.EXTRA_TEXT   , "BODY");
        try {
            startActivity(Intent.createChooser(i, "Send email..."));
        } catch (android.content.ActivityNotFoundException ex) {
            Toast.makeText(Start.this, "Sorry, there is no email client installed", Toast.LENGTH_SHORT).show();
        }

Cheers, Felix


text:
Q: Inheritance from metaclasses in Python I've got simple metaclass, that turns methods of classes starting with "get_" to properties:
class PropertyConvertMetaclass(type):
    def __new__(mcs, future_class_name, future_class_parents, future_class_attr):
        new_attr = {}
        for name, val in future_class_attr.items():
            if not name.startswith('__'):
                if name.startswith('get_'):
                    new_attr[name[4:]] = property(val)
            else:
                new_attr[name] = val
        return type.__new__(mcs, future_class_name, future_class_parents, new_attr)

Imagine I have TestClass:
class TestClass():
    def __init__(self, x: int):
        self._x = x

    def get_x(self):
        print("this is property")
        return self._x

I want it to work like this: I create some new class that kinda inherits from them both
class NewTestClass(TestClass, PropertyConvertMetaclass):
    pass

and I could reuse their both methods like this:
obj = NewTestClass(8)
obj.get_x() # 8
obj.x       # 8

As I take it, I should create a new class, lets name it PropertyConvert and make NewTestClass inherit from It:
class PropertyConvert(metaclass=PropertyConvertMetaclass):
    pass

class NewTestClass(TestClass, PropertyConvert):
    pass

But it doesn't help, I still can't use new property method with NewClassTest. How can I make PropertyConvert inherit all the methods from its brother, not doing anything inside NewClassTest, changing only PropertyConverterMetaclass or PropertyConverter? I'm new to metaclasses, so I'm sorry, if this question might seem silly.

A: When you do TestClass():, the body of the class is run in a namespace which becomes the class __dict__. The metaclass just informs the construction of that namespace via __new__ and __init__. In this case, you have set up the metaclass of TestClass to be type.
When you inherit from TestClass, e. g. with class NewTestClass(TestClass, PropertyConverter):, the version of PropertyConvertMetaclass you wrote operates on the __dict__ of NewTestClass only. TestClass has been created at that point, with no properties, because its metaclass way type, and the child class is empty, so you see no properties.
There are a couple of possible solutions here. The simpler one, but out of reach because of your assignment, is to do class TestClass(metaclass=PropertyConvertMetaclass):. All children of TestClass will have PropertyConvertMetaclass and so all getters will be converted to properties.
The alternative is to look carefully at the arguments of PropertyConvertMetaclass.__new__. Under normal circumstances, you only operate on the future_class_attr attribute. However, you have access to future_class_bases as well. If you want to upgrade the immediate siblings of PropertyConverter, that's all you need:
class PropertyConvertMetaclass(type):
    def __new__(mcs, future_class_name, future_class_parents, future_class_attr):
        # The loop is the same for each base __dict__ as for future_class_attr,
        # so factor it out into a function
        def update(d):
            for name, value in d.items():
                # Don't check for dunders: dunder can't start with `get_`
                if name.startswith('get_') and callable(value):
                    prop = name[4:]
                    # Getter and setter can't be defined in separate classes
                    if 'set_' + prop in d and callable(d['set_' + prop]):
                        setter = d['set_' + prop]
                    else:
                        setter = None
                    if 'del_' + prop in d and callable(d['del_' + prop]):
                        deleter = d['del_' + prop]
                    else:
                        deleter = None
                    future_class_attr[prop] = property(getter, setter, deleter)

        update(future_class_dict)
        for base in future_class_parents:
            # Won't work well with __slots__ or custom __getattr__
            update(base.__dict__)
    return super().__new__(mcs, future_class_name, future_class_parents, future_class_attr)

This is probably adequate for your assignment, but lacks a certain amount of finesse. Specifically, there are two deficiencies that I can see:

*

*There is no lookup beyond the immediate base classes.

*You can't define a getter in one class and a setter in another.

To address the first issue, you will have to traverse the MRO of the class. As @jsbueno suggests, this is easier to do on the fully constructed class using __init__ rather than the pre-class dictionary. I would solve the second issue by making a table of available getters and setters before making any properties. You could also make the properties respect MRO by doing this. The only complication with using __init__ is that you have to call setattr on the class rather than simply updating its future __dict__.
class PropertyConvertMetaclass(type):
    def __init__(cls, class_name, class_parents, class_attr):
        getters = set()
        setters = set()
        deleters = set()

        for base in cls.__mro__:
            for name, value in base.__dict__.items():
                if name.startswith('get_') and callable(value):
                    getters.add(name[4:])
                if name.startswith('set_') and callable(value):
                    setters.add(name[4:])
                if name.startswith('del_') and callable(value):
                    deleters.add(name[4:])

        for name in getters:
            def getter(self, *args, **kwargs):
                return getattr(super(cls, self), 'get_' + name)(*args, **kwargs)
            if name in setters:
                def setter(self, *args, **kwargs):
                    return getattr(super(cls, self), 'set_' + name)(*args, **kwargs)
            else:
                setter = None
            if name in deleters:
                def deleter(self, *args, **kwargs):
                    return getattr(super(cls, self), 'del_' + name)(*args, **kwargs)
            else:
                deleter = None
            setattr(cls, name, property(getter, setter, deleter)

Anything that you do in the __init__ of a metaclass can just as easily be done with a class decorator. The main difference is that the metaclass will apply to all child classes, while a decorator only applies where it is used.

A: There is nothing "impossible" there.
It is a problem that, however unusual, can be solved with metaclasses.
Your approach is good - the problem you got is that when you look into the "future_class_attr" (also known as the namespace in the classbody), it only contains the methods and attributes for the class currently being defined . In your examples, NewTestClass is empty, and so is "future_class_attr".
The way to overcome that is to check instead on all base classes, looking for the methods that match the pattern you are looking for, and then creating the appropriate property.
Doing this correctly before creating the target class would be tricky - for one would have to do attribute searching in the correct mro (method resolution order) of all superclasses -and there can be a lot of corner cases. (but note it is not "impossible", nonetheless)
But nothing prevents you of doing that after creating the new class. For that, you can just assign the return value of super().__new__(mcls, ...)  to a variable (by the way, prefer using super().__new__ instead of hardcoding type.__new__: this allows your metaclass to be colaborative and be combined with, say, collections.ABC or enum.Enum). That variable is them your completed class and you can use dir on it to check for all attribute and method names, already consolidating all superclasses - then, just create your new properties and assign then to the newly created class with setattr(cls_variable, property_name, property_object).
Better yet, write the metaclass __init__ instead of its __new__ method: you retrieve the new class already created, and can proceed to introspecting it with dir and adding the properties immediately. (don't forget to call super().__init__(...) even though your class don't need it.)
Also, note that since Python 3.6, the same results can be achieved with no metaclass at all, if one just implements the needed logic in the __init_subclass__ method of a base class.

A: One of the solutions of my problem is parsing parents' dicts in PropertyConvertMetaclass:
class PropertyConvertMetaclass(type):
    def __new__(mcs, future_class_name, future_class_parents, future_class_attr):
        new_attr = {}
        for parent in future_class_parents:
            for name, val in parent.__dict__.items():
                if not name.startswith('__'):
                    if name.startswith('get_'):
                        new_attr[name[4:]] = property(val, parent.__dict__['set_' + name[4:]])
                new_attr[name] = val

        for name, val in future_class_attr.items():
            if not name.startswith('__'):
                if name.startswith('get_'):
                    new_attr[name[4:]] = property(val, future_class_attr['set_'+name[4:]])
            new_attr[name] = val
        return type.__new__(mcs, future_class_name, future_class_parents, new_attr)


text:
Q: How to index a XML file with Lucene how the create lucene index following xml file with any sample code.
 so I can search for cloth name as well as its color and sale type.
<cloths>
   <cloth color="red">shirt</cloth>
   <cloth color="green" sale="Y">shirt</cloth>
   <cloth color="orange">jeans</cloth>
</cloths>

Is there a way to use Lucene to do this?


text:
Q: How to Animate a div to the Center of an Element I want to animate a div to the center of its parent. I'm taking a mobile-first approach where my div is at the center of its parent occupying 90% of its parent's width. When @media only screen and (min-width: 800px) is reached the width of the div is animated down to 400 pixels.
My problem is when the parent's width is below the break point the div immediately jumps to the center and occupies 90% of the parent's width.
How would I reverse this effect whereby if the parent's width is below the break point the div is animated to the center and the width is animated to occupy 90% of the parent's width?
Here's the CSS:
.container {
  background: white;
}
.box {
  background: red;
  width: 90%;
  height: 100px;
  margin: 0 auto;
  transition: width 1s, margin 2s;

}
@media only screen and (min-width: 800px) {
  .box {
    width: 400px;
    margin: 0 0 0 4em;
  }
}

Here's the HTML:

Here's the fiddle https://jsfiddle.net/p38nrhu2/
Thanks for your time!

A: My best solution to this involved changing the CSS properties. I used absolute positioning to layout the red box and removed the margins and used the positioning elements top and left to mimic the margins.
Here's the CSS:
.container {
    background: #fff;
    position: relative;
}
.box {
    width: 90%;
    height: 100px;
    background: red;
    position: absolute;
    left: 50%;
    transform: translate(-50%);
    transition: left 1s, width 1s;
    background: red;
}

@media only screen and (min-width: 800px) {
    .box {
        width: 400px;
        left: 200px;
    }
}

Here's the HTML:

This animates the width down to 400px and to the left when the breakpoint of @media only screen and (min-width: 800px) is reached. Otherwise, the red box is translated back to the center.
Here's the fiddle https://jsfiddle.net/qchdj7sv/1/


text:
Q: How can I delete menus in Glade? I'm writing a program using Quickly and I can't figure out how to delete menu bar entries.

A: There are 2 different ways to edit the menu items. Note that these steps also work for a toolbar and partially for a treeview too.
Option 1

*

*Select the menu by clicking on it in the editor (A) or search for it in the widget tree (B).

*A new Glade toolbar button will appear at the end with an "Edit" icon. Click that to bring up a new dialog where you can change the entries.

*In the "Hierarchy" tab you'll see all entries which can be added/removed/edited.

Option 2

*

*Search and select the menubar in the widget tree

*Unfold the child widgets

*These are your menu entries. Select them to bring up their properties in the property editor and edit them as you would with all other wisgets. Right click to bring up options including removal.


text:
Q: Reexecuting await/async/promise.all function with a new value I am basically trying to send multiple API queries at once and wait for the result. The code works well for the first query, but I am actually struggling to reset the value of the prior async return. After the first execution is completed, it keeps returning the very first values. The goal is to assign random href(URL) with every function's execution and recall the API once again, so it can call the API once again with a newly randomized href and return new values. Here is the code, would be great is someone could help:
async function fetchData() {

    const [test0_array_response,
           test1_array_response,
           test2_array_response,
        ] = await Promise.all([
      fetch(random_href+'/test0/'),
      fetch(random_href+'/test1/'),
      fetch(random_href+'/test2/'),
    ]);

    const test0_array = await test0_array_response.json();
    const test1_array= await test1_array_response.json();
    const test2_array = await test2_array_response.json();

    return [test0_array, test1_array, test2_array];
  }

function callApi() {
    console.log(fetchData()) // returns a promise
};

A: From what I can see random_href is part of the closure of fetchData, so you need to pass it as argument inside callApi or wherever you use fetchData in order to use his correct value.
Take a look here for learn what I means with closure.
You should do something like this:
async function fetchData(random_href) {

  const [test0_array_response,
    test1_array_response,
    test2_array_response,
  ] = await Promise.all([
    fetch(random_href+'/test0/'),
    fetch(random_href+'/test1/'),
    fetch(random_href+'/test2/'),
  ]);

  const test0_array = await test0_array_response.json();
  const test1_array= await test1_array_response.json();
  const test2_array = await test2_array_response.json();

  return [test0_array, test1_array, test2_array];
}

function callApi(random_href) {
  console.log(fetchData(random_href)) // returns a promise
};

Another approach could be to make an object random_container = { href: 'VALUE'} and use it's reference inside the fetchData function. So, for example, fetch(random_container.href+'/test0/'). In this way random_container will be part of the closure of fetchData but you'll be able to read the last value of random_container.href.


text:
Q: search in sqlite database i am trying to build an application that save data in sqlite database.i have a class that search in the database searching by VendorName and Date. The problem is i want it to display the MeterNumbers that was saved on the same Date . to what i have tried it only gives me the first result it get in the database, lets say i search for Tom that was saved on 01/01/2013, it supposed to display both metereNumbers of Tom that was saved on 01/01/2013
here is an example of my table in sqlite

VendorName Date MeterNumber
...Tom.... 01/01/2013 ......2098957438902
...Tom... 01/01/2013........4786909876785
...Steven...18/01/2013.........8978978906542

This is the Code in Sqlite database
public String getMeterNUmber(String MeterNumber) throws SQLException
{
    String[] whereArgs = new String[]{MeterNumber};

Cursor mCursor = db.rawQuery("SELECT MeterNumber FROM " + SCAN_TABLE + " WHERE  Date = ?",whereArgs);
mCursor.moveToFirst();

if(mCursor.getCount() > 0){
    MeterNumber = mCursor.getString(0);
}

return MeterNumber;
}

this is the code in the class that calls for the query in the sqlite database and take the result to another class by intent
Intent updateCustomerIntent = new Intent(Searching.this, Result.class);
updateCustomerIntent.putExtra("product", dbUser.getMeterNUmber(ss));
 startActivity(updateCustomerIntent);

A: Firstly, your parameter should be date not number,Secondly you don't loop through the result you just pull your first record. I think you should revise some good tutorial first at using SQLite with android.Here are some good links that may help.

*

*Android SQLite Database and ContentProvider - Tutorial!

*Android SQLite Database Tutorial

A: First of all, your getMeterNumber method takes a meter number as an argument, as already pointed out in ggenglish's comment, this seems odd, it should be a date no? Also, your method only calls mCursor.getString(0) once, and then returns that, which means you will only get the meter number from the first row of your result set.
If you want all the results, you will need to iterate over the full recordset. When you receive the cursor, it will be positioned just before the first row, so, you can loop through it with the method moveToNext(). Then, you will also have to store your result in a appropriate data structs, such as a ArrayList
ArrayList<String> results = new ArrayList<String>();
while (mCursor.moveToNext()) {
    results.add(mCursor.getString(0));
}

So, you will end up with something like this
public ArrayList<String> getMeterNUmber(String meterDate) throws SQLException
{
    String[] whereArgs = new String[]{meterDate};

    Cursor mCursor = db.rawQuery("SELECT MeterNumber FROM " + SCAN_TABLE + " WHERE  Date = ?",whereArgs);

    ArrayList<String> results = new ArrayList<String>();
    while (mCursor.moveToNext()) {
        results.add(mCursor.getString(0));
    }

    mCursor.close();

    return results;
}

And then finally, use putStringArrayListExtra instead of putExtra when adding the data to the intent.

A: If you are expecting one value you should do this:
public String getMeterNUmber(String date) throws SQLException {

    String meterNumber = null;

    Cursor cursor = db.rawQuery("SELECT MeterNumber FROM " + SCAN_TABLE + " WHERE  Date = ?", new String[]{date} );

    if ( cursor.moveToNext() )  meterNumber = cursor.getString(0);

    cursor.close();

    return meterNumber;

}

if you are expecting multiple elements you should loop as mentioned by others
public ArrayList<String> getMeterNUmber(String date) throws SQLException {

    ArrayList<String> meterNumbers = new ArrayList<String>();

    Cursor cursor = db.rawQuery("SELECT MeterNumber FROM " + SCAN_TABLE + " WHERE  Date = ?", new String[]{date} );

    while ( cursor.moveToNext() )  meterNumbers.add( cursor.getString(0) );

    cursor.close();

    return meterNumbers;

}

you specify you are querying by name and date but your example code shows otherwise, hopefully this helps a bit though.