text:
Q: how can I split array by delimiter I got string that I split using 'explode()'.But I need some more steps to do.I have to split that array output few more times by delimiter.
The txt file's contents look like
 Question1|opt1,opt2,opt3;Question2|opt1,opt2,opt3;question3|opt1,opt2,opt3;Question4|opt1,opt2,opt3;

Please have a look at the code
$open=fopen("mydata.txt","r+");
  while(!feof($open)){
     $see=fgets($open);
     $exp=explode(";",$see);
     //$exp1=explode("|",$exp);
     //$exp2=explode(",",$exp1);

     $vaq = "
 ".$imp[0];
     echo $vaq;

    }
fclose($open);

what I need is to echo in following format
Question1
Opt1
Opt2
Opt3

Question2
Opt1
Opt2
Opt3

.......
.......
.......

I know 'explode()' split string and output array.but even after that tried to see the result.It gives me error.
Look forward for expert assistance.
Thanks in advance.

A: $str = file_get_contents('mydata.txt');
$data = preg_split('/[\|,;]/', $str);
echo join("\n
", $data);

Code assumes that non of QuestionN, OptN have symbols |, , and ; inside.
If you want to separate all the things
$blocks = explode(';', file_get_contents('mydata.txt'));
foreach($blocks as $block)
{
    list($question, $opts) = explode('|', $block);
    $opts = explode(',', $opts);

    // do whatever you wanted to do
    var_dump($question);
    var_dump($opts);
}


text:
Q: COUNT(*) FROM different tables with LEFT JOIN I have 1 table of users, and 10 tables (articles, news, ...) where I save user's publications. I want to show how many publications has each user, in one query:
| ID_USER | COUNT(id_article) | COUNT(id_news) | etc...
-------------------------------------------------
| 1       | 0                 | 3               |
| 2       | 2                 | 9               |
| 3       | 14                | 5               |
| 4       | 0                 | 0               |

If I use this query to show the number of articles...
SELECT id_user,COUNT(articles.id_article) FROM users
LEFT JOIN articles ON articles.id_user_article=users.id_user
GROUP BY users.id_user

... it shows the information correctly. But if I start to add the second table...
    SELECT id_user,COUNT(articles.id_article),COUNT(news.id_news) FROM users
    LEFT JOIN articles ON articles.id_user_article=users.id_user
    LEFT JOIN news ON news.id_user_news=users.id_user
    GROUP BY users.id_user

... it doesn't show the correct information.. and if I join all the rest tables, if shows really strange result (thousands of articles for first user, and NULL for the rest).
Which is the correct way of show this information using only one query? Thank you!

A: You can use a subselect instead of a left join for each table. The final result will be the same but maybe in that way is clearer.
SELECT u.id_user,
  (SELECT COUNT(a.id_article)
  FROM articles a
  WHERE a.id_user_article = u.id_user) AS articles,
  (SELECT COUNT(n.news)
  FROM news n
  WHERE n.id_user_news = u.id_user) AS news
FROM users u

Also if you only uses one column of each table, the subselect is a better option than multiple left joins.

A: Your problem is that you are joining along different dimensions, which creates cartesian products for each user.  The solution by @rafa is actually a fine solution in MySQL.  The use of count(distinct) works okay, but only when the counts are not very large.  Another approach is to pre-aggregate the results along each dimension:
SELECT u.id_user, a.articles, n.news
FROM users u left outer join
     (select id_user_article, count(*) as articles
      from articles
      group by id_user_article
     ) a
     on u.id_user = a.id_user_article left outer join
     (select id_user_news, count(*) as news
      from news
      group by id_user_news
     ) n
     on u.id_user = n.id_user_news;

EDIT:
If you are using the count(distinct) approach, then you are generating a cross product.  If every user had 3 articles and 4 news items, then the users would be multiplied by 12. Probably feasible.
If every user had 300 articles and 400 news items, then every user would be multiplied by 120,000.  Probably not feasible.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to pass parameter to sitecore controller rendering method I have this on my cshtml page
<div class="liveMatch-timer">
            @Html.Sitecore().Controller("Blog", "LiveBlogHeader")
        </div>

And this is my controller
    public PartialViewResult LiveBlogHeader()
    {
        var matchHeader = GetMatchDayHeader();
        return PartialView(BlogConstant.LiveBlogHeaderPath, matchHeader);
    }

I have one hidden field with the name "liveMatchItemId" on my cshtml page. I would like to pass its value to controller so that I can access it inside controller. I am expecting to change controller definition something like this
public PartialViewResult LiveBlogHeader(string liveMatchItemId)

Anyone can help me understand on how can I do this? I am new to sitecore and MVC.
EDIT: I am able to achieve this using below code
@Html.Action("LiveBlogHeader", "Blog", new { liveMatchItemId = "12" })

But how can I set hidden field value instead of static field "12"?

A: Probably you could use something like:
    @Html.Action("LiveBlogHeader", "Blog", new { liveMatchItemId = Model.LiveMatchItemId })
Where Model.LiveMatchItemId is the property that you want to pass to the controller.


text:
Q: Wordpress: CSS file not working? Okay. I've been trying to link the css stylesheets to my webpages. I've been scratching my head trying to figure out what I am doing wrong. Any ideas?
functions.php
<?php

function roofers_wp_resources() {
    wp_enqueue_style('normalize', get_stylesheet_uri());
    wp_enqueue_style('style', get_stylesheet_uri());
}

add_action('wp_enqueue_scripts', 'roofers_wp_resources');

?>

header.php
<!DOCTYPE html>

        <title>R.J Roofers</title>
        <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <?php wp_head(); ?>

front-page.php
<?php get_header(); ?>

R.J Roofer

home

services

gallery

about us

contact

HOME ROOFING BRISBANE NO.1 FOR ROOF RESTORATIONS AND ROOF REPLACE

                <button class="quote-btn-1">BOOK A FREE QUOTE</button>

More Code..

A: get_stylesheet_uri() gives full url to your style.css file, so in your case it's good only if you want to enqueue the style.css file.
For the second file, you need to pass a full url including the name of the file.
Assuming your normalize file called normalize.css:
function roofers_wp_resources(){
    wp_enqueue_style('my-theme-style', get_stylesheet_uri());
    wp_enqueue_style('normalize', get_template_directory_uri() . '/normalize.css');
}
add_action('wp_enqueue_scripts', 'roofers_wp_resources');

Notice that if you working on a child theme, you need to change get_template_directory_uri() to get_stylesheet_directory_uri().


text:
Q: TFS 2010 Gated Checkin with Exclusive Checkouts We are using TFS 2010 with gated checkins. I've got some question about what I think is strange behaviour. Look at the following process:

*

*File A is checked out by me exclusively.

*File A is changed

*File A is checked in

*TFS asks to build changes

*Build started

*File A is reverted locally to the old version

*Build succeeded

*Asks for reconcile -> however during reconcile there are no changes to be made

*After clicking OK, the File A is checked in with my changes, however my local file is still the old version.

Why does it have this behaviour? This does not seem logical to me. It seems logical until step 8. There it should get the latest version of File A for my local repository. Is this a setting somewhere?

A: It is my understanding, that Reconcile works by looking at files checked in for the build (shelved, actually), check if the file in your workspace has pending changes, and matches the built version. If they don't match, (ie. you edited in between) it will ask you to merge. If they do match, it will perform an undo, and getting the latest version (which will be the same content, since the TFS server has just checked your changes in).
In other words, if you do not choose to preserve pending changes locally, reconcile won't work and you need to do a get latest manually to get your most recent changes back into your workspace.

A: Shelving
What happens is that, when you check in, your changes are added to a shelve set. In other words, your changes are shelved. When shelving changes you can choose to roll back your local changes.
For instance when you are working on a problem and suddenly you need to fix another problem with higher priority. Then you can shelve your changes (of the problem you're working on) and roll those changes back locally. This allows you to work on the new problem and check its changes in when you're done. Once finished you can unshelve your previous work (of the first problem) and continue your work.
Gated check-ins
With gated check-ins, shelve sets are created automatically. When shelving you have the option whether your local changes are kept or not. I.o.w. you can shelve changes without rolling them back locally. So when the "Keep local changes" checkbox is not checked you will have this strange behaviour (I also find it very unintuitive).
Locks and 'Preserve local changes' option
The "Preserve local changes" checkbox is disabled however if any of the files in your workspace are locked. Even if they have nothing to do with your changes (also not very intuitive i.m.h.o.). Locks can be put manually on files or automatically in the case of exclusive lockouts (disable "Allow multiple checkouts" checkbox in the projects build configuration). So if you have exclusive lockout and someone modifies a file then it becomes locked and therefore you cannot use the "Preserve local changes" option.
Workaround
To workaround this problem I think you can choose one of several poisons:

*

*Do not use gated checkins

*Do not use locking and therefore do not use exclusive lockouts

*Do not use colleagues

*Learn to wait for the build to finish and always perform Get Latest Version (Reconcile will not do that because it will only do that for files you have modified in the mean time) or make sure that you automatically GLV when editing a file.

*Do not use TFS :-)

Hope this helps.

A: Furthermore, if the gated checkin build failes, shelveset files remains as checked-out by build service account. We found a way to undo checked-out files but reconcile doesn't work becuase "Preserve pending changes locally" is greyed out if "exclusive checkouts" is enabled on team project.


text:
Q: automation filtering in pivot table(excel) with powershell I have a script that:

*

*opens excel file

*updates query to table

*updates pivot table

*closes excel

after data update all my filters in pivot table are lost.
so i need to select last 4 values in my column in table manualy.
is there way to specify filters in powershell?
original script comes from here


text:
Q: Outer Measure exercise This comes from an exercise from Real Analysis by Folland.

Let $\mathcal{A}\subset P(X)$ be an algebra, $\mathcal{A}_\sigma$ the collection of countable unions of sets in $\mathcal{A}$, and $\mathcal{A}_{\sigma\delta}$ the collection of countable intersections of sets in $\mathcal{A}_\sigma$. Let $\mu_{0}$ be a premeasure on $\mathcal{A}$ and $\mu^*$ the induced outer measure.
a.) For any $E\subset X$ and $\epsilon > 0$ there exists $A\in \mathcal{A}_\sigma$ with $E\subset A$ and $\mu^*(A) \leq \mu^*(E) + \epsilon$.
b.) If $\mu^*(E) < \infty$, then $E$ is $\mu^*$-measurable if and only if there exists $B\in \mathcal{A}_{\sigma\delta}$ with $E\subset B$ and $\mu^*(B\setminus E) = 0$

proof of a.) was done in an earlier post: Outer measure problem
proof of b.) Using part a.) $\forall \epsilon_i$ there exists $A_i\in \mathcal{A}_\sigma$ such that $E\subset A_i$. Let $B = \bigcap_{i=1}^{n}A_i$ then $B\in\mathcal{A}_{\sigma\delta}$. Now, we need to show that $\mu^*(B\cap E^c) = 0$. From the definition of outer measure we know that: $$\mu^*(B\cap E^c) = \inf\left\{\sum_{1}^{\infty}\mu^*(E_j):E_j\in\mathcal A \ \ \text{and} \ \ (B\cap E^c)\subset \bigcup_{1}^{\infty}E_j\right\}$$ From part a.) we know that $\mu^*(A)\leq \mu^*(E) + \epsilon$.  I am not sure if this fact helps and I am stuck where to go from here, any suggestions would be great. Also, any hints on how to prove the converse would be great as well.

