text:
Q: Text Classification using Decision Trees in Python I am new to Python as well as machine learning. My implementation is based on the IEEE research paper http://ieeexplore.ieee.org/document/7320414/ (Bug report, feature request, or simply praise? On automatically classifying app reviews)
I want to classify text into categories. The text is user reviews from google play store or apple app store. The categories used in the research were Bug, Feature, User Experience, Rating. Given this situation, I am trying to implement a decision tree using sklearn package in python. I came across an example data set provided by sklearn 'IRIS', which builds a tree model using the features and their values mapped to the target. In this example, it is numeric data.
I am trying to classify text instead of numeric data. Examples:

*

*I liked very much the upgrade to pdfs. However, they aren't displaying anymore Fix it and it will be perfect [BUG]

*I just wish it would notify me if I go below a certain dollar amount [FEATURE]

*This app is very helpful in my line of business [Rating]

*Easy to find songs and purchase in iTunes [UserExperience]
Given these texts and lot more user reviews of these categories, I want to create a classifier that can train using the data and predict the target of any given user reviews.
So far I have pre-processed the text and created training data in the form of list of tuples that contains the pre-processed data and its target.
My Pre-processing:

*

*Tokenize multi-line comments to into single sentences

*Tokenize each sentence into words

*Remove stop words in the tokenized sentence

*Lemmatize the words in the tokenized sentence

(['i', 'liked', 'much', 'upgrade', 'pdfs', 'however', 'displaying', 'anymore', 'fix', 'perfect'], "BUG")
Here's what I have so far:
import json
from sklearn import tree
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import sent_tokenize, RegexpTokenizer

# define a tokenizer to tokenize sentences and also remove punctuation
tokenizer = RegexpTokenizer(r'\w+')

# this list stores all the training data along with it's label
tagged_tokenized_comments_corpus = []

# Method: to add data to training set
# Parameter: Tuple in the format (Data, Label)
def tag_tokenized_comments_corpus(*tuple_data):
tagged_tokenized_comments_corpus.append(tuple_data)

# step 1: Load all the stop words from the nltk package
stop_words = stopwords.words("english")
stop_words.remove('not')

# creating a temporary list to copy the existing stop words
temp_stop_words = stop_words

for word in temp_stop_words:
if "n't" in word:
    stop_words.remove(word)

# load the data set
files = ["Bug.txt", "Feature.txt", "Rating.txt", "UserExperience.txt"]

d = {"Bug": 0, "Feature": 1, "Rating": 2, "UserExperience": 3}

for file in files:
input_file = open(file, "r")
file_text = input_file.read()
json_content = json.loads(file_text)

# step 3: Tokenize multi sentence into single sentences from the user comments
comments_corpus = []
for i in range(len(json_content)):
    comments = json_content[i]['comment']
    if len(sent_tokenize(comments)) > 1:
        for comment in sent_tokenize(comments):
            comments_corpus.append(comment)
    else:
        comments_corpus.append(comments)

# step 4: Tokenize each sentence, remove stop words and lemmatize the comments corpus
lemmatizer = WordNetLemmatizer()
tokenized_comments_corpus = []
for i in range(len(comments_corpus)):
    words = tokenizer.tokenize(comments_corpus[i])
    tokenized_sentence = []
    for w in words:
        if w not in stop_words:
            tokenized_sentence.append(lemmatizer.lemmatize(w.lower()))
    if tokenized_sentence:
        tokenized_comments_corpus.append(tokenized_sentence)
        tag_tokenized_comments_corpus(tokenized_sentence, d[input_file.name.split(".")[0]])

# step 5: Create a dictionary of words from the tokenized comments corpus
unique_words = []
for sentence in tagged_tokenized_comments_corpus:
for word in sentence[0]:
    unique_words.append(word)
unique_words = set(unique_words)

dictionary = {}
i = 0
for dict_word in unique_words:

dictionary.update({i, dict_word})
i = i + 1

train_target = []
train_data = []
for sentence in tagged_tokenized_comments_corpus:
train_target.append(sentence[0])
train_data.append(sentence[1])

clf = tree.DecisionTreeClassifier()
clf.fit(train_data, train_target)

test_data = "Beautiful Keep it up.. this far is the most usable app editor..
it makes my photos more beautiful and alive.."

test_words = tokenizer.tokenize(test_data)
test_tokenized_sentence = []
for test_word in test_words:
    if test_word not in stop_words:
     test_tokenized_sentence.append(lemmatizer.lemmatize(test_word.lower()))

#predict using the classifier
print("predicting the labels: ")
print(clf.predict(test_tokenized_sentence))

However, This doesn't seem to work since it throws an error during run time when we train the algorithm. I was thinking If I can map the words in the tuple to the dictionary and convert the text into numeric form and train the algorithm. But I am not sure if this may work.
Can anyone suggest how can I fix this code? Or if there is any better way to implement this decision tree.
Traceback (most recent call last):
  File "C:/Users/venka/Documents/GitHub/RE-18/Test.py", line 87, in <module>
clf.fit(train_data, train_target)
  File "C:\Users\venka\Anaconda3\lib\site-packages\sklearn\tree\tree.py", line 790, in fit
X_idx_sorted=X_idx_sorted)
 File "C:\Users\venka\Anaconda3\lib\site-packages\sklearn\tree\tree.py", line 116, in fit
X = check_array(X, dtype=DTYPE, accept_sparse="csc")
File "C:\Users\venka\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 441, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[ 0.  0.  0. ...,  3.  3.  3.].
Reshape your data either using array.reshape(-1, 1) if your data has a
single feature or array.reshape(1, -1) if it contains a single sample.

A: Decision trees can only work when your feature vectors are all the same length. Personally I've got no clue as to how effective Decision Trees would be at text analysis like this, but if you're to try and go for it, the way I'd suggest is a "one-hot" "bag of words" style vector.
Essentially, keep tag of how many times words appear in your example, and put them in a vector that represents the whole corpus. Say, once you removed all the stop-words the set of the entire corpus was:
{"Apple", "Banana", "Cherry", "Date", "Eggplant"}

You represent this by a vector the same size as the corpus, with each value representing whether or not the word appears. In our example, a 5 length vector where the first element is associated with "Apple", the second with "Banana" and so on. You might get something like:
bag("Apple Banana Date")
#: [1, 1, 0, 1, 0]
bag("Cherry")
#: [0, 0, 1, 0, 0]
bag("Date Eggplant Banana Banana")
#: [0, 1, 0, 1, 1]
# For this case, I have no clue if Banana having the value 2 would improve results.
# It might. It might not. Something you'd need to test.

This way, you have the same sized vector regardless of the input, and the decision tree knows where to look for certain outputs. Say "Banana" corresponds strongly to bug reports, in which case the decision tree will know that a 1 in the second element means a bug report is more likely.
Of course, your corpus might be thousands of words long. In that case, your decision tree probably won't be the best tool for the job. Not unless you first take some time to trim down your features.


text:
Q: uicollectionview crashing rotating iPad fast I usually don't ask for help but this time I really need it.
I have an UICollectionViewinto an UIViewController. I have tried using default UICollectionViewFlowLayout or subclassing it trying to solve this annoying problem.
When I started to rotate the app so fast (from portrait to landscape and going back to portrait) I'm getting this errors:
*** Assertion failure in -[UICollectionViewData validateLayoutInRect:], /SourceCache/UIKit/UIKit-2935.138/UICollectionViewData.m:357

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView recieved layout attributes for a cell with an index path that does not exist:  {length = 2, path = 2 - 4}'

What I have tried:

*

*Under viewWillLayoutSubviews I have tried with [self.collectionView reloadData]; or [self.collectionView.collectionViewLayout invalidateLayout];

*setting [UIView setAnimationEnabled: NO]; in willRotateToInterfaceOrientation setting [UIView setAnimationEnabled: YES]; in didRotateToInterfaceOrientation

*Tried what I found in this link UICollectionView assertion error on stale data

Digging about similar problems I found those 3 but none of them is what I'm looking for:

*

*Crash when reloading collectionView frequently

*UICollectionView performBatchUpdates cause collectionview misplace while rotating the device

*UICollectionView recieved layout attributes for a cell with an index path that does not exist
All the data is downloaded before show theUICollectionView and I'm using cell created in XIB.
I guess it's about spamming invalidateLayout because the UICollectionView has not finished the last "layout process" when the app is calling invalidateLayout again... but I'm not sure.

A: It's been a long time since I posted this question, but I had to come back to the project in where I was using this code and I found that the problem was solved for Apple in iOS release 8.3.
Details: link

Orientation and rotation fixes
  * Addresses an issue that sometimes prevented rotating back to portrait after having rotated to landscape
  * Improves performance and stability issues that occurred when rotating the device between portrait and landscape

I tested it in 2 devices and is working perfectly

redpajama_set_name: RedPajamaStackExchange


text:
Q: Can't get my head around creating unambiguous grammar for if else This is from a tutorial our professor wrote and I can't get my head around it. I can come up with derivation but I can't come up with grammar by just analyzing the derivation.
What does "matched" refer to in this context?
Can you explain how matched_if, matched_stmt, unmatched_if works in simple words :) ?
The following is an unambiguous grammar for the problem:

stmt → if_stmt | nonif_stmt
if_stmt → matched_if | unmatched_if
matched_if → 'if' logical_expr 'then' matched_stmt 'else' matched_stmt
matched_stmt → mathced_if | nonif_stmt
unmatched_if → 'if' logical_expr 'then' stmt
 | 'if' logical_expr 'then' matched_stmt 'else' unmatched_if
logical_expr → id '==' lit
nonif_stmt → assgn_stmt
assgn_stmt → id '=' expr
expr → expr '+' term | term
term → '(' expr ')' | id
id → 'A' | 'B' | 'C'
lit → '0' | '1' | '2'

Consider the following input:
if A == 0 then
  if B == 1 then
    C = A + B
  else
    B = C

Let us do a leftmost derivation for the input:

stmt
=> if_stmt
=> unmatched_if
=> 'if' logical_expr 'then' stmt
=> 'if' id '==' lit 'then' stmt
=> 'if' 'A' '==' lit 'then' stmt
=> 'if' 'A' '==' '0' 'then' stmt
=> 'if' 'A' '==' '0' 'then' if_stmt
=> 'if' 'A' '==' '0' 'then' matched_if
=> 'if' 'A' '==' '0' 'then' 'if' logical_expr 'then' matched_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' id '==' lit 'then' matched_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' lit 'then' matched_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' matched_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' nonif_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' assgn_stmt 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' id '=' expr 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' expr '+' term 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' term '+' term 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' id '+' term 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + term 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' matched_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' nonif_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' assgn_stmt
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' id '=' expr
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' 'B' '=' expr
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' 'B' '=' term
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' 'B' '=' id
=> 'if' 'A' '==' '0' 'then' 'if' 'B' '==' '1' 'then' 'C' '=' 'A' + 'B' 'else' 'B' '=' 'C'

