INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Are `armeabi-v7a` and `armeabi` the only two arm options to put in Application.mk for an Android app? If not, what other options are there for the arm architectures in the Application.mk file?
Two additional options are `x86` and `mips`. I believe those 4 are the only options.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "android, cpu architecture" }
what is setTimeOut() function in javascript? Can i ask what the function of setTimeOut method in javascript?As below: function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); document.getElementById('txt').innerHTML=h+":"+m+":"+s; t=setTimeout('startTime()',500); }
Not sure you what you want. `setTimeout` is a method of the global window object. It executes the given function (or evaluates the given string) after the time given as second parameter passed. Read more about `setTimeout`.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "javascript, function, methods, settimeout" }
Best axe for making kindling and little work I am looking for the best type of axe for being able to chops already split wood into smaller kindling, while also being capable of chopping down small trees.
Apparently it is called a "carpenters axe" today. My father called it a "boat axe" as one you could reasonably bring in a canoe. Larger than a hatchet, smaller than a regular felling axe and not nearly as heavy.
stackexchange-outdoors
{ "answer_score": 1, "question_score": 0, "tags": "camping, fire starting, firewood" }
And operator Lisp Why does `and` operator returns a value? What is the returned value dependent on? When I try the following example - (write (and a b c d)) ; prints the greatest integer among a b c d where `a`, `b`, `c` and `d` are positive integers, then `and` returns the greatest of them. However when one of `a`, `b`, `c` and `d` is 0 or negative, then the smallest integer is returned. Why is this the case?
As stated in the documentation: > The macro `and` evaluates each _form_ one at a time from left to right. As soon as any form evaluates to `nil`, `and` returns `nil` without evaluating the remaining _forms_. If all _forms_ but the last evaluate to `true` values, and returns the results produced by evaluating the last _form_. If no _forms_ are supplied, `(and)` returns `t`. So the returned value doesn't depend on which value is the "greatest" or "smallest" of the arguments.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "lisp, common lisp" }
How to make applyFilters function return false via functions.php So I have a following code inside the plugin: if( window.wp.hooks.applyFilters( 'filtername', true, $(this) ) ) { //do something } how can I make above statement always false without editing plugin files but using functions.php instead? I'm not sure if I understand applyfilters correctly but I've tried: function filtername() { return false; } add_filter( 'filtername', 'filtername', 10, 3 ); but it didn't work. What would be propper way to do it? Can someone please explain.
JS hooks don't do server-side calls to retrieve PHP declared hooks. wp.hooks.addFilter( 'hookName', 'namespace', () => { return false; }, 10 )
stackexchange-wordpress
{ "answer_score": 3, "question_score": 2, "tags": "functions, filters" }
Material whose dielectric constant * [dielectric strength]^2 > 20,000,000,000 I'm looking for a material or compound, whose dielectric constant multiplied by the square if its dielectric strength (MV/m) is greater than two billion at temperature from -20C to 100C. It doesn't matter whether the individual values of dielectric strength or dielectric constant are high or low, I'm only interested in the final value. Also frequency is not a consideration, since this is not for AC use.
I found a paper by Natalie Jenkins at the Department of Mechanical Engineering, Naval Postgraduate School. Fumed silica wetted to incipient wetness, with a saturated NaCl solution has a dielectric constant > 10,000,000,000, and a dielectric strength > 2.3 MV/m.
stackexchange-electronics
{ "answer_score": 0, "question_score": 0, "tags": "dielectric" }
Derivative of $\frac{d}{dt}\ln(6t^2+9t+12)=$ $\dfrac{d}{dt}\ln(6t^2+9t+12)=$ $y=2\ln(6t)+\ln(9t)+\ln(12)$ $y\;'=2\dfrac{1}{6t}(6)+\dfrac{1}{9t}(9)+0$ $=\dfrac{12}{6t}+\dfrac{9}{9t}=\dfrac{2}{t}+\dfrac{1}{t}$ What am I doing wrong?
You cannot simplify a logarithm like you did in the second step - that is, $$y=\ln{(6t^2+9t+12)}$$ does not equal $$y=2\ln{6t^2}+\ln{9t}+\ln{12}$$ You _can_ split up logarithms when you are multiplying numbers - that is, $$\ln(x\times x)=\ln(x)+\ln(x)$$ In this case, though, just use the chain rule: $$f'(g(x))=f'(g(x))g'(x)$$ > Because $g(t)=6t^2+9t+12$, $$f'(t)=y'=(12t+9)\left(\frac{1}{6t^2+9t+12}\right)$$ which becomes $$f'(t)=\frac{12t+9}{6t^2+9t+12}$$ and then $$f'(t)=\frac{4t+3}{2t^2+3t+4}$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "calculus, derivatives, logarithms" }
Are there alternatives for proof of work? Bitcoin uses proof of work to secure the network, Ripple uses a global consensus system and PPCoin uses proof of stake. Are there any known alternatives to the above methods?
Another alternative is proof of burn.
stackexchange-bitcoin
{ "answer_score": 5, "question_score": 18, "tags": "security, doublespend, proof of work, proof of stake, consensus" }
Why is this true? $\frac{x}{b}=cos(180 -\theta) \implies x=-b\ cos\ \theta$ So in my textbook, this is part of a proof for the law of cosines, where two triangles share a side b, and are aligned on a straight line c + x. One triangle has the angle $\theta $ and another has the angle $\alpha =180-\theta$ between b and c, and b and x respectively. Which supposedly leads to the following conclusion: $$\frac{x}{b}=cos(180 -\theta) \implies x=-b\ cos\ \theta$$ I don't understand the logic behind this however, since $180-\theta$ must result into a positive number, as$\theta $ cannot be greater than 180. So why does $\frac{x}{b}= cos(180-\theta)$ imply $x=-b\ cos\ \theta$? What am I missing here?
Note that $90^\circ<\theta<180^\circ\implies\cos(\theta)<0$. On the other hand,$$\cos(180^\circ-\theta)=-\cos(-\theta)=-\cos(\theta).$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "trigonometry, triangles" }
Simplest command to print unique values of some column data with count of repeated values A sample input data with 3 columns, 1st and 3rd column has values in duplicates, need to print them uniquely with their repetition count. sort -u does help in some sense but unable to print occurrence of repeated values relating 1st and 3rd column. Input : A 3210 -06:00 A 5172 -06:00 A 3335 -07:00 A 3258 -05:00 B 3322 -05:00 B 5097 -05:00 C 3238 -06:00 C 5364 -05:00 C 3366 -06:00 C 3293 -06:00 Output : A(2) -06:00 A(1) -07:00 A(1) -05:00 B(2) -05:00 C(3) -06:00 C(1) -05:00 or Output : A 2 -06:00 A 1 -07:00 A 1 -05:00 B 2 -05:00 C 3 -06:00 C 1 -05:00
1. Given _Input_ use `cut`, `sort`, `uniq` and `sed`: cut -d ' ' -f1,3 Input | sort | uniq -c | sed 's/^ *//;s/^\([0-9]*\) \([^ ]*\)/\2 \1/' 2. Using `datamash` and `sed`: datamash -t ' ' -g1,3 -s countunique 2 < Input | sed 's/\(.*\) \(.*\) \(.*\)/\1 \3 \2/' Output of either: A 1 -05:00 A 2 -06:00 A 1 -07:00 B 2 -05:00 C 1 -05:00 C 3 -06:00
stackexchange-unix
{ "answer_score": 2, "question_score": 0, "tags": "text processing, awk" }
Exponential series representation It is well known that the exponential function can be represented as follows: $$e^x=\sum_{n=0}^\infty\frac{x^n}{n!}$$ However, the right hand side is not defined at $x=0$ due to $n=0$. Is it wrong? should we use this one: $$e^x=1+\sum_{n=1}^\infty\frac{x^n}{n!}\text{?}$$
First of all, $0!=1.$ This is not in dispute. It is just the definition. There are reasons for the definition, but I won’t go into them here. This example is one of many reasons to define $0^0=1.$ There are several other reasons, but there are other questions covering that on this site. I’ll just add that there is no problem with defining $0^0=1.$ It doesn’t lead to paradoxes, just discontinuities. That said, even if we left $0^0$ undefined, we’d still treat $e^0=1$ using the standard power series notation. The notation is too convenient. Do we really want to write: > If $$f(x)=a_0+\sum_{n=1}^\infty a_nx^n$$ then $$f’(x)=1\cdot a_1+\sum_{n=1}^\infty (n+1)a_{n+1}x^n?$$ That hides the pattern. You have to read carefully to realize the constant term follows the pattern of the other terms. It would be notation that obscures rather than clarifies.
stackexchange-math
{ "answer_score": 5, "question_score": 5, "tags": "sequences and series, functions, power series" }
replace values in data.frame in R based on two vectors I'm trying to write a GENERAL-purpose looping function that replaces _one **or more** unwanted values_ (e.g., `"#N/A"` & `'p'`) in a `data.frame` with _one **or more** desired_ values (e.g., `NA`) in BASE R. I have tried the following with no success, is there an efficient fix? input <- data.frame(id = c(1,3,"#N/A"), school = LETTERS[1:3], read_2018 =c("#N/A",'p',49)) replace = c("#N/A", 'p') # can be one or more elements with = NA # if shorter in length than `replace`, recycle the last element # My solution without scucess: lapply(seq_along(replace), function(i){input[input == replace[i]] <- with[i]; input})
Since you've tagged your question with `loops`, the following should work with minimal modification of your attempted solution. for(i in seq_along(replace)){ input[input == replace[i]] <- with[i] } input # id school read_2018 #1 1 A <NA> #2 3 B <NA> #3 <NA> C 49
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "r, loops, dataframe, lapply" }
Where to put a library shared between portlets in Liferay? I need to share a library (built in-house) between portlets and I prefer to put it in a common place instead of adding it as dependency to every portlet that need it because I want to update the library once. Can I build a hook or ext plugin that the portlets can refer to and access the library? I know that you can add it to the common library directory and add it to `liferay-plugin-package.properties` for each portlet but the location depends on the application server. I want to know, there is a standard or cleaner way to do this? Thanks in advance.
With the tomcat bundle, the common usage is to put these in the `tomcat/lib/ext` folder. There is one big drawback, every modification in this folder will require a server restart.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "liferay, portlet" }
Add file to ignored and remove it from the remote repository I have a following case: I made a `.gitignore` on `gitignore.io`. The `.idea` folder and `project_name.iml` were not in the ignore list and were pushed into the repo. I added them into the `.gitignore`, but they remain in the repo. If I make any changes to them, they appear in the list of changed files to commit. There is a way to get rid of them through the terminal git rm -r --cached .idea/ But is it possible to start ignoring changes in those files and remove them from the repo by the IDE without using terminal?
1. Remove the file/folder in Project tool window via the "del" key: 2. Invoke "Undo" action to get them back. You will be asked if you want to add the files to git. 3. Click "NO" 4. Commit changes. The removed/re-added folder will be removed from git in the scope of this commit. Here is the short video demonstrating the process: ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "intellij idea, gitignore" }
vb.net New line in string paragraph I'm going to break line in a paragraph. Is there such thing as `\n` break the line in string? Dim info As String = "Page name \n Date and Time" & DateTime.Now.ToString("yyyy-MM-dd, HH:mm:ss") & "\n Printed By Admin"
use **vbLf** Dim info As String = "Page name " & vbLf & " Date and Time" & DateTime.Now.ToString("yyyy-MM-dd, HH:mm:ss") & "" & vbLf & " Printed By Admin"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "vb.net, string" }
Is there any way to turn a bit.ly to a full url using Xcode? I am wondering if this is actually possible,because I am running out of solutions for my problem.The bit.ly short links are just ruining my day lol. The code below is what I am trying to pull off, but this doesn't work with bit.ly links. And it is always detecting bit.ly links first then google redirected links next. -(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType { if ( inType == UIWebViewNavigationTypeLinkClicked ) { if ([[inRequest.URL absoluteString] rangeOfString:@"google"].location==NSNotFound){ [[UIApplication sharedApplication] openURL:[inRequest URL]]; return NO; } } return YES; }
In order to expand the bit.ly link you'll need to make another web service call. LongUrl offers a service to expand shortened URLs. They offer a API to provide this. You'll just have to live with the extra latency of a second request.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, objective c, xcode, hyperlink, bit.ly" }
View classes dependency graph plugin? Is there any plugins I can use for Eclipse that will show graphical view of classes dependencies?
**Classycle** can be a good start (for static dependencies between classes at least) (I find their graph a bit complicated to follow though : CDA - Class Dependency Analyzer is an external tool, but produce much more readable dependency graphs)
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 38, "tags": "java, eclipse, eclipse plugin, eclipse rcp, eclipse 3.4" }
Blender 3D python For Every pose bone add a constraint not working selected = bpy.context.selected_pose_bones for bone in selected: bpy.ops.pose.constraint_add(type='COPY_ROTATION') every time i run this it the contstraints on the same pose bone not on all the pose bones. does anyone know how to make it add a constraint on every selected pose bone .
`bpy.ops.pose.constraint_add()` is an operator that only effects the active item, in this case a pose bone. While you are looping through the bones in the selection you aren't using the reference to each bone as you loop through. Instead of using an operator you can manually create the constraints on each specific bone and adjust other parameters as you go. for bone in bpy.context.selected_pose_bones: nc = bone.constraints.new(type='COPY_ROTATION') nc.target = bpy.data.objects['Armature'] nc.subtarget = bone.parent nc.influence = 0.5
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "python 2.7, blender, blender 2.61, blender 2.67" }
How to limit number of digits after decimal point in python random I am using this code:`newAgent = [random.gauss(0, 1), random.gauss(0, 1)]` and I want to limit the number of digits after decimal point.now is about 20 digits.
The answer is quite simple. Just use `round` and then specify the places with `, #Number of spaces`. In this example, I did to 5 decimal spaces. import random newAgent = [random.gauss(0, 1), random.gauss(0, 1)] print(round(newAgent[0], 5), round(newAgent[1], 5))
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -5, "tags": "python" }
What is the distribution of a stochastic process? Let * $(\Omega,\mathcal{A})$ be a measurable space * $E$ be a Polish space and $\mathcal{E}$ be the Borel-$\sigma$-algebra on $E$ * $I\subseteq\mathbb{R}$ * $X_t$ be a random variable on $(\Omega,\mathcal{A})$ with values in $(E,\mathcal{E})$ Then, $X:=(X_t,t\in I)$ is called a **stochastic process**. I've seen that people talk about the _distribution_ $\mathcal{L}[X]$ of a stochastic process $X$, but how is $\mathcal{L}[X]$ defined?
Let $E^I$ denote the set of all functions from $I$ to $E$. Note that $X$ can be viewed as a mapping from $\Omega$ into $E^I$, with $X(\omega) = X_t(\omega)$. Also, $X$ is measurable with respect to the $\sigma$-algebra $\mathcal{F}$ on $E^I$ which is generated by all of the projections $\pi_t: E^I\to E$, given by $\pi_t(f) = f(t)$. Hence there is a pushforward measure $X_*P$ on $(E^I,\mathcal{F})$ defined by $(X_*P)(A) = P(X \in A)$, and this pushforward measure is usually called the $law$ (or distribution) of $X$. My best guess is that $\mathcal{L}[X]$ refers to this pushforward measure. It can be proved that if $Y=(Y_t)_{t \in I}$ is another stochastic process on $E$ such that the finite-dimensional distributions of $Y$ agree with the finite-dimensional distributions of $X$, then $\mathcal{L}[X]=\mathcal{L}[Y]$. <
stackexchange-math
{ "answer_score": 6, "question_score": 7, "tags": "probability theory, stochastic processes, stochastic calculus, stochastic analysis" }
Non-singular bilinear forms over a vector space. I have a field $k$ and a finite dimensional $k$-vector space $E$. Let $f$ be a symmetric $k$- bilinear form on $E$. I define $f$ to be non-degenerate if $f(x,y)=0$ $\forall y\in E$ implies $x=0$. I define $f$ to be nonsingular if the map $E \to {\rm Hom}_k(E,k)$ defined by $x \mapsto \varphi_x$ where $\varphi_x(y)=f(x,y)$ is an isomorphism. How can show that $f$ is non-singular iff it's non-degenerate? I guess the 'if' part might be quite easy since $E$ is finite dimensional.
**Hint:** You can show (if you don't know already) that $\dim \operatorname{Hom}_k(E, k) = \dim E$. As such, a $k$-linear map $E \to \operatorname{Hom}_k(E, k)$ is an isomorphism if and only if it is injective.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "abstract algebra, bilinear form" }
Prepending letter to field value I have a file `0.txt` containing the following value fields contents in parentheses: (bread,milk,), (rice,brand B,), (pan,eggs,Brandc,), I'm looking in OS and elsewhere for how to prepend the letter `x` to the beginning of each value between commas so that my output file becomes (using bash unix): (xbread,xmilk,), (xrice,xbrand B,), (xpan,xeggs,xBrand C,), the only thing I've really tried but not enough is: awk '{gsub(/,/,",x");print}' 0.txt for all purposes the prefix should not be applied to the last commas at the end of each line.
With `awk` awk 'BEGIN{FS=OFS=","}{$1="(x"substr($1,2);for(i=2;i<=NF-2;i++){$i="x"$i}}1' Explanation: # Before you start, set the input and output delimiter BEGIN{ FS=OFS="," } # The first field is special, the x has to be inserted # after the opening ( $1="(x"substr($1,2) # Prepend 'x' from field 2 until the previous to last field for(i=2;i<=NF-2;i++){ $i="x"$i } # 1 is always true. awk will print in that case 1
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "bash, unix, field, text processing, prepend" }
Error: POM not present while using mvn deploy command I am using below mentioned command to send jar from my local workspace to Artifcatory in maven repo. I am not using pom.xml to do so. I have configured setting.xml with credentials for Artifactory. mvn deploy:deploy-file -Durl= -DrepositoryId= arti-mavenpre -Dfile=trial.zip -DgroupId=com/org/mydir -DartifactId=test -Dversion=1.0 -Dpackaging=zip I get following error while executing above command: [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\raji\script). Please verify you invoked Maven from the correct directory. -> [Help 1] What am I doing wrong? I don't want to use pom.xml file. How to make it work without pom? Thank you.
So this was the error. I am using powershell to execute maven command and it requires double quotes for execution. After using double quotes, its working fine. C:\apache-maven-3.3.9\bin\mvn -s "C:\Users\my-user.m2\settings.xml" -Dversion="$(Build.BuildNumber)" -Durl=" -DgroupId="com.mycomp.mydir" -Dfile="C:\agent_work\1\a_PublishedWebsites\test_$(Build.BuildNumber).zip" -Dpackaging="zip" -DrepositoryId="my-artifac tory" -DgeneratePom=true -DartifactId="test" -B deploy:deploy-file
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "maven, pom.xml, artifactory" }
Jquery autocomplete - only allow autocomplete suggestions I use this jQuery Autocomplete \- framework for an input field (after input of three characters the suggestions appear), and I only will allow entries of autocomplete suggestion. My first approach was: var nameSelectedOverSearch = false; var availablePersons = []; $(function() { $("#anspr").autocomplete({ source: availablePersons, select: function(event, ui) { nameSelectedOverSearch = true; } }); }); the user must click an autocomplete suggestion but it is still possible that afterwards the user change the input. Is there any possibility to only allow autocomplete inputs?
You can use this awesome library < I did a full exemple with autocomplete and chosen to compare : < I think it fits exactly your needs. Relevant code : $("#tags").autocomplete({ source: availableTags }); $.each(availableTags,function(i,e){ $("#choosen").append('<option>'+e+'</option>'); }); $("#choosen").chosen({search_contains: true});
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "jquery, jquery autocomplete" }
write sed commands to multiple lines I am taking efforts to learn sed and encounter such a situation $ echo "abcd" | sed -n "/b/p" abcd it works properly, $ echo "abcd" | sed -n " → /b/p" abcd good again, but $ echo "Abcd" | sed -n "/b /p" sed: -e expression #1, char 2: unterminated address regex What's the problem with the error report?
`/b/p` is a complete sed command. Each sed command needs to be on a single line. When you say `/b` on one line, sed treats it as a syntax error. You can try by echo "abcd" | sed -n "/b" and see the result. You can also try echo "abcd" | sed -n "/b/p > p" and observe that after the command is completed, the next command takes effect.
stackexchange-unix
{ "answer_score": 1, "question_score": 1, "tags": "sed" }
Calculating a certain Laurent series (two parts) I'm trying to solve the following problem: Let $t \in \mathbb{R}$ be fixed and let $$ e^{[\frac{t(z - 1/z)}{2}]} = \sum_{n \in \mathbb{Z}} J_n(t)z^n$$ be the Laurent expansion in $\mathbb{C}$*. Show that (a) $J_n(t) = \frac{1}{\pi} \int_0^\pi \cos(t\sin(\theta) - n\theta)\,d\theta.$ (b) $J_{-n}(t) = (-1)^n J_n(t)$. I've done a few basic calculations so far but haven't really gotten anywhere. For part (a), using the theorem about the representation of holomorphic functions as Laurent series, I know that $$J_n(t) = \frac{1}{2\pi{i}} \int_{\gamma} \frac{(e^{\frac{t(z - \frac{1}{z})}{2}})}{z^{n+1}}\, dz,$$ where $\gamma(s) = e^{2\pi{i}s}$ for any $s \in [0, 1]$. But I'm not quite sure of where to start in order to put this in the desired form stated in (a). Any help would be appreciated!
For $a)$, consider the path $\gamma(t) = e^{i 2 \pi t}$ for $0 \leq t \leq 1$. This is a unit disk, it doesn't get much better than this. If we express the function as a Laurent series centered at 0 as $\sum \limits_{n \in \mathbb{Z}}c_nz^n$, we know that the coefficients $c_n$ is given by $\frac{1}{2 \pi i}\int_\gamma \frac{f(z)}{z^{n + 1}}$. It is routine to verify that this integral cannot have an imaginary part by using the power series representation of the exponential function. That is, it is an honest to goodness real-valued number. The result then follows from the definition of the integral. Then Bob's your uncle! For $b)$, consider the power series representation of $J_n$.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "complex analysis, complex integration, laurent series" }
How to install antlr4? I read a lot in the antlr4 doc on github and I kind of understood how it works. The thing is I am not a pro java coder, I am trying to use antlr4 with python. Anyway I reached a deadend on the step to execute this antlr4 -Dlanguage=Python2 Hello.g4 I downloaded the antlr4 complete.jar but I don't know how to setup or use it. so any help?
I found the -jar paramater easiest to use, so my command line (in a batch file) looks so: set LOCATION=antlr4-4.5.4-SNAPSHOT.jar java -jar %LOCATION% -Dlanguage=Cpp -listener -visitor -o generated/ -package antlrcpptest TLexer.g4 TParser.g4 taken from the C++ ANTLR runtime demo. You don't need to change your classpath, nor have to add any environment variables (or doskeys).
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "java, python, python 2.7, antlr, antlr4" }
How can I apply a uniform format after finishing a presentation? I realize that the slide master dictates a certain style on any new slides that are added to the presentation. However, users are free to override the style dictated by the slide master. Once all of the presentation content has been finalized, **is there a way to reapply the slide master** across the presentation in order to obtain uniform formatting (e.g. consistent bullets and fonts) on all slides prior to finalizing the presentation?
**PowerPoint 2003** 1. Go to Format > Slide Layout to open the Slide Layout task pane. 2. Select the slides you want to reapply the master layout to. 3. In the Slide Layout task pane, find the layout that you want to reapply. 4. Click the arrow on that layout and then select _Reapply Layout_. **PowerPoint 2007 / 2010** 1. Select the slides you want to reapply the Slide Master formatting to. 2. On the Home tab of the ribbon, in the Slides section, click the _Reset_ button. !Reset button in PowerPoint 2007
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "formatting, microsoft powerpoint, presentations" }
how to explain in a statistical way, if revenue increase in several store but overall no change Let's say, Target has implemented a new store management methodology and applied to 100 stores went well as revenue increase. but once extend to all 1000 stores not seeing the lift of revenue. How to analyze/explain this in a statistical way? I was thinking about this is kinda a quasi-experiment based on the different time intervals. first, the revenue increase might not be significant. second, the interrupted time series usually have concerns that the two different time interval will introduce temporal variant. so the treatment and control are not independent. What is a good comprehensive way to explain this?
I do not know your particular numbers, but you may have encountered an example of _Simpson's paradoxon_. Arithmetically, it boils down to the observation that $$\frac{s_{11}}{n_{11}} < \frac{s_{21}}{n_{21}} \quad\mbox{and}\quad \frac{s_{12}}{n_{12}} < \frac{s_{22}}{n_{22}}$$ does generally _not_ imply $$\frac{s_{11} + s_{12}}{n_{11}+n_{12}} < \frac{s_{21} + s_{22}}{n_{21}+n_{22}}$$ For examples and a detailed discussion, see > Wang B, Wu P, Kwan B, Tu XM, Feng C.: "Simpson's Paradox: Examples." Shanghai Arch Psychiatry. 2018;30(2):139-143.
stackexchange-stats
{ "answer_score": 1, "question_score": 1, "tags": "hypothesis testing, statistical significance" }
Increment query string parameters using jquery function on button click I'm making a next page system in which you click on 'next' and it takes you to the next set of elements. This is the button in php: <input id="nextbtn" type="button" value="Next"></input> This is the jquery function: $('#nextbtn').click(function(){ }); The URL is: `www.domain.com?var1=0&var2=20` I want to increment `var1` and `var2` by 20 everytime the 'next' button is clicked. Please tell me the code I should write in the jquery function so that this works.
You can get query string current value: function getQueryStringParameterByName(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } Now call this function in your next button click and add increment value: var var1 = parseInt(getQueryStringParameterByName('var1'),10)+20; var var2 = parseInt(getQueryStringParameterByName('var2'),10)+20; and set it to url and redirect.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, jquery, query string" }
Trigger iSeries job on new message in data queue IBM WebSphere MQ has functionality called triggering that allows for an iSeries program to be called when a new message arrives on the queue. Is there a way to allow for the same functionality with a native iSeries data queue?
Yes, set up a CL program that waits on the QRCVDTAQ() API and when a message comes in, call the program, submit a job, etc. The sender would be sending messages that contain the library/program or perhaps even the entire CALL command. You can use QCMDEXC() in the CL to run/submit the program.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "message queue, ibm midrange" }
Java process pegging CPU at 100% We have an application which is running normally in a variety environments. However, at one client site when the application invokes a child process (in this case CODEFIND.EXF - please see enclosed displayed) it pegs the processor at 100%. I need help in interpreting the display. Although the display seems to indicate that the parent process is consuming all the resources, could it in fact be due to the child process that the parent process invoked? How could I tell this? Thank you, Elliott !enter image description here
The display indicates that the culprit is java.exe. That indication is correct. The child process is not consuming CPU.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "java, windows, cpu usage, taskmanager" }
Cannot list all folders in /data/data in few apps I have a rooted Android 11. Using Termux, or Es File Explorer, I can see all the 284 directories in `/data/data`. Unfortunately, many file explorer apps ( _with_ root privileges, such as Total Commander, ZArchiver) can only see 2 folders : `com.google.android.gms` (don't know why), and their own data folder. I thought this was related to this, but apparently no since I granted the root privileges to both apps... How could I see all the folders in /data/data using (for example) Total Commander? Doing a `chmod 755` in Termux? Or maybe there is a problem with these apps as if they they don't use root privileges if at least one folder/file is visible in "normal user" mode?
To mark this question as solved. As @alecxs said, these apps does not handle correctly mounting namespaces, and therefore we need to select in Magisk settings `Mount Namespace Mode`->`Global Namespace` instead of Inherit.
stackexchange-android
{ "answer_score": 1, "question_score": 2, "tags": "root access, file permissions" }
Eigenvectors Shared By Two Matrices **Background:** * $\bf{x}$ is an eigenvector of matrix $A$ corresponding to eigenvalue $\lambda$. * $M = 7I -2A + A^2$ * Where $I$ is the identity matrix and $A^2 = AA$ **Question:** How do we know that $\bf{x}$ is also an eigenvector of the matrix $M$? What are the eigenvalues that go with this matrix? Is there a formula that relates the eigenvalues to the operations on $A$ that form $M$? This relation seems arbitrary, yet I've checked (with _Mathematica_ ) it's true for a variety of matrices... Thanks!
Let's calculate $M\mathbf x$ and see what happens: $$M\mathbf x=(7I-2A+A^2)\mathbf x=7\mathbf x-2A\mathbf x+A^2\mathbf x=7\mathbf x-2\lambda\mathbf x+\lambda^2\mathbf x=(7-2\lambda+\lambda^2)\mathbf x$$ where we used the fact that $A^2\mathbf x=A(A\mathbf x)=A(\lambda\mathbf x)=\lambda A\mathbf x=\lambda^2\mathbf x$. Hence $\mathbf x$ is an eigenvector of $M$ with corresponding eigenvalue $7-2\lambda+\lambda^2$. Perhaps unsurprisingly, this generalizes as follows: if $P(\lambda)$ is a polynomial and $M=P(A)$, then $\mathbf x$ is an eigenvector of $M$ with eigenvalue $P(\lambda)$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "matrices, eigenvalues eigenvectors" }
sqldatasource and dropdown list I have 2 DropDownLists, the first one has a SqlDataSource with only one field, and another DropDownList has a SqlDataSource with a where clause baseed on the selection of the first drop down. If I press a button the second drop down list populate with the query but how can I make it to populate after selecting an item from the first one.
you can handle the `SelectionChangeCommitted` event of first combo box. And then after building the datasource you can assign it to your second combobox. Like below private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { //build your datasource with the query comboBox2.DataSource = datasource; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c#, asp.net" }
moving CGPoint a certain distance along a certain heading...iphone this seems like such a simple problem but I have been unable to find an answer (and im no good at math). I am trying to move a UIView to a new CGPoint X distance away along a certain heading. What is the formula for determining the new coordinates? (i do no want this to be animated, just an instantaneous move) something like: x = 100; (current x value) y = 150; (current y value) d = 25; (distance to move the point) h = 90; (west) \\\ insert formula to determine new x,y coords self.car.center = (CGPointMake ([newX],[newY]);
If **p** is your point, D is the distance, and θ is the heading-angle from the X-axis, > **p** new.x = **p** old.x + D * cos(θ) > **p** new.y = **p** old.y + D * sin(θ) Rather than storing distances and angles, though, this is usually done using vectors (which removes the need for the sin/cos)
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 3, "tags": "iphone, objective c, trigonometry, heading, cgpoint" }
Is a map from a smooth curve, bijective away from the singularities, already a normalization? Over $\mathbb{C}$, I am considering a map between projective curves $f: C \rightarrow C'$, where $C$ is smooth. Suppose that $f$ is surjective as well as bijective away from the singularities of $C'$. Does it already follow that $C$ is a resolution of singularities? The converse is clear, but I'm not sure how to formally prove this direction (if it is true at all).
We use the following fact: if $X$, $Y$ are integral schemes of finite type over $\mathbb{C}$ and $f: X \to Y$ is bijective and $Y$ is normal, then $f$ is birational. See Akhil Matthew's post in < for the proof of this fact. Now it's easy: look at $$f : C \backslash f^{-1}(\text{ Sing }(C')) \to C' \backslash \text{ Sing }(C')$$ and it satisfies the above criterion. Hence, $f$ is birational. It's well-known that if two smooth curves are birational, they are isomorphic. Hence $C$ must be isomorphic to the normalization of $C'$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "algebraic geometry, algebraic curves" }
PHP function running inside loop not working (with code) I am running this function function Age($month, $day, $year) { date_default_timezone_set('America/New_York'); $dob = $month .''. $day .''. $year; $startDate = strtotime($dob); $endDate = time(); $dif = $endDate - $startDate; return $years = (date('Y', $dif) - 1970) .' y, '. ($months = date('n', $dif) - 1).' m'; } inside a `foreach` loop (some CodeIgniter markup): foreach ($users as $row) { echo $this->includes->Age($row->birth_month, $row->birth_day, $row->birth_year) } The loop works OK, showing all my users. But the problem is that it calculates the age correctly for the first user and then shows that same age for all other users. I should point out that all other user's data is correct, only the age is wrong. Anyone know how to fix this? Thanks!
Your `$dob` looks malformed. Try `$dob = $year . '-' . $month . '-' $day;`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "php, function, codeigniter, loops" }
Screen keeps Loading forever So I just started Working with Sencha Touch 2 and I am already running into some issues. I am currently working through the getting started tutorial but then I'm stuck because after I've made some changes and refresh the page, the loading screen just keeps loading non-stop. This prevents me from moving forward with the tutorial because not matter what I do, it just keeps loading. I tried creating a new project but then run into the same issue again. Can anyone help with this? I would really appreciate it. Thanks!
I think this is because you must have something in your code that throws an error and therefore prevent the application from executing properly. Maybe you should try to debug it with Firebug Hope this helps
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "javascript, extjs, sencha touch 2" }
Anonymous Private Chat in SignalR I'm somewhat new to SignalR. I understand hubs to a limited degree, but I don't understand how two users can share a connection while excluding others. My scenario is that I want an unauthenticated public website user to be able to initiate a private (not necessarily secure) chat session with a customer service user. Is there an example or resource that my point me in the right direction? I've looked at a few resources, including < but haven't found the right scenario.
You can create groups, so add some methods to your hub (a subscribe method should return a Task as they are asynchronous...) public Task SubscribeToGroup(string groupName) { return Groups.Add(Context.ConnectionId, groupName); } Then you publish notifications to users of that group as normal but via the groups collection... public void BroadcastMessageToGroup(string groupName, string message) { Clients.Group(groupName).onCaptionReceived(message); } Now only subscribers of that particular group will get the message! Hope this helps. You can find a tutorial here for SignalR Groups. <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "c#, .net, signalr" }
Loop Over Python Dictionary (using C API) Twice? I'm currently writing a Python module in C. In it, I have a dictionary that I iterate over like so: PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(index, &pos, &key, &value)) /* do interesting things here */ Later in the same method, I then want to loop over the dictionary again. However, `PyDict_Next(...)` continues to return `NULL`. Is there any way to reset the internal iteration counter used by `PyDict_Next(...)`?
The iterator is initialized by setting pos to 0. You can restart the iterator by setting pos to 0 again. PyObject *key, *value; Py_ssize_t pos = 0; while (PyDict_Next(index, &pos, &key, &value)) /* do interesting things here */ pos = 0; while (PyDict_Next(index, &pos, &key, &value)) /* do even more interesting things here */
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python c api" }
Using GraalVM to run Java on Heroku Is there any ability to use GraalVM to run Java apps on Heroku? I read a lot articles about cold starts of Java applications with GraalVM AOT (ahead-of-time) compilation feature and how it decrease startup time and I'd like to try to use it in my projects deployed on Heroku.
This buildpack can be used with the Heroku Java buildpack to replace the default JDK with Graal by running: $ heroku buildpacks:set $ heroku buildpacks:add heroku/java
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "java, performance, heroku, cold start" }
How to fetch data between weeks in different year in Mysql In my table there is a column for week and date. How I can fetch data between 2015 **week** 52 to 2016 **week** 2\. sorry for my bad English :(
Try this query which may solve your problem. SELECT * FROM TABLE WHERE (WEEK(date)>=52 AND YEAR(date)=2015) OR (WEEK(date)<=2 AND YEAR(date)=2016);
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": -1, "tags": "php, mysql" }
Geoserver WFS-T, write to PostGIS and default table values (current_user() and now()) In my table definition I have default values for auditing i.e logging the database user creating the record and time date_created date NULL DEFAULT now(), edited_by varchar NULL DEFAULT "current_user"(), When a record is inserted via Geoserver WFS-T these default values are not triggered. I am curious to why and if I can do something about it? Both these basic examples triggers the default values to inject expected default values INSERT INTO test_table (notes, dato, edited_by) VALUES('test', now(), "current_user"()); INSERT INTO test_table (notes) VALUES('test2'); Make me belive Geoserver actually produces this SQL? INSERT INTO test_table (notes, dato, edited_by) VALUES('test', null, null);
Solved using triggers in the database for the operation rather than rely on default table definitions.
stackexchange-gis
{ "answer_score": 0, "question_score": 1, "tags": "postgis, geoserver, wfs t" }
How to change the Accounts-UI template? According to the Telescope example (source code), it is possible to display a custom accounts-ui form (see his user_signin.html) and use `{{loginButtons}}` (see his nav.html) to keep the other things by default from `Accounts-UI package`. I am looking for 2 hours how this is possible. Any idea how to achieve this?
You can configure the Accounts UI with Accounts.ui.config. For example: Accounts.ui.config({ requestPermissions: { facebook: ['user_likes'], github: ['user', 'repo'] }, passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL' });
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "templates, overriding, meteor, user accounts" }
What does [\0-9] mean in regex (perl)? [\0-9]{10,15} I tried to match phone numbers and ended up writing that regex, and it does match phones containing `+`, `(`, `)` , but I don't understand why.
`\0` is a `NUL` byte, the byte `0x0`. The range expresses the range of characters from `0x0` to "9" (`0x39`), which happens to include a bunch of characters like "+". In fact, the range spans the first 58 characters of the ASCII table. See < So "##########" would also match your regex.
stackexchange-stackoverflow
{ "answer_score": 20, "question_score": 4, "tags": "regex, perl" }
Remainder of $100^{10k} \text{ by } 13$ I have to find out the remainder of the Euclidean division of $100^{10k}$ by $13, k \in \mathbb{N}$ Could anyone support me with some hints
first lets calculate the remainder for $100^k, k\in\mathbb{R}$ for k=1, R=1 for k=2, R=9 for k=3, R=3 for k=4, R=1 As you can see, the remainder only depends on k mod 3.(mod returns the remainder) So what about $100^{10k}$? Let's calculate 10k mod 3.(since k is an integer, I'll start with k=1) for k = 1, R = 1 for k = 2, R = 2 for k = 3, R = 0 for k = 4, R = 1 ... So when K mod 3 = 0, then 10k mod 3 = 0, so the remainder will be 1 So when K mod 3 = 1, then 10k mod 3 = 1, so the remainder will be 9 So when K mod 3 = 2, then 10k mod 3 = 2, so the remainder will be 3
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "elementary number theory" }
What's the subscript for the last sample, if $m$ sampled from $n$ with replacement and without ordering? Source: p. 25 on the page = p. 41 of 288 in the PDF. _Lecture Notes in Applied Probability_. Please see the screenshot beneath that I can't reproduce with MathJAX. 1. Am I right that $k_n$ means the $n$th ball drawn? 2. Please see the question beneath. Because $m$ (which can $> n$) is the number of drawings, shouldn't the last drawn ball be $k_m$? > ![enter image description here](
1. Yes, $k_i$ will be the _label_ of the $i$th ball that you draw. For example if you draw three balls and they are "5", "2", and "4", then $(k_1,k_2,k_3)=(5,2,4)$. 2. Yes, that is a typo, it should be $k_1,\ldots, k_m$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "combinatorics, proof verification" }
check if user likes a page with Laravel Socialite I'm using Laravel Socialite to make users log in to my site. I've managed to do that and store the user's data. But now i want to find out how i can check if that particular user (when logged in) has liked my facebook page. Thank you so much!
Socialite is a package that handles authentication using Facebook, Twitter, LinkedIn, Google, GitHub and Bitbucket. It does not have the ability to retrieve information regarding user likes. You can use the facebook-php-sdk inorder to get the pages that user has liked. The code below is from the facebook graph api documentation on how to get the pages that the user has liked. /* PHP SDK v5.0.0 */ /* make the API call */ $request = new FacebookRequest( $session, 'GET', '/{user-id}/likes' ); $response = $request->execute(); $graphObject = $response->getGraphObject(); /* handle the result */
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "laravel, laravel socialite" }
How can I use SECURE_SSL_REDIRECT with a Cache-Control header? I've enabled `SECURE_SSL_REDIRECT` in the settings of my django deployment, so now these headers are getting sent to the client: < HTTP/1.1 301 MOVED PERMANENTLY < Date: Fri, 19 Feb 2016 15:57:50 GMT < Server: Apache/2.2.15 (Red Hat) < Location: < Content-Length: 0 < Content-Type: text/html; charset=utf-8 The main disadvantage with 301 redirects is that they tend to be cached for a very long time by browsers, so I would quite like to add a `Cache-Control: max-age=604800, must-revalidate` header to this. Preferably, I would like a way that doesn't involve re-implementing `SECURE_SSL_REDIRECT`.
You can try overriding Django's `SecurityMiddleware` to add the http headers you need. Below is a full implementation of the middleware: class CustomSecurityMiddleware(SecurityMiddleware): def process_request(self, request): response = super(CustomSecurityMiddleware, self).process_request(request) # SecurityMiddleware returns an HttpResponsePermanentRedirect only if # the request should be redirected if response is not None: response['Cache-Control'] = 'max-age=604800, must-revalidate' return response This implementation retains everything that Django's `SecurityMiddleware` does already, while adding the custom http headers you need. The custom middleware should replace SecurityMiddleware in `settings.MIDDLEWARE_CLASSES`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "django" }
How to set maximum width of message bubbles in MessageKit I have been using MessageKit for my live chat feature for my application. One of the issues I am running into is that long messages just look very weird on the screen as the width of the bubbles doesn't seem to be restricted. I wanted to figure out a way to be able to set the maximum width of the chat bubbles so that they format more like a text conversation on the native imessage application. Currently my messages look like this, but I would want the message below to be less wide and taller: ![enter image description here](
You can adjust the right/left padding for incoming/outgoing messages respectively. The default padding is: public var incomingMessagePadding = UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 30) public var outgoingMessagePadding = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 4) And you can set the padding on the layout object in your messages view controller like this: let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout layout?.setMessageIncomingMessagePadding(UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 50)) layout?.setMessageOutgoingMessagePadding(UIEdgeInsets(top: 0, left: 60, bottom: 0, right: 4)) You can see more examples of layout changes in the AdvancedExampleViewController in the MessageKit example project.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, swift, layout, chat, messagekit" }
How does carbon dioxide or water vapour absorb thermal infra red radiation from the sun? We are all told at school water vapour and carbon dioxide are the top two greenhouse gases, and that they absorb thermal infra red radiation, trap heat and warm up the Earth. My question is how do they do that? Why can't Oxygen or Nitrogen or any other gas not absorb infra red radiation as well as water vapour or CO2?
As you can see on these absorption spectra for $\textrm{H}_2\textrm{O}$ and $\textrm{C}\textrm{O}_2$, both molecules have moderate to strong absorbtion in the mid-IR wavelengths, with the absorption of $\textrm{C}\textrm{O}_2$ extending out into the longer wavelengths. Other molecules common in the atmosphere don't have such strong absorption at the wavelengths given off by thermal radiation. If you are asking why that is, I'm afraid I can't give you a very detailed answer, except to say that the absorption spectra of molecules (and atoms) is governed by quantum mechanics. Maybe somebody else can explain how they would be calculated from principles, but that is beyond my education.
stackexchange-physics
{ "answer_score": 6, "question_score": 16, "tags": "atmospheric science" }
python; counting elements of vectors I would like to count and save in a vector `a` the number of elements of an array that are greater than a certain value `t`. I want to do this for different `t`s. eg My vector:`c=[0.3 0.2 0.3 0.6 0.9 0.1 0.2 0.5 0.3 0.5 0.7 0.1]` I would like to count the number of elements of `c` that are greater than `t=0.9`, than `t=0.8` than `t=0.7` etc... I then want to save the counts for each different value of t in a vector my code is (not working): for t in range(0,10,1): for j in range(0, len(c)): if c[j]>t/10: a.append(sum(c[j]>t)) my vector a should be of dimension 10, but it isn't! Anybody can help me out?
I made a function that loops over the array and just counts whenever the value is greater than the supplied threshold c=[0.3, 0.2, 0.3, 0.6, 0.9, 0.1, 0.2, 0.5, 0.3, 0.5, 0.7, 0.1] def num_bigger(threshold): count = 0 for num in c: if num > threshold: count +=1 return count thresholds = [x/10.0 for x in range(10)] for thresh in thresholds: print thresh, num_bigger(thresh) Note that the function checks for strictly greater, which is why, for example, the result is 0 when the threshold is .9.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "python, arrays, numpy, vector, count" }
Big Sur - Archive error in xcode12 for pod sparkle Before updating to big sur my project worked without any problem... After updating I keep getting errors saying Undefined symbol: _OBJC_CLASS_ $_SUUpdater and Command CompileSwift failed with a nonzero exit code I'm using pod --> sparkle for updating my program. Is there any solution for this??? I have tried deleting sparkle and reinstalling + rebooting mac + cleaning up build folder + restarting xcode.. none of it helped. ![enter image description here]( image description here](
This same error was happening for me in release builds of Fluency when using Sparkle v1.22.0. I updated to 1.24.0 via Cocoapods and it doesn't happen for me anymore, so I'm guessing there was some work done at some point between those versions which made Sparkle work correctly with arm64 architectures (for the new M1 devices). Discussion about it on Sparkle's github page: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "xcode12, macos big sur, sparkle" }
Understanding power supply requirements I have a basic question about power supply requirements for typical transceivers. I'm looking at the specs for a Kenwood TM-V71A, which is a 50W mobile transceiver. I figured that a 50W transceiver running on a 12V(-ish) power supply would pull around 4A max, but the specs for this radio show a "maximum current drain" of around 13A. How does that work?
A 50W transmitter is one that can create 50 watts of RF output. The RF amplifier is never 100% efficient, so the input power requirements will always be higher than the output power. Furthermore, the maximum current drain accounts for startup transients and other peaks in excess of the average current drain.
stackexchange-ham
{ "answer_score": 10, "question_score": 10, "tags": "dc power" }
Google Sheet API, PUT: this.http.put(...).map is not a function I'm trying to make a simple `PUT` call to google sheets API. I followed some of the `http.put` syntax, but keep getting the error: `this.http.put(...).map is not a function.` My code block: return this.http .put(url, JSON.stringify(data), {headers: headers}) .map( (res: any) => { res.json(); console.log ("transaction data updated to google seets:"+res.json()); } );
Did you import ? import { map } from 'rxjs/operators'; **EDIT** You need to import the above, also i would recommend you to use HttpClient instead of HttpModule which would remove the res.json(), your code will look like, set the options as, return this.http.put(url, JSON.stringify(formData), this.options) .pipe(map(response => response.json()));
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, angular, google sheets api" }
SonicWALL NSA 220 degraded egress performance We have a SonicWALL NSA 220 running SonicOS Enhanced 5.8.1.2-20o. Our ISP provides a symmetrical 100/100 ethernet handoff. Performance on the ingress achieves the full 100Mbps while egress only achieves ~30-40Mbps. What am I not considering in troubleshooting this? Is there anything that might cause this type of asymmetry in performance? Here is what I have done so far: • Disabled auto-negotiation on WAN interface and coordinated hard coded 100/Full Duplex setting on ISP gateway • Confirmed MTU is 1500 bytes on all devices on the local ethernet • Confirmed MTU is 1500 bytes on firewall and ISP gateway and ISP next hop • Confirmed all services are disabled on SonicWall (including CFS, DPI, BWM, LB, etc.) - it is pretty much just running a stock configuration minus some port forwarding rules • Observed high CPU utilization (65%-95% for periods in excess of 10 minutes under a relatively light load 58 connections)
The issue was resolved by updating the firmware. Firmware was updated to 5.9.x.
stackexchange-networkengineering
{ "answer_score": 4, "question_score": 2, "tags": "routing, firewall, sonicwall" }
iOS device battery life when developing I have an iPhone and an iPad that are constantly connected through USB to my MacBook Pro 8 hours a day. The battery of both device is always at 100%. Will this hurt my devices battery life? I've researched into alternatives to build and debug from XCode via WIFI or Bluetooth but I find out that those features were dropped by Apple due to stability issues. Are there other alternatives?
I don't think it will hurt your iPhone. The charger is smart enough to stop charging when necessary. It is the number of charge/use cycles that degrade battery life and if you are attached most of the time its doing neither. I have had mine attached to a cable most of the time for over a year and not seen any degradation.
stackexchange-apple
{ "answer_score": 1, "question_score": 0, "tags": "ios, battery, lightning" }
Enumerate rows in each group starting from one I have a dataframe (which is sorted on date, date column is not included in the example for simplicity) that looks like this: df = pd.DataFrame(['A', 'B' , 'B', 'A', 'C', 'B'], columns=['letters']) letters 0 A 1 B 2 B 3 A 4 C 5 B I want to create a new column that counts the occurrence of each value in the `letters` column, increasing 1 by 1 as the value occurs in the `letters` column. The data frame I want to reach is like this: letters occurance_counter 0 A 1 1 B 1 2 B 2 3 A 2 4 C 1 5 B 3 Any help would be amazing, thanks in advance!
You can `groupby` and use the method `cumcount`: df['occurance_counter'] = df.groupby('letters')['letters'].cumcount().add(1) Result: letters occurance_counter 0 A 1 1 B 1 2 B 2 3 A 2 4 C 1 5 B 3
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, pandas, dataframe, count, pandas groupby" }
Removing options from select with regex in jQuery I am using following selector to remove single item in select. jQuery("#stateCity option[value='Adak, AK, USA']").remove(); I want a selector that can remove all cities of a state. Like `*, AK, USA` will remove all cities of Alaska in the combo. So what regex I should use to do it in one line? Of if I have to loop it. How can I do that. <select name="stateCity" id="stateCity"> <option value="Adak, AK, USA">Adak, AK, USA</option> <option value="Akhiok, AK, USA">Akhiok, AK, USA</option> <option value="Redwood, CA, USA">Redwood, CA, USA</option> <option value="AL, USA">AL, USA</option> </select>
Try this `jQuery("#stateCity option[value$='AK, USA']").remove();` Demo: < `$=` selects any element that the value ends with that you specified, in this case `AK, USA`. Read more at <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "jquery, regex, jquery selectors" }
Restricted inheritance in java I know that class A { } class B extends A { } class C extends B { } is completely legal and I can C obj = new C(); obj.anyMethodfromA(); is possible. Now question is this What if I don't want to access **class A** methods in **class C** only **class B** methods should be inherited. Is this possible? C anotherObj = new C(); anotherObj.anyMethodfromA(); //can be illegal? anotherObj.anyMethodfromB(); //should be legal.
You cannot remove `classA` methods from `classC`, all you can do is override the classA method in classC and throw UnsupportedOperationException. like class C extends B { @override public void someMethodWasInClassA() { throw new UnsupportedOperationException("Meaningful message"); } }
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "java, inheritance, multiple inheritance" }
AlarmManager.setExact undefined I'm upgrading one of my apps to work properly on Kit Kat, and it depends on an exactly timed alarm. Now the API changes page says that you must use a new call, setExact, to get this behavior back in 4.4. I'm attempting to use it but Eclipse is telling me that setExact is undefined, and indeed it doesn't appear in the auto-completion popup. Any thoughts?
Set your build target (Project > Properties > Android) to API Level 19 (or higher, if you're reading this answer sometime in the future when we have higher than 19).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "android, alarmmanager, android 4.4 kitkat" }
$6^{66}\equiv r \pmod {66}$ The answer doesn't need to be exact, the possible answers to the exercise are "between 30 and 40", "from 50 to 66" or something akin to that. I've no idea how to solve this. Previous problems of this kind were simple usage of Euler's theorem but I don't see how I can apply it in this case.
Notice $\,\ {\rm mod}\ 11\\!:\ \ \color{#c00}{6^5\,\equiv\, -1}\,\ $ by $\,\ 6(6^2)^2\equiv 6(3)^2\equiv 6(-2)\equiv\color{}{ -1}$ Therefore $\ 6^{65}\equiv (\color{#c00}{6^5})^{13}\equiv (\color{#c00}{-1})^{13}\equiv\color{#0a0}{ -1},\,$ so $\,6^{65} = 11n\color{#0a0}{-1}\,\overset{\times\,6}\Rightarrow\, 6^{66} = 66n-6$
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "elementary number theory" }
How to make case insensitive constraints? How do I make a case insensitive constraint on a varchar. So if I inserted the same `dob` but the name's where `bob` and `Bob` they would be considered as duplicates? CREATE TABLE customer( name varchar(32) NOT NULL, dob date NOT NULL, CONSTRAINT test_uq UNIQUE (LOWER(name), dob) ); INSERT INTO customer (name, dob) VALUES('bob', '01/01/2020'); // This would work INSERT INTO customer (name, dob) VALUES('Bob', '01/01/2020'); // This would not work because its a duplicate even though it Bob and not bob
Define the column with a case-insensitive collation: CREATE TABLE customer( name varchar(32) collate utf8_general_ci NOT NULL, dob date NOT NULL, unique (name, dob) ); By default MySQL is case-insensitive, so I assume your server or database has set the collation to a case-sensitive collation. Here is a db<>fiddle.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql, sql, constraints" }
らせる typo for される or different word? > **** > > The strong wind, similarly to the quasi-deified dragon, makes its serpentine body twist like a spiral with the intention of swallowing the corridor and the (man) with the skull mask. I think this could be an acceptable translation, but I consider as a typo for . Is it another form completely?
is not a suru-verb and doesn't make sense anyway. If it's not a typo, maybe the author wanted it to be read as . Does the author of this novel like "creative" readings like this? Anyway, I don't know why this doesn't come with furigana.
stackexchange-japanese
{ "answer_score": 6, "question_score": 3, "tags": "grammar" }
difficult to find the current location of agents in Anylogic simulation i built a simple model for pedestrian movement from start line towards target line, I want to find the number of moving agents in some area using the XY-coordinates (from X=150 to X=350, Y is the same ) ![enter image description here]( The action for the event is to get the count of agents in that area and set the value for the variable crowd1: ![enter image description here]( crowd1=count(agents(), p-> p.getX()>150 && p.getX()<350) the problem is that it's always 0 , even though the gents are moving in the simulation.
There are no agents in your environment because you haven't created any agent type... For your code to work you need to have a population of pedestrians registered in your environment (meaning that you have to create the agent type and add it to main as a populatin), and then you have to add to a custom population the agents created in pedSource... Otherwise, you can use this code: count(pedGoTo.getPeds(),p->p.getX()>150 && p.getX()<350)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "simulation, anylogic, agent based modeling" }
duplicate html element with jquery anyone knows of any jquery plugin that handles duplication of some random html elements? I'm looking for a way to dynamically add identical rows to a form. I know its not hard to make, but i don't really want to reinvent the wheel here.
From jQuery API The .clone() method, when used in conjunction with one of the insertion methods, is a convenient way to duplicate elements on a page. $('originalSelector').clone().appendTo('selectorToPlaceClone')
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "javascript, jquery" }
Issue with grid and Blender Unit (Screenshot attached) I hope all is well. I've been having an issue with Grids and the Blender Unit during my 3D designs. For context, I want to set the Blender Unit (length) to be 1:1 with millimeters. I'm expecting that to mean that every subdivision of the grids should equal 1 mm. But, as you can see from the screenshot, it still equals 1000 mm or 1 meter. Does anyone happen to know what I'm doing wrong here? ![enter image description here](
Try setting the _unit scale_ to `.001`. The drop down settings only affect what prefix is used to display the units, not the actual scaling. ![enter image description here](
stackexchange-blender
{ "answer_score": 1, "question_score": 1, "tags": "units" }
onTap: () async {} => moveToHome(context), in this line "=>" this is giving me error Expected to find ')'.dart(expected_token)It is shown in the image
You can use the method in different ways. Writing a few here onTap: () => moveToHome(context), Or onTap : (){ moveToHome(context);}, if you want to call an async method you can try onTap: () async{ await moveToHome(context);} Or onTap: () async => moveToHome(context),
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "flutter, dart, flutter layout, flutter dependencies, flutter animation" }
How can I add fractional times in R? I have large number of dates in this format: dt = as.POSIXct("2004-04-02 12:45:00 UTC") And I have to add/subtract numbers that may not always be whole numbers.I am using lubridate library. Example: dt - days(2) [1] "2004-03-31 12:45:00 UTC" But, dt - days(1.5) Error in validObject(.Object) : invalid class “Period” object: periods must have integer values Is there an alternative for this operation?
The error is occurring with `days(1.5)`, which doesn't allow fractional periods. You could do: dt - days(1) - hours(12) or dt - 1.5*24*3600 or there's probably a base date function that guys like @DirkEddelbuettel know about that would work also. Ah, it's `difftime` (I don't work with dates enough to remember these things off the top of my head). dt - as.difftime(1.5, units="days") And, as pointed out by @maximusdooku: dt - ddays(1.5) (Based on the code, it looks like `ddays` just returns the number of seconds in the requested time period, plus some class information.)
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 6, "tags": "r, datetime, lubridate" }
Why does the Linpack Benchmark solves two Matrixes (n and n+1)? I'm currently testing several Linpack Apps as well as the original Linpack from netlib.org. While most currently available Implementations of the Linpack Benchmark only calculate a give Matrix (e.g. 500x500), the original Linpack was meant to calculate two Matrixes for a given dimension n. n and n+1 (eg. if n is 500 -> then first 500x500 and 501x501) as far as how I understood how these things work. But why does it calculate the second Matrix with n+1?
That is what I wondered when I produced a version, for PCs (that had low resolution timers in the early days). This was accepted by Netlib in 1996 and can be found there: < I believe that it was looking for memory address alignment performance issues that must have been important at some time. The following has results for this on PCs and other versions for Windows, Linux and Androids, including Java. < This version is unsuitable for multiprocessors but users are allowed to implement their own linear equation solver. See: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "benchmarking" }
Как подставить переменную в Select [psycopg2] У меня произошел переход на Postgresql в библиотеку psycopg2. До этого я сидел на sqlite3 задача следующая у меня до postgresql был такой запрос: result = self.cursor.execute('SELECT * FROM `user` WHERE `user_id` = ?', (user_id,)).fetchmany(1) return bool(len(result)) а теперь мне нужно сделать схожий запрос в psycopg2. Спасибо за помощь!
вопрос был решен таким образом crs = connection.cursor() class all_user_class: def user_exists(self, user_id): user_id_select = "SELECT * FROM users WHERE user_id = %s" crs.execute(user_id_select, (user_id,)) result = crs.fetchone() return bool(result)
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, sql, postgresql" }
.Xaml doesn't render unicode that write in the code? In .xaml of windows store app, If I write like this: <TextBlock Text="&#x2606;" /> It will render a star. But If I write like this in C# code: TextBlock tb = new TextBlock { Text = "&#x2606;" }; it won't render, why? How to render the unicode write in c# code??
The `&...;` notation is an XML encoding, there is no decoding applied to C# strings. Use TextBlock tb = new TextBlock { Text = "\x2606"; // Or just: // Text = ""; };
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "c#, silverlight, xaml, unicode, windows store apps" }
Is there a way for content assist to allow wildcard characters in Eclipse? This is not the first time that I would have needed that... In the example bellow I would love to have all set*Listeners listed so I wouldn't have to scroll trough all the houndreds of methods to find the listener setter I need. !eclipse camelCase content assist Is there a way to do that, or any alternative that lets me search trough the content assist results more effectively? (Allowing a wildcard character would be a really good start)
The Eclipse Code Recommenders project includes subwords completion which seems to be what you are looking for. In your example, it will find _setListener_ when completing on _sLis_. You don't even have to type in a wildcard. Keep in mind that subwords completion is not activated by default. Go to _Preferences > Code Recommenders > Completions_ and activate the _Subwords-Completion Processor_.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "eclipse, content assist" }
Constructing a field with the roots of the polynomial $x^2-3$ and $F=\mathbb{Z}_5$ I'm stuck trying to figure out this problem. The polynomial $x^2-3$ is irreducible in $\mathbb{Z}_5$. I know that if $F[x]/f(x)$ is a field since $f(x)$ is an irreducible polynomial. I'm not sure how this plays into showing that this allows us to construct a field with the roots of the given polynomial and given field.
You can show $F[\sqrt 3] \simeq F[x]/(x^2-3)$, where $(x^2-3)$ denotes the principal ideal generated by the function. Consider the evaluation homomorphism $\varphi : F[x] \to F[\sqrt 3]$, $\varphi (g) = g(\sqrt 3)$. Show ker $\varphi = (x^2-3)$ and use the 1st Homo. Theorem. $F[\sqrt 3]$ is the splitting field of $x^2-3$ over $F=\mathbb Z _5$ since $x^2-3=(x+\sqrt 3)(x+4\sqrt 3)$ in $F[x]$.
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "abstract algebra" }
Vuetify : how to change items-per-page select items in v-data-table component? In data table component footer , there is select option that i need to change its numbers How can I do it ? ![enter image description here](
It should be applied to v-data-footer, but if you want to apply that to v-data-table, the items per page can be set in that way: <v-data-table :footer-props="{'items-per-page-options':[15, 30, 50, 100, -1]}" ...>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, vue.js, vuejs2, vuetify.js" }
how to read txt file and upload in database using php I have a txt file file.txt with content 'hello, this is the test file'. I need to read this file and insert the content in database using php. I tried following:: $var = file_get_contents('file.txt', true); $result = mysql_query("INSERT INTO `mytable`.`json_dump` (`json`) VALUES ('$var')", $con); if ($result) { echo 'successful'; } else { echo 'got error'; } But it displays got error. How to fix it??
Fix your SQL query: `'INSERT INTO hitchernet.json_dump (json) VALUES ("' . mysql_real_escape_string($var) . '")'`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "php, mysql" }
In a world where magic can only be used for baking, how can this be exploited to naturally lead to invention of space travel? basically what the question says. Of course, magic must preserve the conversation of energy. Baking is defined in the normal way: > the action of cooking food by dry heat without direct exposure to a flame, typically in an oven.
Think of all the time/effort/energy that is used in the cooking of Food. Especially in a Medieval setting. That's now gone. That frees up a significant portion of time to devote to non-necessity pursuits. Then there is the other reason for cooking food - not only does it taste yummy, but it kills bugs/parasites/bacteria - meaning it's safer to eat and there was a study from 2012 that indicated that cooked Meat in particular is good for brain growth - so to answer your question: We needed to spend less time cooking (cause magic) and we grew bigger brains (cause cooked meat) - which causes a significant societal pivot into Science and Technology, leading to a much shortened time period to achieve space travel.
stackexchange-worldbuilding
{ "answer_score": 3, "question_score": 3, "tags": "magic, space travel" }
How do I use $location to to get the protocol host and port of my current url in a factory How do I get the current protocol host and port of my current url? app.factory('actionTypeFactory', ['$resource', function($resource, $location){ return $resource($location.protocol() + '://'+ $location.host() +':'+ $location.port() +'82/somelocation') }]); I would like the url to look like this: http:// localhost:80 /somelocation
You must inject the $location service, that's why it is undefined: app.factory('actionTypeFactory', ['$resource', '$location', function($resource, $location){ return $resource($location.protocol() + '://'+ $location.host() +':'+ $location.port() +'82/somelocation') }]);
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 13, "tags": "angularjs, location, factory" }
Flask-Mail - Any way to request Read Receipt? I just spent a little time browsing similar questions on here, and it looks like some mail frameworks have a way of sending the proper signals to a mail client for the confirmation of read receipts. The project on which I am working must have Read-Receipts requested as all the recipients have auto-sent read receipts enabled, and also have images blocked so I'm unable to use image-loading for tracking. I'm most familiar with Python, Flask, and Flask-Mail, which is why I'm starting here to see if anyone knows a way to request this through these frameworks, or perhaps knows what to add to a to a mail header to request this. Thanks!
So after a little more research and testing, in the absence of a specific setting in Flask-Mail for read-receipts, it is possible to request them by defining the header `Disposition-Notification-To` using `extra_headers` in the Flask-Mail `Message()` definition in order to trigger a read-receipt request: sender = '[email protected]' recipient = '[email protected]' msg = Message(subject='Testing Read Receipt', recipients=[recipient], sender = ('Testy McTesterson', sender), extra_headers={'Disposition-Notification-To': sender})
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "email, flask, flask mail" }
Adding List Data to a Text File I am trying to save the list of data from C# code to a text file. It throws an error at `foreach` stating that list cannot be converted to string. Any ideas where I am going wrong? I have to Run Application only on .Net Framework 3.5 IList<FolderDetails> ListToCheck; using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\LogFile.txt")) { foreach (string line in ListToCheck) { file.WriteLine(line); } } public class FolderDetails { public string PropertyGroupName { get; set; } public string ProjFiles { get; set; } }
Examine this code: IList<FolderDetails> ListToCheck; using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\LogFile.txt")) { foreach (string line in ListToCheck) You say ListToCheck is a list of objects of type FolderDetail, but in foreach (string line in ListToCheck) you try to assert that the type is string instead. Try something like foreach (FolderDetail line in ListToCheck) { file.WriteLine(line.SomeAppropriatePropertyOfFolderDetail);
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "c#, list, foreach, notepad" }
Image detector website I'm looking for online image recognition website. How it works is when I submit a photograph to the website, the website will tell me information about the photo. For example: This photo is Mona Lisa painting. Painted by Leonardo Da Vinci. Have you found some website like that?
I know two websites that try to match the image you supply with others that are found in the web, then you can visit the results' sites and find more info. * TinEye * GazoPa Good luck!
stackexchange-webapps
{ "answer_score": 3, "question_score": -2, "tags": "webapp rec" }
Regex for getting the first occurring matching pair Given that you can reference a capture group in a regex pattern, is it possible to use said capture group in a `lookbehind`? if you have the string "monkeys eat bananas, bananas are terrified of monkeys" bananas is the first matched pair, while monkeys is the first word that has a match. I can get monkeys without any issue (\w+).*\1 # returns monkeys But if I want to get the word which matches first I would need to be able to do something like this (?<=\1)(\w+) However, this fails, and I would guess for the simple reason that when the `lookbehind` is evaluated, `\1` means nothing. Is there some more regex magic that I have not come across yet, that would allow me to match something like this?
Many regular expression engines require backreferences to appear _after_ the group which they reference (see my related question about this behavior in .NET) Try using a lookahead instead: (\w+)(?=.*\1)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "regex" }
Refresh admin authentication token Is it possible to refresh the admin authentication token? At the current default implementation it expires after 10 minutes. $header = ['Content-Type' => 'application/json']; $authJson = json_encode([ 'grant_type' => 'client_credentials', 'client_id' => $key, 'client_secret' => $secretKey, ]); $auth = new GuzzleRequest('POST', '/api/oauth/token', $header, $authJson);
You cannot refresh tokens of `client_credentials`. Just fetch a new token instead.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "shopware6" }
Should the XSLT and XSL tags be merged? The tags xsl and xslt seem to be used pretty interchangeably on StackOverflow. In most, if not all cases, I feel that xslt is how the question should be tagged. In many cases, questions are tagged as both. Could the two tags be merged into xslt?
The semantic distinction between "XSL" and "XSLT" may be useful in some contexts, but SO's tag taxonomy isn't one of them. I browsed through the top 30 or so questions tagged with "xsl" to see if I could find one that was about XSL and not XSLT, and couldn't. In all cases, the questioner was using "XSL" and "XSLT" interchangeably. This shouldn't be terribly surprising; people to whom the distinction between the two is significant don't ask a lot of questions about either of them. There are times when I'm adamant that the proper terminology be used (do not say "nodes" when you mean "elements" in my hearing), but I think that cleaving to this particular distinction, in this particular context, probably does no good and may do a little harm.
stackexchange-meta
{ "answer_score": 13, "question_score": 11, "tags": "discussion, status completed, stack overflow, tags, retag request" }
Multivariate calculus: how to differentiate the trace of inverse Let $C$ be $m \times n$. Let $\Sigma$ be $n \times n$ and symmetric. Note that $C \Sigma C^T$ will also be symmetric in this case . Also let $A$ be $m \times m$. I am faced the following: $$\frac{\partial \operatorname{tr}( [C \Sigma C^T]^{-1}A)}{\partial C}$$ and $$\frac{\partial \operatorname{tr}( [C \Sigma C^T]^{-1}A)}{\partial \Sigma}$$ I read the matrix cookbook but I am still having trouble to solve these 2 quantities. Can someone kindly guide me through this please ?
Let $$\eqalign{ M &= C\Sigma C^T \cr B &= M^{-1}AM^{-1} \cr }$$ Write the function and its differential in terms of these new variables $$\eqalign{ f &= A:M^{-1} \cr\cr df &= -A:(M^{-1}\,dM\,M^{-1}) \cr &= -B:dM \cr &= -B:(dC\,\Sigma C^T+C\Sigma\,dC^T+C\,d\Sigma\,C^T) \cr &= -(BC\Sigma+B^TC\Sigma):dC - (C^TBC):d\Sigma \cr }$$ The colon denotes the inner/Frobenius product, which is a compact infix notation for the trace $$X:Y={\rm tr}(X^TY)$$ The respective gradients are seen to be $$\eqalign{ \frac{\partial f}{\partial C} &= -(B+B^T)\,C\Sigma \cr\cr \frac{\partial f}{\partial\Sigma} &= -C^TBC \cr\cr }$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "multivariable calculus, self learning, matrix calculus" }
creating prototype using es6 I created the following JS code: ;(function($w) { var Article = function() { this.articles = {}; return this; } Article.prototype = { constructor: Article, loadArticles: function(data) { //do something } } $w.article = new Article(); })(window); And when I to do the same function in ES6 i do the following class Article { constructor() { this.modules = {}; return this; } constructor() { return loadArticles.apply(this, arguments); } loadArticles(data) { //do something } } I been using < to learn how to use/code ES6 without luck. Could anyone help me point out my issues?
This is the ES6 of your first bit of code class Article { constructor() { // var Article = function() ... this.articles = {}; } loadArticles(data) { // Article.prototype.loadArticles = function() ... // do something... } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "javascript, ecmascript 6" }
select values at specified indices in a list I got a list, call in `listIn` with `n` number of elements. I got another list, call it `ind` with `m` elements (`m<n`). `ind` is indices I want to keep in `listIn`, and remove others. I can do it by running a loop, but I am curious is there is a smart way to do it. Eg. listIn = [0,1,2,3,4,5,6,7,8,9,10]; // 11 elements ind = [4,7,8] // 3 indices Result = drop all elements excepts ones at 4,7,8.
listIn = ind.Select(i => listIn[i]).ToList();
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 0, "tags": "c#, .net" }
How do you prefer between &cycle->read_events[i] and cycle->read_events+i &cycle->read_events[i] cycle->read_events+i They are the same,how do you prefer one to the other?
Assuming cycle->read_events is a pointer or array, they are identical within the language and will compile identically. However, I prefer `&cycle->read_events[i]`, because someday you might decide to port to C++ and use a vector or other container class. Such classes are more likely to have a `[]` operator than to implement `+` as "pointer arithmetic". So this way makes it easier to change the data type without needing a recompile. (Personally, I also find `&a[x]` to be more expressive of intent than `a+x`, but that is purely a matter of taste.)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c, syntax" }
compare strings from two columns and make sure their substrings are not the same I have two columns: Location1 | Location2 --------------------------- Canada*ab*av USA*nm*mn Canada*vn*mv Canada*ty*av I want to select all the rows where the first part of the string (before the first '*' ) are different. So in the example I would get the first row because Canada and USA are different, but I would NOT get the second row because CANADA and CANADA are the same. I tried something like this, but it looks like it is a syntax error: select * from tab WHERE substring_index(location1, '*', 1) <> substring_index(location2, '*', 1)
> select * from tab WHERE substring_index(location1, ' _', 1) <> substring_index(location1, '_', 1) Shouldn't you compare Location1 vs Location2? And i would suggest to keep the word case to be the same as your table. I.E. use Location instead of location.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql" }
Is December somehow special in Google Sheets? I count the number of transactions made per month =if(COUNTIF(ArrayFormula(month( indirect($H$12&"!$F$3:F") )),10) =0,"",COUNTIF(ArrayFormula(month( indirect($H$12&"!$F$3:F") )),10) ) Where `10` is `October`, while referencing a sheet named in `$H$12`. This works well for months 1-11. When it comes to December, I am getting a seemingly random (wrong) integer back. Is December somehow special?
I ended up using `Filter`. Seems to work perfectly fine `=COUNTA(filter(indirect($H$12&"!$A$3:A"),month(indirect($H$12&"!$F$3:F"))=10))`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "google sheets" }
Sum of SQL columns in codeigniter I have a SQL table as follows: +---+--------+------------+ |ID | AMOUNT | PRODUCT_ID | +---+---------------------+ |1 | 100 | 5 | |2 | 100 | 5 | |3 | 100 | 5 | |4 | 100 | 10 | |5 | 100 | 10 | |6 | 100 | 10 | |7 | 100 | 10 | +---+--------+------------+ I'm using codeigniter and expecting to get the `SUM OF AMOUNTS` according to the `PRODUCT_ID` dynamically. the required output is: sum of product_id 5 = 300 sum of product_id 10 = 400
Use `GROUP BY` with `SUM` like this: SELECT product_id, SUM(amount) AS TotalAmount FROM tablename GROUP BY product_id; **Results** : | product_id | TotalAmount | |------------|-------------| | 5 | 300 | | 10 | 400 |
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "sql, codeigniter" }
Get Date format from Data My input source has date present in all possible formats, I want to write generic code to decode all the possible dates that might be present. I am trying to fetch the date format from data itself, is it possible to get the format from data? I tried writing some if conditions to get the format, but my confusion is around dates like 2019-06-07 - it can be interpreted as 2019 June or 2019 July as well. In the code snip below if we are able to fetch dateformat from data itself, the problem will be solved import datetime dateformat='%Y/%m/%d' try: pk = datetime.datetime.strptime('2018/06/13', dateformat) except: pk = False if pk: print(pk.date()) else: print('issue with date')
There's no way to do this 100% correctly: the example you gave _is_ ambiguous, but YYYY-DD-MM would be very unlikely. Something like 01/02/2019 means 1st of February in the UK and January 2nd in the US, and there's no way to tell which without metadata.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "python, date, datetime, format" }
Change the image on submit in HTML I want to change the image of a button on clicking it. Below is my code, but it is not working. Please help me on that. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Image</title> </head> <body> <h1>My Image</h1> <p> <img src="C:\Users\Hrushikesh\Pictures\iCloud Photos\Downloads\2015\IMG_3695.jpg" alt="HTML5 Icon" style="width:256px;height:256px;"> </p> <button onclick="picturechange()"><img src="C:\Users\Hrushikesh\Desktop\star2.jpg" alt="HTML5 Icon" style="width:16px;height:16px;" id="pic1"></button> <script> function picturechange() { document.getElementById("pic1").src="C:\Users\Hrushikesh\Desktop\star1.jpg"; } </script> </body> </html>
Your image may not be showing up due to the following **reasons** : * You need to add `file:///` prefix before loading any of local resources with full paths. * You may be getting an error ' **Not allowed to load local resource** ' in your browser if you are running your webpage through a Web Server.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html" }
How can I repair a drain that won't stop leaking? I have a kitchen drain that won't stop leaking. I've checked, and it's definitely leaking from around the joins in the PVC pipe. I've replaced several of the o-rings (washers), as well as the P trap (bend). The pipes are all joined with o-rings and lock-nuts and they're as tight as my programmers hands can make them. Is there anything else I should try before simply replacing the whole setup?
Respectfully disagree with Shirlock. OVER tightening of PVC joints damages them and causes leakage. Hand tight is snug, not SO TIGHT YOUR HANDS HURT. Take a look at this article for more information. The "Do's and Don'ts" of Assembling Threaded Plastic Fittings
stackexchange-diy
{ "answer_score": 5, "question_score": 3, "tags": "water, leak, sink, drain" }
dplyr Exclude row I am looking for an dplyr equivalent on SELECT user_id, item FROM users WHERE user_id NOT IN (1, 5, 6, 7, 11, 17, 18); -- admin accounts I can use `users %>% filter(user_id != 1)` but can't imagine using multiple `&&` all the way. Is there a way to exclude a number of rows?
You can use `!` and `%in%`: filtered_users <- filter(users, !user_id %in% c(1, 5, 6, 7, 11, 17, 18)) This is based on < I just googled "dplyr not in" and this was the first result. Google is your friend when learning new things. Also, as @thelatemail said, `%in%` is a base R function.
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 6, "tags": "r, dplyr" }
Can we use return rdr using a stored procedure in C#? I have table as follows emp_id, emp_name, emp_address, emp_salary, emp_rating I would like to get all the above rows ... I have written stored procedure as follows: CREATE PROCEDURE [dbo].[fetch_empdata] @empid int AS SELECT * FROM emptable WHERE emp_id = @empid; string connection = "Data Source=" + server + ";Initial Catalog=" + dbase + ";User ID=" + userid + ";Password=" + password; conn = new SqlConnection(connection); conn.Open(); SqlCommand cmd = new SqlCommand(storedprocedure, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@empid", empid)); rdr = cmd.ExecuteReader(); Is there a way to use a command return rdr? I would like to return all the values of this table to some other class. Or do I have to explicitly move var empid = rdr("EMPID")?
Once you get your `SqlDataReader` like this: rdr = cmd.ExecuteReader(); you now need to enumerate over the result set: while(rdr.Read()) { int emp_id = rdr.GetInt(0); string emp_name = rdr.GetString(1); string emp_address = rdr.GetString(2); decimal emp_salary = rdr.GetDecimal(3); int emp_rating = rdr.GetInt(4); // do something with those variables.... then move on to next row } What you do with those variables is entirely up to you - whatever makes sense for you. Stick them into an object and put all objects retrieved into a `List<Employee>` or something - whatever you want. Also: you might need to check for NULL values, too - before calling `.GetString/.GetInt` etc. - otherwise you'll get an exception.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, .net, sql" }
MATLAB classification trees (fitctree) I tried to build a classification tree for the following table: < The script I wrote is as following (after consulting the documentation and previous questions on this forum): TBL = [1,1,1,0,1,0 ; 2,1,1,1,0,1 ; 3,0,0,1,0,0 ; 4,0,1,0,1,0 ;... 5,1,0,1,1,1 ; 6,0,0,1,1,0 ; 7,1,0,0,0,0 ; 8,0,1,1,1,1]; DT = fitctree(TBL(:,2:5), TBL(:,6), 'SplitCriterion', 'deviance',... 'CategoricalPredictors','all'); view(DT,'mode','graph') Yeah... The table is only an image on a PDF so I had to write it by myself... Anyway, I got a nullified tree: < Does anyone know what the problem in the script is? Thanks ahead
It is ok to be irritated by the fact that the problem was working with only 8 samples in the training set, isn't it? I don't see any mentioning of it in documentation so my fix is basically duplicating TBL. works like magic (no need to care for the first column here, as it remained unused anyway): TBL = [1,1,1,0,1,0 ; 2,1,1,1,0,1 ; 3,0,0,1,0,0 ; 4,0,1,0,1,0 ;... 5,1,0,1,1,1 ; 6,0,0,1,1,0 ; 7,1,0,0,0,0 ; 8,0,1,1,1,1]; TBL = [TBL;TBL]; TBL = [TBL;TBL]; DT = fitctree(TBL(:,2:5), TBL(:,6), 'SplitCriterion', 'deviance',... 'CategoricalPredictors','all'); view(DT,'mode','graph') ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "matlab, decision tree" }
clearInterval when the setInterval has finished the whole execution I have used clearInterval to stop the execution of setInterval when a function is called. var myVar; function myFunction() { myVar = setinterval(function(){ alert("Hello"); }, 3000); } function myStopFunction() { clearInterval(myVar); ... } But the problem is the clearInterval doesn't wait that setInterval has finished to execute the entire code.... therefore I have an error. How can I do this? (if it is possible)
You'll need to put your post-stopping code in a callback as well. You can check if this has been set before starting the next iteration, and then again inside your interval callbacks. var myVar; var stopCallback = null; var processing = false; function myFunction() { myVar = setInterval(function(){ processing = true; // don't let the finishStopping() code run yet alert("Hello"); someOperationWithCallback(function() { /* inside your deepest level of callback */ processing = false; if (stopCallback) finishStopping(); }); }, 3000); } function myStopFunction() { stopCallback = function() { /* work to do after stopping */ }; if (!processing) finishStopping(); } function finishStopping() { clearInterval(myVar); stopCallback(); stopCallback = null; }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, node.js, setinterval, clearinterval" }
javascript - convert localtime to different timezone Does anyone know how to convert "Date().getTime()" to UTC? Obviously the getTime() is the users local time so I need a function to get the users timezone, convert the timestamp to UTC so I can then * it by -8 to get the current PST time.
`Date.getTimezoneOffset()` as seen here. It returns the user's browser time relative to GMT, which you'll compare to your server time, relative to GMT.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "javascript" }