A: A hint for the forward case:
Since by assumption $E$ is $\mu^{*}$-measurable we have that for all $F \subset X$ we have:
$\mu^{*}(F) = \mu^{*}(F \cap E) + \mu^{*}(F\cap E^{c})$
Since this holds for all $F \subset X$ it must also hold for $B$ as you constructed above. Now use the fact that $E \subset B$ and part (a) to rearrange the above and show that $0 \leq \mu^{*}(B\setminus E)< \varepsilon$.
A hint for the reverse case:
First if there exists such a set $B$ show that $B$ is $\mu^{*}$ measurable. Then you get that for any $F \subset X$:
$\mu^{*}(F) = \mu^{*}(F \cap B) + \mu^{*}(F\cap B^{c})$
Now try to show that:
$\mu^{*}(F \cap B) \geq \mu^{*}(F\cap B\cap E) + \mu^{*}(F\cap B \cap E^{c})$
and
$\mu^{*}(F \cap B^{c}) = \mu^{*}(F\cap B^{c} \cap E^{c} ) + \mu^{*}(F\cap B^{c} \cap E)$
Finally note that:
$F \cap E = (F\cap B\cap E)\cup(F\cap B^{c} \cap E)$
and
$F\cap E^{c} = (F\cap B\cap E^{c})\cup(F\cap B^{c} \cap E^{c})$
Combining all of this information with subadditivity of $\mu^{*}$ it is possible to show that $\mu^{*}(F) \geq \mu^{*}(F\cap E) + \mu^{*}(F \cap E^{c})$ which is sufficient to prove $E$ is $\mu^{*}$ measurable.


text:
Q: Accuracy too low with very simple CNN model using Keras in Tensorflow I'm new to TensorFlow so help is appreciated. My output for the model is the same as the input, only in a different shape so I expect an accuracy of 1 but am instead getting 0.0062.
Inputs
Each input of my dataset is in the shape of (19, 19, 1). For each of these inputs, only a random single value is set to 1 while the rest are 0. Example but with a (4, 4, 1):
# [[0, 0, 0, 0],
#  [0, 1, 0, 0],
#  [0, 0, 0, 0],
#  [0, 0, 0, 0]

Outputs
Each output has a shape of (361) and is essentially the flattened version of its input so it shouldn't be a problem to reach an accuracy of 1 in theory. Example:
# [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

My dataset consists of 2404 of these samples.
Here's my code. Note that I've tried a combination of different loss functions and optimizers:
model = models.Sequential()
model.add(layers.Conv2D(1, (1, 1), activation='relu', padding='same', input_shape=(19, 19, 1)))
model.add(layers.Flatten())
model.add(layers.Dense(19 * 19, activation='softmax'))
model.compile(
    optimizer='adam',
    loss=tf.keras.losses.Huber(),
    metrics=['accuracy']
)

dataset = Dataset()
inputs = dataset.input
outputs = dataset.output

model.fit(
    inputs, # (2404, 19, 19, 1)
    outputs, # (2404, 361)
    epochs=1000,
    shuffle=True,
    verbose=1
)

Result
It quickly reaches 0.0062 and remains there.
Epoch 10/1000
76/76 [==============================] - 0s 2ms/step - loss: 0.0014 - accuracy: 0.0062

Update 1 - Slightly Better
Thanks for the help. After removing uses of random in my code and disabling shuffling it started hitting an accuracy of 1.00 50% of the time I ran the code. The other 50% was peaking at an accuracy of 0.0046.
When I tried to initialize weights and biases at 0, it peaked at 0.0046 100% of the time. Updating all of my TF packages almost fixed the problem, with it now being successful 90% of the time.

A: Coming out of comments to an answer. You're convolving a 1x1 kernel, then passing that to a dense layer. The ideal parameters that you want the network to learn is for all the weights in the dense layer to be the inverse of the kernel value. What's most important here though is that you're mostly passing zeroes. Any weight value in the dense layer, applied to a zero results in another zero, so the zeroes are causing your gradient to vanish.
When you initialize your weights as zeros, this turns your input vector to all zeroes, all zeros always ends learning. Can't backpropagate. When you don't do anything to the initialization, TF uses a normal distribution to initialize, centered around 0. Half the time, that initialized kernel value is negative. After convolving, you have all zeroes and a negative number. After relu you have all zeroes. Half the time it can learn - because by chance it initialized with a positive kernel value, and half the time it can't.
Try this:
initializer = tf.keras.initializer.Ones()
model.add(layers.Conv2D(1, (1, 1), kernel_initializer=initializer, activation='relu', padding='same', input_shape=(19, 19, 1)))


text:
Q: Are all final states reachable from the starting states of a DFA? Suppose that DFA D is a valid DFA. What would this imply regarding the reachability of its final states from initial states? May I assume this:

$\delta^* (q_0, w) = f$, where $w \in \Sigma$ and $f \in F$

A: No, you cannot assume this. It's perfectly consistent with the definition of a DFA for there to be states which are unreachable from the starting state. What you can do is start with a DFA and filter it down to just the states reachable from the start state without changing the language of the DFA, though, if you think it would help.
Hope this helps!


text:
Q: What size for a SqlDbType parameter with bigint? What is the size to specify for a bigint parameter?
SqlParameter param = new SqlParameter("@Param", SqlDbType.Bigint);

param.Size = ???

Or can specifying the size be omitted altogether?

A: SQL Server Integer Data types INT, TINYINT, SMALLINT OR BIGINT all has a specific Range and fixed storage space required.
In Sql Server when consuming these data types we cannot limit the range or space required to store these data types by defining a size.
For more information on size and range of these data types have a look here SQL SERVER int, bigint, smallint, and tinyint
╔═══════════╦══════════════════════════════════════════════════════════════════════════╦═════════╗
║ Data type ║                                  Range                                   ║ Storage ║
╠═══════════╬══════════════════════════════════════════════════════════════════════════╬═════════╣
║ bigint    ║ -2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807) ║ 8 Bytes ║
║ int       ║ -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)                         ║ 4 Bytes ║
║ smallint  ║ -2^15 (-32,768) to 2^15-1 (32,767)                                       ║ 2 Bytes ║
║ tinyint   ║ 0 to 255                                                                 ║ 1 Byte  ║
╚═══════════╩══════════════════════════════════════════════════════════════════════════╩═════════╝

A: Correct you don't need to specify the size when creating the integer type parameters for the command
Command.Parameters.Add("@p0", SqlDbType.TinyInt)  // omit size, name.


text:
Q: If $A$ and $B$ are positive definite, then is $B^{-1} - A^{-1}$ positive semidefinite? I've found this while googling some properties of positive semidefinite matrices. (Unfortunately, I cannot remember where I've discovered it.) If this is true, it'll greatly save my time in my work. Is it true? How can you prove it?

Let's say I have two real symmetric and positive definite matrices $\mathbf A$ and $\mathbf B$ of the same size. Also, assume that $\mathbf A - \mathbf B$ is positive semidefinite too. Then, $\mathbf B^{-1} - \mathbf A^{-1}$ is also positive semidefinite.

A: I like Martin Argerami's answer better, but here is a slightly different approach which does not use that the nonzero eigenvalues of $CD$ are the same as those of $DC$.
Note: this approach applies verbatim to the more general case of a $C^*$-algebra. Note also that in view of the notion of operator monotone function, we could interpret this result as saying that $x\longmapsto x^{-1}$ is operator nonincreasing.
The rather lengthy following paragraph shows that we can assume $B=I_n$ without loss of generality. Then it is obvious.
Since $B$ is positive definite, we have its square root $B^{1/2}$ which is also positive definite with positive definite inverse $B^{-1/2}$. Now since $A-B$ is positive semidefinite, so is $B^{-1/2}(A-B)B^{-1/2}=B^{-1/2}AB^{-1/2}-I_n=A_0-I_n$. And to prove $B^{-1}-A^{-1}$ positive semidefinite is equivalent to proving $B^{1/2}(B^{-1}-A^{-1})B^{1/2}=I_n-A_0^{-1}$ is positive semidefinite. Since $A_0=B^{-1/2}AB^{-1/2}$ is still positive definite, this shows that we can assume $B=I_n$ withtout loss of generality.
Now using the usual notation $C\geq D$ for symmetric matrices to mean that $C-D$ is positive semidefinite, or equivalently that the spectrum of $C-D$ is nonnegative, we get
$$
A-I_n\geq 0\Rightarrow A^{-1/2}(A-I_n)A^{-1/2}=I_n-A^{-1}\geq 0.
$$
So the result you mentioned holds, together, of course, with its converse.

A: Yes. Here is one way to prove it:
Since $A-B\geq0$, we have (conjugating with $B^{-1/2}$) that $B^{-1/2}AB^{-1/2}-I\geq0$. This tells you that all the eigenvalues of the positive definite matrix $B^{-1/2}AB^{-1/2}$ are $\geq1$.
Now note that $B^{-1/2}AB^{-1/2}=(B^{-1/2}A^{1/2})(A^{1/2}B^{-1/2})$. Since commuting the product of two matrices does not change the eigenvalues, we get that $A^{1/2}B^{-1/2}B^{-1/2}A^{1/2}=A^{1/2}B^{-1}A^{1/2}$ has also all eigenvalues $\geq1$. So
$$
A^{1/2}B^{-1}A^{1/2}-I\geq0.
$$
Now conjugating with $A^{-1/2}$ we get $B^{-1}-A^{-1}\geq0$.