A: "Matched" means that every then is matched with an else.
It's not necessary for an if statement to have a matching else, but if it doesn't, it cannot be inside an matched if statement, because that would imply that some else matches an outer then instead of an inner then).
All the grammar does is formalize the above.
A similar problem is writing a grammar for ordinary arithmetic expressions with the additional rule that you can leave out trailing close parentheses. (So you could write (1+2*(1+2*(1+2, for example.) That language is clearly unambiguous, but when you are writing the grammar for it, you need to deal with unmatched parentheses and thus expressions containing unmatched parentheses. That's the same use of the word "matched"· (and the solution would be somewhat similar).


text:
Q: Inner functions of Nic As packet arrives Nic detect it on its interface like wire/air and than packet is kept in Rx FIFO the on chip memory for further processing like offloading and determining it belong to it after everything using DMA and it's descriptor packet is transmitted to host memory and interrupt is done than kernel manages it.
I understand deeply the code and architecture about how kernel manages packet as have workes on Linux kernel source code.
But the only problem i suffer with is NIC i searched a lot tried to read many books but not got what I wanted to know
That after arriving on wire which is first place where packet stream is kept is it RX FIFO or something else.
Than the details about its every minute processing that it does during working on a particular packet
As it have on chip DMA descriptor as it fetches it from host memory how it allocate packet to particular descriptor
Or leave the above questions as i know some of you will not get it only help i want is to know every minute processing undergoes by NIC from when packet arrives on interface to putting it into host memory can anyone broadly explain it here not in summarised way or suggest link of some webpages/book where I can get what I want
I already posted it on many forums but really the webpages/book i got either told about specification of particular network adapter or summary of Nic processing or about interface between kernel/Host Cpu and Nic


text:
Q: How to fix material angular css issue In my application material, angular CSS is not loaded properly. I have installed the required module but, I do not know why it is not loading the material CSS in stackblitz. If anyone knows please help to fix this issue.
Angular material application: https://stackblitz.com/edit/angular-ivy-1mgagj?file=src%2Fapp%2Fapp.component.ts


text:
Q: How to get turn by turn or destination from google maps app? How do apps such as
https://play.google.com/store/apps/details?id=com.headupnav.demo
get turn and destination info?
I want the user to use google maps app, and for my app to run in the background but know distance to the next turn, and where the final destination is.
Others do it, but I cannot understand how they are using the api (or which one)
https://developers.google.com/maps/documentation/api-picker
 to accomplish the same task?
Please Advise

A: As far as Google Direction API goes, it is a breach of privacy policies to develop these sort of apps.
As per the documentation goes:
No navigation. You will not use the Service or Content for or in connection with (a) real-time navigation or route guidance; or (b) automatic or autonomous vehicle control.
Also Google does not provide any sort of open source API for developers to build turn by turn navigation. The app developers might have designed there own navigation system which is not coming out well as far as the reviews goes.


text:
Q: Messaging system. Question about database design I'm designing a messaging system that will have to support a huge amount of messages and users.
I was thinking about two solutions.
Usertable -> id, username ....
Messagetable -> id, from_id, to_id, message ...

Or:
Usertable -> id, username ....
Messagetable -> id, message ...
HasMessagetable -> id, from_id, to_id...

I'm wondering what is the best approach to this and why.
Also, are there good publications (free or not) about large databases design and best practices?
Thank you

A: In general, the less joins you have to do, the better your queries will perform.  Therefore, the first option will probably be a better choice since you are going to have a very large database.
Basically, you are going to need to ignore some database normalization techniques in order to gain the performance you need.  However, try not to limit yourself either.  For example, if you have messages that go to multiple people, you are going to need to either choose option two or figure out a different way to handle this.
As for resources for large database design, here is one for Microsoft SQL Server but a lot of the things it discusses will apply:
http://sqlcat.com/

A: Your second schema is more normalized.  Both are acceptable.  Properly normalized database design is cleaner, but for perfomance reasons many DBA resort to denormalisation. I would use the second schema, until you hit performance issues this would be the better approach in my very humble opinion.
Do note that normalising to that extent is often considered overkill by many, as others have posted. I do it that way from habit and old (now outdated) DB theory courses I learned 12 years ago.
Happy-coding

A: I did the same not too long ago and started out with approach 1. But then users were supposed to be able to send messages to multiple users. Suddenly approach 1 saved each message n times if n recipients were addressed. So if this is ever a possibility, I think 2 is better.


text:
Q: Is there always a toric isomorphism between isomorphic toric varieties? Suppose two toric varieties are isomorphic as abstract varieties. Does it follow that there exists a toric isomorphism between them?

Edit: the comments below lead me to believe that I'm using the terms "toric variety" and "toric morphism" in a non-standard way, so let me clarify. Here are the definitions I have in mind.
Definition: A toric variety is a normal variety $X$ together with (1) a dense open subvariety $T\subseteq X$, and (2) a group structure on $T$ making it a torus, such that the action of $T$ on itself extends to an action on $X$. (Note: I do not include the data of an isomorphism between $T$ and $\mathbb G_m^{\dim X}$, but only require that such an isomorphism exists.)
Definition: If $(X,T_X)$ and $(Y,T_Y)$ are toric varieties (group structures on $T_X$ and $T_Y$ implicit), a toric morphism between them is a morphism $f:X\to Y$ which restricts to a group homomorphism $f|_{T_X}:T_X\to T_Y$.

A: This is a partial answer.  Let $X$ be the given abstract variety.  I think the question is equivalent to asking whether all maximal tori in the group $\mathrm{Aut}(X)$ are conjugate.  When $X$ is complete, this is a linear algebraic group, so all maximal tori are conjugate, and the answer is affirmative.  (See Cox's famous paper on the homogeneous coordinate ring.)
If $X$ is not complete, the automorphism group may of course be infinite-dimensional, but perhaps you can argue by compactifying.

A: I'm pretty sure the answer is yes, and that the proof will use Cox rings. However, I haven't been able to find references for all the facts about Cox rings I want, so I'll leave this as CW and hope someone else fills in the gaps.
Let $\Sigma$ and $\Sigma'$ be two fans, and $X$ and $X'$ the corresponding toric varieties, with $X \cong X'$. For simplicity, I'll assume that the unit groups of $X$ and $X'$ are both trivial (i.e. equal to $k^*$). This is equivalent to assuming that $\Sigma$ (respectively $\Sigma'$) is not contained in a hyperplane.
Let $H$ be the class group of $X$ (Weil divisors modulo principal divisors). Let $G$ be the character group $\mathrm{Hom}(H, \mathbb{G}_m)$. Cox's construction gives: A variety $Y$; an action of $G$ on $Y$; a $G$-invariant open subspace $U$; and a map $U \to X$ which makes $X$ into the categorical quotient $U/G$. This is sometimes called the universal torsor of $X$, although it is only a torsor when $X$ is smooth (earlier false statement corrected).
To help get you oriented, if $X = \mathbb{P}^2$, then $H = \mathbb{Z}$, $G = \mathbb{G}_m$, $Y= \mathbb{A}^3$ and $U$ is the complement of the origin in $Y$.

There are two ways to think about this construction. The one I understand well is the one from Cox's original paper. Let $\rho_1$, ..., $\rho_N$ be the rays of $\Sigma$. Let $Y = \mathbb{A}^N$. Each ray represents a class in $H$, and hence a character of $G$. Let $G$ acts on the $i$-th coordinate of $Y$ by the character of $G$ corresponding to $\rho_i$. Let $(y_1, \ldots, y_N)$ be a point of $Y$. Let $i_1$, \ldots, $i_k$ be the coordiantes for which $y_{i_j} =0$. Then $(y_1, \ldots, y_N)$ is in $U$ if and only if there is a cone of $\Sigma$ containing the rays $\rho_{i_1}$, ..., $\rho_{i_k}$. I'll cite you to Cox's paper for the map $U \to X$.

That contsruction is very explicit, but it uses the fan. There is a more abstract construction, which I don't understand as well, which works for any normal variety and does not use the torus action. Specifically, for every $h \in H$, choose a specific Weil divisor $D(h)$ representing $h$. For any $h_1$ and $h_2$, choose a rational function $u(h_1, h_2)$ with divisor $D(h_1+h_2) - D(h_1) - D(h_2)$, subject to conditions to be named later.
Define the ring
$$R := \bigoplus_{h \in H} H^0(X, \mathcal{O}(D(h)))$$
with multiplication $H^0(X, \mathcal{O}(D(h_1))) \times H^0(X, \mathcal{O}(D(h_2))) \to H^0(X, \mathcal{O}(D(h_1 + h_2)))$ given by $f_1 \times f_2 = f_1 f_2 u(h_1, h_2)$. My understanding is that (1) it is always possible to choose the $u$'s such that this is a commutative and associative ring and (2) $R$ is independent of these choices, up to nonunique isomorphism. However, you should check these claims before using them.
We set $Y = \mathrm{Spec} \ R$. This comes with an obvious action of $G$, where $G$ acts on $H^0(X, \mathcal{O}(D(h)))$ by the character $h$. I am not sure how to define $U$ or the map $U \to X$, but I think there is a way. Note that none of this uses the torus action.

Now, let $(\Sigma, X)$ and $(\Sigma', X')$ be as above, and let $(Y, G, U, U \to X)$ and $(Y', G', U', U' \to X')$ be the results of the above constructions. If I am right that the Cox construction is sufficiently natural, then there should be isomorphisms $Y \cong Y'$ and $U \cong U'$, making the obvious diagrams commute. (Note that the construction of $G$ is intrinsic, so we definitely have $G \cong G'$.)
From the first description of the Cox ring, we see that $Y \cong Y' \cong \mathbb{A}^N$, so that $\Sigma$ and $\Sigma'$ both have $N$ rays.
A priori, we have $Y \cong Y'$ as $G$-varieties, and we know that each of $Y$ and $Y'$ can be identified with $\mathbb{A}^N$ so that the $G$-action becomes linear. My next claim is that the two representations of $G$ are isomorphic; i.e., we can arrange that the composition $\mathbb{A}^n \cong Y \cong Y' \cong \mathbb{A}^N$ is linear. Proof: Find a point $y$ in $Y$, fixed by the $G$-action. There is at least one such point, because the origin is fixed. Let $\phi: Y \to Y'$ be any $G$-equivariant isomorphism. Then the $G$-action on $Y$ is isomorphic to the $G$-action on the tangent space $T_y Y$, and the $G$-action on $Y'$ is isomorphic to the $G$-action on $T_{\phi(y)} Y'$. But the differential $D \phi : T_y Y \to T_{\phi(y)} Y'$ gives a linear isomorphism between the tangent spaces. Transporting structure, we have the claim.
So, $G$ acts on $Y$ and on $Y'$ by the same characters. This means that $\Sigma$ and $\Sigma'$ have the same rays. Now, looking at the combinatorics of $Y \setminus U$ and $Y' \setminus U'$, you should be able to read off the corresponding fans.

A: I don't know if you are still interested in a reference for this, but I recently found that this is proved in section 4 of "Lifting of morphisms to quotient presentations" by F. Berchtold. The proof uses the Cox construction and it seems to me that the argument is the one that David suggested above, but I am not done reading the paper. I hope this helps.


text:
Q: How to use one view, in two ASP.NET MVC areas? I have an ASP.NET MVC application, and in it, I have set up two areas. However, there is one view that I have implemented in Area A, but I also need to use it in Area B. How can I render it in Area B? I mean, Html.RenderPartial method takes the name of the view as the input parameter. But how it's gonna know which view do I mean? In other words, if my view's name is Countries, and I want to write Html.RenderPartial("Countries") in Area B, how ASP.NET MVC knows that I'm talking about a view which belongs to Area A?

A: You can place that partial view in Shared folder inside Views folder(the views folder in the project directory, not area). ASP.NET MVC will check that place and you wouldn't need to define any path. You can use Html.RenderPartial("SomePartial"); in your view.


text:
Q: How can I specify a custom reset password URL for Auth0 Lock iOS SDK? I'm trying to specify a custom reset password URL using the Auth0 Lock iOS SDK.
This is easy to do using the web SDK, it's just a configuration parameter passed into the Auth0Lock constructor as options (docs here).
However, I'm struggling to find anything similar on the iOS SDK.
Short of hacking Auth0 classes in the iOS SDK, how can I do this?

A: According to the documentation there is no support to customize Lock for iOS in the way you describe. It's possible do hide the default reset password functionality, but if you need to go beyond that it seems you'll need to provide your own custom UI.
Reference: Lock iOS: Password Reset


text:
Q: Wake-up PIC with USART RX
I'm working with eXtreme Low Power (XLP) Microcontroller PIC 16LF1933.
For it to consume little battery, I put it to sleep until it receives a Break character (00h) in RX. The documentation explains well how to set the Auto-Wake-up with Break character in RX. I followed it.
I'm using Proteus to simulate the project, with Virtual Terminal to send information. If you press CTRL + SHIFT + @ it sends de 00h (null/ all 0's), so, this would wake up the PIC, as said in documentation.
The problem is, when I do this, I receive a warning log saying that
Wake up event is only 937.500003us wide. Minimum (at current baudrate) expected is 6.656ms. I'm using 9600 baudrate.
How do I make a proper Wake up event with RX?
My while code
while (1) {
    BAUDCONbits.WUE = 1;    //Wake-up Enable
    SLEEP();

    while (BAUDCONbits.WUE);

    msg = Receive_Serial(); //Clear RCIF
    __delay_ms(100);
    msg = '\0';             //Discard
    __delay_ms(100);
    msg = Receive_Serial(); //Receive the next character
    __delay_ms(100);
    RCREG = 0;
    msg = '\0';
    __delay_ms(100);
}

And my Receive function
unsigned char Receive_Serial() {
    if (OERR) {                 //Overrun error
        RCSTAbits.CREN = 0;     //Fix reset Enable Receive
        RCSTAbits.CREN = 1;
    }

    while (!RCIF);

    return RCREG;
}

A: The warning message you get is simply due to the fact that a null character (00h) is NOT a break condition.
Your pic code may be fine but the dev tool is not generating the correct test data.
Long long ago, I was once desperate to send a break to wake up a piece of dormant equipment and needed to send it a break. My terminal could not send one. I had to get this working so a quick hack was to send a null character with the terminal set to a lower baud rate, and switch back to the correct baud rate.


text:
Q: Comparing two koalas dataframes for testing purposes Pandas has a testing module that includes assert_frames_equal. Does Koalas have anything similar?
I am writing tests on a whole set of transformations to koalas dataframes. At first, since my test csv files have only a few (<10) rows, I thought about just using pandas. Unfortunately, the files are quite wide (close to 200 columns) and have a variety of data types that are specified when spark reads the files. Since the type specification is very different for pandas than it is for koalas, I would have to write a whole ~200 list of dtypes, in addition to the type schema we already wrote for spark. Which is why we decided it would be more efficient to use spark and koalas to create the dataframes for the tests. But then, I can't find in the docs a way to compare the dataframes to see if the result of the transformations is the same as the expected one we created.

A: I ended up using this:
assert_frames_equal(kdf1.to_pandas(), kdf2.to_pandas())

This works, and I think it is okay because the data frames are "small." I wonder if the reason nothing like this has been implemented natively in koalas is because the main use of such an assertion would be in tests, and the tests should be small data frames anyway.


text:
Q: how to open chatbot automally when the page loaded I have embedded one chatbot in my website from third-party sites it is working properly. but, I want a chatbot which opens automatically, when the web page is loaded.
I have used this below code
  <script type="text/javascript">
    ! function(t, e) {
        "use strict";
        var r = function(t) {
            try {
                var r = e.head || e.getElementsByTagName("head")[0],
                    a = e.createElement("script");
                a.setAttribute("type", "text/javascript"), a.setAttribute("src", t), r.appendChild(a)
            } catch (t) {}
        };
        t.CollectId = "234567ertyusd3456", r("https://s3.amazonaws.com/collectchat/launcher.js")
    }(window, document);
</script>

can anyone suggest me a solution
Thanks in Advance

A: I see that you are using Collect.chat to embed chatbot on your website. Here are two options you can try.
If you want to open chatbot immediately without any delay, add the following line of code inside the script
var CollectAlwaysOpen = true;

Instead, if you want a small delay after the user enters your website, You can set the delay from 'Settings > User targeting' page in Collect.chat's  dashboard


text:
Q: how to order wordpress search by meta key values? During search in 2 meta key( say acf hr_archive_title and acf hr_archive_question ), I want to list down post in following order.

*

*first preference is post with searched text found in hr_archive_title

*then posts with searched text found in hr_archive_question

example data1: hr_archive_title - HR-fråga 1432 - Rekryteringsbonus; hr_archive_question - lorem ipsum
example data2: hr_archive_title - HR-fråga 1223 - Rekryteringskonsult i Norge - Rekryteringsbonus; hr_archive_question - Har det påverkat er rekryteringsprocess på något vis?
example data3: hr_archive_title - HR-fråga 1167 - Linkedin Recruiter; hr_archive_question - Har det påverkat er rekryteringsprocess på något vis?
Now when I search for 'Rekrytering' the listing should be as data1, data2, data3. Is this possible? Itried the following but to no avail. The listing is coming as mixed list.
Display results of one meta key and order by a different meta key
https://www.billerickson.net/wp-query-sort-by-meta/
https://wordpress.stackexchange.com/questions/218709/order-by-custom-field-value
Any help/suggestions are welcome.

A: You can try something like:
$q = new WP_Query( array(
    'meta_query' => array(
        'relation' => 'AND',
        'title_clause' => array(
            'key' => 'hr_archive_title',
            'compare' => 'EXISTS',
        ),
        'question_clause' => array(
            'key' => 'hr_archive_question',
            'compare' => 'EXISTS',
        ),
    ),
    'orderby' => 'title_clause'
) );

This will pull posts that have both meta keys set, but sort them by the hr_archive_title meta. meta_query is an array of meta clauses, each clause is an associative array with an identifier key. Then you set the orderby parameter to listen to the title_clause meta clause.
This exact query might not get you what you want, but play with the idea of "clauses" for your meta_query and you should be able to achieve what you are trying to do.
Idea taken from: https://wordpress.stackexchange.com/a/246358/70417


text:
Q: Changing legend label for a plot I want to change a "Data series legend label" for a plot, say from "foo" to "bar". Is there any way to change the previously recorded values of "foo" to be values of "bar" as well?
Currently I get values of "foo" for old builds and values of "bar" for new builds if I make the change.
I assume I can manually edit the csv file, where these values are stored, but I do not have write access to those files in the setup I am using now. Even if I did, I wouldn't want to edit the csv file by hand for something which feels like it is a common requirement.

A: The only way that I know of to do that is to edit the file that stores the plot values.  This will be located in $JENKINS_HOME/jobs/jobname on the machine that runs your Jenkins master, and will be a .csv file with a numeric name, e.g. 280055090.csv


text:
Q: Orthogonality condition in van der Vaart I have a question related to the proof of Theorem 11.1 in van der Vaart "Asymptotic Statistics" p.154 which can be found here
The question is related to the assertion

"the parabola $\alpha \rightarrow \alpha^2E(S^2)-2\alpha
 E(T-\hat{S})S$ is nonnegative if and only if  the orthogonality
  condition $E(T-\hat{S})S=0$ is satisfied"

Could you help me to understand why this is the case?

A: Let $f(\alpha) = a\alpha^2 - 2b\alpha$ where $a\geq 0.$
If $a=0, b=0,$ then $f(\alpha) = 0.
If $a=0, b\neq 0$ then $f(\alpha)$ is linear in $\alpha$ and is a negative number for $b=+1$ or $b=-1.$
If $a>0,$ then $\min_\alpha f(\alpha) = f\left(\frac ba\right) = - \frac{b^2}{a}<0$ unless $b=0.$
Looking at all these cases, it follows that $f(\alpha)$ takes only non-negative values only when $b=0$.
Substitute $a = \mathbb{E}S^2$ and $b = \mathbb{E}(T-\hat{S})S.$


text:
Q: why to save the name of java program with the same main class name in case of public main class why is it necessary to save the name of java program with the main class name when that class is public, if the class is not public then we can save the program with any name and then can compile it. why in case of public main class we can not do that.?

A: I think the question means, why does a public class name needs to match the name of the file it's been declared in.
I think this answer by Bill K would answer your question:
https://stackoverflow.com/a/2134888/1401409

A: No it is not necessary .  You can save the file containing class say MainClass containing main method with any other name say NonMainClass.java (given that the file doesn't contain any other public class). You can compile the same using javac NonMainClass.java . But when executing it you need to execute it using java MainClass.
For Example. Consider the code given below:
class MainsClass
{
    public static void main(String[] args)
    {
        System.out.println("Hello World!");
    }
}

This file is saved as NoMainClass.java. And it is compiled as javac NoMainClass.java. It generates the MainClass.class in working directory. And to execute the program you need to run following command java MainClass .


text:
Q: Leer excel con gran cantidad de columnas en C# Hola estimados desarrolladores, tengo un pequeño problema, resulta que estoy leyendo hojas excel en un programa de consola y me toco un excel que tiene una gran cantidad de columnas (Hasta la columna ABT) y mi dataset excel sólo lee hasta la columna WZ y nose como lograr que lea la hoja completa sin dejar ninguna columna fuera. tengo que hacerlo en OLEDB por temas de licencia de mi cliente.
Acá el código
OleDbConnection Econ;
Econ = new OleDbConnection(constr);
string qTotal = string.Format("Select * from[Sheet1$]");
string qTotalvalores = string.Format("Select * from[Sheet1$A12:ABT755]");
OleDbCommand ETotal = new OleDbCommand(qTotal, Econ);
OleDbCommand Etotal2 = new OleDbCommand(qTotalvalores, Econ);

termino = termino + 1;

Econ.Open(); //al procesar el archivo n° 120 //Se cae la conexion en Econ.Open();

// Creacion de Dataset para cada uno de los contructores
DataSet dsTotal = new DataSet();
DataSet dsTotal2 = new DataSet();
OleDbDataAdapter odaTotal = new OleDbDataAdapter(qTotal, Econ);
OleDbDataAdapter odaTotal2 = new OleDbDataAdapter(qTotalvalores, Econ);

Econ.Close();

A: No se puede leer más de 256 columnas con OLED, está limitado.
Una opción es partir la tabla en varios rangos de columnas y luego los consultas por rangos como Select * From RangeName
La otra opción es utilizar ExcelDataReader DLL
Es una biblioteca de código abierto utilizada para leer archivos de Microsoft Excel en .NET
https://www.nuget.org/packages/ExcelDataReader/
PD. Respondo como respuesta porque con mi puntuación todavía no puedo hacer comentarios, solo responder. Confío en que no me penalicen


text:
Q: MapReduce Freezes at 99% I have this problem with a very simple hadoop program which progress to 99% of reduction stage and then freezes. The input is a very lite file ~50 lines of text, the output should be very straight forward key-value pairs of Id's and their frequencies.
I have increased mem allocation inside mapred-site.xml to ~6Gig.
<property>
    <name>mapred.child.java.opts</name>
    <value>-Xmx6024m</value>
</property>

I tried to examine the log files but they are all empty, nothing is written to them. Please suggest what could be wrong with this?

A: Ok, so the problem was fixed when I started using newer Job & Configuration classes. Till now I was using legacy code which seem to be causing lot of errors. So I guess my advice here is to use the latest hadoop libraries & not the deprecated ones.
Sad that some of the hadoop books still teach with legacy classes & APIs.-- Do not use them!


text:
Q: Plotting a line above/below existing lines created with plotyy I'm running this code:
t = linspace(0, 10, 1000);
y1 = 2*t;
y2 = 3*t;
figure;
[ax, h1, h2] = plotyy(t, y1, t, y2);
set(h1, 'LineWidth', 4);
set(h2, 'LineWidth', 4);
hold on;
h3 = plot([5, 5], [0, 3000], 'LineWidth', 6, 'Color', [0.6, 0.6, 0.6]);

Which creates this plot:

Notice how the vertical grey line appears on top of the blue line (y1) but below the green line (y2).
How do I plot the grey line either on top of the other two lines, or below the other two lines?

A: I see two options:
A. Bring the gray line forward by moving it to the second axes created by the plotyy command
set(h3,'parent',ax(2));

B. Place the gray line on the bottom by rearranging the order of the blue and grey lines on
the axes.
chld = [h1 h3];
set(ax(1),'children',chld); %# reorders the two lines so that the gray line is in back.

A: To make the gray line bottom, you can also change the order of drawing.
t = linspace(0, 10, 1000);
y1 = 2*t;
y2 = 3*t;
figure;
h3 = plot([5, 5], [0, max(y1)], 'LineWidth', 6, 'Color', [0.6, 0.6, 0.6]);
hold on;
[ax, h1, h2] = plotyy(t, y1, t, y2);
set(h1, 'LineWidth', 4);
set(h2, 'LineWidth', 4);

There's a trick in h3 = plot(...) to make sure the left scale is correct, though.


text:
Q: Decomposing a 1-d signal into arbitary basis functions Hi all,
The short-time fourier transform decomposes a signal window into a sin/cosine series.
How would one approximate a signal in the same way, but using a set of arbitrary basis functions instead of sin/cos? These arbitrary basis functions are likely in my case to be very small discrete chunks of a 1-dimensional non-periodic waveform.
Is this something wavelets are used for?
Please excuse my tag, 'signal-analysis' does not exist and I can not create it.

A: Wavelets are generally used for nonperiodic signals. They're often used in earthquake detection and things like that. There are many books on the subject, a quick look for "Wavelets" in amazon.com should reveal many.
The Haar Wavelet and Daubchies Wavelet might be good choices. Haar may be better if you don't need a smooth decomposition, the wavelet decomposition their is much easier.
Google scholar (scholar.google.com) may be a good place to look, just look up "Wavelet decomposition" and your particular topic.
You can make your own wavelets per your particular needs, but it's not particularly easy, they need to fulfill certain conditions
This may be useful
https://doi.org/10.1007/BF01257191
Generalized multi-resolution analyses and a construction procedure for all wavelet sets in R^n
If you can get this down to 1-d you may have your answer.

A: You can use an arbitrary set of basis functions that can be placed or scaled at any point along your signal, if I understand what you want. The problem you'd be solving would be to find placement locations (another set of parameters) and scales (another set), to minimize squared error relative to the original signal (or some other measure that is easy to minimize). I think the main issue will be ensuring that you get a single solution (if there are many) or prevent situations where some basis functions cancel out the others. One way to do this would be to use something like wavelets, indeed, though there you don't have an arbitrary set. Another would be to enforce some sort of regularization on the parameters (e.g. a penalty that would make most of them 0). I don't know too much about this myself but the thing to look for is "overcomplete basis".

A: If we talk about the time periodic signals, may be used every set of functions with scalar product (Hilbert space), and optimise to minimize mean squared error relative to the original signal.
In signal theory there are some functions frequently used in this scope such us the Legendre, Tchebyshev ore Hermite  polynomials. For initiate in this theory you can read the book "LINEAR SPACES IN ENGINEERING" by FAZLIOLLAH REZA, GINN AND COMPANY, TORONTO-LONDON, 1971.

A: If the signal is not periodic we talk about the integral transform of the signal (in case of Fourier transform) and it have a continuum spectrum but not discreet.
In case of polynomial decomposition the desired accuracy of approximation is valid in the finite interval in which the basis functions are orthogonal. Outside, the error can be significant.


text:
Q: Implemention Zigbee Home Automation Are there any open source libraries to implement Home Automation Profile for zigbee?
The end device does not necessarily belong to a particular developer.

A: There aren't any, although not for a lack of trying. The reason they don't exist is that the ZigBee Alliance is very protective of their trademarks, and won't let you use "ZigBee" without becoming a paying member of the alliance.
This effectively killed the open source ZigBee project a few years ago.
The HA profile itself requires certification through the ZigBee Alliance, so you'll find this same issue whether it's a stack or profile.


text:
Q: Should I default my website to www.foo or not? Notice how the default domain for stackoverflow is http://stackoverflow.com and if you try to goto http://www.stackoverflow.com it bounces you to http://stackoverflow.com ?
What is the reason for this? Not the tech reason (as in the http code, etc) but why would the site owners want to do this?
I know it's purely aesthetic and I always have host-headers for both www and not, but is there a reason to bounce a user to a single domain, subheaded or not?
Update 1
Not having a subdomain is called a bare domain. Thanks peeps! never knew it had a term :)
Update 2
Thanks for the answers so far - please note I understand that www.domain.com can point to domain.com. This is not a question about if i should offer both or either/or, it's asking why some sites default to a baredomain instead of www subdomains, or vice-versa. Cheers.
Jeff Atwood actually HAS explained why he's gone for bare domains here and here. (Nod to Jonas Pegerfalk for the post :) )
Jeff's post (and others in this thread) also talk about the problems of a bare domain with cookies and static images. Basically, if you have cookies on in a bare domain, then all subdomains are forced also. The solution is to purchase another domain, as posted by the Yahoo Perf Team here.

A: It is worth noting that you can't have CNAME and an NS record on the same (bare domain) name in DNS. So, if you use a CDN and need to set up a CNAME record for your web server, you can't do it if you are using a bare domain. You must use "www" or some other prefix.
Having said that, I prefer the look of URLs without the "www." prefix so I use a bare domain for all my sites. (I don't need a CDN.)
When I am mentioning URLs for the general public (eg. on a business card), I feel that one has to use either the www. prefix or the http:// prefix. Otherwise, just a bare domain name doesn't tell people they can necessarily type it into their browser. So, since I consider http:// an ugly wart on a business card, I do use the www. prefix there.
What a mess.

A: In some cases, www might indeed point to a completely separate subdomain in a large corporate environment. Especially on an internal network, having the explicit www can make split DNS easier if the Web site is hosted externally (say, at Rackspace in Texas, but everything else is in your office in Virginia.) In most cases, it doesn't matter.
The important thing is to pick one and add an IHttpModule, rewrite rule, or equivalent for your platform to permanently redirect requests from one to the other.
Having both can lead to scary certificate warrnings when switching from http to https if you don't have a wildcard certificate and forget to explicitly redirect based on your site's name (which you probably don't because you want your code to work in both dev and production, so you're using some variable populated by the server).
Much more importantly, having both accepted results in search engines seeing duplicated content--you get dinged for having duplicated content, and you get dinged because your hits are getting split across two different URIs, hurting your rankings.

A: Jeff Atwood has written a great article about the The Great Dub-Dub-Dub Debate. There is also a blog entry in the Stackoverflow blog on why and how Stackoverflow has dropped the www prefix.

A: as far as I can tell, it doesn't really matter, but you should pick one or the other as the default, and forward to that.
the reason is that, depending on the browser implementation, www.example.com cookies are not always accessible to example.com (or is it the other way around?)
for more discussion on this, see:
in favor of www

*

*http://faq.nearlyfreespeech.net/section/domainnameservice/baredomain#baredomain - This webhost lists several good reasons for anyone considering doing more than simple webhosting to consider (such as load balancing, subdomains with different content, etc.)

*http://yes-www.org - This blog post from 2005 mainly proposed that most internet users needed the www prefix in order to recognize a URL. This is less important now that browsers have built-in searching.  Most computer illiterates I know bypass the URL bar entirely.
in opposition to www

*

*http://no-www.org/
and a miscellaneous related rant about why www should not be used as a CNAME, but only as an A RECORD.

*

*http://member.dnsstuff.com/rc/index.php?option=com_myblog&task=view&id=62&Itemid=37

A: actually you can use both of them. So it's better to find user your address or some. I mean actually it doesn't really matter tho :)
But putting www as a prefix is more common in public so I guess I'd prefer to use www behind it.

A: It's easier to type google.com than www.google.com, so give the option of both. remember, the www is just a subdomain.
Also no www is a commonplace these days, so maybe make the www.foo.com redirect to foo.com.

A: I think one reason is to help with search rankings so that for each page only one page is getting rankings instead of being split between two domains.

A: I'm not sure why the StackOVerflow team decided to use only one, but if it were me, I'd do it for simplicity. You'd have to allow for both since a lot of people type www by default or out of habit (I'm sure less "techy" people have no idea that there's a difference).
Aside from that, there used to be a difference as far as search engines were concerned and so there was concern about having either a duplicate content penalty or having link reputation split. But this has long since been handled and so isn't much of a consideration at this point.
So I'd say it's pretty much personal preference to keep things simple.


text:
Q: How to add feedback when user clicks on command button? When a user click on the button Save/Update, it does what it should but it doesn't give the user feedback that it did it. I would prefer not to refresh the page.
How to give the user feedback?
<apex:page standardController="Community_Yearly_Plan__c" extensions="vf_CommunityPlanGoalPSetting_Cntrlr" cache="false">

    <apex:form >
        <apex:pageblock >
            <apex:pageBlockSection columns="1" id="pbsCon" >
                <apex:outputPanel id="panelCon">

                    <apex:pageBlockTable id="pbtCon" value="{!listGoalsCurrYear}" var="cpgs">
                      <apex:variable value="{!0}" var="cnt"/>
                        <apex:column headervalue="Action">
                            <apex:commandlink value="Remove" action="{!removeRecord}" immediate="true">

                                <apex:param name="index" value="{!cnt}"/>
                            </apex:commandlink>
                            <apex:variable var="cnt" value="{!cnt+1}"/>

                        </apex:column>
                        <apex:column value="{!cpgs.Year__c}" />
                        <apex:column>
                            <apex:facet name="header">Funding Type</apex:facet>
                            <apex:inputField id="ft" value="{!cpgs.Funding_Type__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True' || newRow ="nr",'True','False')}" />
                        </apex:column>
                        <apex:column>
                            <apex:facet name="header">Core Current Participation</apex:facet>
                            <apex:inputField id="ccp" value="{!cpgs.Core_Current_Participation__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True'  || newRow ="nr",'True','False')}" />
                        </apex:column>

                        <apex:column style="width:10px;">
                            <apex:facet name="header">Funding Amount</apex:facet>
                            <apex:inputField id="fa" value="{!cpgs.Funding_Amount__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True' || newRow ="nr",'True','False')}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">Funding Description</apex:facet>
                            <apex:inputField id="fd" value="{!cpgs.Funding_Description__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True' || newRow ="nr",'True','False')}" />
                        </apex:column>
                        <apex:column style="width:10px;">
                            <apex:facet name="header">Goal Amount</apex:facet>
                            <apex:inputField id="ga" value="{!cpgs.Goal_Amount__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True' || newRow ="nr",'True','False')}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">Goal Amount Comments</apex:facet>
                            <apex:inputField id="gac" value="{!cpgs.Goal_Amount_Comments__c}" rendered="{!IF(cpgs.EditableOrReadOnly__c='True' || newRow ="nr",'True','False')}" />
                        </apex:column>

                    </apex:pageBlockTable>

                    <apex:commandButton style="align:center;" action="{!AddRow}" value="Add Goal Setting" reRender="pbsCon" />
                    <apex:commandButton style="align:center;" action="{!SaveRecords}" value="Save/Update" reRender="pbsCon" />

                </apex:outputPanel>

                <apex:outputPanel id="panelCon2">

                    <apex:pageBlockTable id="pbtCon2" value="{!listGoalsPrevYears}" var="cpgs2">

                        <apex:column value="{!cpgs2.Year__c}" />
                        <apex:column>
                            <apex:facet name="header">Funding Type</apex:facet>
                            <apex:outputField value="{!cpgs2.Funding_Type__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>
                        <apex:column>
                            <apex:facet name="header">Core Current Participation</apex:facet>
                            <apex:outputField value="{!cpgs2.Core_Current_Participation__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>
                        <apex:column>
                            <apex:facet name="header">Funding Amount</apex:facet>
                            <apex:outputField value="{!cpgs2.Funding_Amount__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">Funding Description</apex:facet>
                            <apex:outputField value="{!cpgs2.Funding_Description__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">Goal Amount</apex:facet>
                            <apex:outputField value="{!cpgs2.Goal_Amount__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>
                        <apex:column >
                            <apex:facet name="header">Goal Amount Comments</apex:facet>
                            <apex:outputField value="{!cpgs2.Goal_Amount_Comments__c}" rendered="{!IF(cpgs2.EditableOrReadOnly__c!='True','True','False')}" />
                        </apex:column>

                    </apex:pageBlockTable>

                </apex:outputPanel>
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

A: use apex:pagemessages attribute.
In your controller add the pagemessage and then rerender the section.
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'Success');
ApexPages.addMessage(myMsg);

and on VF page include
<apex:pageMessages />


text:
Q: Optional parameters with a stub in RhinoMock I want to stub a function that receive 2 boolean parameters. The first is required and the second is optional. If I try to send Arg.Is.Anything to the first but without information for the second, I receive an error:
System.InvalidOperationException : When using Arg, all arguments must be defined using Arg.Is, Arg.Text, Arg.List, Arg.Ref or Arg.Out. 2 arguments expected, 1 have been defined.
Here is a sample of my class to stub:
   public interface IOptionalParameterTester
   {
      bool IsValid(bool mustCheck, bool checkInDatabase = true);
   }

   public class OptionalParameterTester : IOptionalParameterTester
   {
      public bool IsValid(bool mustCheck, bool checkInDatabase = true)
      {
         if (checkInDatabase)
            return true;
         else
            return false;
      }
   }

And here is a sample of the test:
  [Test]
  public void ValidateProducerTest()
  {
     IOptionalParameterTester optionalParameter = MockRepository.GenerateStub<IOptionalParameterTester>();

     optionalParameter.Stub(x => x.IsValid(Arg<bool>.Is.Anything)).Return(true);
  }

In this case, if I want the test to pass without error, I must define the same information that for the first (Arg.Is.Anything) or a specific boolean value like true or false.
If I set anything other than Arg.Is.Anything for the first parameter, I don't have any error.
Is it a bug?
Can I setup an option in RhinoMock to don't have to define a value for each optional parameter?
If there is no setup, is there a better thing to do to handle this case (Best practice, pattern, etc.)?
Thank you.

A: I think I understand what you are trying to do but, since it seems that this is a limitation of Rhino Mocks (we can get to that conclusion from the error message you are receiving) I would suggest to change your testing strategy.
Try doing the following:
[Test]
  public void ValidateProducerTest()
  {
     bool anyBooleanValue = true;
     IOptionalParameterTester optionalParameter = MockRepository.GenerateStub<IOptionalParameterTester>();

     optionalParameter.Stub(x => x.IsValid(anyBooleanValue)).Return(true);
  }

I know that on your test you want Rhino Mocks to ignore the first parameter and that it takes the optional second one but, depending on the logic you want to test, just hard code the first parameter and Rhino Mocks should not complain.
As long as on your test it is clearly stated that the first parameter's value is not relevant your test is valid and readable.

A: Just had a similar issue myself, try
optionalParameter.Stub(x => x.IsValid()).IgnoreArguments().Return(true);

A: This is quite an old question now, but I landed on this page because I was having issues with AssertWasCalled and optional parameters.
Eventually, I solved my problem using the following syntax found on this page: http://petermorlion.blogspot.com/2012/11/rhinomock-assertwascalled-vs.html.
string expectedMessage = "RhinoMocks baby!";
string actualMessage = "RhinoMocks dude!";
var fooMock = MockRepository.GenerateMock<ifoo>();
fooMock.Bar(actualMessage);

var calls = fooMock.GetArgumentsForCallsMadeOn(x => x.Bar(string.Empty), o => o.IgnoreArguments());
Assert.AreEqual(1, calls.Count);
var arguments = calls[0];
Assert.AreEqual(expectedMessage, arguments[0]);


text: Q: Python3 как получить координаты слоя div на экране Имеется django 2.2, python3, как получить в переменную координаты определенного слоя div с определенным классом, что бы в дальнейшем сделать скриншот этой области.


text:
Q: AttributeError trying to automate WhatsApp using Selenium in Python from selenium import webdriver
from selenium.webdriver.support.ui  import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time

driver = webdriver.Edge(r"C:\Users\Manan\Downloads\edgedriver_win64\msedgedriver")
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver,600)
target = "Dad"
string = "message send from manan!!"
x_arg ='//span[contains(@title,'+ target + ')]'
target = wait.until(EC.presence_of_all_elements_located((By.XPATH, x_arg)))
target.click()

