INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Compilation type step for JavaScript I guess I am used to compiled static languages. Is there a way to do the following with JavaScript. JavaScript that mostly uses jQuery 1. Validate JavaScript script (also HTML document may be available), maybe use jslint 2. Run unit tests 3. Compress a set of JavaScript files into one large JavaScript file (maybe obfuscated) Do you have an approach for compiling all of those steps into one command? Like an ant script or maven script?
1. Unit testing 2. Google Closure compiler for minimizing javascript. 3. Javascript obfuscation approaches
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, jslint" }
How to disable content after the content has expired I want to disable Content(not to permanently delete the data) after the product has crossed his/her Expiration date
add a `status` into product row if product is not crossed the set `status` to `enable` and if it has crossed the set status to `disable`. and according to status you `show/hide` the content. you sql query to dosplay content like, "select * from tab where status = 'enable'"; if your data is too large then suggest to use boolean for status like 0/1 into status column.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": -4, "tags": "php, phpmyadmin" }
Proving tautology Trying to prove if this statement is a tautology: $\neg (p\to q) \to p$ I can simplify the left hand side $\neg (p\to q)$ to $p\land \neg q$, but once I get there I'm stuck.
Apply the equivalence of implication twice, then commute and associate so that you can apply identity rules. $$\neg(p\to q)\to p \\\= (p\to q) \vee p \\\ = (\neg p \vee q)\vee p \\\ \vdots$$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "logic, propositional calculus" }
Duplicate acc on accepting personal answer in activity view Is this a bug? A fluke? I don't really know how to go about duplicating it except for the obvious (create another answer, mark it accepted). Not sure if my being mod over there has anything to do with it (if so, another mod can quickly jump on this as "not an issue"). !shows duplicate acc on list
You asked the question and accepted your own self-answer, for two acceptance events. This is also why there's no actual reputation bonus for either one. But if you check the links, one should point to the question while the other would point to the answer.
stackexchange-meta
{ "answer_score": 4, "question_score": 4, "tags": "support, accepted answer, recent activity" }
Master method - polynomially and asymptotically comparison This might be a trivial question but want to ensure that I had sound understanding. In the master method, when we try to solve recurrences, we typically compare two functions (asymptotically and polynomially) to determine which case of the master method is applicable. For example, comparing $f(n)=n$ with $g(n)=n\log n$, we can say that $g(n)$ is asymptotically larger than $f(n)$, but the polynomial relation between the two functions cannot be determined because the ratio between the two functions is $\log n$ (which less than polynomial). How about comparing $f_1(n)=n$ with $g_1(n)=n+\log n$? I expect $f_1(n)$ and $g_1(n)$ to be equal (asymptotically and polynomially) because $g_1(n) \in O(n)$. Right?
It depends on how you define asymptotic equivalence, but assuming the standard definition, which is that $f \sim g$ if $\lim_{n \to \infty} \frac{f}{g} = 1,$ then we have at once that $n \sim n + \log n$, since $\lim_{n \to \infty} \frac{n + \log n}{n} = \lim_{n \to \infty} 1 + \frac{\log n}{n} = 1$. Indeed, this limit of the ratio ($1$) turns out to be a polynomial, so they are also polynomially equivalent per your definition.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "algorithms, recurrence relations" }
Deploying an SWT application on Java Webstart Is it possible to deploy SWT applications using JNLP. Especially loading the swt native library (dll in Windows, so in Linux)? Any links? I found one at IBM Developer Works, however it just describes using swt.jar. In addition to that, is it possible to load the native dll files over JNLP?
The IBM developer works article you linked to contains everything you need to know including how to load the native dll files. Notice the nativelib element in the resources. The jar file referred to here will contain any native libraries required by the application. See here for an explanation of using nativelib.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "swt, jnlp, java web start" }
Sorting a list of items in a list box I want to get an bunch of items from a list box, add them to an array, sort it, then put it back into a different listbox. Here is what I have came up with: ArrayList q = new ArrayList(); foreach (object o in listBox4.Items) q.Add(o); q.Sort(); listBox5.Items.Add(q.ToString()); But it doesnt work. Any ideas?
ArrayList q = new ArrayList(); foreach (object o in listBox4.Items) q.Add(o); } q.Sort(); listBox5.Items.Clear(); foreach(object o in q){ listBox5.Items.Add(o); }
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 11, "tags": "c#, winforms, listbox, arraylist" }
Proof explanation: Let $\mathsf{V,W}$ are vector spaces, $u\in\mathsf{V}$, then $[\mathsf{T}(u)]_\gamma=[\mathsf{T}]_\beta^\gamma[u]_\beta$ I don't understand the step: $[g(1)]_\alpha=[g]_\alpha^\gamma$ in the proof below. Is there any other way to prove it? $\dagger$ The theorem 2.11 it uses is $[\mathsf{T}f]_\alpha^\gamma=[\mathsf{T}]_\beta^\gamma[f]^\beta_\alpha.$ * * * ![enter image description here](
$\alpha=\\{1\\}$ is the basis for $F$ and $g:F\to W$. So the matrix of $g(1)$ with respect to $\gamma$ is the matrix of $g$ with respect to $\gamma$ and $\alpha=\\{1\\}$.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "linear algebra, proof explanation, alternative proof" }
Showing a set is measurable. Let $X=Y=[0,1]$, equipped $X$ by giving Lebesgue measure on Borel sigma-algebra and equipped $Y$ by giving counting measure on the power set of $Y$. Define $D=\\{(x,x):0\leq x\leq 1\\}$ then how do we show that $D$ is measurable set in product sigma-algebra?
$D$ is closed and hence $$ D\in \mathcal{B}([0,1]^2)=\mathcal{B}([0,1])\otimes \mathcal{B}([0,1]). $$
stackexchange-math
{ "answer_score": 0, "question_score": 2, "tags": "measure theory" }
Store $(java -version) into a bash variable Why when I do this: `$ var=$(java -version)` on my bash terminal, `var` is always empty? Same thing with `$ java -version >> version.txt` nothing is sent to the version.txt file.
The command usually send such information to STDERR, not STDOUT. So in your case you should use commands like: java -version >>version.txt 2>&1 and var=$((java -version) 2>&1)
stackexchange-superuser
{ "answer_score": 3, "question_score": 0, "tags": "bash, java" }
Android AOSP linux service standard output Im developing my own watchdog linux service (init.rc) for an android image Im cooking. These linux services use some log libraries like log.h to show the output of such services. I have tried to track these libraries in order to find where that log output is dumped. I havent found anything neither in the android logcat nor /proc/kmsg or dmesg This is the log.h library for the linux services started in init.rc: #ifndef _INIT_LOG_H_ #define _INIT_LOG_H_ #include <cutils/klog.h> #define ERROR(x...) KLOG_ERROR("init", x) #define NOTICE(x...) KLOG_NOTICE("init", x) #define INFO(x...) KLOG_INFO("init", x) #define LOG_UEVENTS 0 /* log uevent messages if 1. verbose */ #endif And this is an example of using such library INFO("Starting watchdogd\n");
to display log from your service in init.rc you can start your service with **/system/bin/logwrapper** example **service xupnpdx /system/bin/logwrapper /system/bin/xupnpdservice**
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 6, "tags": "android, c, linux, linux kernel, android source" }
How to test if two RMSE are significantly different? Say I have two models for a regression task and from each model I get a RMSE. One RMSE is smaller than the other, however I wish to test if the difference is statistically significant in order to be able to say that one model is better than the other. How can I do it?
To test whether two (root) mean squared prediction errors are significantly different, the standard test is the Diebold-Mariano test (Diebold & Mariano, 1995, _Journal of Business and Econonomic Statistics_). We have a diebold-mariano tag, which may be useful. I also recommend Diebold's (2015, _Journal of Business and Econonomic Statistics_ ) personal perspective on uses and abuses twenty years later.
stackexchange-stats
{ "answer_score": 7, "question_score": 6, "tags": "statistical significance, rms, diebold mariano test" }
Change Cursor on Portion of Image I have a circular image. How do I change the cursor only on the circle part, not the whole square? If it makes any difference, the rest of the image is transparent.
How about adding something like this? .circular { width: 300px; height: 300px; border-radius: 150px; -webkit-border-radius: 150px; -moz-border-radius: 150px; background: url( no-repeat; } <div class="circular"><img src=" alt="" /></div>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "css" }
Is there a way to know which tags I created? > **Possible Duplicate:** > Can I find out which tags I have created? Seeing this question about the Taxonomist badge caused me to wonder how close I am to said badge. Is there a way to see which tags I've created?
If there is I would love to know about it, but as far as I know there is no simple method of finding out who was the first to create a tag. In theoretical terms, you could look for the oldest item with a certain tag, but that is not a guarantee to be the originator because tags can be changed and taken away, so the oldest may have been retagged at some point.
stackexchange-meta
{ "answer_score": -1, "question_score": 0, "tags": "support, tags, taxonomist badge, tracking" }
How is this derived $p(Y^cR) = p(Y^c)-p(Y^cR^c)$ How is this derived $$p(Y^cR) = p(Y^c)-p(Y^cR^c)$$
Think in terms of a Venn diagram. You can split $Y^c$ -- the event that $Y$ does not happen -- into two parts: $Y$ doesn't happen and $R$ does, and $Y$ doesn't happen and neither does $R$. In other words: $$ P(Y^c)=P((Y^c\cap R)\overset{\cdot}{\cup}(Y^c\cap R^c))=P(Y^c\cap R)+P(Y^c\cap R^c). $$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "probability" }
Could someone help me explain the algebra of these steps Im confused on the algebraic steps of this simplification. Im looking for someone to explain how the ^2 got removed and how $(2k^2+7k+6)$ gets simplifed to $(k+1)(k+2)(2k+3)$ from the image below ![enter image description here](
(This is a restatement of the comments, to help remove this Question from the Unanswered queue) * In the second line, $(k+1)$ appears as a factor of both terms in the numerator. It is then un-distributed and appears as the factor at the front of the numerator in the third line. * In the final step $2k^2+7k+6$ has been factored as $(k+2)(2k+3)$.
stackexchange-math
{ "answer_score": 3, "question_score": -1, "tags": "discrete mathematics" }
custom order of a python list i'm using **glob.glob()** to get a list of files from a directory. the result is this list. there is a way i can sort it using the int part of the filename? ['export_p-01.xml', 'export_p-02.xml', 'export_p-03.xml', 'export_p-04.xml', 'export_p-05.xml', 'export_p-06.xml', 'export_p-07.xml', 'export_p-08.xml', 'export_p-09.xml', 'export_p-10.xml', 'export_p-100.xml', 'export_p-101.xml', 'export_p-102.xml', 'export_p-103.xml', 'export_p-104.xml', 'export_p-105.xml', 'export_p-106.xml', 'export_p-107.xml', 'export_p-108.xml', 'export_p-109.xml', 'export_p-11.xml', ]
Here you go, with a custom lambda for using as key: In [1]: l = ['export_p-01.xml', ...] In [2]: sorted(l, key = lambda x: int(x.split(".")[0].split("-")[-1])) Out[2]: ['export_p-01.xml', 'export_p-02.xml', 'export_p-03.xml', 'export_p-04.xml', 'export_p-05.xml', 'export_p-06.xml', 'export_p-07.xml', 'export_p-08.xml', 'export_p-09.xml', 'export_p-10.xml', 'export_p-11.xml', 'export_p-100.xml', 'export_p-101.xml', 'export_p-102.xml', 'export_p-103.xml', 'export_p-104.xml', 'export_p-105.xml', 'export_p-106.xml', 'export_p-107.xml', 'export_p-108.xml', 'export_p-109.xml']
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python" }
What happened to @JsonSerialize in Jackson 1.9? Looks like `@JsonSerialize` annotation has gone missing in the newer versions of Jackson. Can't find what happened to them. Wanted to do the following in Scala: @JsonSerialize(using=classOf[YourSerializer]) @JsonDeSerialize(using=classOf[YourDeserializer]) I imported `import org.codehaus.jackson.annotate._`. When I go to compile, I get the following `not found: type JsonSerialize`. Where did it all go?
Looks like it was bundled in a new package. `import org.codehaus.jackson.map.annotate._`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, scala, jackson" }
Getting zeros every time while using random function in Python I am doing this as shown below. Initially I have a 2D array A = [(1,2,3) , (4,5,6)]. Now through a function func , I want to replace all the elements in both the two rows of array A by random numbers. I am trying but I am getting every element as 0 after execution of the function. Can somebody help. Remember I have to do this problem by using this function func and doing these slicing operations. import numpy as np import random A=np.array([(1,2,3),(4,5,6)]) def func(B): B[0:3]= np.random.random((1,3)) return(B) for ic in range(0,2): A[ic,:]= func(A[ic,:]) print(A) Output Everytime I am getting zeros. There should be random numbers in both the rows of array A . I think the random number generator is generating zeros every time. Can somebody help ?? [[0 0 0] [0 0 0]]
The way you are constructing the array `A` is such that it will always have integer dtype. You can check with `print(A.dtype)`. This means that values that are between 0-1 are getting cast to zero which is a problem because `np.random.rand` only returns values between 0 and 1. You can fix this in a few ways: 1. Construct using floats `A=np.array([(1.,2.,3.),(4.,5.,6.)])` 2. Set dtype explicitly `A=np.array([(1,2,3),(4,5,6)], dtype=np.float)` 3. cast to float type `A=np.array([(1,2,3),(4,5,6)]).astype(np.float)`
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "python" }
Instantiating WPF objects and making them available Below is some startup code to instantiate a ResourceManager for a WPF application. If I wanted this made available via xaml, would I put it in a resource dictionary? Use ObjectProvider? Something else? Is there a reason to prefer one method of object instantiation over another in a WPF app? Cheers, Berryl var asm = Assembly.Load("SampleApp.Common"); var resourceMan = new ResourceManager("SampleApp.Common.Resources.SupportedCultures", asm); DataContext = new MainWindowVm(resourceMan);
In my opinion the static class is the best solution if you don't need to replace dictionary during application lifetime: public static class SampleAppCommonResources { private static ResourceManager _Manager; public static ResourceManager Manager { get { if (_Manager == null) { var asm = Assembly.Load("SampleApp.Common"); _Manager = new ResourceManager("SampleApp.Common.Resources.SupportedCultures", asm); } return _Manager; } } } XAML usage: <Menu Tag="{x:Static local:SampleAppCommonResources.Manager}"> If there is multi-threaded environment, `_Manager` should be assigned using `Interlocked.CompareExchange` for instance.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wpf, resourcedictionary" }
CNAME records and Heroku domains This is my first time setting up custom domains, DNS and SSL and I am thoroughly confused. I have a heroku app running on `sagerenewables.heroku.com` with an SSL endpoint at `okinawa-64385.herokussl.com` My custom domain is `{www.}sagedataportal.com` and both are linked to `okinawa-64385.herokussl.com` in Heroku. I have 3 CNAME Records(in Namecheap): www -> parkingpage.namecheap.com www -> okinawa-64385.herokussl.com www.sagedataportal.com -> okinawa-64385.herokussl.com as well as 3 redirect domains: sagedataportal.com -> sagedataportal.com -> sagedataportal.com -> Clearly I'm doing something wrong but I don't know what. How are the CNN records supposed to look like? What about the heroku redirect URLs?
In order to map `www.sagedataportal.com` to the Heroku SSL endpoint you only need 1 CNAME: CNAME www okinawa-64385.herokussl.com Assuming your current DNS provider appends automatically the zone name after the www prefix. Remove all the other CNAMEs. As for the root domain (`sagedataportal.com`) the only way to map it to Heroku with SSL is by using a provider that supports the ALIAS feature. See < and < NameCheap currently doesn't support that feature hence you will not be able to use your SSL certificate with Heroku under the root domain.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ssl, heroku, dns, cname" }
WordPress localhost site redirect to live site I have download the code and export the database from server and setup the site on my localhost also I have been changed the home and site URL in wp_options table I am able to login at wp-admin but when I am clicking on the home page it redirect me to live site. If anyone know the issue please help me. Thanks in Advance.
Try following * If there are caching plugins installed like W3 total cache. Then purge cache first. Or may be disable them for time being * Perform Search and Replace in the database for Old Site URL. You can Use this Plugin * Reset Permalinks ( Dashboard >> Settings >> Permalinks ) * Last but not the least. Clear your browser Cache and History * In Chrome, you can try to clear your DNS cache before clearing _all_ your cache
stackexchange-wordpress
{ "answer_score": 12, "question_score": 16, "tags": "redirect" }
Question about continuity of piecewise function of two variables Let $$ f(x,y)= \left\\{ \begin{array}{ll} \left(x\sin\left(\frac{y}{x}\right),\frac{\cos (y) -1}{y}\right) & x \neq 0 \wedge y \neq 0 \\\ (0,0) & x = 0 \vee y = 0 \\\ \end{array} \right. $$ Is f continuous? My approach: For $x \neq 0 \wedge y \neq 0$, f is continuous because the composition of continuous functions is continuous. For $x = 0$ and $y = 0$ I look at the sequence $(1/n,1/n)$ and look at the value of f as n goes to infinity. The result is also $(0,0)$. Now my question is, whether it's sufficient to look at one sequence? I know that the sequence criterion should be valid for any sequences, so if I only look at $(1/n,1/n)$, that actually wouldn't prove the continuity correct? Also another question is whether I also would have to look at the points where x approaches 0, but y does not and the points where y approaches 0, but x does not?
It is not sufficient to look at a sequence. Can you find a counterexample? However, you have $$\vert x\sin(\frac{y}{x}) \vert \le \vert x \vert$$ for $x \neq 0$ so $f$ first component is continuous. And the second is also continuous as $$\lim\limits_{(x,y) \to (0,0)} \frac{\cos y - 1}{y}=\cos^\prime (0)$$ Finally a $f$ is continuous as its two components are continuous.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "multivariable calculus, continuity" }
'the second', 'the moment' compared to 'as soon as' with respect to simultaneousness I am looking for expressions that can substitute for **as soon as** as in the following context. What is important in this context is that the melting of snow happens extremely simultaneously and instantly as it reaches the ground. (Please excuse me, if the example sentence is clumsy. I am not a native English speaker and I'd like to be informed if there is something to fix with the sentence.) > Original Sentence(Context): _Snow is melting away **as soon as** it gets on the ground. So it won't pile up._ Below are what I came up with. 1. _Snow is melting away **the (very) moment** it gets on the ground._ 2. _Snow is melting away **the (very) second** it gets on the ground._ Can I use the expressions in article 1, 2 while keeping the connotation? If then, is there any difference in the degree of simultaneousness between them?
Yes, you can use either 1 or 2, and there is no significant change of meaning. In this sort of use "second" means simply "a very short length of time" and does not imply an actual measured period of one second. I would avoid the "very", as it adds little here, in my view. Other words which might be used here are "instant" or "minute". One might also write: * > Snow is melting away as it touches the ground. * > Snow is melting away as it lands on the ground. all of these imply more or less instant melting as the snow comes into contact with the ground.
stackexchange-ell
{ "answer_score": 1, "question_score": 0, "tags": "conjunctions, time" }
Nginx ssl - Passphrase is needed even with key without passphrase I generated new key using this, (I wanted start nginx without passphrase) > openssl rsa -in server.key.org -out server.key and everything looks fine, but when I try restart nginx it still ask for a pem passphrase(and even I typed the key it still ask for the passphrase...), default config in sites-available is fine. why pem is needed then? greetings
A PEM is a file that contains both the key and certificate data. The order is important, KEY first, CERT Second. It's possible that you did not update the PEM file accordingly.
stackexchange-serverfault
{ "answer_score": 0, "question_score": 0, "tags": "nginx, ssl" }
Can somebody explain this javascript fragment? // JavaScript source code var foo = (function () { var o = { bar: "bar" }; return { bar: function () { console.log(o.bar); } }; })(); foo.bar(); What is going on? Is foo an object? Is it a named function? This looks like a hideous way to provide the class concept of private data members....
They are called `IIFE`'s < Check this example where IIFE's are used < Usually javascript modules are written in the pattern. var foo = function () { var o = { bar: "bar" }; return { bar: function () { console.log(o.bar); } }; }; foo().bar(); AND var foo = (function () { var o = { bar: "bar" }; return { bar: function () { console.log(o.bar); } }; })(); foo.bar(); are similar.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "iife" }
New line in a TextBox with Return i have a TextBox but if i hit RETURN i dont get a new line. Is there any special command for that? Google returns result with TextWrapping but that is not what i want thx in advance
Assuming that you mean `TextBox` instead of TextBlock since it's not writable, You can acheive that by setting `AcceptReturns = "true"`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wpf, xaml" }
How to printout all the system variables , for example java.class.path I am wondeirng how to print out all the system variables. I would like to know if I can enumerate them all.
Do you mean like? System.getProperties().list(System.out); or for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) System.out.println(entry);
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "java" }
Are there disadvantages to using :before & :after CSS? Before I implement these to my site, just wanted to know if someone has any negative experience using :before and :after to design. (or outweighing positive aspects)
Well, by using pseudo element, you make it more semantic. You don't need to create empty element just for layout purposes. The cons, I believe some legacy browsers won't support it, but you can use polyfill for that.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "css, pseudo element" }
How to add a toggle input button in Active Admin? On one of my models, I want to use a toggle button instead of a radio button in the Active Admin form. ![enter image description here]( How can I do this?
You may find < useful. Check out the wiki for other resources.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "ruby on rails, ruby, ruby on rails 4, rubygems, activeadmin" }
Is it reasonable to evaluate spelling/grammar in reports for students diagnosed with dyslexia? Students diagnosed with dyslexia qualify for accommodations at most universities. As with other special needs students, they're entitled extra time for work, exams, access or licenses to spell checkers, etc. If these accommodations are in place, and assuming good grammar/spelling is part of the evaluation of work outlined in the university course syllabus, is it reasonable for an instructor to penalize students with dyslexia for making spelling/grammar mistakes as with other students?
I’ll go for a legal answer, at least valid in my current place of employment (France): dyslexia, which must be medically characterized as a learning disability for an individual, is covered by the laws regarding disabilities. As such, students impacted can request that **exam conditions be modified for their benefit** : most commonly by giving them additional time to “compensate” for their disability, but it could also include changes in setup (such as having access to a dictionary, spellchecker, or even a secretary). On the other hand, **no leniency should then be granted on judging the exam paper**. The operating principle in all cases should be that of **equal opportunity**. (See here a summary of jurisprudence by the _Association lyonnaise de droit administratif_.)
stackexchange-academia
{ "answer_score": 15, "question_score": 26, "tags": "language, disability, grading" }
Initialize class depending on config value I would like to find out how it is possible to initialize a `Module`, depending on a value. So I have a `config.extend` value which will decide if the `core` will instantiate of the `Core` or `ExtendedCore` module. However I am getting the error "value := is not a member of Sodor.core". val extend = 1 val core = Module(new Core(data_address)) if(extend==1){ core := Module(new ExtendedCore(data_address)) } What is the proper way to intialize a Module depending on the statement, like in this case? Thanks.
`:=` is the connection operator in Chisel. It is used for connecting Wires and Registers. What you really want to do is conditionally instantiate different Modules at elaboration time (ie. with Scala constructs _not_ Chisel constructs). Try the following: val extend = 1 val core = if (extend == 1) Module(new ExtendedCore(data_address)) else Module(new Core(data_address))
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "scala, if statement, module, initializer, chisel" }
Quadratic residues modulo pq Let us say we have the sets of quadratic residues $X = \lbrace x^2 \pmod{p}\rbrace$ and $Y = \lbrace y^2 \pmod{q}\rbrace$. Is there a way to construct the set of quadratic residues $Z_{\beta} = \lbrace x : x \equiv z^2 \pmod{pq} \land x < \beta \rbrace$ without having to go through $X \times Y$ and applying the Chinese Remainder Theorem $|X \times Y|$ times?
You can compute the two specific numbers $e, d \bmod pq$ with the property that $$e \equiv 1 \bmod p, e \equiv 0 \bmod q$$ $$d \equiv 0 \bmod p, d \equiv 1 \bmod q.$$ Then to find a number congruent to $x \bmod p, y \bmod q$ you just compute $ex + dy \bmod pq$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "elementary number theory, quadratic residues" }
Using "or" in list comprehensions I feel like I've somehow misunderstood the fundamental concept of how the 'or' keyword works in Python. I have the following code: word = "aarrgh" print(*[x for x in word if x == "a" or "r"]) and this is giving me: a a r r g h The same thing happens when using `==` or `!=`. What am I missing here? I cant find anything online explaining this so sorry if this is something obvious.
Your problem isn't specifically related to the comprehension. It's a question of how `or` and `==` works. `x == "a" or "r"` means `(x == "a") or "r"`. You should use one of these instead. print(*[x for x in word if x in ["a", "r"]]) print(*[x for x in word if x == "a" or x == "r"])
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, list comprehension" }
How to use custom syntax highlighter styles in DocBook 5.0 I have syntax highlighting on a docbook using a custom language highlighter based on the c++ example. How can I use different styles for the same highlighter type? for instance: <highlighter type="keywords"> <keyword>char</keyword> <keyword>const</keyword> <keyword>double</keyword> <keyword>true</keyword> <style>keyword</style> </highlighter> <highlighter type="keywords"> <keyword>Hotspot</keyword> <keyword>Character</keyword> <keyword>Region</keyword> <style>class</style> the second load of keywords should highlight with the style 'class' but how do I define and test for this non-default style?
Solved: <xsl:template match='xslthl:class' mode="xslthl"> <b style="color: green"><xsl:apply-templates/></b> </xsl:template> the 'mode' attribute seems vital
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, xml, xslt, docbook" }
Is there a way to mathematically model the coupling of Quantized EM fields in macroscopic circuits? I want to investigate (if it hasn't been done yet, which is very unlikely) how the coupling of a quantized em field couples to a circuit through for example an inductor. How can one do this? The circuit is a classical element and the field is a quantum element.
An LC circuit is basically a single mode of the EM field and can be treated as a harmonic oscillator. Some example can be found in the famous paper by Caldeira and Leggett.
stackexchange-physics
{ "answer_score": 1, "question_score": 0, "tags": "electric circuits, quantum electrodynamics, capacitance, inductance" }
Problem with Zend_Db_Abstract in Model I've found out that when I extends `Zend_Db_Table_Abstract` in my model I get # An Error Ocurred ## Aplication error When I run this code <?php class Admin_Model_News { protected $_name = 'news'; protected $_primary = 'new_id'; public function addNews($data) { $this->insert($data); } } It works properly, but when I run <?php class Admin_Model_News extends Zend_Db_Table_Abstract { protected $_name = 'news'; protected $_primary = 'new_id'; public function addNews($data) { $this->insert($data); } } It messes up What could be wrong? You can check some of my files here
Wrap the insert in a try catch block: try{ $this->insert($data); } catch (Exception $e){ echo $e->__toString(); } This will give you a more detailed error message then application error. AND PLEASE comment here if it doesnt work dont post a new question AGAIN.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, zend framework, zend db table" }
How to select only certain rows in a matrix in Matlab? I have a matrix `A` in Matlab A= [1 2 3 |1; 2 3 4 |2; 5 6 7 |2; 3 4 5 |1; 6 7 0 |3; 6 3 7 |3; 4 5 3 |1; 6 5 4 |4] where the last column contains natural indices possibly repeated. For each index in the last column, I want to select the first row of `A` associated with that index and create the matrix B=[1 2 3 |1; 2 3 4 |2; 6 7 0 |3; 6 5 4 |4]
Use `unique` to get the values and indices you require: [U,I] = unique(A(:,4), 'first') Then A(I,:)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "matlab" }
integrate "public final class" into "public class" So i have public class `GPSTracker extends Activity { .. }` and after that `public final class GPSTracker implements LocationListener` . the second one i found in a tutorial, the whole location tracking process happens here, but as far as i understand, i need to include `onCreateOptionsMenu` and `onCreate` methods in order to make it work. The question is; How do i put these two together? here is the full code, so that you can analyze better. Any help would be much appreciated. Thanks in advance.
Cou can combine them as following: public class GPSTracker extends Activity implements LocationListener { } and put all your code of both classes into this one. The `onCreatOptionsMenu` is only necessary if you're using a menu. The `onCreate` should be used because your GPSTracker class is an Activity.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android" }
Prevent line being printed to command line pipe to file The title maybe a little confusing.. so here is my attempt of explaining it: I have a command for my program: c file1.txt > file2.txt This command in the commandline takes the first file and pipes the output of the program (that is printed) to the second file. So im scanning a user message in: printf("Enter a message:"); char *message = malloc(sizeof(char) * 256); scanf("%s", message); printf("Your message is: %s", message); But this prints both `printf(...)` statements to my piped file, whereas I only want the second one. How can i prevent this? Thanks!
One way is to use `stderr` for the information you don't want copied to the output file: fprintf(stderr, "Enter a message:");
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "c, command line" }
Applying Unit Of Work pattern I have read in Patterns of Enterprise Application Architecture that a Unit Of Work should only be used in a single Session. So each session should have its only Unit Of Work. Can anybody tell me why I could not use one Unit Of Work for the whole application (in my case ASP.NET).
Half of the unit of work pattern is to keep track of changes in a transaction and you could certainly track that for an entire application (this seems to be pretty common) but the other half is the resolution of concurrency problems which becomes meaningless if you are applying the pattern to the entire application rather than on a per session level. Also, at some point you have to decide "Hey this is a unit...time to commit" and that might be difficult when taking the whole application into account with different users doing different things at the same time.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 6, "tags": "design patterns, unit of work, poeaa" }
lightweight SVG viewer Sometimes I want to look quickly at a large number of SVG files. My options seem to be Inkscape, which is rather ponderous and slow to open, or a browser, which is unsatisfactory for other reasons. Is there a tool that does nothing but display (not edit) SVG images?
You have quite the diverse range of options: Free: Gapplin (AppStore) 14MB macSVG 9MB > macSVG is a MIT-licensed open-source macOS application for designing and editing Scalable Vector Graphics (SVG) content for HTML5 web pages, mobile apps, animation design, and general graphics usage. SVGViewer > Fast, Free and Simple SVGViewer file Viewer Open and export SVG files on Mac, send to friends. Download SVGViewer for Mac. It’s free! And with an additional footprint of 0 bytes: * your favourite browser!
stackexchange-apple
{ "answer_score": 8, "question_score": 10, "tags": "macos, software recommendation, graphics" }
Do we necessarily need to close a FileInput/OutputStream to delete a file? In the application I'm working on we have to deal with temp files. Because of the usual programming mistakes, files might not be disposed properly (until we notice and fix it of course !). I want to write a simple module that will garbage-collect files. I'm wondering if I can always delete those files, regardless of there is a open stream on it. I tried it (vm 1.6, linux) and it works, but since I cannot find a specification I'm hesitant to implement it. _Note 1 : we are talking about a single process application._ _Note 2 : I'm mainly interested about inputStream, if it makes a difference._
AFAIK, On Linux you can, on Windows you cannot As @EJP points out you can get yourself in an endless mess making workarounds. If you are going to work around a bug, only do it because you _really have no choice_ One of the things I have seen with workarounds is you not only get a mess but it can make it much harder to fix bugs later. On more than one occasion I have seen a fix to code breaking a workaround resulting in a break in the program.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, file io" }
How to share iPad's wifi to Mac? I want to connect my MacBook Pro to my iPad mini's Wi-fi. I don't see any hotspot settings. I have searched on the web but all I see is to go to cellular option in setting which is not available in my iPad (cause there is no SIM). Can this be achieved through Bluetooth sharing, a personal hotspot, USB tethering or any other means?
If the iPad mini and the MacBook Pro is on the same WiFi, they also have the same IP-adr. range, so they can see each other. The Personal Hotspot option is for sharing an internet connection, and here you have the cellular network (SIM-card) as the external connector, and the WiFi (Personal Hotspot) as the DHCP Server.
stackexchange-apple
{ "answer_score": 0, "question_score": 0, "tags": "ipad, mac, wifi, internet sharing, tethering" }
AndEngine drawing 2D tiled game field I'm in process of developing simple android puzzle game. I decided to choose `andEngine` as an engine for my game. In my game I have a `gameField [][]` array, which represents a game field, where each element is a cell of game level and consists of a type of the cell (for ex. `FLOOR` of `WALL`). During the game, state of cell can be changed (for ex. `DOOR_CLOSED` changed to `DOOR_OPENED`), but it happens rarely, almost all the elements of gameField don't change. I tried to implement that by adding `repaint` method to `updateHandler`, which would paint sprites for each cell every tick. But I wonder wouldn't be that approach a wasting of memory and processor time? What is the best practise for doing that?
How about having that multidimensional array of yours filled with, say, an extension of TiledSprites. Something like the following: public class Door extends TiledSprite { private boolean isOpen = false; private static final int DOOR_CLOSED = 0; private static final int DOOR_OPEN = 1; public Door() { this(0, 0, doorTextureRegion, vertexBufferObjectManager); this.setCurrentTileIndex(DOOR_CLOSED); } public open() { this.isOpen = true; this.setCurrentTileIndex(DOOR_OPEN); } public close() { this.isOpen = false; this.setCurrentTileIndex(DOOR_CLOSE); } } In your scene, you attach all the TiledSprites as children of the scene. Iterate over the array in an initialization method, say. You shouldn't have to constantly poll and redraw--AndEngine takes care of that for you.
stackexchange-gamedev
{ "answer_score": 2, "question_score": 0, "tags": "android, andengine" }
javascript issue body style Here's my code, any idea why it's not working? <script type="text/javascript"> windows.onload = function() { function(){ document.body.style.backgroundColor = ('red'); } }; </script>
Without jquery, you can do that : window.onload = function(){ document.body.style.backgroundColor = 'red'; }; In your code you declared a function inside the callback you give to onload but you didn't call it.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript" }
Constants in Haskell and pattern matching How is it possible to define a macro constant in Haskell? Especially, I would like the following snippet to run without the second pattern match to be overlapped. someconstant :: Int someconstant = 3 f :: Int -> IO () f someconstant = putStrLn "Arg is 3" f _ = putStrLn "Arg is not 3"
You can define a pattern synonym: {-# LANGUAGE PatternSynonyms #-} pattern SomeConstant :: Int pattern SomeConstant = 3 f :: Int -> IO () f SomeConstant = putStrLn "Arg is 3" f _ = putStrLn "Arg is not 3" But also consider whether it's not better to match on a custom variant type instead of an `Int`.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 3, "tags": "haskell, pattern matching, pattern synonyms" }
"net-position" of a node in directed Erdos-Renyi graph In a directed weighted random Erdos-Renyi graph $G(N,p)$ with only positive weights, let $e_{ij}$ denote the weight going from node $i$ to node $j$ and assume all $e_{ij}$'s are normally distributed. How can one calculate the expected value of the "net-position" of a node $i$? i.e. is there a simple way to get the expected value of $\sum_{j=1}^n(e_{ij}-e_{ji})$? or even better, to get the expected value of **all** the **positive** net-positions in the graph? Thanks for any help.
Assuming the $e_{ij}$ are identical and independent normal distributions, any linear combination will also be normally distributed. Since then the expected value of $e_{ij} - e_{ji}$ is zero, the expected value of the "net-position" is always $0$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "probability, graph theory, random graphs" }
Fourier cosine series for $\cos(\pi x)$ on $(0,1)$ My goal is to find the Fourier cosine series for $f(x) =\cos(\pi x)$ on the interval $(0,1).$ Using the formulas $$A_{0}=\frac{1}{L}\int_{0}^{L}f(x)\ dx \ \ \ \ \text{and} \ \ \ \ A_{n}= \frac{2}{L}\int_{0}^{L}f(x) \cos\left(\frac{n \pi x }{L}\right) \ dx,$$ we can find the coefficients to write the series in the form $$f(x)\sim \frac{A_{0}}{2} + \sum_{n=1}^{\infty}A_{n}\cos\left(\frac{n \pi x }{L}\right).$$ I won't write out the calculus and the algebra that follows, but both coefficients come out to be $0.$ Does it make sense for the Fourier cosine series of this function to be equal to $0$? Was it obvious from the beginning? Thanks in advance!
$A_1$ is not zero: $$A_1 = \frac{2}{1} \int\limits_0^1 \cos \pi x \cos \pi x \ dx = 1$$ which makes sense because you are approximating the first term of the cosine series including in the Fourier expansion. You are right with the others, $A_0,A_2,\ldots A_{\infty}$ $$A_0 = \int\limits_0^1 \cos \pi x \ dx = 0$$ $$A_k = \frac{2}{1} \int\limits_0^1 \cos \pi x \cos \pi x \ dx = 0 \qquad k \geq 2$$
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "integration, sequences and series, fourier analysis, fourier series" }
Android - homescreen appwidget transparency I have an application that publishes a homescreen widget. The widget has portions that are transparent. I have recently updated to API 10 and latest ADT (10), and now my Appwidget has lost it's transparency. Has anyone encountered this and have you found a fix? My widget is a PNG-24 with transparency info, it is 100x100 pixels - might that be the issue? It has been working well previously. I am testing on Android 2.2 device (HTC Incredible) as well as on emulator 2.1. Thanks!
Duh! I had the color changed in the layout wrapping the widget element from #0000 to #000000 which is obviously not transparent.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, android widget, transparency" }
Not sure how to declare a variable in MSSQL I am confused on how to declare a variable into a MSSQL Statement. I keep getting page not showing up. Here is a partial code from my project. <?php include 'users.php'; require_once("db_connect.php"); //prepared statement with PDO to query the database $stmt = $db->prepare("SELECT * FROM requests WHERE User=$user1 ORDER BY id DESC); $stmt->execute(); ?>
I don't have a way to test this at the moment, but I noticed there was a quote missing, and I would append the variable to the query. <?php include 'users.php'; require_once("db_connect.php"); //prepared statement with PDO to query the database $stmt = $db->prepare("SELECT * FROM requests WHERE User=".$user1." ORDER BY id DESC)"; $stmt->execute(); I apologize in adance if this isn't helpful. heh.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, sql server, pdo" }
Making raw SQL safe in Entity Framework var retval = db.TestTable.SqlQuery("SELECT * FROM dbo.TestTable WHERE " + aColumn + " = '" + passedInValue + "'"); // normally when using parameters I would do something like this: var valueParam = SqlParameter("aValue", passedInValues); var retval = db.TestTable.SqlQuery("SELECT * FROM dbo.TestTable WHERE Column1 = @aValue", valueParam); // NOTE: I would not do this at all. I know to use LINQ. But for this question, I'm concentrating on the issue of passing variables to a raw sql string. But since both the column and value are "parameters" in: var retval = db.TestTable.SqlQuery("SELECT * FROM dbo.TestTable WHERE " + aColumn + " = '" + passedInValue + "'"); , is there to prevent sql injection for both?
First: whilelist `aColumn`: this has to be added via string concatenation but you know what columns are in your database (or you can check using schema views). Second: In entity framework – as you show – you can use parameters for values in the query. However, rather than creating `SqlParameter` instances you can pass the values and use `@p0`, `@p1`, ….
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "entity framework, entity framework 6, sql injection" }
Converting specific string to NSDate object in swift 2 I have a string representing a date `"2016-06-28T22:26:31.200577Z"` and the dateformatter I use uses the format `"yyyy-MM-dd'T'HH:mm:ssZ"` the extra `".200577"` is causing my dateformatter to return nil when I try convert the date string to a NSDate object. I have tried changing my dateformatter string to `"yyyy-MM-dd'T'HH:mm:ss.ssssssZ"` but this is not correct. I am unsure whether the `".200577"` actually denotes a fraction of a second or is something else like a time zone.. At the moment I can get past this error by splitting the end part off of the string but I do not want to lose this information. I am looking for help as to what my correct dateformatter string should be.
You can follow the Unicode Markup Language its yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ" Reference : SO Question
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "swift, nsdateformatter" }
How can I search Active Directory by username using C#? I'm trying to search active directory by the username 'admin'. I know for a fact that there is a user with that username in the directory, but the search keeps coming back with nothing. var attributeName = "userPrincipalName"; var searchString = "admin" var ent = new DirectoryEntry("LDAP://"dc=corp,dc=contoso,dc=com") var mySearcher = new DirectorySearcher(ent); mySearcher.Filter = string.Format("(&(objectClass=user)({0}={1}))", attributeName, searchString); var userResult = mySearcher.FindOne(); userResult always ends up null. I would love to know why, there must be something that I'm missing.
It turns out that "userPrincipalName" needed to be all lower-case ("userprincipalname"). Good to know, thanks for your responses.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 12, "tags": "c#, active directory" }
Add new form input fields on option select basis using jquery I have an html form where on the input field selection from a drop down i want to add some html input fields. I am using `append()` but it actually just appends to the div let say i have 2 options 1,2 on selecting 1 some input fields are added to the form but on selecting 2 input fields for option 1 remains the same. What another method i can use instead off append ? I am really missing something very basic, googled a lot but not helping in this case. jQuery('#category').change(function() { if( $(this).val() == 1 ) { // input fields to add for 1 } if( $(this).val() == 4 ) { // input fields to add for 4 } });
Why not create all the input fields initially in the form and do the following: $(document).ready(function() { $("#inputfield1").hide(); $("#inputfield2").hide(); }); jQuery('#category').change(function() { if( $(this).val() == 1 ) { $("#inputfield1").show(); $("#inputfield2").hide(); } if( $(this).val() == 4 ) { $("#inputfield2").show(); $("#inputfield1").hide(); } });
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "jquery, html, forms, logic" }
Proper pagination in a JOIN select I have a SQL statement select * from users u left join files f on u.id = f.user_id where f.mime_type = 'jpg' order by u.join_date desc limit 10 offset 10 The relationship is 1-N: user may have many files. This effectively selects the second 10-element page. The problem is this query limits/offsets a joined table, but I want to limit/offset distinct rows from the first (`users`) table. **How to?** I target PostgreSQL and HSQLDB
You need to limit the select on the outer table first and then join the dependent table to the result. select * from (select * from users where f.mime_type = 'jpg' limit 10 offset 10) as u left join files f on u.id = f.user_id
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 13, "tags": "sql, postgresql, join, pagination, hsqldb" }
How to handle thousands of lights I'm trying to create a night-time city in Blender 3.2. For streetlights I've tried two approaches with geometry nodes: * Instance lots of balls with an emissive texture. * Instance actual point lights. Neither does much in Eevee. Emissive materials don't light surfaces. With more than 128 point lights they get ignored. Cycles is slow in both cases. I wonder if there is a clever solution? Can I somehow bake this lighting so the roads and buildings get a fast lightmap texture? I want to animate some stuff, but the lights and buildings will be static. ![Cycles render of city at night](
Here is a dark city scene setup with emissive materials for the windows and emissive spheres used as street lamps (EEVEE) ![Dark]( As you noticed, the emissive lights do not cast light on the surrounding objects - to do this in EEVEE, you will need an _Irradiance Volume_. Scale the Volume to your size requirements and bake the lighting in the render properties tab. You can adjust the cube-map size if you need better resolution (right side):: ![Irradiance]( You can also select the Irradiance properties and change the resolution - don't go too high or performance will suffer: ![Rad]( Here is the scene after the bake - the lighting will stay the same until you delete the lighting cache or bake again: ![Baked](
stackexchange-blender
{ "answer_score": 16, "question_score": 16, "tags": "eevee render engine, lighting" }
Creating an arbitrarily styled text outline in Photoshop which updates if I change the text or font? I'd like to create a 5px wide outline for some text in Photoshop, with one caveat: if I change the font of the original text, or the exact wording, the outline must change too. I'd like to style this outline using all the conventional features of Blending Options. This includes things like emboss, outer glow, etc. Is this at all possible in Photoshop? I know how to do this to create a "permanent" outline, so no need to explain that - I just wonder if I can set up the layers in such a way that the font is not "set in stone". Perhaps this isn't quite what Photoshop is designed for - which software would you recommend that better captures the "history of features" paradigm, where I can go back and change the decisions made at the very start of the design?
The easiest way to do this is to set your text, add the 5px stroke and set the Fill opacity to 0. Turn the layer into a Smart Object, and you can style it any way you like. Any time you want to change the text, double-click the layer icon to open the Smart Object as a separate window, make your change, save and close.
stackexchange-graphicdesign
{ "answer_score": 3, "question_score": 1, "tags": "adobe photoshop" }
Family of analytic functions from unit disk to the plane minus a line _Let $\mathcal F$ be the family of analytic functions on the unit disk $\,\mathbb D=\\{z: \lvert z\rvert <1 \\},$ such that $f[\mathbb D] \subset \mathbb C\\!\smallsetminus\\!(-\infty, 0]$. Show that $\mathcal F$ is a normal family._ (Normal Family= relatively compact= _every_ sequence contains a subsequence which converges uniformly on _every_ compact subset of $\mathbb D$) EDIT. I see that this is immediate from Montel's theorem, but can it be proved somewhat easily without that?
Hint. Note that $\mathbb C\setminus (-\infty,0]$ is a simply connected domain, and hence there exists a conformal map $$\varphi : \mathbb C\setminus (-\infty,0]\to\mathbb D.$$ Next observe that the family $$ \mathcal G=\\{\varphi\circ f : f\in\mathcal F\\} $$ is bounded and hence a normal family. Next, if $\\{\varphi\circ f_n\\}$ converges on compact subsets of $\mathbb D$, then so does the sequence $$ f_n=\varphi^{-1}\circ(\varphi\circ f_n), \quad n\in\mathbb N. $$
stackexchange-math
{ "answer_score": 5, "question_score": 1, "tags": "complex analysis, analysis, convergence divergence, conformal geometry, normal families" }
ASIFormDataRequest empty POST request I'm using ASIFormDataRequest to send multipart POST data to a server running nginx + php-fpm. ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:sessionKey forKey:@"session"]; [request setPostValue:secret forKey:@"secret"]; [request setPostValue:@"test" forKey:@"description"]; [request setFile:filePath forKey:@"image"]; [request setTimeOutSeconds:120]; [request setDelegate:self]; [request startAsynchronous]; However, once in a while (occurs very randomly, hard to reproduce) an empty request reaches server, I'm using the same file for all tests. ASIHTTPRequest peforms requestFinished, like everything's ok. No server-side errors generated, I checked logs. Has anyone had this problem before?
I had this problem too earlier today. It has something to do with nginx behaviour on how to reuse a connection. A simple fix is to just add the following to your request procedure: [request setShouldAttemptPersistentConnection:NO]; This option also has been set to NO by default in the newest build of ASIHTTPRequest. Read more about it at Github: Stop using persisted connections on POST/PUT
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "iphone, ios, nginx, asihttprequest" }
Integral version of Ampere's law: why current outside the surface does not contribute to $\oint B\cdot d\ell$? I have a question about why this is true $\oint B\cdot d\ell = \mu_0$ $I_{enclosed}$ My problem is that I am not really seeing visually or mathematically why the magnetic field generated by a current that doesn’t pass through the loop will not contribute to the integral. Any advice or intuition is aprecciated thanks.
Remember that the magnetic field lines are circular around the wire. If the wire is inside the loop all contribution to the line integral will have the same sign, but if the wire is outside the loop there will be both, positive and negative contributions, and these cancel each other. One easy example is if the wire is infinitely far away and creates a constant magnetic field parallel to the plane of the loop. Here it is easy to see, by looking at the angles between the field and the loop, that the integral on one half of the loop cancels the integral on the other half of the loop.
stackexchange-physics
{ "answer_score": 1, "question_score": 1, "tags": "electromagnetism" }
Do controls need to be defined in a web app or will .NET do it for you I always thought that when you dropped a control onto an .aspx page that a declaration of that control ended up being generated for you (either in a designer file, or within your code behind). All of the apps I have worked on have worked this way. A coworker of mine was installing resharper and it was showing that all her code behind pages would not build. Turned out that resharper could not find a definition for any control that she has dropped onto her markup. She has no designer files, and no declarations in markup. Do they get automatically built when putting together the partial classes? Is there an option at that page/project level to instruct .NET to do this for you? Is this a difference between web app and web site? This is a a .NET 3.5 site, C#, and it is running in a production environment. Thanks in advance
You are correct in the difference is that she's running a **Web Site project** as opposed to a **Web Application project**. In a website there are no designer files. So to answer each of your questions... Do they get automatically built when putting together the partial classes? * Yes, when the .aspx gets compiled the controls are created as if they were there...this happens in the background in VS so you get intellisense. Is there an option at that page/project level to instruct .NET to do this for you? * Kinda, use a Web Application project for this :) Is this a difference between web app and web site? * Yes, one of the main differences :) Web Application projects have a `Page.aspx.designer.cs` that house the control declarations.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, asp.net" }
Angular: How to data-bind an async property to a background image * I'm trying to set a background image on a div with angular. * The 'image.imagrURL | async' works well when just assigning it to a plain 'img' tag. * The issue I'm having is when trying to assign it to an inline background image The question is: How do I modify my below snippet to work? :) **HTML** <div [ngStyle]="{'background-image': 'url(' + image.imageurl | async + ')'}"> **Error** > Parser Error: Missing expected } I'm not entirely sure where that's supposed to go. Thank you.
Adding brackets will be helped, because you are trying call async pipe on `'url(' + image.imageurl` Try in this way: <div [ngStyle]="{'background-image': 'url(' + (image.imageurl | async) + ')'}">
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 6, "tags": "angular, data binding" }
setInterval only runs once on object method Here is the code. (function($){ $.fn.testfunc = function() { this.init = function() { setInterval(this.func1(), 1000); }; this.func1 = function() { console.log('func1'); this.func2(); }; this.func2 = function() { console.log('func2'); //some codes }; return this.init(); } })(jQuery); *When I use parenthesis the 1st and 2nd method runs but the 1st method is called only once. *When I don't use parenthesis the 1st method runs in interval just fine but it doesn't/couldn't call the 2nd method. What should I go with? With parenthesis or not? I need to run the 1st method in the interval but also need to call 2nd method.
`setInterval` expects a function. `this.func1` is a function but `this.func1()` is the result of calling the function, which is `undefined` (the function doesn't return anything). This is your first misunderstanding. The second misunderstanding has to do with scope. If you call `setInterval(this.func1, 1000);` then `setInterval` will call the correct function, but `this` will not refer to what you think. I don't have time now to explain and you should definitely read more about this. In any case, this will work: this.init = function() { var self = this; setInterval(function() { self.func1(); }, 1000); };
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "javascript, jquery, jquery plugins, setinterval" }
using latex for depicting grammar of file format I came across the a paper where the STL file format was depicted in the following way. ![STL file format]( I would very much be interested in using something similar to this but I have no clue how to achieve this.
Manual solution using a tabular surrounded by curly braces (based on Curly brackets spanning multiple lines (no math env)): \documentclass{article} \begin{document} \noindent\textbf{solid} \textit{name}\\ $\left\{ \begin{tabular}{@{}l@{}} \textbf{facet normal} $n_i n_j n_k$ \\ \hspace{1em}\textbf{outer loop} \\ \hspace{2em}\textbf{vertex} $v1_x\ v1_y\ v1_z$\\ \hspace{2em}\textbf{vertex} $v2_x\ v2_y\ v2_z$\\ \hspace{2em}\textbf{vertex} $v3_x\ v3_y\ v3_z$\\ \hspace{1em}\textbf{endloop}\\ \textbf{endfacet} \end{tabular} \right\}^+$\\ \textbf{endsolid} \textit{name} \end{document}
stackexchange-tex
{ "answer_score": 0, "question_score": 0, "tags": "diagrams" }
Curious about how django achieves the ORM query optimization I am no python expert and I am curious about how django optimize the following query Model.objects.filter(field = 'abc')[0] Somehow django will intelligently add '`limit 1`' to SQL query like '`select * from model where field = 'abc' limit 1`'
This is because `Model.objects.filter(...)` doesn't actually return a list, it returns a queryset object. When you do `qset[0]`, it calls the `__getitem__` method on querysets, which adds the `limit 1` and executes it. Here's the source of that method; there's logic for various cases when the result has already been cached or not and so on.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, django" }
USB Driver on a Windows (x32) on Windows (x64) using Virtualization/Emulation I have a piece of software that doesn't have a USB driver for x64. I was hoping to use VirtualBox , VirtualPC, or VMWare in order to have an x32 Windows which would allow me to continue to use the software. However, I find that if the host can't use the USB then the client can't either. Do emulators solve this issue? I've used QEMU before but I read that the hardware support in VirtualBox was based on QEMU so I wouldn't expect it to work. Any suggestions? Does anyone have this scenario working?
You might want to play with a 30day trial of Parallels Desktop 4 (MSRP $80) or VMWare Workstation (MSRP $189). They each have distinct implementations of the USB passthrough and one or the other might support connection of non-recognized USB devices to a guest. And a longshot...with a relatively new chipset that's Intel VT-d (directed IO) enabled and a virtualization software which is VT-d aware (Parallels Workstation Extreme being the one I'm aware of) you could connect one of your USB root hubs (or technically the PCIe device behind it) to a guest with VT-d. That guest would get exclusive access to those USB ports and Windows x64 would never even see them. Truth be told, I've only done this under VMWare ESXi 4.1, but given that Parallels is charging $400 (5x more than 'Parallels Desktop') just for VT-d enabled 'Extreme' edition, I imagine they got it right.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 1, "tags": "virtualization, usb, 64 bit" }
How can I create an Item Frequency Plot for association rule data? By converting to data frame or numeric? I have given the code that the rules are generated.I would like to create an item frequency histogram plot but ıt didn't work. library(arules) library(arulesViz) library(rattle) x <- read.table("C:/Users/toshıba pc/Desktop/Kitap2.csv", header = TRUE, sep = ";") y <- as.matrix(x) rules <- apriori(y, parameter = list(supp = 0.1, conf = 0.8)) itemFrequencyPlot(rules, support = 0.1, cex.names = 0.8) > Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘itemFrequencyPlot’ for signature ‘"rules"’
`itemFrequencyPlot` is not defined for `rules`. You can use itemFrequencyPlot(items(rules)) to get the frequency of the items in the rules, but I am not sure that this will give you the results you want.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "r, csv" }
Looking for geo-taxonomies libraries Can I create a geo-taxonomy map by using all tags and locations of Flickr? Otherwise, is there any geo-taxonomy library I can use for my experiments describing world (or smaller areas) with tags?
I think Google Maps geolocation API is what you are looking for.
stackexchange-webapps
{ "answer_score": -1, "question_score": -2, "tags": "geolocation" }
Outlook 2007 wont let me add RSS feeds I have Outlook 2007, but I'm having trouble adding RSS feeds. When I go 'Tools -> Account Settings...', I have no RSS Feeds tab (that should apparently be there), and when I right click the RSS Feeds folder, the options for 'Add a New RSS Feed' and 'Import an OPML File...' are both grayed out. I have found a post on here that suggested an option was long ago clicked to remove RSS feeds, but I honestly don't know if that is the case. The post suggested removing a registry key to re-enable all RSS features, but said key does not exist. Does anybody know what is going on here? Thanks.
If you are using Outlook on a network at your work, there could be a restriction put in place by the network administrator. If the registry key in not there, it is likely there is a policy disabling RSS.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "microsoft outlook 2007, rss" }
Alle Rechte sind vorbehalten (aber wem?) Ich versuche gerade ein Dokument zu verstehen, das folgenden Satz enthält: > Alle Rechte, insbesondere die des Nachdrucks, der Fotokopie, der elektronischen Verwendung und der Übersetzung, jeweils auszugsweise oder vollständig, sind vorbehalten. Für mich fehlt hier die wesentliche Information, wem diese Rechte vorbehalten sind. Dem Herausgeber oder den Käufern des Dokuments? Oder ist das eine übliche Formulierung die ich nicht verstehe?
Ja, genau, das ist eine übliche, sehr alte Standardformulierung, die aus sich selbst heraus etwas schwer verständlich ist. Der Text impliziert, dass die Rechte demjenigen vorbehalten sind, der die Urheberrechte an dem Text hat. "Rechteinhaber" ist der dafür allgemein übliche Begriff im Urheberrecht. Das ist im Allgemeinen der Verlag oder Herausgeber, und der hat diesen Hinweis normalerweise auch dort hineinschreiben lassen (und dabei den Rechteinhaber nicht näher benannt). Der Leser oder Käufer (m/w/d) hat zwar das Recht, das Werk (Buch, Heft ...) zu lesen oder sein Exemplar weiterzuverkaufen, aber wenn er die Dinge tun will, die dem Rechteinhaber "vorbehalten" sind, braucht er eine Erlaubnis.
stackexchange-german
{ "answer_score": 4, "question_score": 3, "tags": "meaning in context" }
While installing using WUBI Kubuntu just reboots on boot I've installed Kubuntu 16.04 with a Windows application called "Wubi", but when I boot into Kubuntu to complete the installation it shows me the pulsing blue Kubuntu logo for about 20-30 seconds and then my PC reboots. Does anybody happen to know the fix to this?
Thanks to the help from @dessert, we were able to find this for WUBI and Kubuntu booting. The following steps were taken from: < > After the first restart it should display: > > > Completing the Ubuntu installation. For more installation boot > options, press `ESC' now... > > > There you can press ESC and then you can select "Verbose mode" in the following menu: > > > Normal mode > Safe graphic mode > ACPI workarounds > Verbose mode > Demo mode > > > In "verbose mode" it collects more information for debugging but it is also a workaround for some issues. In some tests, it worked in "verbose mode", if default mode "normal mode" didn't work. Hope this helps!
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 2, "tags": "system installation, kubuntu, wubi" }
Best cross-platform audio library for synchronizing audio playback I'm writing a cross-platform program that involves scrolling a waveform along with uncompressed wav/aiff audio playback. Low latency and accuracy are pretty important. What is the best cross-platform audio library for audio playback when synchronizing to an external clock? By that I mean that I would like to be able to write the playback code so it sends events to a listener many times per second that includes the "hearing frame" at the moment of the notification. That's all I need to do. No recording, no mixing, no 3d audio, nothing. Just playback with the best possible hearing frame notifications available. Right now I am considering RTAudio and PortAudio, mostly the former since it uses ALSA. The target platforms, in order of importance, are Mac OSX 10.5/6, Ubuntu 10.11, Windows XP/7. C/C++ are both fine. Thanks for your help!
The best performing cross platform library for this is jack. Properly configured, jack on Linux can outperform Windows asio easily (in terms of low latency processing without dropouts). But you cannot expect normal users to use jack (the demon should be started by the user before the app is started, and it can be a bit tricky to set up). If you are making an app specifically for pro-audio I would highly recommend looking in to jack. Edit: Portaudio is not as high-performance, but is much simpler for the user (no special configuration should be needed on their end, unlike jack). Most open source cross platform audio programs that I have used use portaudio (much moreso than openal), but unlike jack I have not used it personally. It is callback based, and looks pretty straightforward though.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "audio, cross platform" }
Why isn't the keydown event firing? I'm trying to attach an event handler to the keyDown event in a canvas element. Here is a simplified version of my code. class CanvasFun{ CanvasElement canvas; CanvasFun(this.canvas){ print("Game is loading!"); this.canvas.onKeyDown.listen(handleInput); } void handleInput(e) { //breakpoint is never hit print(e.keyCode); } } I've removed some of the drawing code. In my main function I simply query the canvas element and pass it to my CanvasFun constructor. I've also tried doing it this way: void main() { var canvas = query("#Game"); canvas.onKeyDown.listen(handleInput); var canvasFun = new CanvasFun(canvas); } void handleInput(e) { print(e.keyCode); }
The reason why the event is not firing is because the focus is on the document (or some other element like an input, for example). And in fact, canvas element even when focused does not fire an event. Some elements do, like input elements. The solution is to listen to key down events from the document or window: window.onKeyDown.listen(handleInput); document.onKeyDown.listen(handleInput); // You already noticed this worked.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "dart" }
controlling for each loop in visual basic i have the following code.... For Each dgvRow In bout_grid.Rows vfile = dgvRow.Cells("FileName").Value video.FileName = "D:\bee\" + vfile vduration = video.Duration vposition = video.Position If vduration > 0 The bplayer_out.URL = "D:\bee\" + vfile bplayer_out.Ctlcontrols.play() End If Next dgvRow but it plays only one video and than stops but i want that it should play every video in datagridview i.e bout_grid....i have tried System.Threading.Thread.Sleep = vduration but it stops every thing how can i solve it
Yes, you can't make this kind of code work in a Windows Forms or WPF app. Windows apps are event driven, you can't program long loops without blocking UI updates. Windows Media Player generates events when something significant happened. Like the PlayStateChange event. Write an event handler for that event to index to the next item in your list. Note that WMP also supports play lists. Your ultimate resource for programming WMP in Visual Basic is this MSDN Library topic. Take a look at the provided samples.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "vb.net" }
Including a .text.erb partial in a .html.erb template? (Invoice) I'm porting an application to Rails 3. We're an e-commerce site and naturally we send copies of tax invoices by email. We use plain text, so a `.text.erb` seems logical. We also display invoices in an area of the user profile, inside `<pre></pre>` tags. Is there are way I can share a partial between plain text mailer templates, and views in HTML? If I try to `render "shared/invoice"` inside my HTML ERB template, it says the partial doesn't exist, and that's because it's a `.text.erb` partial. What are my options, without duplicating code?
I haven't tried this in Rails 3, but in Rails 2 you could specify the format of the partial. Might be worth giving it a go on Rails 3. render :partial => "shared/invoice.text.erb"
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "ruby on rails, partial, erb, invoice" }
C# programming writing to a file user data I am trying to develop a user interface, where users can input their name, id and hometown and I am saving it into a text file. File.WriteAllText(path,"name"+" " + textBox2.Text+ Environment.NewLine + "number"+" "+ textBox3.Text+Environment.NewLine + "town"+" " + textBox4.Text+Environment.NewLine ); This works but the data of the users is written in the text boxes and it works only for the first user, when I enter new data and click the button with the function, it overwrites the first user's data and that way I am not able to save more than 1 user's data. Please suggest the required modification in the code.
`File.WriteAllText`.aspx) will always overwrite the current file if it exists. Use `File.AppendAllText`.aspx) instead.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -5, "tags": "c#, file, streamwriter, saving data" }
How can I get rid of irritating prefactor of one in Mathematica? I am trying to refine algebraic expressions into a convenient form using Mathematica to make sure I don't drop a sign or make some other trivial slip. After a lot of swearing, I have come to accept that this is not a deterministic process and I will have to do it step by step and also that the algebraic manipulation palette is my friend. However, there is still one thing that's driving me nuts. Sometimes mathematica spits out expressions with these seemingly extraneous leading ones. For example, right now I'm looking at: 0.5*(1.*Log[-1.*a^2 + 1.*bigr^2] - 1.*Log[1.*a^2 - 2.*a*bigr + 1.*bigr^2]) when I would much rather be looking at: 0.5*(Log[-a^2 + bigr^2] - Log[a^2 - 2.*a*bigr + bigr^2]) It's more than just a cosmetic problem because it confuses Factor[] when I try to apply it to some of the obvious quadratic factorizations in the above expression. Any clean fixes?
your = 0.5*(1.*Log[-1.*a^2 + 1.*bigr^2] - 1.*Log[1.*a^2 - 2.*a*bigr + 1.*bigr^2]) your /. {1. -> 1, -1. -> -1} (* -> 0.5 (Log[-a^2 + bigr^2] - Log[a^2 - 2. a bigr + bigr^2]) *) The dot after the `1` tells mathematica to treat the number as a non-exact quantity. So for example 1. * 1/2 (* -> .5 *) but 1 * 1/2 (* -> 1/2 *) Use exact quantities in your calculations (1, 2, 1/2) instead of decimal numbers (1., 2. ,0.5) if you need exact results
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "wolfram mathematica, algebra" }
How can I set the URL of a GridView SelectButton in ASP? I have a GridView that shows a table of results from a database. I have the ShowSelectButton set to true, but the links always take me back to the page that the GridView is on. How can I change the URL of the SelectButton to say UpdateItem.aspx?id=??? where ??? is equal to the ID of the db row? <asp:SqlDataSource ID="GetStudents" runat="server" ConnectionString="<%$ ConnectionStrings:dbConn %>" SelectCommand="dbo.GetStudents" SelectCommandType="StoredProcedure"></asp:SqlDataSource> <asp:GridView ID="StudentGrid" runat="server" AutoGenerateColumns="False"> <Columns> <asp:CommandField ShowSelectButton="true" /> <asp:BoundField DataField="studentId" HeaderText="ID" /> <asp:BoundField DataField="firstName" HeaderText="First Name" /> <asp:BoundField DataField="lastName" HeaderText="Last Name" />
<asp:GridView ID="StudentGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="StudentId" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"> protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { int studentId=0; int.TryParse(GridView1.SelectedValue, out studentId); Response.Redirect("~/UpdateItem.aspx?id=" + studentId); } Perhaps you can consider trying some like above and see if that helps.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net" }
How to get margins after suest in Stata I'm running a sur with two equations using `suest`. How can I get the margins after `suest`? For example: eststo model1: reg y1 x1##(x2 x3) eststo model2: reg y2 x1##(x2 x3) suest model1 model2, vce(robust) margins, dydx(x1) predict(equation(y1)) atmeans post margins, dydx(x1) predict(equation(y2)) atmeans post The `margins` does not work after `suest`. I'm using `suest` instead of `sureg` because I need robust standard errors.
You almost got it, you only got the name of the equation wrong. After `suest model1 model2`, the equations will be named `model1_mean` and `model2_mean`. // Get some example data webuse regress // Generate y2 gen y2 = y + rnormal() // Run regressions reg y c.x1##c.(x2 x3) estimates store M1 reg y2 c.x1##c.(x2 x3) estimates store M2 suest M1 M2, vce(robust) // Get partial effects on y with respect to x1 for each model at means of x2 and x3 margins, dydx(x1) predict(equation(M1_mean)) atmeans margins, dydx(x1) predict(equation(M2_mean)) atmeans
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "stata" }
How can I change this statement to add another If? I am using the following code to find an active "Internet Explorer" window and interact with it. I am trying to add a message box popup if the user does not have an internet explorer window open, as opposed to just getting a VBA error. Here is my current code: For Each GetIE In CreateObject("Shell.Application").Windows() 'Loop to find If (Not GetIE Is Nothing) And GetIE.Name = "Internet Explorer" Then Exit For 'Found! Next GetIE And what I want to add is essentially: If Not GetIE.Name = "Internet Explorer" Then MsgBox ("You do not have an active Internet Explorer window open") End IF But when I added that right below the first code it did not work and gave me an error. I did not write the top section and unsure how to change it to implement the messagebox. Any help is appreciated.
Try this approach, please: Sub testFindIE() Dim GetIE As Object, boolFound As Boolean For Each GetIE In CreateObject("Shell.Application").Windows() If (Not GetIE Is Nothing) And GetIE.Name = "Internet Explorer" Then boolFound = True Exit For End If Next GetIE If Not boolFound Then MsgBox "You do not have an active Internet Explorer window open" End Sub
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "excel, vba" }
Vue 3: Setup Script, TS Problem: "An import declaration can only be used in a namespace or module." when using in Vue 3 the setup script with typescript, I get an error in vscode saying: "An import declaration can only be used in a namespace or module." That happens for external libs and own vue components. i. e.: <script setup lang="ts"> // ... // ASSETS import SvgCircle from '@/assets/img/IconsSvg/SvgCircle.vue'; // MODELS import { IApiParams } from '@/models/api/apiparams.interface // import { EBp } from '@/models/enum/baseParams.enum'; // LIBS import justSafeGet from 'just-safe-get'; // ... </script> All these are getting red lines in vscode. Others like import from vue or vue-router or own composables do not get red line. I do not find something helpful to fix it. Anybody understands that and has a clue?
I could not repeat the error with enums (in SFC) but with interfaces. That's why I added now an interface import to my description. After a longer search I found a working solution. ## Solution 1: "import type" `import type { IApiParams } from '@/models/api/apiparams.interface'` ## Solution 2: "Import * as" import * as IApi from '@/models/api/apiparams.interface'; const apiParmams: IApi.IApiParams = { // ... } Both seem to not throw an error.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "typescript, vue.js, eslint" }
Are there any discs that boot directly into safe mode out there? I've got a new HP laptop, and once I removed all the default HP junk that's on there, it now has trouble booting. I'm intended to just reformat the thing completely and start fresh with a real installation of Windows, but before I do that I want to get in there and run a utility to find out what the Windows serial key is. But in order to do that, I need to be able to boot into it in the first place! I've tried pressing F8 repeatedly, holding it down, etc., but it won't even give me any options to choose at all. It just tries booting Windows normally each time no matter how I try to press F8. So I'm wondering if there are any boot CDs out there that simply force Windows to go directly into Safe Mode. Surely this should be possible, but I'm not so sure if anyone's made that kind of utility. Obviously I'm looking for something I can find as an ISO image. Is there any such disc available?
If it's a new HP laptop the windows license code should be on a COA license sticker on the bottom.
stackexchange-superuser
{ "answer_score": 3, "question_score": 1, "tags": "windows 7, boot, bootloader, safe mode" }
How much of my code is still around? Strange question, but a pretty reasonable one I think. Basically there's a project that I started several years ago with a couple hundred lines of code. Amazingly, since then it's grown to be a huge, robust project that I'm very proud of. Now, I have a question that very often pops into my head: > How much of my code is still around? Almost certainly the vast majority of my code has been rewritten at this point, but it feels like it should be very possible to have git give me a picture of what's still around. Now, I've looked into this on a basic level, but can't really find anything else along these lines, though some of github's charts are helpful. Any ideas?
So `git blame` is a way to go. Here is how you can calculate number of lines which was changed by each author in current revision git ls-tree -r HEAD --name-only \ | xargs -I{} git blame --line-porcelain {} \ | sed -n 's/^author //p' \ | sort \ | uniq -c \ | sort -rn Which will give 15492 Alice 3406 Bob 100 Carol
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 6, "tags": "git, github" }
Unity AR Foundation not found in Package Manager I'm trying to use Unity's AR Foundation, however I can't seem to find the package in the package manager. I'm using Unity version **2018.3.11f1** These are the only packages available: ![enter image description here]( Even after searching for AR Foundation nothing comes up. I know you can load from disk space but I can't seem to find a download for it anywhere. Where can I find the package?
You want to make sure you have the option for preview packages checked. It's located under the `Advanced` dropdown in the package manager. ![Advanced dropdown](
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "unity3d, augmented reality" }
Чистая архетектура - как правильно делать роутинг? Пишу одноактивное приложение и роутинг тут оказался слишком сложным и от этого активити начало плодить методы перехода между экранами ведь у каждого свой какойто переход, как правильно осуществлять переход в таком случае, у меня просто методы по разные навигации и фрагмент юзает методы активити то это крайне не удобно. Как правильно в рамках mvp + чистая архитектура делать переходы по навигации между фрагментами
Маловероятно, что у вас есть N переходов с одной активити. Скорее всего в главном активити вы показывает фрагмент № 1. По клику на различные области/кнопки вы должны выполняете переходы с текущего фрагмента на другой, оставаясь в рамках этого же активити. Само активити занимается чем-то общим для всех фрагментов, например, организация меню. В таком случае, не вижу никаких проблем. Для замены фрагмента, в активити у вас реализован примерно такой метод: fun replaceFragment(fragment: Fragment, stackEnable: Boolean) { val tr = supportFragmentManager.beginTransaction() tr.setCustomAnimations(R.anim.right_animation_enter, R.anim.right_animation_leave) tr.replace(R.id.mainContainer, fragment, fragment.tag) if (stackEnable) tr.addToBackStack(null) tr.commit() } который вы дергаете из своих фрагментов по callback-у.
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "java, android, mvp" }
Error while building Unity 8: "Could not determine USS private plugin installation dir." I am going through the steps to build Unity 8 and when I get to $ ./build it fails with this error Could not determine USS private plugin installation dir. How do I proceed?
Sorry that I bring bad news. This is a known bug since 2015-03-12. Login with your Launchpad Account and click This bug affects 2 people. Does this bug affect you?. So you will be informed about the progress.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 2, "tags": "14.04, unity, compiling, unity8" }
How to interpret cogemur I would like to know how to translate _cogemur_. I saw that it is the first-person plural future passive indicative _cogo_. But _cogo_ translates as 'force' to me in Google Translate. So that doesn't seem to make much sense as a verb. Being strong?
_Cogo_ has various meanings, including "to force" in the sense of "compel, make someone do something"; it can also mean "to gather or collect". A precise translation will depend on the context, but in the first-person plural future passive indicative, _cogemur_ might mean "we will be forced / compelled / constrained", or possibly "we will be gathered / collected / mustered". If you have a sentence in which the word occurs, we'll be able to tell you more.
stackexchange-latin
{ "answer_score": 10, "question_score": 6, "tags": "vocabulary, latin to english translation" }
Determing all monic irreducible quadratic polynomials in $\mathbb Z_2[x]$ The monic quadratic polynomials in $\mathbb Z_2[x]$ are - $x^2, x^2 + 1, x^2 + x, x^2 + x + 1$ * $x^2 = x \cdot x$ so is reducible * $x^2 + 1 = (x + 1) \cdot (x + 1)$ so is reducible * $x^2 + x = x \cdot (x + 1)$ so is reducible * $x^2 + x + 1$ - The fact that this polynomial has no root in $\mathbb Z_2[x] $, that $\mathbb Z_2$ is a field, and that this polynomial has degree $\le 3$ implies that this polynomial is irreducible. Have I got all that correct? In particular is the last claim correct or have I made an incorrect implication?
This is correct. Given the limited supply of polynomials of degree$~1$ (all monic), you could also say that you have already scrapped all products of two of them from your list, so what remains cannot be written as such a product. Although this sieve method can _in principle_ be used for any finite field and any degree polynomials, it becomes very laborious beyond $\Bbb F_2$ and say degree$~3$ polynomials. There are better methods for testing irreducibility over finite fields.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "abstract algebra, ring theory" }
How to use link_to that has an <i> tag inside it? I wanna make the **a tag** here be a **link_to** helper: <td class="text-center"> <a href="#"> <i class="glyphicon glyphicon-remove-circle"></i> </a> </td> I tried to make it like this: ...loop code for the @events and then: <%= link_to "", controller: "events", action: "edit", id: event.id do %> <i class="glyphicon glyphicon-edit"></i> <% end %> But the url that is coming is wrong, not an edit link. How do I make it right?
The first argument of the 'link_to' helper should not be provided with a 'do' block as it will override the block you pass to it. If you provide one (even an empty string) as you have then it uses that instead, so remove the first argument as so: <%= link_to controller: "events", action: "edit", id: event.id do %> <i class="glyphicon glyphicon-edit"></i> <% end %>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "ruby on rails" }
Do 반말 and 존댓말 have precise definitions? Most students of Korean have heard of and and understand roughly what they mean. But how far can we go to defining _exactly_ what they mean? * Can each of the Korean speech levels be categorised as or ? * Do and classification relate more to formality(), or politeness()? * Do they relate to the usage honorifics such as the honorific particle, or honorific nouns and verbs? * there are other Korean sentence endings beyond those typically seen in the speech level charts, e.g. " ". Can each of these be definitively described as or ?
> Can each of the Korean speech levels be categorised as or ? Of course. ![enter image description here]( (), , are , , , are . It's that simple. > Do and classification relate more to formality(), or politeness()? Politeness, as you can see from the table. > Do they relate to the usage honorifics such as the honorific particle, or honorific nouns and verbs? Yes. Using correctly means using special honorific words( ) correctly, as well as using the correct sentence ending. > there are other Korean sentence endings beyond those typically seen in the speech level charts, e.g. " ". Can each of these be definitively described as or ? Sentences like " ." is called . It's strictly only used in writing, so it's hard to consider them as neither nor . But it's more closer to , if used in speech.
stackexchange-korean
{ "answer_score": 6, "question_score": 3, "tags": "speech levels, register" }
NEHE Lesson 06 broken in LWJGL, what should i use instead of org.lwjgl.devil.IL? In the NEHE Lesson 06 ( It has you load an image and texture an object with it. I am currently using LWJGL, and the version i am using right now does not have the org.lwjgl.devil.IL that the LWJGL version of the tutorial has. Now i am stuck on lesson 6, would anybody please help me?
The Devil texture library is no longer part of LWJGL since version 2.x. Some alternatives that you can use are libraries like Slick-Util or PNGDecoder. Tutorials for these can be found on the LWJGL Wiki under the Helper Library section.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, opengl, lwjgl" }
How to convert normal string to escaped string? I get a normal string from user input, and I need escaped version for another application. How can I convert normal string, for example: saixmmxq amimimxmo\qmsimcimsomacmo mcai\mcismc mcidmoc to escaped string, for example: saixmmxq\n\tamimimxmo\\qmsimcimsomacmo\n\t\tmcai\\mcismc\tmcidmoc in php?
You can use `str_replace` or `json_encode` $string = "saixmmxq amimimxmo\qmsimcimsomacmo mcai\mcismc mcidmoc"; $final1 = str_replace(["\n","\r","\t"],["\\n","\\r","\\t"],$string ); var_dump($final1); //Or $final2 = json_encode($string, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); var_dump($final2); #Output "saixmmxq\r\n amimimxmo\\qmsimcimsomacmo\r\n mcai\\mcismc mcidmoc"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "php" }
Is Blue Bloods based off of a real family? Is the series _Blue Bloods_&usg=AFQjCNETzVqRzmeR83FSc4Rywl9FnYzAuw) based off of a real-life family of law enforcement officers? Since I haven't been able to find a reference to the same. And was the series named as a reference to nobility (often termed blue bloods) or as a reference to the blue police uniforms in NYC?
> Is the series Blue Bloods based off of a real-life family of law enforcement officers? No. CBS has not stated that it has, and there has been no similar situated family dynasty of Cop/Commissioner Father Son in the NYPD history. > And was the series named as a reference to nobility (often termed blue bloods) or as a reference to the blue police uniforms in NYC ? Yes. The Reagans are considered _"royalty"_ among the show's NYPD. It's a play on words.
stackexchange-movies
{ "answer_score": 3, "question_score": 4, "tags": "plot explanation, blue bloods" }
Breaking at a member function in the Python debugger This should be a trivial question, but my search so far has been fruitless: I'm using the Python debugger (pdb) for the first time, and was quite pleased to find most of the commands familiar from using gdb. However, when I went to set a breakpoint in the _parse_ () member of class _JamParser_ with the statement: (Pdb) b JamParser.parse *** The specified object 'JamParser.parse' is not a function or was not found along sys.path. I tried several several variants, including: (Pdb) b jam2dot.py:JamParser.parse I assume that since I invoked the debugger from the command line that it knows the entities in the file. Is that a false assumption? The documentation says that break can take a function as an argument, but doesn't offer any syntax help. So how do I set a breakpoint for a member function by name?
You need to import names before you can refer to them in the debugger. (Pdb) from jam2dot import JamParser (Pdb) b JamParser.parse
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 12, "tags": "python, debugging" }
How to get the filename of the current file in a Perl one-liner Is it possible to get the current filename (from a list of files) in a Perl one-liner like this below? perl -lane 'if ($_=~/my_value/) { print $_; }' *.txt
The name of the variable is `$ARGV`. You can find out about it in perlvar: `$ARGV`.
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 18, "tags": "perl" }
Why can't I scan from control panel of Canon Pixma TS6220 This is a new printer for me on my Ubuntu 18.04.2 LTS. After searching for ways to install, I added this printer via the < website. I have also installed “ScanGear MP Ver. 3.70 for Linux (debian Packagearchive)” from Canon’s driver support website for this printer (< as well as scangearmp2 (version 3.70.3-1804+2). I can scan with Simple Scan, Xsane, and $ scangearmp2 in terminal, but not by using the printer’s control panel, “scan to computer” or “attach to email”. When I select this option, the display shows a response (“Processing – please wait momentarily”), but there is no response in the platen and the “process” ends and the display returns to its normal state. Am I missing some drivers/files, or were the files that I downloaded put in the wrong place?
I don't have that particular model, but for all my Canon printers, that functionality has depended on having Windows software installed "MP Navigator EX". I just tested this by starting my Windows 7 Virtual Machine which has the software installed. After that, when I pressed the "Scan" button on the printer control panel, a menu came up asking me where I wanted to scan to, USB or PC, and the name of the virtual machine was listed by "PC". The scan completed normally and was placed into "My Documents" folder in my account on the virtual machine. When I close the virtual machine and press the "Scan" button, I only get the choice of USB. Bottom line, it's Windows only.
stackexchange-askubuntu
{ "answer_score": 3, "question_score": 0, "tags": "drivers, scanner, canon" }
Whether the options $(iii)$ and $(iv)$ make sense? > Let$~f:\mathbb{R}^2\longrightarrow \mathbb{R}$ be such that $f_x=\dfrac{x}{\sqrt{x^2-y^2}}$ and $f_y=\dfrac{y}{\sqrt{x^2-y^2}}$,$x^2\neq y^2$. Consider the following statements $:$ > > $(i)$ $\displaystyle \lim_{{(x,y)\to (2,-1) }} f(x,y)$ exists. > > $(ii)$ $f(x,y)$ is continuous at $(2,-1)$. > > $(iii)$ $f_x$ and $f_y$ are not continuous at $(0,0)$. > > $(iv)$ $f_x$ and $f_y$ are continuous everywhere. > > then which of the above statement/s is/are true? Clearly $(0,0)$ is not in the domain of $f_x$ and $f_y$. So there is no question of continuity or discontinuity there. So $(iii)$ and $(iv)$ are absurd options. At $(2,-1)$ both $f_x$ and $f_y$ are continuous so, $f$ is differentiable at $(2,-1)$ and hence $f$ is continuous at $(2,-1)$. Therefore according to me $(ii)$ is the only correct option above. Is this reasoning correct at all? Please check it. Thank you in advance.
Your reasoning is almost correct. $(iii)$ is true (it's the negation). $(i)$ is true too because $(ii)$ is true. Also note that for differentiability, you need the partial derivatives to exist in a neighbourhood of said point, which is pretty much obvious. I assumed here that the domain of the partial derivatives are the same as $f$, so only "half" of their values are given in the question. I chose this, because it would be lame to give a secret function $f$ defined on $\mathbb{R}^2$ and the given partial derivatives with another domain.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "limits, multivariable calculus, derivatives, continuity, partial derivative" }
How to read config file in Jenkins pipeline I'm creating a new pipeline job, before execute detail bat files, there are lots of variable to define. node('BuildMachine') { env.ReleaseNumber='1.00.00' env.BuildType='Test' env.Language='ENU' ... Stage('Build') { bat ''' call build.bat %ReleaseNumber%_%BuildType%_%BUILD_NUMBER% ''' } } 1. Can I save these global variable to a config file, store in git repository and read it? 2. Can these variable still work in bat?
EnvInject Plugin aka (Environment Injector Plugin) gives you several options to set and use environment variables in Jenkins job. It will write the variables to a file which can be loaded later to get the variables, but I don't think the variables will directly work in bat.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "jenkins, jenkins pipeline" }
Confidence interval for exponential distribution I'm having trouble with homework and hope somebody can help. The lifespan of a lightbulb is assumed to be a random variable $X$ with density function: $$f_X(x)=e^{-x/\theta}/\theta,\, 0\leq x $$ The lifespan of a single lightbulb have been measured to 1000 hours. Construct a confidence interval that contains the true values of $\theta$ with $95$% certainty. My attempt: $$f_X(x)=e^{-x/\theta}/\theta\implies F_X(t)=1-e^{-t/\theta}$$ So $$F_{X/\theta}(t)=1-e^{-t}$$ is independent of $\theta$ Now $$P(X/c_2\leq \theta <X/c_1)=P(c_1\leq X/\theta < c_2)=F_{X/\theta}(c_2)-F_{X/\theta}(c_1)=(1-e^{-c_2}) - (1-e^{-c_1})=e^{-c_1}-e^{-c_2}$$ And here I am stuck with no way forward. I dont really understand the general procedure here and would really apreciate some help Regards, Tobias
The inequality $\mathrm e^{-c_1}-\mathrm e^{-c_2}\geqslant95\%$ is achieved by many $(c_1,c_2)$, for example if $\mathrm e^{-c_1}\geqslant97.5\%$ and $\mathrm e^{-c_2}\leqslant2.5\%$, say $c_1=0.0253$ and $c_2=3.6889$. Another valid, but asymetric, choice is $c_1=0$, $c_2=2.9958$ (this yields the shortest possible interval). Still another one is $c_1=0.1053$, $c_2=+\infty$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "statistical inference" }