A: Let me offer a constructive proof.
Lemma 1. For invertible and symmetric matrix $A$, and vectors $x$ and $y$, we have
$$
x^{'}A^{-1}x = \underset{y}{max\, \, } 2{x}'y - {y}'Ay
$$
Lemma 2. For invertable matrices $A$ and $B$, we have
$$
(A + C) ^{-1} = A^{-1} - A^{-1} (A ^{-1} + C ^{-1}) ^{-1} A ^{-1}
$$
Theorem. If $A > 0$, $B > 0$, $A$ and $B$ are symmetric matricex, and $A > B$, then $ B ^{-1} > A ^{-1} $.
Proof. By Lemma 1, we have
$$x ^{'} ( B ^{-1} - A ^{-1} ) x  = \underset{y}{max\, \, } 2{x}'y - {y}' ( B ^{-1} - A ^{-1} ) ^{-1} y$$
Let $ y = A ^{-1} x $, we have
$$ x ^{'} ( B ^{-1} - A ^{-1} ) x \ge 2x ^{'} A ^{-1} x - x ^{'} A ^{-1} ( B ^{-1} - A ^{-1} ) ^ {-1} A ^{-1} x $$
Then by Lemma 2, we have
$$ x ^{'} ( B ^{-1} - A ^{-1} ) x \ge x ^{'} A ^{-1} x + x ^{'} ( A - B ) ^{-1} x $$
By assumption, $ A > 0 $, so $ A ^{-1} > 0 $. Also $ A > B $, i.e. $ A - B > 0 $, so $ (A - B ) ^ {-1} > 0$.
Thus the LHS of above equation is greater than 0, so $ B ^{-1} - A ^{-1} > 0 $, i.e. $ B ^{-1} > A ^{-1} $.
EDIT: typos.


text:
Q: how to change scroll vertical to horizontal when orientation change? I want to change my recycler scroll view vertical to horizontal when the device orientation is change to landscape ...
Here is my code of recyclerView scroll orientation:
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);

A: Try
mRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true));

Assuming you are using LinearLayoutManager in your RecyclerView, then you can pass true as third argument in the LinearLayoutManager constructor.


text:
Q: No manual entry for man I'm working in a Centos 6.6 Docker image.  I thought I installed everything to get access to man pages, but apparently not...
$ yum install -y man man-pages man-pages-overrides
[...]
Complete!
$ which man
/usr/bin/man
$ man man
No manual entry for man

What am I missing ?

Regarding questions in comments (thanks for your help everyone):
$ echo $MANPATH
# empty
$ man 1 man
No entry for man in section 1 of the manual
$ man 7 man
No entry for man in section 7 of the manual
$ ll /usr/share/man/man1/
total 8
drwxr-xr-x  2 root root 4096 Sep 23  2011 ./
drwxr-xr-x 61 root root 4096 Jan 31 01:55 ../
$ yum search man | grep db
ModemManager.x86_64 : Mobile broadband modem management service
hsqldb-manual.noarch : Manual for hsqldb
db4-utils.x86_64 : Command line tools for managing Berkeley DB (version 4)
foomatic-db-ppds.noarch : PPDs from printer manufacturers
ldb-tools.x86_64 : Tools to manage LDB files

$ rpm -q -l man | grep man.1
/usr/share/doc/man-1.6f
/usr/share/doc/man-1.6f/COPYING
/usr/share/doc/man-1.6f/README
/usr/share/man/bg/man1/man.1.gz
/usr/share/man/cs/man1/man.1.gz
/usr/share/man/da/man1/man.1.gz
/usr/share/man/de/man1/man.1.gz
/usr/share/man/el/man1/man.1.gz
/usr/share/man/en/man1/man.1.gz
/usr/share/man/es/man1/man.1.gz
/usr/share/man/fi/man1/man.1.gz
/usr/share/man/fr/man1/man.1.gz
/usr/share/man/hr/man1/man.1.gz
/usr/share/man/it/man1/man.1.gz
/usr/share/man/ja/man1/man.1.gz
/usr/share/man/ko/man1/man.1.gz
/usr/share/man/man1/man.1.gz
/usr/share/man/nl/man1/man.1.gz
/usr/share/man/pl/man1/man.1.gz
/usr/share/man/pt/man1/man.1.gz
/usr/share/man/ro/man1/man.1.gz
/usr/share/man/sl/man1/man.1.gz

A: See the comment re: removing tsflags=nodocs from /etc/yum.conf, put there as a purported consequence of base docker image build policy:
https://groups.google.com/forum/#!topic/docker-user/fuW0e9xlqQE
I just tested this on a CentOS 6.7 container and it works.

A: If echo $MANPATH is empty you need to set the manpath.
echo "MANPATH=/usr/share/man" >> ~/.bashrc
The login again.


text:
Q: How to do a bootstrap accordion filled by a database? What I want to do is a Frequently Asked Questions using bootstrap accordion.
Right now, my listview is filled with my database in codebehind. But, the problem is it's always the div "collapseOne" that's opening no mather which question i'm clicking. I would need to change dynamically the "href" and the div's ID "collapseOne" into "collapseTwo", "collapseThree" etc. depending on what's in my table.
How can I do that?
<asp:ListView ID="lviewFAQ" runat="server"
              ItemType="Site_de_la_Technique_Informatique.Model.FAQ"
              SelectMethod="SelectFAQ"
              OnSelectedIndexChanged="lviewFAQ_SelectedIndexChanged">

              <LayoutTemplate>
                   <asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
              </LayoutTemplate>

              <ItemTemplate>

                            <asp:Label ID="lblQuestionFAQ" runat="server" Text='<%# BindItem.texteQuestion %>'></asp:Label>

                            <asp:Label ID="lblReponseFAQ" runat="server" Text='<%# BindItem.texteReponse %>'></asp:Label>

              </ItemTemplate>
</asp:ListView>

And the code for filling the listview with the questions :
public IQueryable<Model.FAQ> SelectFAQ()
        {
            List<Model.FAQ> listeDesQuestions = null;

            using (LeModelTIContainer lecontexte = new LeModelTIContainer()) {
                try
                {
                    listeDesQuestions = (from faq in lecontexte.FAQSet select faq).ToList();
                }
                catch (Exception ex)
                {
                    lblMessage.Text += "Erreur s'est produite lors du SelectFAQ : " + ex.ToString();
                }
            }
            return listeDesQuestions.AsQueryable();
        }

I'd really like to have a solution full-c#, with no javascript. But I don't think it's possible. Right?

A: You can use placeholders in your ItemTemplate
<a class="accordion-toggle" ... href="#collapseOne"
and
<div id="collapseOne"...
can be replaced with
<a class="accordion-toggle" ... href="#<%# BindItem.linkName %>"
and
<div id="<%# BindItem.linkName %>"...
substitute linkName with a suitable property from the FAQSet object

A: Paul, thanks for your reply. It didn't work though. I think it was because I had runat="server" in my controls.
I played around your suggestion and came up with this :

                                <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse<%# Item.IDFAQ %>">
                                <asp:Label ID="lblQuestionFAQ" runat="server" Text='<%# BindItem.texteQuestion %>'></asp:Label>

                        <div id="collapse<%# Item.IDFAQ %>" class="panel-collapse collapse">

                                <asp:Label ID="lblReponseFAQ" runat="server" Text='<%# BindItem.texteReponse %>'></asp:Label>

Which did the trick for me ! Thanks !


text:
Q: Getting information from node.js session vs getting it from database I am using "express-session" with a MongoStore from "connect-mongo". Now from my understanding, the session is somehow stored in mongodb. Lets say that I have stored the username in session.
Now, lets say I frequently need the favorite color of the user. I have two way of doing it. Store the favorite color in session, or use the username from session to query the DB.
Now my question is, since sessions are stored in db, querying from session will eventually query the db. So, what's the difference between the two methods. If they are different, which one is better?

A: Retrieving the session data requires a database query. If you would store the favorite color in the session, getting that preference would require that one query.
If you don't store the color in the session, you would need two database queries: one for the session, one for the user data that holds the color preference.
So if you know that during a session you will be needing the color information a lot, it would be better to copy that information into the session (although don't expect massive performance improvements, MongoDB and your OS will try and keep often-used database records in memory as much as possible).
A possible downside would be that in case of changes to preferences you need to update multiple documents (if the user changes their favorite color, you need to update both the session document and the user document in the database).


text:
Q: How to access remote lan machines through a ipsec / xl2ptd vpn (maybe iptables related) I'm trying to do the setup of a IPSEC / XL2TPD VPN for our office, and I'm having some problems accessing the remote local machines after connecting to the VPN.
I can connect, and I can browse Internet sites trough the VPN, but as said, I'm unable to connect or even ping the local ones.
My Network setup is something like this:
INTERNET > eth0 > ROUTER / VPN > eth2 > LAN
These are some traceroutes behind the VPN:
traceroute to google.com (173.194.78.94), 64 hops max, 52 byte packets
 1  192.168.1.80 (192.168.1.80)  74.738 ms  71.476 ms  70.123 ms
 2  10.35.192.1 (10.35.192.1)  77.832 ms  77.578 ms  77.865 ms
 3  10.47.243.137 (10.47.243.137)  78.837 ms  85.409 ms  76.032 ms
 4  10.47.242.129 (10.47.242.129)  78.069 ms  80.054 ms  77.778 ms
 5  10.254.4.2 (10.254.4.2)  86.174 ms
    10.254.4.6 (10.254.4.6)  85.687 ms
    10.254.4.2 (10.254.4.2)  85.664 ms

traceroute to 192.168.1.3 (192.168.1.3), 64 hops max, 52 byte packets
 1  * * *
 2  *traceroute: sendto: No route to host
traceroute: wrote 192.168.1.3 52 chars, ret=-1
 *traceroute: sendto: Host is down
traceroute: wrote 192.168.1.3 52 chars, ret=-1
 *
traceroute: sendto: Host is down
 3 traceroute: wrote 192.168.1.3 52 chars, ret=-1
 *traceroute: sendto: Host is down
traceroute: wrote 192.168.1.3 52 chars, ret=-1

These are my iptables rules:
iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# allow lan to router traffic
iptables -A INPUT -s 192.168.1.0/24 -i eth2 -j ACCEPT

# ssh
iptables -A INPUT -p tcp --dport ssh -j ACCEPT

# vpn
iptables -A INPUT -p 50 -j ACCEPT
iptables -A INPUT -p ah -j ACCEPT
iptables -A INPUT -p udp --dport 500 -j ACCEPT
iptables -A INPUT -p udp --dport 4500 -j ACCEPT
iptables -A INPUT -p udp --dport 1701 -j ACCEPT

# dns
iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 53 -j ACCEPT

iptables -t nat -A POSTROUTING -j MASQUERADE

# logging
iptables -I INPUT 5 -m limit --limit 1/min -j LOG --log-prefix "iptables denied: " --log-level 7

# block all other traffic
iptables -A INPUT -j DROP

And here are some firewall log lines:
Dec  6 11:11:57 router kernel: [8725820.003323] iptables denied: IN=ppp0 OUT= MAC= SRC=192.168.1.81 DST=192.168.1.3 LEN=60 TOS=0x00 PREC=0x00 TTL=255 ID=62174 PROTO=UDP SPT=61910 DPT=53 LEN=40
Dec  6 11:12:29 router kernel: [8725852.035826] iptables denied: IN=ppp0 OUT= MAC= SRC=192.168.1.81 DST=224.0.0.1 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=15344 PROTO=UDP SPT=56329 DPT=8612 LEN=24
Dec  6 11:12:36 router kernel: [8725859.121606] iptables denied: IN=ppp0 OUT= MAC= SRC=192.168.1.81 DST=224.0.0.1 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=11767 PROTO=UDP SPT=63962 DPT=8612 LEN=24
Dec  6 11:12:44 router kernel: [8725866.203656] iptables denied: IN=ppp0 OUT= MAC= SRC=192.168.1.81 DST=224.0.0.1 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=11679 PROTO=UDP SPT=57101 DPT=8612 LEN=24
Dec  6 11:12:51 router kernel: [8725873.285979] iptables denied: IN=ppp0 OUT= MAC= SRC=192.168.1.81 DST=224.0.0.1 LEN=44 TOS=0x00 PREC=0x00 TTL=1 ID=39165 PROTO=UDP SPT=62625 DPT=8612 LEN=24

I'm pretty sure that the problem should be related with iptables, but after trying a lot of different confs, I was unable to find the right one.
Any help will be greetly appreciated ;). Kind regards, Simon.
EDIT:
This is my route table:
default         62.43.193.33.st 0.0.0.0         UG    100    0        0 eth0
62.43.193.32    *               255.255.255.224 U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth2
192.168.1.81    *               255.255.255.255 UH    0      0        0 ppp0

A: Umm, a partial answer would seem to be :
iptables -A OUTPUT -p tcp --dport dns -j ACCEPT
... similar statements to mirror '-A INPUT' in your description
Ok, I should have realized this at first: you are running NAT so...
iptables -A FORWARD -i eth1 -o ppp0 -j ACCEPT
iptables -A FORWARD -o eth1 -i ppp0 -j ACCEPT
sysctl -w net.ipv4.ip_forward=1
iptables -A FORWARD -i ppp0 -o eth1 -p tcp --dport 80 -d x.x.x.x -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth1 -p tcp --dport 53 -d y.y.y.y -j ACCEPT
iptables -t filter -P FORWARD DROP

A: You are very likely having the exact same issue as this post
Your situation is as follow:
VPN client can reach VPN server and tunnel through VPN to the internet, but cannot reach server LAN nor any other VPN clients ip.
Tunneling to the internet work because you have iptables NAT rule. The rest you need to apply the following ON THE VPN SERVER:
Enable tcp/ip forwarding
Linux TCP/IP stack by default does not forward packets (either between interfaces or re-routing them between IP network). It has to be enabled
echo 1 > /proc/sys/net/ipv4/ip_forward

Without that, VPN server will accept VPN client packet locally, and route client packet according to NAT rule, but will not route traffic to local network.
Iptables
Iptables block all traffic by default. You need rules to allow traffic to get through(forward).
$IPTABLES -A FORWARD -s 192.168.1.0/24 -d 192.168.1.0/24 -j ACCEPT

PS: Each vpn connection is an individual(virtual) interface(nic), to allow packet to flow/route between them, you need FORWARD in iptables.
/etc/l2tpd.conf
When vpn client need to talk to each together, the vpn server is acting as a routing point and need to be on the same netowrk.
local ip 192.168.1.1
ip range 192.168.1.2 - 192.168.1.254

Modify the above according to your network setup. If your vpn server has a 192.168.1.x ip, use it for the "local ip".
Modified Iptables script
Be very careful if you don't have physical access to the vpn server.
(This script will need anti-spoofing on the wan interface, but lets focus on getting traffic from vpn to lan 1st.)
# Reset/Flush iptables
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT

# Enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# NAT
# -- iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
#
# Updated NAT rule
#   External interface  = eth0
#   External IP     = 123.123.123.123
#   Internal LAN        = 192.168.1.0/24
#   To support dynamic interface : "-j SNAT" replace "-j MASQUERADE"
#   NO NAT if destination is LAN
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.1.0/24 ! -d 192.168.1.0/24 -j SNAT --to-source 123.123.123.123

# New(1) - lo
# -- iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i lo   -m state --state NEW  -j ACCEPT
iptables -A OUTPUT -o lo   -m state --state NEW  -j ACCEPT

# -- iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# New(2) Allow inter-192.168.1.x routing
iptables -A INPUT  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT
iptables -A OUTPUT  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT
iptables -A FORWARD  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT

# -- allow lan to router traffic - Shadowed by New(2)
# -- This rule maybe your source of trouble too, it only accept 192.168.1.x from eth2
# -- iptables -A INPUT -s 192.168.1.0/24 -i eth2 -j ACCEPT

# ssh
iptables -A INPUT -p tcp --dport ssh -j ACCEPT

# vpn
iptables -A INPUT -p 50 -j ACCEPT
iptables -A INPUT -p ah -j ACCEPT
iptables -A INPUT -p udp --dport 500 -j ACCEPT
iptables -A INPUT -p udp --dport 4500 -j ACCEPT
iptables -A INPUT -p udp --dport 1701 -j ACCEPT

# dns - Shadowed by New(2)
# -- iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 53 -j ACCEPT
# -- iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 53 -j ACCEPT

# logging
iptables -I INPUT 5 -m limit --limit 1/min -j LOG --log-prefix "iptables denied: " --log-level 7

# block all other traffic
iptables -A INPUT -j DROP


text:
Q: Override function in non derived c# class I have the following class
public class classB : classA

which contains function dostuff
Now I have a class SUPER, which has an instance of B amongst its variables
classB SUPER_B;

and that has a 'redefinition' of 'dostuff' amongst its methods.
Basically, what I need is that when classB calls 'dostuff', it does not call its internal dostuff, but SUPER's dostuff implementation instead.
Substantially, I would need that, on SUPER's initialization, classB's 'dostuff' be replaced with SUPER's dostuff.
It'd sort of make sense if there was a way to retrieve B's 'dostuff''s reference, but I don't know how to achieve that.
I've looked into virtual and Func, but they seem to require that SUPER be a derivate of B

A: You cannot force a method change upon a class from the outside. There are ways to achieve functionality like that when either (1) classB is designed in such a way as to support replacing its methods, e.g. though a settable delegate, or (2) if classB implements an interface, which you can implement, wrap classB inside it, and replace a method.
Example #1 - settable delegate:
class ClassB {
    public Action<int> dostuff {get;set;}
    public ClassB() {
        dostuff = myDoStuff;
    }
    void myDoStuff(int n) {
    }
}

class Program {
    public static void Main() {
        var myB = new ClassB();
        myB.dostuff = myOverride;
    }
    void myOverride(int n) {
    }
}

Example #2 - interfaces.
interface IClassB {
    void dostuff(int n);
    void dosomething();
}
class ClassB : IClassB {
    void dostuff(int n) {
    }
    void dosomething() {
    }
}
class Program {
    public static void Main() {
        var bb = new Override(new ClassB());
    }
    class Override : IClassB {
        private readonly IClassB inner;
        public Override(IClassB inner) {
            this.inner = inner;
        }
        void dostuff(int n) {
            // do not call inner.dostuff
        }
        void dosomething() {
            inner.dosomething();
        }
    }
}

A: It sounds like you need to use decorator pattern: class SUPER has an instance of classB and uses it's methods. SUPER decorates all necessary methods of classB, and adds some new. For example:
public class SUPER {
  private classB SUPER_B = new classB();
  public void foo()  {
     SUPER_B.foo();
  }
  public void bar()  {
     SUPER_B.bar();
  }
  ...
  public void dostuff()
  {
       // don't call SUPER_B.bar(), but write your implementation
  }
}

A: You can't do that easily.
Instead you should design your classB for extensibility, such as add events to classB which you can handle in your SUPER class.


text:
Q: Xamarin Custom Control binding collectionChanged to IEnumerable ItemsSource I have custom control that takes a list of object and present them in sort of listview.
public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable<object>), typeof(MyCustomControl), null);
    public IEnumerable<object> ItemsSource
    {
        get { return (IEnumerable<object>)GetValue(ItemsSourceProperty); }
        set{ SetValue(ItemsSourceProperty, value);}
    }