Can someone help out? I am a beginner and it always gives me this error:
AttributeError: 'list' object has no attribute 'click'

A: presence_of_all_elements_located returns a list of WebElements. That means there are more than one element in target. You must first select which of those WebElements you'd like to click, or click them all:
targets = wait.until(EC.presence_of_all_elements_located((By.XPATH, x_arg)))
target = targets[0] # Select first one
target.click()

targets = wait.until(EC.presence_of_all_elements_located((By.XPATH, x_arg)))
for target in targets: # Loop over and click each one
    target.click()

See: docs on presence_of_all_elements_located


text:
Q: Whats going on in my kali linux? E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. Im a Newbie I was installing this package when this happened.
root@kali:~/airgeddon# apt install isc-dhcp-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gsettings-desktop-schemas : Breaks: mutter (< 3.31.4) but 3.30.2-7 is to be installed
 linux-headers-4.19.0-kali4-amd64 : Depends: linux-compiler-gcc-8-x86 but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

How TO Fix All This Mess?

A: Simply clear the dpkg/status as follows...

leafpad /var/lib/dpkg/status

Select all [Ctrl+A], and delete (Del)
Make sure the status is cleared by typing...

cat /var/lib/dpkg/status

Update apt and install failed packages...

apt update
apt install -f

Now install the DHCP server...