From the ViewModel
I would be binding the ItemsSource to an ObservableCollection<object> and I would like my custom control to listen to the collectionchanged event on the ObservableCollection rather than propertychanged.
ListView some how able to listen to the collection changed and refreshes its view, I tried to find the code from the Xamarin github, no luck in finding where the listener is binded.
Any solution, how I can listen to the collection from my custom control?

A: You can add an event to your collection using ObservableCollection<T>.CollectionChanged. more info here.
 And you can handle changes in you view using a callback mechanism like below
In your ViewModel something like this
public ObservableCollection<Item> myObservableList { get; set; }
MyChangeHandler handler;

//Pass a callback to your viewModel to listen to changes in your view
public YourViewModel(MyChangeHandler handler)
{
   this.myObservableList = new ObservableCollection<Item>();
   this.myObservableList.CollectionChanged += this.OnCollectionChanged;
}

//Handle collection changes
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
//...Call your custom control method here
    handler.someMethod("List changed");
}

public interface MyChangeHandler{
    void someMethod(string value);
}

And in your custom view
class MyView: ContentView,MyChangeHandler{
    public MyView(){
        var vm = new YourViewModel(this);
    }

    public someMethod(string value){
        ///Handle changes in your view
    }
}

A: Okay Answering my own post
I was suggested by many other people to use MessagingCenter, Collection event in the ViewModel, create custom eventhandler inside the Custom control...These are all work around, not solution.
If its bug then work around would be best solution but since the way how bindableproperty is implemented, we are able to achieve this using the actual provided design.
So in custom control
protected override void OnPropertyChanged(string propertyName)
{
    if(propertyName == CustomView.ItemsSourceProperty.PropertyName)
    {
        if (ItemsSource != null && ItemsSource is INotifyCollectionChanged collection)
        {
                collection.CollectionChanged -= ItemsSourceCollectionChanged;
                collection.CollectionChanged += ItemsSourceCollectionChanged;
        }

    }

    base.OnPropertyChanged(propertyName);
}

private void ItemsSourceCollectionChanged(object s, EventArgs e)
{
    //Handle collection changed event
}

When ItemsSource property is changed, it resubscribe to collectionchanged event.


text:
Q: Discord Bot always replies one more message Respons Picture

Hi my Bot always replies one more message, The command works you press the button enter a reason in the text input field and then you select a platform from the drop down menu. But instead of sending the embed once, it sends it multiple times each time.
Error: Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
Or: "Interaction has already been acknowledged."
const Discord = require('discord.js')
const Command = require('../../structures/CommandClass');
const { stripIndents } = require('common-tags');
const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, TextInputStyle, StringSelectMenuBuilder, Events, ModalBuilder, TextInputBuilder } = require('discord.js');

module.exports = class spielersucheerweitert extends Command {
    constructor(client) {
        super(client, {
            data: new SlashCommandBuilder()
                .setName('sendspielersuche')
                .setDescription('Sende das Spielersuche Embed')
                .setDefaultMemberPermissions(PermissionFlagsBits.BanMembers)
                .setDMPermission(false),
        });
    }

  async run(client, interaction) {

    let member = await interaction.member.fetch();

      const pfmenü = new ActionRowBuilder()
            .addComponents(
                new StringSelectMenuBuilder()
                    .setCustomId('pfmenü')
                    .setPlaceholder('Plattform auswählen')
                    .addOptions(
                        {
                            label: 'PS4',
                            value: 'ps4',
                        },
                        {
                            label: 'PS5',
                            value: 'ps5',
                        },
            {
                            label: 'PS4/PS5',
                            value: 'ps4ps5',
                        },
            {
                            label: 'PC',
                            value: 'pc',
                        },
            {
                            label: 'Switch',
                            value: 'switch',
                        },
            {
                            label: 'Alle',
                            value: 'alle',
                        },
                    ),
            );

      const modals = new ModalBuilder()
            .setCustomId('minput')
            .setTitle('Spielersuche ');

      const spielinput = new TextInputBuilder()
            .setCustomId('spielinput')
            .setLabel("Für welches Spiel?")
      .setPlaceholder('GTA5, Fortnite, Call of Duty, Minecraft ...')
            .setStyle(TextInputStyle.Short)
      .setMinLength(2)
      .setMaxLength(20)
      .setRequired(true);

      const grundinput = new TextInputBuilder()
            .setCustomId('grundinput')
            .setLabel("Der Grund der Anfrage?")
      .setPlaceholder('Beispiel: Suche Spieler für Cayo Perico Heist.')
            .setStyle(TextInputStyle.Short)
      .setMinLength(10)
      .setMaxLength(60)
      .setRequired(true);

      const firstActionRow = new ActionRowBuilder().addComponents(spielinput);
      const secondActionRow = new ActionRowBuilder().addComponents(grundinput);
      modals.addComponents(firstActionRow, secondActionRow);

  const spielersucheerweitertEmbed = new EmbedBuilder()
  .setTitle(`Spieler suchen Spieler `)
  .setColor('#00ff0c')
  .setDescription(stripIndents`Drücke auf denn Button um eine Spielersuche Anzufragen!`)
  .setFooter({ text: 'YANKEEUNIT91 COMMUNITY'})
  .setTimestamp();

  const buttonsa = new ActionRowBuilder()
            .addComponents(
                new ButtonBuilder()
                    .setCustomId('buttonanfrage')
          .setEmoji('')
                    .setLabel('Spielersuche Anfragen')
                    .setStyle(ButtonStyle.Success),
            );

      client.on('interactionCreate', async interaction => {
        if (interaction.isButton()) {
            const buttonID = interaction.customId
            if (buttonID === 'buttonanfrage') {
              await interaction.showModal(modals);
            }
        }
    });

    client.on('interactionCreate',  (modalSubmit) => {
      if (!modalSubmit.isModalSubmit()) return;

  const ginputdata = modalSubmit.fields.getTextInputValue('grundinput');
    const sinputdata = modalSubmit.fields.getTextInputValue('spielinput');
      modalSubmit.reply({
        content:'**Wähle deine Plattform!**', components: [pfmenü], ephemeral: true });

      client.on('interactionCreate', async interaction => {
        if (!interaction.isStringSelectMenu()) return;

  const selected = await interaction.values.join(', ');

  const spielersucheerweitertEmbedfertig = new EmbedBuilder()
  .setTitle(`${ginputdata}`)
  .setColor('#00ff0c')
  .setDescription(stripIndents`Spiel: \`${sinputdata}\`
  Plattform:  \`${selected}\``)
  .setFooter({ text: 'YANKEEUNIT91 COMMUNITY'})
  .setTimestamp();

        await interaction.channel.send({ embeds: [spielersucheerweitertEmbedfertig] });
        return await interaction.update({ content: '**Spielersuche wurde erfolgreich Angefragt!**', components: [] });
      });

    });

    await interaction.channel.send({ embeds: [spielersucheerweitertEmbed], components: [buttonsa] });
    return await interaction.reply({ content: 'Spielersuche Embed wurde versendet!', ephemeral: true });

}

};

I've looked at the code several times but have no idea why he's doing it more and more often

A: client.on('interactionCreate', async interaction => {
        if (!interaction.isStringSelectMenu()) return;

  const selected = await interaction.values.join(', ');

  const spielersucheerweitertEmbedfertig = new EmbedBuilder()
  .setTitle(`${ginputdata}`)
  .setColor('#00ff0c')
  .setDescription(stripIndents`Spiel: \`${sinputdata}\`
  Plattform:  \`${selected}\``)
  .setFooter({ text: 'YANKEEUNIT91 COMMUNITY'})
  .setTimestamp();
        //executed when the button with the buttonanfrage custom ID is clicked
        await interaction.channel.send({ embeds: [spielersucheerweitertEmbedfertig] });
        return await interaction.update({ content: '**Spielersuche wurde erfolgreich Angefragt!**', components: [] });
      });

    });

    //This block is executed when the function is run
    await interaction.channel.send({ embeds: [spielersucheerweitertEmbed], components: [buttonsa] });
    return await interaction.reply({ content: 'Spielersuche Embed wurde versendet!', ephemeral: true });

}

The issue you are experiencing is caused by the fact that both of these blocks of code are being executed, which is resulting in the same message and update being sent multiple times.
So you have 2 options:

*

*Remove the second block of code that sends the message and updates
the interaction. This will prevent the message and update from being
sent multiple times.

*Add a flag to track whether or not the message and update have
already been sent. You can then check the flag before sending the
message and update to ensure that they are only sent once.


text:
Q: To generate 10 random numbers between -1.5 and 1.5 and write them in a ran.dat file I have tried this
Fix the range and also compute average and number of data greater than average
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    int i;
    float num;
    srand(time(NULL));

    FILE *fp;
    fp = fopen("ran.dat", "w");

    for (i = 0; i < 9; i++)
    {
        num = rand() % (-1.5,1.5);
        fprintf(fp, "%f\n", num);
    }

    fclose(fp);
    return 0;
}

A: You can generalize it by creating a function like so:
float random_float(float min, float max)
{
    return ((float)rand() / ((float)RAND_MAX)) * (max - min) + min;
}

With both min and max inclusive.
This is the complete code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

float random_float(float min, float max)
{
    return ((float)rand() / ((float)RAND_MAX)) * (max - min) + min;
}

int main()
{
    srand(time(NULL));

    FILE *fp;
    fp = fopen("ran.dat", "w");

    int i;
    for (i = 0; i < 9; i++)
    {
        fprintf(fp, "%f\n", random_float(-1.5, 1.5));
    }

    fclose(fp);
    return 0;
}

A few things I changed:

*

*Declared the variable i immediately before the for loop. This is a good practice, declaring things only when you are about to use them;

*Removed declaration of float num as it was unnecessary.

A: This will create 10 random numbers between -1.5 and 1.5.
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(){
    int i;
    float num;
    srand(time(NULL));
    FILE *fp;
    fp = fopen("ran.dat","w");

    for(i=0; i < 10; i++)
    {
        num = (double)rand()/RAND_MAX * 3.0 - 1.5;
        fprintf(fp,"%f\n", num);
    }
    fclose(fp);
    return 0;
}


text:
Q: Purchase Order - Supplier Code I am trying to get Supplier code to show on the Purchase order.
I am able to make it show, as long as there is only a single vendor associated with the product, but if there is more I get the error: Unexpected singleton
<xpath expr="//table[@class='table table-condensed']//tbody//tr" position="replace">

</xpath>

Is there a way to get the default or first seller code to show, if there is more than 2 vendors on the product?

A: The following is the simple way, using and operator.
Ex:
    <xpath expr="//table[@class='table table-condensed']//tbody//tr" position="replace">

    </xpath>


text:
Q: Ivy + eclipse runtime dependencies deployment I have an eclipse project with IvyDE managed dependencies
My IvyDE is something like:
<ivy-module version="2.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
     <info organisation="R01"
           module="myModule"
           status="integration">
     </info>

     <configurations>
         <conf name="compile" description="Used only at compile time; not deployed to the server" />
         <conf name="runtime" extends="compile" description="Deployed to the server"/>
     </configurations>

     <dependencies>
         <dependency org="com.sun.jersey" name="jersey-core" rev="1.9.1" conf="runtime"/>
         <dependency org="javax.ws.rs" name="jsr311-api" rev="1.1.1" conf="compile"/>
     </dependencies>
</ivy-module>

I have dependencies needed at compile-time and dependencies needed at runtime
I don't know if this is possible with apache IVY in eclipse (IvyDE) but I want to deploy to the server ONLY the RUNTIME-dependencies.
Now the only solution I've found is:

*

*set IvyDE to resolve ALL (compile + runtime) dependencies and set the module classpath

*add the [Ivy] library to the [DeploymentAssembly] at the project properties

This way all the dependencies (including the compile-time dependencies) are deployed to the server...
Is there any way to achieve this???
Thanks in advance

A: I answer my own question.
Finally I managed to get have TWO different ivy-managed classpath libraries, one used at compile-time and the other at run-time

The trick is include TWO ivyDE-managed dependencies:

One ivyDE managed dependency should be for COMPILE configuration and the other for RUNTIME configuration:

(repeat for the RUNTIME configuration)
Then it's only a matter of setting:

*

*ivy dependency for COMPILE config should be a [Project Library]

*ivy dependency for RUNTIME config should be at [Deployment Assembly]

That's all!


text:
Q: Incomplete retrieving multidimensional array from a Form I've created a form that produce 3 dimensions array.
$_POST['tgt'][1234]['target_produk'];

The result is like this,
110
array (size=9)
  'dr' => string '1020' (length=4)
  'target_harnal' => string '0' (length=1)
  'target_vesicare' => string '0' (length=1)
  'target_perdipine' => string '0' (length=1)
  'target_dorner' => string '0' (length=1)
  'target_mycamine' => string '0' (length=1)
  'target_nasea' => string '0' (length=1)
  'target_prograf' => string '0' (length=1)
  'target_max' => string '2' (length=1)
111
array (size=9)
  'dr' => string '1019' (length=4)
  'target_harnal' => string '1' (length=1)
  'target_vesicare' => string '1' (length=1)
  'target_perdipine' => string '0' (length=1)
  'target_dorner' => string '0' (length=1)
  'target_mycamine' => string '0' (length=1)
  'target_nasea' => string '0' (length=1)
  'target_prograf' => string '0' (length=1)
  'target_max' => string '1' (length=1)
112
array (size=1)
  'dr' => string '1018' (length=4)

I tried to check are the data has been sent successfully by create a simple foreach and a var_dump,
public function target_process(){
    $i=1;
    foreach($_POST['tgt'] AS $data){
        //set_time_limit(0);
        echo $i;
        $id = $data['dr'];
        var_dump($data);
        $i++;
    }
}

The process always stop at 112th loop.
Is it because of the time limit or the memory or any other possible reason?
I've also tried to create a manual array (not from a form),
and it could loop as usual until the end.
Thank you.


text:
Q: document.querySelector keeps returning null in function I have a span element with an id="edit-..." that is in a card like this. This card is dynamically added to the DOM by the way:

${post.creator}

            Likes ${post.likes}

${post.content}

            ${post.created}&#8287&#8287&#8226 EDIT

When I try to access that span element directly from the console like below it works perfectly fine:
> document.querySelector('span[id="edit-4"]')

or I even tried out this and it still worked:
> const tweet = 4
> document.querySelector(`span[id="edit-${tweet}"]`)

However, when I try and do it from a function and print to console it keeps returning null and I cannot understand why?
function editButton(creator, post){
    const currentUser = document.querySelector('#signed-in-user').innerText;
    const tweet = post

    if(creator != currentUser){
        const editBtn = document.querySelector(`span[id="edit-${tweet}"]`);
        console.log(document.querySelector(`span[id="edit-${tweet}"]`));
        console.log("Post (" + post + "): " + creator + " does not match logged in user");
    }
}

I even added this extra line to my function:
console.log(`edit-${tweet}`)

to see if tweet was returning the number correctly and it is. Can anyone see what's going on here?