sudo apt install -y isc-dhcp-server


text:
Q: Changing text using css in smooth writing animated style I have created an animation using css to write the text in smooth writing style. I need help in changing the text with different one in similar way
HTML & CSS
.typed-out{
  overflow: hidden;
  border-right: .15em solid orange;
  white-space: nowrap;
  animation:
    typing 1s forwards;
  font-size: 1.6rem;
  width: 0;
}
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}
</style>

I'm Mumin, I'm a

Web Developer

```
}

A: i prefer you for you using javascript. which is easy to implement and understand.

      var characterContainer = "WEBDEVELOPER".split("");
      var characterContainerLength = characterContainer.length;
      var charIndex = 0;
      function writeTheChars()
      {
            if (charIndex == characterContainerLength) {
                charIndex = 0;
                document.getElementById("webdevloper").innerHTML="";
                setTimeout(() => {
                //sleep the function for 500 milisecond
                 writeTheChars();
                }, 500);
            }

            else
            {
                document.getElementById("webdevloper").innerHTML+=characterContainer[charIndex];
                charIndex++;
                setTimeout(writeTheChars, 90);
            }

      }
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

And i guess this is what you are looking for.


text:
Q: What does it mean when someone says to "deliver the eyeballs"? Skimming through the following article on Guardian I stumbled upon the following sentence:

So if someone asked "What's your space?" and you had a deeply unfashionable job like, say, writer, it behooved you to say "I deliver eyeballs like a fucking ninja".

What exactly does it mean to deliver the eyeballs in this context?
Thanks in advance

A:  When people say "deliver eyeballs like a fucking ninja," they mean, "I'm can get a quarter-million people to look at your website." Obviously, that means quite something different than carving peoples' eyes out, after which they won't be able to see any websites.

A: eyeballs [ plural ] [Cambridge Dictionarry]1
   > MARKETING the number of people who watch a particular television

channel or visit a particular website:

AS IN:

Our xyz firm will guarantee to deliver the eyeballs to you website
  twice what you currently experience.


text:
Q: Add "ng-class" on parent of selected element's So another question related to ng-class is..
Adding class to the
 on the click of <button> present in its

demo
html:

{{ item.name }}

<button>
        active
        </button>

{{ item.name }}

<button>
        active
        </button>

JS:
var app = angular.module('myApp', []);

app.controller('myCtrl', function ($scope) {

    $scope.model = {
        selected: null,
        items : [
            {name: "Apple"},
            {name: "Banana"},
            {name: "California"}
         ]
    };
})

A: Try this

var app = angular.module('myApp', []);

app.controller('myCtrl', function($scope) {

  $scope.uls = [{model: { selected: null, items: [{ name: "Apple" }, { name: "Banana" }, { name: "California" }] }}, {model:{ selected: null, items: [{ name: "Apple" }, { name: "Banana" }, { name: "California" }] }}];

  /* $scope.model = {
    selected: null,
    items: [{
      name: "Apple"
    }, {
      name: "Banana"
    }, {
      name: "California"
    }]
  }; */
})
.on {
  color: red
}

{{ item.name }}

        <button ng-click="ul.onIsOn = !ul.onIsOn">
          active
        </button>


text:
Q: forefront TMG 2010 ... UPnP Port mapping I've tried googling the answer for a few days now, have come up with very little apart from
http://retrohack.com/how-to-enable-xbox-live-behind-tmg-2010/
but can only publish ports on 1 ip address which isn't ideal as we have a few xbox's on our LAN
Essentially my 2008 R2 box is running forefront TMG as an Edge device.
i.e. 1x NIC connect to Internet directly
1x NIC Connected to private LAN (NAT'd)
I want to set TMG to allow UPnP devices to auto port map.. can this be done?(im aware of the security implications that this causes)
I essentially want be able to connect multiple Xbox's with full Xbox Live support.

A: Aceth,
Thanks for checking out my post on RetroHack. To the best of my knowledge, there is no UPnP support on any 'enterprise' class firewall product, be it TMG, a Cisco ASA, a Juniper SG, or any other. The market seems to consider UPnP a home service, and no one would put a game console in at work. I guess they have never worked at a startup/dotcom/otherwise completely cool shop, or tried to run their own stuff at home.
I really hope someone else pops in with an answer, but the whole reason I had to do all that on my TMG, and then posted how to do it was because lacking UPnP, that was the only way to get it to work.
I'll keep an eye out here and elsewhere in case something pops up.
Best of luck.
Ed

A: There's no UPNP support for TMG, but I did come up with a system that got it working. It might be a bit late for this particular question, but I blogged my config here:
Xbox Live vs TMG 2010
Edit: (Had a problem with one friend originally - turned out to be his double-router setup at issue and it's fixed now)… So it's a solution for me!
Incidentally, it'll always appear as Strict NAT - it works anyway, though. Same solution should work for ISA 2006.


text:
Q: Where should I learn about the p-adic L-functions of elliptic curves? Where is the best place to learn about the p-adic L-functions of Elliptic Curves? Doing a bit of research I have found books like "An Introduction to Cyclotomic Fields" by Washington, but those only seem to discuss the p-adic analogues of Dirichlet L-functions.
As background, I am a student whose main relationship with algebraic Number Theory is Joe Silverman's "The Arithmetic of Elliptic Curves". I have also taken a course on Analytic Number Theory.

A: We know how to attach $p$-adic $L$-function to elliptic curves over $\mathbb Q$ only because we know how to attach them to cuspidal modular eigenforms, and we know
by Breuil-Conrad-Diamond-Taylor that every elliptic curves over $\mathbb Q$ are themselves attached to a cuspidal modular eigenform of weight $2$. Historically, the construction of $p$-adic $L$-functions attached to modular forms is the work of Mazur-Swinnerton-Dier, Manin, Amice-Velu, Shokurov. The article of Mazur-Tate-Teitelbaum quoted in comment contains a synthesis of all that.
But I think the best way to learn the theory now is to learn the version of the construction (not fundamentally different than the previously mentioned, but much simpler and clearer) given by Pollack and Stevens. For this, see the two papers by Pollack-Stevens:
Overconvergent modular symbols and p-adic L-functions, Ann. Sci. Ec. Norm. Sup. (4) 44 (2011), no. 1, 1–42, and Critical slope $p$-adic $L$-functions, J. Lond. Math. Soc. (2) 87 (2013), no. 2, 428--452.
I have also written a book, an expanded version of a course I gave at Brandeis, on the subject of p-adic L-functions of modular forms (and families thereof).  It exposes the Pollack-Stevens method, as well as their generalization and mine for the so-called "critical" case, that was missing at the time of Mazur-Tate-Teitelbaum, and many other things.
The book is called The Eigenbook. Eigenvarieties, families of Galois representations, p-adic L-functions and it will be published soon by Springer-Birkhauser, but you can also find a non-final version on my webpage.


text:
Q: Running a process from Java, consuming the output from C++ Short: What is the best way to invoke a process from Java and have its output be consumed by a C++ function invoked via JNI.
Long: I am experimenting with a log reader application for Android. For that, I have to run the logcat command and parse its output. I have attempted this from Java, but the amount of memory allocations performed are such that not only makes the process utterly slow but it also clutters the very same log with lots of GC related entries.
For that reason, I have implemented all parsing related operations in C++. However, I can't use the usual fork/exec idiom to invoke logcat from the C++ side as its not really supported by the NDK. Instead, I need to start the process from Java and somehow make its output accessible to the C++ code. Ideally I would use a pipe for this, but the redirectOutput methods from ProcessBuilder are not available on Android either.
The best solution I have come up with so far is to start the process redirecting its output to a temporary file (using logcat > tempfile), and have the C++ code read from that file. However, this is far from ideal. Is there a better way to have native code access the output of a process started from Java?

A: Your premise is a bit mistaken: fork/exec() is no more "proper" on Android when accomplished from Java than when accomplished via the NDK - in both cases it works today, but is considered to be outside of the way Android apps are supposed to work.
Reading the logs is another borderline case: as of JellyBean, you can only read your own (process or userid, not sure which) messages.  There is an ADB command which can be used to enable a given app to read all logs as in previous releases, but that has to be issued from the ADB - it cannot be set up by an app.
If you want to do literally what you have stated, regardless of the lack of necessity and impending limitation of utility, the thing to do would be to get knowledge of the file descriptors connecting to the child process into the native code.  You may be able to pass it, or the native code may be able to discover it for itself, since all file descriptors are listed in /proc.


text:
Q: MySql - How do i set a new value when it matches a criteria? SELECT ID, Division, EffectiveDate, PM, Status, Name, Address, ProjectType
FROM intranet.t_bidinfo
WHERE Division = 'TI'
AND EffectiveDate >= curdate()
AND Status = 1
ORDER BY EffectiveDate ASC
;

I need to change the return value of Status to 'Active' instead of 1 in my sql statement, how would i go about doing this correctly?

A: Use case statement:
SELECT ID, Division, EffectiveDate, PM, case Status when 1 then 'Active' end as Status, Name, Address, ProjectType
FROM intranet.t_bidinfo
WHERE Division = 'TI'
AND EffectiveDate >= curdate()
AND Status = 1
ORDER BY EffectiveDate ASC
;


text:
Q: Ideal generated by polynomials and linear dependence I've been thinking about this for almost a day and I have given up.
I just get stuck in an invalid argument and dunno how else to do this.
So the question is:

Let $s>1$ and let $f_1,...,f_s$ be a basis of the ideal $I$ in $k[x_1,...,x_n]$. If $f_i \neq 0$ for all $i$, then show that for any $i$ and $j$, zero can be written as a linear combination of $f_i$ and $f_j$ with nonzero polynomial coefficients.

So essentially, I have to show that for $k_i,k_j$ in $k[x_1...x_n]$, if $k_if_i+k_jf_j=0, k_i,k_j \neq 0$.
I first started with assuming $k_if_i+k_jf_j=0$ and then showing that $k_i,k_j$ are not zero. I then said because $I$ is an ideal, $0$ is in $I$, and thus
$k_1f_1+...+k_sf_s = 0$ and tried to use the fact, but that didn't end up proving anything I wanted.
I've been fiddling with it but no, I am starting to think using $k_1f_1+...+k_sf_s = 0$ doesn't help, but I have no idea what else to use otherwise....
Please please help I am so stressed with this, it seemed so simple at first and I think I am missing something basic, I just can't figure what and it is unbelievably irritating :/
I really appreciate your help, thanks so much!


text:
Q: What are the differences between a companion object function and package level functions? Whats the difference between having a function on a companion object and having the function at package level?
class Foo {

    companion object {
        fun bar() = println("bar")
    }
}

fun bar() = println("bar")

You can call both pretty similar
class B {

    fun print() {
        Foo.bar()
    }

    fun print2() {
        bar()
    }
}


text:
Q: Norm of adjoint Assume we have 2 injective continuous operators with dense images $A$ and $B$ on a Hilbert space $\mathbb H$ and $B$ is self adjoint. Further let there be constants $a_1$ and $a_2$ such that-
$a_1\|Bu\| \leq \|Au\| \leq a_2\|Bu\|$ for all $u \in \mathbb H$.
Can we show that for $A^{*}$, the adjoint of $A$, we have -
$a_1\|Bu\| \leq \|A^{*}u\| \leq a_2\|Bu\|$ for all $u \in \mathbb H$.
This is obviously true when $A$ is normal. Is it true for non normal operators?

A: Consider in $\Bbb{R}^2$,$B(v_1)=3v_1$ and $B(v_2)= 12 v_2$. Let $A(v_1) = v_2$ and $A(v_2)= 4v_1$ where $v_1 = (1,0)$ and $v_2=(0,1)$
Note that
$$|A(v)|=\frac{1}{3}|B(v)|$$
So we conclude that
$$a_1\|Bu\| \leq \|Au\| \leq a_2\|Bu\| $$
with $a_1 = \frac{1}{3}$ and $a_2 = \frac{1}{3}$
Now note that $A*(v_1)= 4v_2$
$$|A^*(v_1)|\nleq \frac{1}{3} B(v_1)$$
Hence it does not follow that
$$a_1\|Bu\| \leq \|A^{*}u\| \leq a_2\|Bu\| $$
Note:  and $AA^* \neq A^*A$. $A$ is not a normal operator.


text:
Q: Why does Postgres handle NULLs inconsistently where unique constraints are involved? I recently noticed an inconsistency in how Postgres handles NULLs in columns with a unique constraint.
Consider a table of people:
create table People (
   pid  int  not null,
   name text not null,
   SSN  text unique,
 primary key (pid)
);

The SSN column should be kept unique. We can check that:
-- Add a row.
insert into People(pid, name, SSN)
values(0, 'Bob', '123');

-- Test the unique constraint.
insert into People(pid, name, SSN)
values(1, 'Carol', '123');

The second insert fails because it violates the unique constraint on SSN. So far, so good. But let's try a NULL:
insert into People(pid, name, SSN)
values(1, 'Carol', null);

That works.
select *
from People;

0;"Bob";"123"
1;"Carol";"<NULL>"

A unique column will take a null. Interesting. How can Postgres assert that null is in any way unique, or not unique for that matter?
I wonder if I can add two rows with null in a unique column.
insert into People(pid, name, SSN)
values(2, 'Ted', null);

select *
from People;

0;"Bob";"123"
1;"Carol";"<NULL>"
2;"Ted";"<NULL>"

Yes I can. Now there are two rows with NULL in the SSN column even though SSN is supposed to be unique.
The Postgres documentation says, For the purpose of a unique constraint, null values are not considered equal.
Okay. I can see the point of this. It's a nice subtlety in null-handling: By considering all NULLs in a unique-constrained column to be disjoint, we delay the unique constraint enforcement until there is an actual non-null value on which to base that enforcement.
That's pretty cool. But here's where Postgres loses me. If all NULLs in a unique-constrained column are not equal, as the documentation says, then we should see all of the nulls in a select distinct query.
select distinct SSN
from People;

"<NULL>"
"123"

Nope. There's only a single null there. It seems like Postgres has this wrong. But I wonder: Is there another explanation?

Edit:
The Postgres docs do specify that "Null values are considered equal in this comparison." in the section on SELECT DISTINCT. While I do not understand that notion, I'm glad it's spelled out in the docs.

A: NULL is considered to be unique because NULL doesn't represent the absence of a value. A NULL in a column is an unknown value. When you compare two unknowns, you don't know whether or not they are equal because you don't know what they are.
Imagine that you have two boxes marked A and B. If you don't open the boxes and you can't see inside, you never know what the contents are. If you're asked "Are the contents of these two boxes the same?" you can only answer "I don't know".
In this case, PostgreSQL will do the same thing. When asked to compare two NULLs, it says "I don't know." This has a lot to do with the crazy semantics around NULL in SQL databases. The article linked to in the other answer is an excellent starting point to understanding how NULLs behave. Just beware: it varies by vendor.

A: Multiple NULL values in a unique index are okay because x = NULL is false for all x and, in particular, when x is itself NULL. You'll also run into this behavior in WHERE clauses where you have to say WHERE x IS NULL and WHERE x IS NOT NULL rather than WHERE x = NULL and WHERE x <> NULL.

A: It is almost always a mistake when dealing with null to say:

"nulls behave like so-and-so here, *so they should behave like
such-and-such here"

Here is an excellent essay on the subject from a postgres perspective. Briefly summed up by saying nulls are treated differently depending on the context and don't make the mistake of making any assumptions about them.

A: The bottom line is, PostgreSQL does what it does with nulls because the SQL standard says so.
Nulls are obviously tricky and can be interpreted in multiple ways (unknown value, absent value, etc.), and so when the SQL standard was initially written, the authors had to make some calls at certain places.  I'd say time has proved them more or less right, but that doesn't mean that there couldn't be another database language that handles unknown and absent values slightly (or wildly) differently.  But PostgreSQL implements SQL, so that's that.
As was already mentioned in a different answer, Jeff Davis has written some good articles and presentations on dealing with nulls.


text:
Q: How do you seek in VLC 2.0.6 in C# I am using a VLC 2.0.6 ActiveX control in a Visual Studio 2012 windows application. I figured out how to load and play a basic video using the following code:
        axVLCPlugin21.playlist.add(filename, title, null);
        axVLCPlugin21.playlist.play();

I am trying to figure out how to programmatically seek the video to a certain location. I scowered the internet and found people talking about shuttle(), MoveToPosition(), Position, and more, but none of those methods/properties are available to me. All I can see is axVLCPlugin21.StartTime, which is an int, and setting that either before, or after calling play() has no affect.
Thanks in advance!

A: According to the documentation here
http://wiki.videolan.org/Documentation:WebPlugin
one can set the seek position by using
axVLCPlugin21.input.time = 20000; // in milliseconds
There is more information there on getting the total length in milliseconds.
And if it doesn't show up in your auto-generated COM wrapper, ditch it altogether and roll your own. It's not too difficult to make your own inheritor of AxHost and use a "dynamic" (the .NET 4 keyword) OCX object.


text:
Q: How would I push an input value into an array for localstorage? I have a block of code that saves the input into localStorage, however, when I look into localStorage it is not formatted properly. This is the code:
var selectN = document.getElementById("select").value;
var arr= JSON.parse(localStorage.getItem("Table"));
var arr2 = [arr]
arr2.push(selectN);
localStorage.setItem("Table", JSON.stringify(arr2));

However it ends up formatting like this:
[["", "Data1"], "Data2"]
which is not what I am looking for. I am looking for something like this ["", "Data1", "Data2"] However it seems that I am getting the same result. I have even tried:
const arr = [JSON.parse(localStorage.getItem('Data'))];
    const arr2 = [
      ...arr,
      selectN
    ]

Any help would be appreciated.

A: You need to parse the table values to an array "if there is value since the first time the Table will be null", and then add the selected values to the table arr then stringify the arr and set it in the local storage, Here is the snippet of code
var selectN = ["Data1", "Data2"]
var table = localStorage.getItem("Table");
var arr = []

if(table)
 arr = JSON.parse(table);

 arr.push(...selectN);

localStorage.setItem("Table", JSON.stringify(arr));

console.log(localStorage.getItem("Table"))
// ["Data1","Data2"]

A: I saw that you put the array inside an new array. that is the reason why you got this new array structur.

*

*Get the value from localStorage.

*parse the string to an array

*push to this array the value from your select.

*stringify the array

*save it to the localstorage again

var arr = JSON.parse(localStorage.getItem("Table"));
// arr output ["Data1"]
data.push( document.getElementById("select").value );
localStorage.setItem("Table", JSON.stringify(arr2));


text:
Q: UIView background pattern Can I achieve the same as a following:
view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"imageName.png"]];

using IB only? Without need to write such a codeline?
It seems that IB only allows to set up plain color, not images as background.

A: Interface Builder doesn't allow the use of a background pattern. However you could simply overlay the background with the appropriate image within an UIImageView. This would give the desired look to the application, without having to use the code you posted above.
However, I strongly disagree that you should use only Interface Builder. Code is a lot cleaner in my eyes and allows for a lot more control over what you build.

A: This cannot be done in IB, but got the code right.  Despite what others have commented, use IB to the fullest extent possible, that way you can focus your efforts on the real business logic of your application, only customizing further where IB doesn't reach.  Good luck!

A: As others have said you can't do this solely in IB/storyboard. But with @IBDesignable you can add a few lines to your subclass and have it show up in IB, which is pretty cool.
import UIKit

@IBDesignable
class MyView: UIView {
override func awakeFromNib() {
    super.awakeFromNib()
    self.addPattern()
}

override func prepareForInterfaceBuilder() {
    self.addPattern()
}

private func addPattern() {
    let image = UIImage(named: "MyPattern", in: Bundle(for: self.dynamicType), compatibleWith: nil)
    self.backgroundColor = UIColor(patternImage: image!)
}

}

Then just change your storyboard/IB view's class to MyView.


text:
Q: Jquery UI sortable glitches with mouseenter event My sortable elements have also a mouseenter and mouseleave event.
When I hover a mouse over it some buttons are being shown on top of sortable element.
While I drag my sortable over another sortable element I have some glitches, those buttons quickly shown and removed within half a second.
If I do drag the sortables in slow way I don't have these glitches.
I thought about disable the mouseenter event while I drag the sortable and then turn it on again when it is droped?
Can someone provide an example?
Or maybe any other better solution?
Cheers.

A: I was having the same problem, and I was able to verify that the error was in the jquery ui css file, when I removed it from the page link, it worked.


text:
Q: What design pattern is Codeigniter using? Fairly straightforward question:
I know that Codeigniter is a MVC framework - however what design pattern is Codeigniter using?
From first look it seems like Facade, but I could be wrong.
Edit:
Perhaps I should describe Codeigniter for those who don't use it.
In Codeigniter you have a concept of a Controller and a Model, which each has their own separate folder. In each of the folders you create a file:
cart.php:
<?php

class Cart {
 //...
}
?>

Then you can also have a model:
<?php

class User {
    function login(){...}
}
?>

Inside of the class Cart, you can use the login function in User by simply using $this->user->login()
I find this interesting because the framework makes an object of the User object and the programmer does not.

A:
In Codeigniter you have a concept of a
  Controller and a Model, which each has
  their own separate folder.

They have setup their main router class such that it searches for corresponding controller and model files, it can even go recursive. This has nothing to do with any design pattern, it is just a folder organization.

I find this interesting because the
  framework makes an object of the User
  object and the programmer does not.

Yup, they have created a lot of stuff ready-made and to be used any time you want. The User class is used to control whole user system.
Basically, as you said, the main design pattern used is MVC, rest of the things are controlled by different core classes for a specific task.


text:
Q: Effect of temperature on specific weight How much of an impact has a temperature difference when the specific weight of an object in water is measured, e.g. the weight of a mussel in seawater. Would the two scenarios yield the same specific weight and if not is there a way to correct the specific weight for the temperature difference?

*

*Seawater 11 degree Celsius and mussel 11 degree Celsius

*Seawater 21 degree Celsius and mussel 11 degree Celsius

A: Assuming the temperature of the mussel has not changed during the course of the measurement, obviously not. You have to correct  for the variation of the density of seawater.


text:
Q: Hash holding string arrays doesn't read individual strings in Ruby on Rails I'm trying to make an array that collects individual strings from other arrays and then creates a hash that counts how many of each string is contained in estimate.bottom. Bottom belongs_to Estimate.
My problem is that it doesn't currently read the individual strings, but the array as a whole.  So if the bottoms are ["a", "b"] , ["a"] , and ["b"] the hash bottom_count will be {["a"]=>1, ["b"]=>1, ["a", "b"]=>1} instead of {["a"]=>2, ["b"]=>2}
@in_bottom = []
@estimates.each do |est|
  @in_bottom << est.bottom
end
@bottom_count = Hash.new(0)
@in_bottom.each { |in_bottom| @bottom_count[in_bottom] += 1 }

How can I make the method iterate through the individual strings and make bottom_count work correctly?

A: - @in_bottom.each { |in_bottom| @bottom_count[in_bottom] += 1 }
+ @in_bottom.flatten.each { |in_bottom| @bottom_count[in_bottom] += 1 }

See Documentation Array flatten method


text:
Q: Get the textbox value from external html file within IFrame I have a two HTML files (index.html and external.html). external.html has some registration fields. Using IFrame, load the external.html within the index.html. I had trouble getting the external.html input field values.
I used
$("#iframeid").contents().find("body").find("#inputfieldid").val(),

but it shows undefined error. Also I tried this one:
var frameObj = (element.contentWindow || element.contentDocument);
if (frameObj.document) frameObj = frameObj.document;
frameObj.getElementById("inputfieldid").value;

but it won't work. Is there any idea to get the values of an external file's input fields within an IFrame?

A: Try the following:
var obj=document.getElementById("iframeid");
var n1=obj.contentWindow.document.getElementById("inputfieldid").value;

My test codes:
und.php(containing iframe)
<!DOCTYPE html>
<html>
<head>
<script>
function altr(){
    var obj=document.getElementById("iframeid");
    var n1=obj.contentWindow.document.getElementById("inp").value;
    alert(n1);
}
</script>
</head>
<body>
<input type="button" value="Submit" onclick="altr()" />
<iframe id="iframeid" src="und1.php" />
</body>
</html>

und1.php
<!DOCTYPE html>
<html>
<body>
<input id="inp" type="text" />
</body>
</html>

A: Here i came up with answer for my question. Above Mr.Zword answer is worked properly when external.html file has been loaded from localhost itself.I have achieved the values While load the external file from server in following ways:
1)In an index.jsp file call the Servlet within IFrame.Instead of give the external.html in the action attribute.
2)Within Servlet doGet method you have to establish the connection to the server and give the request to the server with proper external.html file URL.
3)Finally print the value through the PrintWriter class.
4)Now you can get the IFrame values using the following way.
var obj=document.getElementById("iframeid");
var n1=obj.contentWindow.document.getElementById("inp").value;


text:
Q: Is there a way to declare the func argument as a variable in swift? In the code below I create a function called startTimer.
The purpose of this function is to count down from an input received by @IBAction. I am trying to understand:
Why do I need to declare a var secondsRemaining?
Why do I need to use a self keyword to be able to refer to the
Full Code
import UIKit

    class ViewController: UIViewController {

    let eggTimes : [String : Int] = ["Soft": 300, "Medium": 420, "Hard": 720]
        var secondsRemaining: Int? // self.secondsRemaining
    @IBAction func hardnessSelected(_ sender: UIButton) {
        let hardness = sender.currentTitle!
        let timerSeconds = eggTimes[hardness]!
        startTimer(secondsRemaining: timerSeconds)
        //until here the code seems to work fine

        func startTimer (secondsRemaining: Int?){
        //create a function called startTimer which accepts an interger as argument called secondsremaining
            self.secondsRemaining = secondsRemaining
            Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (Timer) in
                if self.secondsRemaining! > 0 {
                    //if the secondsRemaining >
                    print ("\(self.secondsRemaining ?? 0) seconds")
                    self.secondsRemaining! -= 1
                }else {
                    Timer.invalidate()
                  }
                }
        }
        //call the function start timer and give the secondRemaining argument the value of timerSeconds

    }

Previous to this my function was like this
 func startTimer (secondsRemaining: Int?){
        //create a function called startTimer which accepts an interger as argument called secondsremaining
           // self.secondsRemaining = secondsRemaining
            Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (Timer) in
                if secondsRemaining! > 0 {
                    //if the secondsRemaining >
                    print ("\(secondsRemaining ?? 0) seconds")
                    secondsRemaining! -= 1
                }else {
                    Timer.invalidate()
                  }
                }
        }

Which would return me the error :

Left side of mutating operator isn't mutable: 'secondsRemaining' is a
'let' constant

This makes me ask two questions:

*

*Are all the arguments declared for functions always constants? If so, why

*If the answer to question 1 is No, how can I declare an argument as a variable in a function?

A:
Are all the arguments declared for functions always constants?

No, there are inout parameters which you can change in the function body. There were also var parameters, but they got removed in Swift 3.
The purpose of inout parameters is for the function to be able to change the argument passed in, and have the changes reflect on the caller's side. An example from the Swift guide:
func swapTwoInts(_ a: inout Int, _ b: inout Int) {
    let temporaryA = a
    // you are able to change a and b here
    a = b
    b = temporaryA
}

var a = 1
var b = 2
swapTwoInts(&a, &b)
// now b is 1 and a is 2

This means that you must pass something mutable to inout parameters, not something like timerSeconds which is a let constant.
Furthermore, you can't use an inout in an escaping closure, like the one you pass to Timer. See my explanation at the start of this answer. This might also be helpful.
If you don't like to use a class-level, you can simply declare a local var:
func startTimer (totalTime: Int?){ // I renamed the parameter
    var secondsRemaining = totalTime
    Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (Timer) in
        ...

A: All parameters passed into a Swift function are constants, so you can't change them. If you want, you can pass in one or more parameters as inout, which means they can be changed inside your function, and those changes reflect in the original value outside the function.
func startTimer (secondsRemaining: inout Int){
   //your code here
}

To use that, you first need to make a variable integer – you can't use constant integers with inout, because they might be changed. You also need to pass the parameter to doubleInPlace using an ampersand, &, before its name, which is an explicit recognition that you're aware it is being used as inout.
startTimer(secondsRemaining: &timerSeconds)


text:
Q: How does one Dockerize and deploy a Pytorch deep learning model via SSH? I'm having trouble understanding how to deploy a PyTorch docker image on a remote machine that has an Nvidia GPU. I'm relatively unfamiliar with Docker in general, and this is my first time using Docker for the purposes of deep learning.
I am able to train my models on my local machine without problems via a trivial command-line call to python main.py, which is what I'm familiar with. But now that I have to SSH into this machine I'm required to use Docker.
So far I have pulled a few images without really knowing what I'm doing. So, here's what got me the furthest so far:
First, I transferred my code to the machine via a GitLab repository -- nothing fancy. I also transferred some large datasets via SSH into the parent directory of my GitLab repository. I.e., it looks something like this:
DeepLearningProject/
├── Data_folder/
│   ├── datasets/
│   ├── results/
│   └── etc...
└── MyGitFolder/
    ├── lots_of_python_files.py
    └── main.py

Next, I pulled the following image via docker pull anibali/pytorch:1.4.0-cuda10.1 as the version numbers satisfy our requirements.
Here's where the guessing game got out of hand. So, I have an image with Pytorch and all the Nvidia stuff, but I'm still missing my own python package dependencies. I'm not sure where the installation hereof takes place, for example in a requirements.txt file. Thus, python reports missing packages when I run the following, as per a tutorial I found online:
docker run --rm -it --init \
  --gpus=all \
  --ipc=host \
  --user="$(id -u):$(id -g)" \
  --volume="$PWD:/app" \
  anibali/pytorch:1.4.0-cuda10.1 python3 main.py

So, I thought I could perhaps enter a bash terminal by excluding the python3 main.py part of the above command. This just opens the python3 interpreter interface. I assume this is due to the image's Dockerfile(?) ending on CMD ["python3"], and I'm unsure as to how I can install my requirements through this.
As requested, please find an example of the error message for the missing python packages below:
Traceback (most recent call last):
  File "main.py", line 16, in <module>
    from model import (generate_model, load_pretrained_model, make_data_parallel,
  File "/app/model.py", line 4, in <module>
    from models import resnet, resnet2p1d, pre_act_resnet, wide_resnet, resnext, densenet
  File "/app/models/resnext.py", line 9, in <module>
    from utils import partialclass
  File "/app/utils.py", line 7, in <module>
    from sklearn.metrics import precision_recall_fscore_support
ModuleNotFoundError: No module named 'sklearn'

I assume this image does not have sklearn in its requirements.txt. Is there a way I could 'pipe' in my own requirements.txt when executing docker run? I believe this to be my main issue here.
Any advice would be appreciated.


text:
Q: Finite ring extensions doesn't preserve non-zero-divisors Can you give an example of a finite ring extension $A \hookrightarrow B$ of noetherian rings $A,B$ which maps a non-zero-divisor to a zero-divisor.
Background: In this case $A \hookrightarrow B$ does not induce a homomorphism $Q(A) \to Q(B)$ of total quotient rings.

A: Yes: take $\mathbb{Z} \to \mathbb{Z}[x]/(2x, x^2)$. Then 2 becomes a zero divisor in the latter. They are noetherian, and it is finite since the latter ring is generated by $1,x$ over $\mathbb{Z}$.
How did I find this? If you try a proof of the fact that non zero divisors are sent to non zero divisors, you stuck at some point. Let $y$ be a non zero divisor, and suppose there exist $x$ in the extended ring such that $\phi(y)x =0$. If x was in the image of phi, then yes, by injectivity you could lift to an element in the original ring. If $y$ was invertible, then the image would be invertible; in particular it would be non zero divisor.
But what about if $x$ is not in the image and $y$ is not invertible? It can happen. Indeed, for any ring $A$, consider a non zero divisor $y$ which is not invertible. Let's add an element $x$ that makes the work: it is not in the original ring, and annihilates $y$. Formally, set $B=A[x]/(yx,x^2)$. The second $x^2$ is put so to get a finite ring extension. And you are done!


text:
Q: How to solve $\sin(x)\frac{d}{dx}\beta \left ( x \right )+\cos(x)\beta (x)=1$? I'm trying to solve $$\sin(x)\frac{d}{dx}\beta \left ( x \right )+\cos(x)\beta (x)=1$$
What I get is :
$$\beta (x)=\beta \left ( \alpha  \right )e^{\sin(\alpha )-\sin(x)}+e^{-\sin(x)}\int_{\alpha }^{x}e^{\sin(t)}dt$$
But I think that this solution is incorrect .The textbook says that there's exactly one solution that has a finite limit as $x$ tends to $0$ . But all the solutions I get have a finite limit . So what's the correct solution?

A: $\sin(x) \beta'(x) + \cos(x) \beta(x) = \sin(x) \beta'(x) + (\sin(x))' \beta(x) = 1$.
Hence,
$$(\sin(x) \beta(x))' = 1 \implies \sin(x) \beta(x) = x + c \implies \beta(x) = \dfrac{x+c}{\sin(x)}$$
Now as $x \to 0$, we want $\lim_{x \to 0} \beta(x)$ to exist i.e. $\lim_{x \to 0} \dfrac{x+c}{\sin(x)}$ exists i.e. $$\lim_{x \to 0} \dfrac{x+c}{\sin(x)} = 1 + \lim_{x \to 0} \dfrac{c}{\sin(x)} \,\,\,\,\,\,\, \text{exists}.$$ Hence, $c=0$ and therefore $\beta(x) = \dfrac{x}{\sin(x)}$.
EDIT
To proceed through your way, we have that
$$\beta'(x) + \cot(x) \beta(x) = \csc(x)$$
Hence, the integrating factor $I(x) = \exp \left(\displaystyle \int M(y) dy\right) = \exp(\log(\sin(x))) = \sin(x)$. Hence, the solution is $$\beta(x) \sin(x) = \int \csc(y) \sin(y) dy = x + c$$