text:
Q: Fling on ListView - what direction? Is there a way to get the direction of a Fling (up or down) in a ScrollListener attached to a ListView? I get the OnScrollListener.SCROLL_STATE_FLING without problems, but I can't get the direction. Do I have to write a whole GestureListener and onTouch listener and attach it to my ListView for this or is there an easier way? I just need the direction of the Fling nothing more. Thanks for your answers.

A:
Do I have to write a whole GestureListener and onTouch listener and attach it to my ListView for this or is there an easier way?

You can simply use an OnTouchListener like this:
listView.setOnTouchListener(new OnTouchListener() {
    int before = -1;
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        switch(event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            before = ((ListView) v).getFirstVisiblePosition();
            break;
        case MotionEvent.ACTION_UP:
            int now = ((ListView) v).getFirstVisiblePosition();
            if(now < before)
                Log.v("onTouch", "Scroll Up");
            else if(now > before)
                Log.v("onTouch", "Scroll Down");

        }
        return false;
    }
});

If you only want to be notified when a fling happens: save the current scroll state in OnScrollListener's onScroll() method and check if is a fling motion.


text:
Q: "Badzipfile: file is not a zip file" using os and openpyxl I have a folder with a bunch of excel spreadsheets (directory called "path" here) and I need to extract a cell from each of the files (same location) and paste it in a new spreadsheet (calling it "output" in the code). I've used the openpyxl module because I can't change the file format into csv and I was struggling to get panda to work. Using os module to iterate through each document in the directory.
This is my code:
import openpyxl
import os

output = openpyxl.load_workbook(r"output file location")
osheet = output.active

path = "directory location"

os.chdir(path)

x=1
for i in os.listdir():
    address = "%s\%s" % (path,i)
    wb = openpyxl.load_workbook(address)
    sheet = wb.active
    unl_vol = sheet['i3'].value

    osheet ['B' + str(x+1)].value = unl_vol
    osheet ['A' + str(x+1)].value = str(i)
    x=x+1
    output.save("output file location")

This is the traceback:
Traceback (most recent call last):

  File "C:\Users\m0s0yin\.spyder-py3\temp.py", line 16, in <module>
    wb = openpyxl.load_workbook(address)

  File "C:\Users\m0s0yin\Anaconda3\lib\site-packages\openpyxl\reader\excel.py", line 315, in load_workbook
    reader = ExcelReader(filename, read_only, keep_vba,

  File "C:\Users\m0s0yin\Anaconda3\lib\site-packages\openpyxl\reader\excel.py", line 124, in __init__
    self.archive = _validate_archive(fn)

  File "C:\Users\m0s0yin\Anaconda3\lib\site-packages\openpyxl\reader\excel.py", line 96, in _validate_archive
    archive = ZipFile(filename, 'r')

  File "C:\Users\m0s0yin\Anaconda3\lib\zipfile.py", line 1266, in __init__
    self._RealGetContents()

  File "C:\Users\m0s0yin\Anaconda3\lib\zipfile.py", line 1333, in _RealGetContents
    raise BadZipFile("File is not a zip file")

BadZipFile: File is not a zip file

I thought it might be a problem with the dash on the definition of "address" but I've tried either way. The code worked for a single file, it's when I added the os module and the for loop that it broke.


text:
Q: Should I load HTML with Inline JS or the Script that Defines the JS First? I have run into an interesting problem. I'm trying to understand when to load inline js functions. What should be defined first? The html that calls the function, or the function itself?
I should note that I'm using babel to use es6 classes and modules. Fairly confident that is not the problem.
I've run into this with the Facebook SDK. I'm unsure of the order of the elements that Facebook needs to load. I've included them in the recommended order but it doesn't recognize the onlogin hook inside of the facebook login button.
My html (jade) looks like this:
script(src='assets/js/bundle.js')

fb:login-button(scope='public_profile,email', onlogin='checkLoginState();')
#status

Inside of bundle I have
function statusChangeCallback(response) {
  if (response.status === 'connected') {
    testAPI();
  } else if (response.status === 'not_authorized') {
    document.getElementById('status').innerHTML = 'Please log into this app.';
  } else {
    document.getElementById('status').innerHTML = 'Please log into Facebook.';
  }
}

function checkLoginState() {
  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  });
}

window.fbAsyncInit = function() {
  FB.init({
    appId      : '###########',
    cookie     : true,
    xfbml      : true,
    version    : 'v2.6'
  });

  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  });
};

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

function testAPI() {
...
}

However, If I click on the Facebook login, it will not fire the checkLoginState function and it returns undefined.
This is exactly the flow that they prescribe.
Alternatively, what is the order that this needs to be loaded in?
Attempted Solutions:

*

*Reversing the order. I've tried loading the script after the button

*I've tried changing the fbAsyncInit to an iife.

*I've tried bypassing the onlogin function entirely but the response comes back as unknown.

*New approach - manually build button and use a document.addEventListener


text:
Q: Compatible Spring Eureka Version I am using below on pom.xml but i am not able to start the application  due to error
I don't want to downgrade the spring boot starter parent version.Is there any solution?
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.4</version>
    </parent>

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
            <version>2.2.9.RELEASE</version>
        </dependency>

I am getting the belwo error

org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'configurationPropertiesBeans' defined in
class path resource
[org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.class]:
Post-processing of merged bean definition failed; nested exception is
java.lang.IllegalStateException:  Failed to introspect Class
[org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]
from ClassLoader [sun.misc.Launcher$AppClassLoader@659e0bfd]

A: You should add Spring Cloud 2020.0.3 that is compatible with Spring Boot 2.5.x by including the BOM in your dependencyManagement section:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2020.0.3</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

You can find an overview of Spring Cloud / Spring Boot compatibility on the Spring Cloud website (see the table Release train Spring Boot compatibility).
Once this is added, you don't need to target a specific version of Spring Cloud Eureka. Instead, you can include the Eureka dependency as follows:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>


text:
Q: emberjs and electron app My Electron App is crashed, when i use Ember. The App binds a Web Application and the Web Application has now EmberJS for the Frontend. In the Console is the following error:

Anybody a idea why this came?
My package.json in electron App have the following dependencies:
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"electron-packager": "5.2.1",
"electron-prebuilt": "0.36.10",
"ember-ajax": "0.7.1",
"ember-bootstrap": "0.6.3",
"ember-browserify": "1.1.8",
"ember-cli": "2.10.0",
"ember-cli-app-version": "^2.0.0",
"ember-cli-babel": "^5.1.7",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-font-awesome": "1.5.0",
"ember-cli-htmlbars": "^1.0.10",
"ember-cli-htmlbars-inline-precompile": "^0.3.3",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^3.0.1",
"ember-cli-release": "0.2.9",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.10.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-electron": "1.12.0",
"ember-export-application-global": "^1.0.4",
"ember-inspector": "1.9.5",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"loader.js": "^4.0.10"
}

A: The problem is solved: https://github.com/electron/electron/issues/254
Thank you @kumkanillam for your help. :)


text:
Q: Android button with selector background doesn't load landscape drawables I've set up a button with an xml selector background. The drawables are located in different versions at drawable-xhdpi and at drawable-land-xhdpi.
Problem is on rotation change to landscape the buttons aren't assigned with the land version.
the button looks like this:
<Button android:id="@+id/home_button"
                            android:layout_height="wrap_content"
                            android:layout_width="wrap_content"
                            android:layout_alignParentBottom="true"
                            android:layout_marginBottom="0dp"
                            android:background="@drawable/xml_selector_home"
                            android:layout_toRightOf="@+id/fwd_button"
                            android:layout_weight="1">
                    </Button>

the button drawable looks like this:

<item android:state_pressed="true" android:drawable="@drawable/homeon"/>
<item android:drawable="@drawable/homeoff"/>

A: change the ladscape folder to
drawable-xhdpi-land


text:
Q: HTML5 - Does
* have to be inside of
*? I know, that the only childred of the
 can be
 elements. However, I can not find any requirement, whether the
 can be used without
 element?
Is the following code correct?

some elements, nevermind

Oh! This has a point

another one!

and here the rest of the site goes...

I know, that it seems to be pointless, but I write some kind of very basic CMS, in which I need to replace [[li]] marks with elements of a list, so if above is correct, I would not need to make a lot of logic, to add  element before the first [[li]] and
 behind the last one.
So in a word - does HTML5 syntax allow me to use
 without
?

A: Straight from the W3 HTML5 Spec (This is a candidate spec, I'd actually recommend
kazagistar's W3 link which includes the <menu> element too.):

4.5.7 The li element
Categories:
      None. Contexts in which this element can be used:
      Inside ol elements.
      Inside ul elements.
The li element represents a list item. If its parent element is an ol, or ul, then the element is an item of the parent element's list, as defined for those elements. Otherwise, the list item has no defined list-related relationship to any other li element.

The W3 Spec shows that you should only use a list item element when it's inside an ordered or unordered list element or a menu element.

A: See the w3 standard pages here
Permitted parent elements: ul, ol, menu

A: Yes as per html standards we write
* inside .. yes you can use without  also.. basically  use to add custom css for every
* its like a container..

A: @Paweł Tokarz:
"So in a word - does HTML5 syntax allow me to use
 without
?"
Answer: yes it does, but with: ol or menu, that's all!
check this:
 "li element can be nested inside the next HTML elements:"
source:
 http://w3-video.com/Web_Technologies/HTML5/li/html5_li_tag_nested.php


text:
Q: Rolling restart Ignite full memory mode on K8s without losing data I am running ignite on the k8s cluster with 5 pods and set backups = 1 https://apacheignite.readme.io/docs/primary-and-backup-copies. Is there any way to do a rolling restart without losing data and how to check if the data is synced to other instances before restarting one after another
Thank you

A: You can monitor cache rebalancing process by using jmx
https://ignite.apache.org/docs/latest/monitoring-metrics/metrics#monitoring-rebalancing


text:
Q: SQL Server stored procedure passing datepart year as a parameter I was wondering if anyone could help please, I've got the below procedure, I'm trying to enable it so that an end user can pass the year portion of the date only and it will query based on that parameter so at the moment I'm querying between ContractDate.ContractDate >= 01/01/2015 AND <= 31/12/2015 but I would like our users to be able to enter '2016' for example into a text box as a parameter that is passed and would update the year part of the above criteria querying based on this but leaving the month and day portion intact, this way they can enter
I'm quite a novice when it comes to sql so any help is gladly appreciated.
SELECT TOP 100 PERCENT
    dbo.Users.LoginName,
    CAST(DATENAME(m, dbo.ContractDate.ContractDate) AS varchar) AS DatePeriod,
    SUM(CASE WHEN dbo.Contract.Contract = 1 THEN 1 ELSE 0 END) AS Contract,
    SUM(CASE WHEN dbo.contract.contract = 0 THEN 1 ELSE 0 END) AS Permanent
FROM
    dbo.ContractSkill
INNER JOIN
    dbo.Users
INNER JOIN
    dbo.Contract ON dbo.Users.UserId = dbo.Contract.UserId
INNER JOIN
    dbo.ContractDate ON dbo.Contract.ContractId =   dbo.ContractDate.ContractId
    ON dbo.ContractSkill.ContractId = dbo.Contract.ContractId
WHERE
    (dbo.ContractDate.DNS = 0)
    AND (dbo.ContractSkill.SkillId = 30960)
    AND (dbo.ContractDate.ContractDate >= CONVERT(DATETIME, '2015-01-01  00:00:00', 102))
    AND (dbo.ContractDate.ContractDate <= convert(DATETIME, '2015-12-31 00:00:00', 102))
GROUP BY
    CAST(DATENAME(m, dbo.ContractDate.ContractDate) AS varchar),
    MONTH(dbo.ContractDate.ContractDate), dbo.Users.LoginName
    ORDER BY MONTH(dbo.ContractDate.ContractDate)

A: If you mean that you will be adding a parameter to your function through which the selected year is being provided, then just add that parameter and:

*

*Declare two variables to be used in the select statement whose type is DATE,

*Add the following assignments:
SET @YourStartVariable = CONVERT(DATETIME,CONCAT(P_Passed_Year,'-01-01 00:00:00'),102);
SET @YourEndtVariable  = CONVERT(DATETIME,CONCAT(P_Passed_Year,'-31-12 23:59:59'),102);

*Use these variable in your query, meaning that instead of:
(dbo.ContractDate.ContractDate >= CONVERT(DATETIME,'2015-01-01 00:00:00', 102))
AND (dbo.ContractDate.ContractDate <= convert(DATETIME,'2015-12-31 00:00:00', 102))

you would have:
(dbo.ContractDate.ContractDate >=  @YourStartVariable)
AND (dbo.ContractDate.ContractDate <=  @YourEndVariable)

That is.
Your original upper limit was YYYY-12-31 00:00:00 and I'm guessing it should be YYYY-12-31 23:59:59.

A: There are two ways to achieve this thing..

1st one is very simple by passing a parameter for Year only
@Contract_Year tityint

then placing a where condition with function Year().
Where Year(dbo.Contract.ContractDate) = @Contract_Year

And the second one is to create two separate variable for From Date and To Date.
I would recommend to use this method if you have created index on ContractDate field. B'coz, index will not be considered if you use the field inside any function (ie. Year(), Month() or Day()).
Paremter
@Contract_Year Char(4)

Stored Procedure Code
Declare @from_Date DateTime = Cast(@Contract_Year + '-01-01' As DateTime);
Declare @to_Date DateTime = Cast(@Contract_Year + '-12-31 23:59:59' As DateTime);

Use the above variable in Where clause
Where (dbo.Contract.ContractDate Between @from_Date and @to_Date)


text:
Q: How to use doxygen in xcode 4.6? I tried to use doxygen in Xcode 4.6 to document the source code written in objective c,
and followed these links:
Link1, Link2
but these links deal with the older xcode versions.
please help me use doxygen in xcode 4.6 (latest).

A: I use an external build system target.  In the Info tab, set the tool to
/Applications/Doxygen.app/Contents/Resources/doxygen

(or wherever you have Doxygen installed)
and the argument to
Doxyfile

Or where you have put the config file.

A: I recommend you to use a better alternative for Apple environement to Doxygen : Appledoc


text:
Q: Android: Add external project package name into a layout xml? I have an XML layout file in my main project, which contains this:
<com.quietlycoding.android.picker.NumberPicker
            android:id="@+id/belegposition_belegpositionpickerpause"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

This package resides in another project which I have added to my build path. The package name is 100% correct. I also tested this with an import in a .java file which the compiler does recognize.
But when the XML file is inflated at runtime I get this error:
02-03 01:56:58.824: E/dalvikvm(4213): Could not find class 'com.quietlycoding.android.picker.NumberPicker', referenced from method de.innosoft.android.activity.BelegPositionen$ArrayAdapterBelegPosition.getView
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213): Didn't find class "com.quietlycoding.android.picker.NumberPicker" on path: /system/framework/android.test.runner.jar:/data/app/de.innosoft.android-1.apk
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213): java.lang.ClassNotFoundException: Didn't find class "com.quietlycoding.android.picker.NumberPicker" on path: /system/framework/android.test.runner.jar:/data/app/de.innosoft.android-1.apk
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.createView(LayoutInflater.java:552)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at de.innosoft.android.activity.BelegPositionen$ArrayAdapterBelegPosition.getView(BelegPositionen.java:107)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.AbsListView.obtainView(AbsListView.java:2159)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.ListView.measureHeightOfChildren(ListView.java:1246)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.ListView.onMeasure(ListView.java:1158)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.View.measure(View.java:15513)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.View.measure(View.java:15513)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.View.measure(View.java:15513)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.View.measure(View.java:15513)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.View.measure(View.java:15513)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.Choreographer.doCallbacks(Choreographer.java:562)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.Choreographer.doFrame(Choreographer.java:532)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.os.Handler.handleCallback(Handler.java:725)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.os.Handler.dispatchMessage(Handler.java:92)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.os.Looper.loop(Looper.java:137)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at android.app.ActivityThread.main(ActivityThread.java:5191)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at java.lang.reflect.Method.invokeNative(Native Method)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at java.lang.reflect.Method.invoke(Method.java:511)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
02-03 01:57:02.191: E/java.lang.ClassNotFoundException(4213):   at dalvik.system.NativeStart.main(Native Method)

Is it not possible to reference an external project package from an XML file? Or have I just forgotten to a specific attribute to the root XML element?
EDIT: i am using an external project because I do not want to pollute my main project folders with all this external stuff (drawables etc). Unfortunately the library does not come as a JAR.

A: Try to add the external project as library.
In the external project go to project properties and in section Android check the Is Library checkbox. Then go your project properties an in the section Android add the external project as Library.


text:
Q: putting local tabBar on the global tabBar (I have a global tabBarController) I have put one global tabBarController in iphone app that I have been working on.
But in one of my screen I needed to put the local tabBar which is different from the global tabBarController.
I have done it in two ways:
1) Hiding the global tabBar by self.tabBarController.tabBar.hidden = yes; and putting local tabBar in place of it in the view. But the frame of tabBar is showing blank white.
2) Tried by adding the local tabBar as subview of global tabBar which worked but after screen is unloaded its not removing the local tabBar though applying [localTabBar removeFromSuperView];
Thanks in advance..
Global tabBarController:
tabBarController          = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray    arrayWithObjects:ActivityTabnav,nav2,privateChatnav,ExploreTabnav,nav3,tempTabnav, nil];

localtabBar is a tabBar on view xib of viewController.
in vIewDidLoad >
 UIWindow* window = [[UIApplication sharedApplication] keyWindow];
 [window addSubview:self.tabBar];

in vIewDidUnLoad >
[self.tabBar removeFromSuperview];

Previously I tried to add self.tabBar to self.tabBarController.tabBar as a subView which persisted the local self.tabBar in other screens.
Thank you...

A: The cleanest way I've found to do this is to set the hidesBottomBarWhenPushed property of your view controller, then place it inside a UINavigationController (hiding the navigiationBar if you don't need it). This will hide the UITabBarController's UITabBar without leaving a white space.
You'd then put the local UITabBar directly into the UIViewController's view;
Another possibility would be to hide the UITabBarController's UITabBar, then add the local UITabBar to as a subview of UITabBarController's view. Of course you'd have to remove from superview when needed.

A: One way is to add TabBar on Window. But be sure that you handle is correctly. You can add it on window by taking the Current Window object and then add TabBar onto it... as below...
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
[window addSubview:tabbar];

this could be one option but handle it carefully...


text:
Q: A doubt regarding change of variables in Double Integrals. So I have recently learnt to calculate "Double Integrals" and I have a doubt on change of variables. Lets say we are evaluating a double integral of the form I = $\int\int _R F(x,y) dx dy $ , where $F(x,y)$ is an integrable smooth function and $R$ is the region of integration in the $xy$ plane. Now I want to convert to polar co-ordinates $x(r,\theta)=r \cos(\theta)$ and $y(r,\theta) = r \sin(\theta)$. Now the region $R$ in the $xy$ palne can be suitably converted to some region $R'$ in the $r \theta$ plane. The function $F(x,y)$ may take the form of some smooth and integrable $G(r,\theta)$. My main doubt is with the change of the area element. According to my textbook, $dx dy = \frac{\partial (x,y)}{\partial(r,\theta)} = rdrd\theta$. So the area element in the $r\theta$ plane is $rdr d\theta$.
Now I want to experiment a little bit with my understanding : I write $dx = d(r\cos\theta) = -r\sin\theta d\theta + \cos \theta dr$  and $dy = d(r\sin\theta)=r\cos\theta d\theta + \sin\theta dr $. And now I multiply the two expression for $dx$ and $dy$ : $dxdy= -r^2\sin\theta\cos\theta d\theta d\theta - r \sin^2 \theta drd\theta + r \cos^2 \theta dr d\theta + \sin \theta \cos\theta dr dr$. Why isn't this expression equal to $rdrd\theta$ ? The $d\theta d\theta$ and $dr dr$ terms look very odd to me. Am I commiting some abuse of notation or something ? Also there are no higher order terms like $dr dr d\theta$ which I can ignore. I am totally confused with all this. Can someone explain this to me a bit clearly? Thanks in Advance :).
EDIT 1 : I know differentials are not the "usual" kind of algebraic quantities and we can't just add and multiply them casually. I am just multiplying $dx$ with $dy$ with the spirit of multiplying some $\delta x$ and $\delta y$ and letting both $\delta x$ and $\delta y$ tend to zero.
EDIT 2 : Is there a branch of Mathematics where addition and multiplication of differentials is very common? Is there something like differential of a differential ?

A: Side Question

Is there a branch of Mathematics where addition and multiplication of differentials is very common? Is there something like differential of a differential ?

There are lots of different contexts/formalizations with involved manipulation of differentials. Trying to give an overview of all of them would be a big undertaking worthy of a whole separate question. Very briefly: The most common thing that is taught/that I would expect a mathematician to think of is the theory of "differential forms". But there are also many other relevant things like "geometric calculus", "Smooth Infinitesimal Analysis", Bartlett and Khurshudyan's approach to manipulating higher order differentials (arXiv link), debatably: Robinson's approach to nonstandard analysis, and probably a couple other things I'm forgetting or haven't encountered.
Main Question

Why isn't this expression equal to $rdrd\theta$ ?

Disclaimer
This is almost entirely copied from my answer to the similar question Why can't we convert the area element $dA$ to polar by multiplying the polar expressions for $dx$ and $dy$?.
Intro
There are two main types of ways to think about things like $\mathrm{d}x\mathrm{d}y$ in multivariable calculus, and we often switch between them depending on the context. (This clarification was inspired in part by Terry Tao's preprint on "differential forms and integration".) $\mathrm{d}x$ can either act kind of like a number, or act kind of like a vector.
For the "number" interpretation, there are things like limit arguments or infinitesimals in nonstandard analysis to make things rigorous. For the "vector" interpretation, there are things like "differential forms" or "geometric calculus" to make things rigorous. But I'm going to gloss over those details because there are many ways to make things formal, and the exact choices don't affect the intuition here.
Numbers
One way to think about things is that $\mathrm{d}x$ and $\mathrm{d}y$ are in some way like tiny positive numbers representing the width and length of a tiny rectangle, so that $\mathrm{d}x\mathrm{d}y$ is the area of a tiny rectangle. Then when we write something like $\iint f\left(x,y\right)\,\mathrm{d}x\mathrm{d}y$ or $\iint g\left(r,\theta\right)\,\mathrm{d}r\mathrm{d}\theta$, we just add up the signed volumes (in case $f$ or $g$ is negative) of thin rectangular prisms with cross-sectional area represented by $\mathrm{d}x\mathrm{d}y$ or $\mathrm{d}r\mathrm{d}\theta$.
Under this interpretation, $\mathrm{d}x=\mathrm d(r\cos\theta)=\cos\theta\mathrm{d}r-r\sin\theta\mathrm{d}\theta$ doesn't make too much sense. For example, if $\theta=\pi/2$, then we would have $\mathrm{d}x=-r\mathrm{d}\theta$, so that $\mathrm{d}\theta$ and $\mathrm{d}x$ couldn't both represent positive lengths. But we can still understand the relationship between the areas $\mathrm{d}x\mathrm{d}y$ and $\mathrm{d}r\mathrm{d}\theta$ with arguments like the geometric one in this answer by Mike Spivey.
Vectors
The other way to think about things is that $\mathrm{d}x$ and $\mathrm{d}y$ are in some way like tiny vectors whose direction we care about, and this leads to a slightly different discussion. To emphasize this vector idea, I will use some nonstandard notation. Let's write $\overrightarrow{\mathrm{d}x}=\left\langle \Delta x,0,0\right\rangle$  for some positive $\Delta x$, and $\overrightarrow{\mathrm{d}y}=\left\langle 0,\Delta y,0\right\rangle$  for some positive $\Delta y$. So $\overrightarrow{\mathrm{d}x}$ points to the right in the $xy$-plane and $\overrightarrow{\mathrm{d}y}$ points "up" in the $xy$-plane. Then the area of the little rectangle they make is $\left\Vert \overrightarrow{\mathrm{d}x}\times\overrightarrow{\mathrm{d}y}\right\Vert =\Delta x\Delta y$.
However, now that we have vectors, we could choose to care about the orientation. When we think about a usual integral like $\int_{\left[a,b\right]}f\left(x\right)\,\mathrm{d}x$ when $f$ is negative, we decide to count that area in a negative way. Similarly, we could count the "signed area" of the oriented rectangle with sides $\overrightarrow{\mathrm{d}x},\overrightarrow{\mathrm{d}y}$ as the positive value $\Delta x\Delta y$ (which is just the $z$-component of $\overrightarrow{\mathrm{d}x}\times\overrightarrow{\mathrm{d}y}$). But the signed area of the oriented rectangle with sides $\overrightarrow{\mathrm{d}y},\overrightarrow{\mathrm{d}x}$ would be the negative value $-\Delta x\Delta y$ (which is just the $z$-component of $\overrightarrow{\mathrm{d}y}\times\overrightarrow{\mathrm{d}x}$).
Then when we write something like $\iint f\left(x,y\right)\,\mathrm{d}x\mathrm{d}y$ or $\iint g\left(r,\theta\right)\,\mathrm{d}r\mathrm{d}\theta$, we could (if we chose) care about the order of things, with something like an implied $\overrightarrow{\mathrm{d}x}\times\overrightarrow{\mathrm{d}y}$ or $\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}$ in our heads, if not always our notation.
When using things like vectors, then something like $\overrightarrow{\mathrm{d}x}=\cos\theta\overrightarrow{\mathrm{d}r}-r\sin\theta\overrightarrow{\mathrm{d}\theta}$ makes a lot of sense. $\overrightarrow{\mathrm{d}r}$ points away from the origin, and $\overrightarrow{\mathrm{d}\theta}$ points perpendicularly to $\overrightarrow{\mathrm{d}r}$ in the counterclockwise way (so that $\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}$ points in the same positive-$z$ direction as $\overrightarrow{\mathrm{d}x}\times\overrightarrow{\mathrm{d}y}$).
Finally, we can correct your calculation:
$$\overrightarrow{\mathrm{d}x}\times\overrightarrow{\mathrm{d}y}=\left(\cos\theta\overrightarrow{\mathrm{d}r}-r\sin\theta\overrightarrow{\mathrm{d}\theta}\right)\times\left(\sin\theta\overrightarrow{\mathrm{d}r}+r\cos\theta\overrightarrow{\mathrm{d}\theta}\right)$$
$$=\cos\theta\sin\theta\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}r}-r^{2}\sin\theta\cos\theta\overrightarrow{\mathrm{d}\theta}\times\overrightarrow{\mathrm{d}\theta}+r\cos^{2}\theta\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}-r\sin^{2}\theta\overrightarrow{\mathrm{d}\theta}\times\overrightarrow{\mathrm{d}r}$$
$$=\overrightarrow{0}-\overrightarrow{0}+r\cos^{2}\theta\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}-r\sin^{2}\theta\left(-\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}\right)=\boxed{r\,\overrightarrow{\mathrm{d}r}\times\overrightarrow{\mathrm{d}\theta}}$$

A: My understanding of this is that in integration the area element which we denote $dA = dxdy$ is in fact a differential form as Miguel mentioned. A differential 2-form measures a certain amount of area, and is made up of differential 1-forms (which measure length) through the wedge product $\wedge$. The wedge product provides natural measures for a space through what's called the exterior algebra of the space. For example, given two vectors $\vec{a}$ and $\vec{b}$ the area of the parallelopiped they span is given by the scalar part of $\vec{a}\wedge \vec{b}$.
That is, when integrating over an oriented surface the area 2-form is $dA = dx\wedge dy.$ Because it describes oriented areas the wedge product is anticommutative, i.e. $dx\wedge dy = -dy\wedge dx$. Then when changing variables, you encounter the quadratic forms $d\theta d\theta$ for example. Interpreting the differentials here as measures (like in differential geometry), when you substitute your change of variables into $dx\wedge dy$ (called a pull-back if you want to get fancy), the terms with repeated differential 1-forms must vanish: $$d\theta \wedge d\theta = -d\theta\wedge d\theta = 0.$$
Differential forms in integration should be distinguished from Riemannian notation like $ds^2$, which really denotes a tensor product. A good elementary book on differential forms is "Differential Forms: Theory and Practice" by Weintraub. Also check out the page on exterior algebra on Wikipedia.

A: The change of variables transforms a small rectangular region $R$ with sides $\Delta x$ and $\Delta y$ in a region $R'$, which is not necessarily rectangular, so an area of $R'$ can differ from a product $\Delta r\cdot\Delta\theta$ of its "dimensions" $\Delta r$ and $\Delta\theta$.
For the case of polar coordinates, $R'$ is bounded by circles of radii $r$ and $r+\Delta r$ and radial lines directed from the origin at angles $\theta$ and $\theta+\Delta\theta $, so the area of $R'$ equals $$\frac 12\Delta\theta((r+\Delta r)^2-r^2)= r\Delta r\Delta\theta+\frac 12(\Delta r)^2\Delta\theta.$$


text:
Q: How to create a workflow app on Sharepoint I'm looking to create a workflow app on Sharepoint. Basically at the top level there's a list of projects. When you click on a project, a list of states is displayed (dev/qa/staging/prod) etc...when a developer finishes their task, they will change the state to QA, and the QA team needs to get a notification.
Is this possible to accomplish in Sharepoint 2007 without any custom webparts?   If not, what's the best way to approach this?
Thanks.

A: SharePoint 2007 supports creation of workflows out of the box MOSS 2007 adds more features on top of basic functionality provided and 2010 versions provide more inprovments.
Check out http://msdn.microsoft.com/en-us/library/bb386168(v=VS.90).aspx or http://msdn.microsoft.com/en-us/library/bb386211.aspx to get statred.
Search for "SharePoint workflow" on your favorite search engine for more information.

A: I was able to do what I wanted to do using SharePoint Designer which is a free download.


text:
Q: Find in list in Django. Find single column class A (models.Model):
name = models.charfield(max_length=200);
study = models.ForeignKey(Study);
b = models.CharField(max_length=200);

def__unicode__(self)
return "%s (%s)" % (self.name, self.id);

In my template i want to show the data from query
select name from A where id = 70.

I have the list for my template loaded, everything else works, but i can't get that name.
Any ideas?

A: Queries are assembled in the view, not the template.
A.objects.filter(id=70).values_list('name')
A.objects.get(id=70).name

A: Q = A.objects.get(pk=70)
Q.name

More details about Django Querys


text:
Q: Override Magento UI js file How can I override this file on my theme?
/vendor/magento/module-ui/view/frontend/web/js/view/messages.js

I'm a newbie to M2

A: In your custom module [Namespace]/[Module]/view/frontend/requirejs-config.js add this
var config = {
    map: {
        '*': {
            'Magento_Ui/Magento_Ui/js/view/messages.js':'[Namespace]_[Module]/js/view/messages.js'
        }
    }
};

your overridden js file should be here [Namespace]_[Module]/view/frontend/web/js/view/messages.js
run below command:

php bin/magento setup:upgrade && php bin/magento setup:static-content:deploy -f

read more here: Extending / Overriding JS in Magento 2


text:
Q: github merging branch into fork before pulled into origin/master So I have created a fork of Repo 1. My fork (Repo 1 Fork) has a branch (patch-1). I have filed a pull request to Repo 1. It is waiting to be merged.
Can I merge patch-1 into Repo 1 Fork?
Also, I want to create patch-2, is it best to create a new branch on Repo 1 Fork master?

A: you can merge commit patch1 it into a fork of repo1 (lets call it fork1). as soon as patch1 is merged into repo1 and you pull from repo1 to fork1 you will get another non-fast-forward-merge (probably), but it does automerge without conflicts when you merge a commit into a branch that you already have there.
if you want to code on another feature, it is reasonable to create another feature-branch (patch2) and it is reasonable to base it on upstream master.

A: Merge operations cannot be applied to repositories. They can only be applied to specific branches.
I assume that

Can I merge patch-1 into Repo-1-Fork?

means

Can I merge my local path-1 branch (residing in Repo-1-Fork) into my local master branch (also residing in Repo-1-Fork)?

Yes, you can. But before that, think about what suits your needs. You may want to be able to create patch-2, patch-3, etc. branches, and you may want for each of these branches to have an individual feature. If this is the case, it may be useful to not merge in order to keep your local master branch in sync with the Repo-1 master branch.
Then if you want you can create a developer branch in your local Repo-1-Fork in which you can merge all patch-1, patch-2, etc. branches so you have a version with all the intended features.
If you merge patch-1 into your local Repo-1-Fork master after all, then remember to create new single-feature branches from the remote Repo-1 master rather than from your own. Otherwise patch-2 will have both patch-1 commits and the new ones that you add to it, and you won't be able to submit a single-feature pull request from patch-2.