body1
stringlengths 20
4.1k
| body2
stringlengths 23
4.09k
|
---|---|
I have the following piece of text in Latex: \texttt{List<List<Integer>>} and it was rendering properly. Then, I decided to use beramono as my typewriter font, and I have a problem: >> is now rendered as a » character. How should I fix it? In a listing environment, >> is shown correctly. | I have an inline code example with a nested Java generic declaration, using the typewriter typeface. However, the closing >> is rendering as a black box. A cursory Google search suggested $>>$, but this removes the typewriter font. Using \textgreater in place of the actual > also encounters the same problem. Here is the offending snippet: ...declaration {\tt List<Map<Integer, String>>} is... Any ideas? |
So I have been given an assignment to recover an encryption key through the method of brute force. I know the keyspace is 2^16. I have the ciphertext, and I have the encryption/decryption algorithms. My problem is I have no clue how one would begin any sort of brute force attack. I don't require any cryptoanalysis from anyone, just maybe some tips and tricks, or a good resource anyone may know of that might help me realize my goal. This is my first time attempting anything like this. I'd really appreciate it guys. If it would helpful in determining what advice I'd need: The assignment code is given at under lecture notes 2. "With BLOCKSIZE set to 16, the script EncryptForFun.py produces the following ciphertext output for a plaintext message that is a quote by Mark Twain: 20352a7e36703a6930767f7276397e376528632d6b6665656f6f6424623c2d\ 30272f3c2d3d2172396933742c7e233f687d2e32083c11385a03460d440c25 Recover the encryption key and decode the message" | Given a CBC ciphertext and IV, how can I find the encryption key? We are limited with an 8 chars key, each char in the range of [a..h], so I can generate every possible key (these are only $8^8 = 2^{24}$ (about 4 million) different possible keys). How would I go about finding the correct one though? |
I am 22, living with my parents. I plan to buy a house in the next 4 or 5 years. I want to learn more about home improvement so I can renovate my future house easily. My dad does renovations, but I see how his lack of education in this domain makes him do mistakes occasionaly. I want to learn about this domain in case I need to renovate a part of my house or if I need to hire a contractor and make sure he is qualified. What can I do to learn about home improvement? Read books? | I am a new homeowner and know literally almost nothing about home improvement. I would like to learn basic concepts by doing things one at a time...but I can't just jump in and do most things. Are there any good resources (websites/books) that provide project ideas or tutorials that are organized from extremely basic to very advanced? I could use this to start with things extremely basic and learn skills and get ideas as I go. |
How can I make a command (or is there an existing one?) which takes two arguments: 1) character type 2) N (count) and puts N number of characters side by side? \newcommand{\foo}[2] { % sample: \foo{c}{3} -> ccc } | Is it possible to define a command, which repeats the following command n-times? Call it for example \Repeat, then \Repeat[4] \command{...} should be equivalent to \command{...} \command{...} \command{...} \command{...} |
Let $R$ be a ring without identity and with no zero divisors. Let $S$ be the ring whose additive group is $R \times \Bbb{Z}$. Let $A = \{(r,n)\in S \mid rx + nx = 0 \text{ for every } x \in R\}$. (a) $A$ is an ideal in $S$. (b) $S/A$ has an identity and contains a subring isomomorphic to $R$. (c) $S/A$ has no zero divisors. Multiplication on $R \times \Bbb{Z}$ is defined like so: $(r,n) \cdot (s,k) = (rs + kr + ns,nk)$. I was able to prove parts (a) and (b), but I am having trouble with part (c). I could use a hint. On a somewhat related note (perhaps I might stretch the definition of "related"), to prove that the quotient of a principal ideal ring is a principal ideal ring, wouldn't I just use the fact that $f : R \to R/I$ defined by $f(r) = r + I$ is a surjective ring homomorphism, and so if $R$ is a principal ideal ring, so is $f(R) = R/I$? I asked this in chat but didn't receive any responses; and I didn't think this question merited its own post. | I am having trouble with another homework problem (Hungerford, Algebra, Problem 12, Chapter III, Section 2). Let $R$ be a ring without identity and with no zero divisors. Let $S$ be the ring whose additive group is $R \times \mathbb{Z}$ with multiplication given by $$(r_1,n_1)(r_2,n_2)=(r_1r_2+n_2r_1+n_1r_2,n_1n_2).$$ Let $A=\{(r,n) \in S \mid rx+nx=0 \text{ for all } x \in R\}$. (a) $A$ is an ideal in $S$. (b) $S/A$ has an identity and contains a subring isomorphic to $R$. (c) $S/A$ has no zero divisors. I've done (a) and (b), but haven't been able to crack (c). Here's what I have so far: (c) Suppose $((r, n) + A)((s, m) + A) = (0, 0) + A$. Then $(r, n)(s, m) \in A$, so $(rs + mr + ns)x + (nm)x = 0$ for all $x \in R$. But $(rs + mr + ns)x + (nm)x = rsx + mrx + nsx + nmx = r(sx + mx) + n(sx + mx)$. Now here we have an expression involving $r(something) + n(something)$ and $s(something) + m(something)$, and I want to say that if it's zero for all $x$ then $rx + nx = 0$ for all $x$ or $sx + mx = 0$ for all $x$, but all I seem to be able to say is that $rx + nx = 0$ for all $x = sx' + mx'$, which is not (or not obviously) what I want. I appreciate any help! |
The image shows a contestant being asked what the probability is of randomly selecting the right answer. $4$ options are given: $2$ being $25\%$ and the other two being $50\%$ and $0\%$. Basically I’m in disagreement with someone over this question. The question in the picture is a paradox but I think the probability of randomly choosing the option $25\%$ is $2/4$ or $1/2$ since it is repeated, while my friend believes it is $1/3$ since there are technically three options. Anyone able to give a conclusive answer? | I found this math "problem" on the internet, and I'm wondering if it has an answer: Question: If you choose an answer to this question at random, what is the probability that you will be correct? a. $25\%$ b. $50\%$ c. $0\%$ d. $25\%$ Does this question have a correct answer? |
I have a long scope for my laser musket but would like to scrap it and build a medium scope. Is there a way to scrap the actual long scope itself? | Let's say I have 10mm pistol. Can I break it down so I'm left with no pistol, and a [barrel, magazine, sight, grip] etc? I ask because I'm finding myself in the early game with mods across 3-4 pistols that I'd like to combine into one, but I lack the extra junk/spare mods to swap things around. |
I do a lot of work with table variables before finally presenting result sets to the user. For example, I might pull in a whole load of columns from many different tables like this: DECLARE @tmp TABLE ( ID int, username nvarchar(50), -- data taken from tbl_Users site nvarchar(50), -- data taken from tbl_Sites region nvarchar(100), -- data taken from tbl_Regions currency nvarchar(5) -- data taken from tbl_Currencies ) I spend a lot of time looking through the Object Explorer to ensure that the data length of the columns in correct (matches the original tables). Sometimes if I change the table schema but don't update all the procedures, I might get caught out with a truncation error. Is there any issue with taking a lazy approach and just doing this: DECLARE @tmp TABLE ( ID int, username nvarchar(max), site nvarchar(max), region nvarchar(max), currency nvarchar(max) ) Does nvarchar(max) actually use up any more memory or this the allocated memory based on the data size? Are there any other gotchas? Please note that I am aware of third-party tools for jumping to the definition, but that's not what I'm asking. UPDATE The duplicate question has value, but the question is not identical IMHO. The duplicate revolves around the design of actual tables, not table variables. However, there is some merit in the answers, namely: nvarchar(max) vs nvarchar(8000) are no different in resource usage until 8000+ data lengths Business logic layers rely on structure and meaningful data, so specifying a column size that compliments the original provides value In that sense, it would seem that it is fine to use nvarchar(max) in table variables instead of nvarchar(n), but it has a reliability and performance risk in some environments. If you think this should be deleted then fair enough (but please stop arguing I appreciate all input!) | In SQL Server 2005, are there any disadvantages to making all character fields nvarchar(MAX) rather than specifying a length explicitly, e.g. nvarchar(255)? (Apart from the obvious one that you aren't able to limit the field length at the database level) |
I am a Computer Science M.Sc. Student in a university in a developing country. I am planning to apply for PhD this year. Actually my main reasons to not continue my PhD here, are the issues related to my country economics and infrastructures. Poor dorm conditions, no funded PhD, unstable internet, no proper study place in university are some of them where decrease the quality and contributions of a PhD student and I think that those issues will be solved by the migration to USA itself and is not related to the rank of the destination university. to make my question clear, actually I want to know what are the benefits of a top 20 university in USA saying, Caltech over a top 70 university saying, Oregon State University . I can imagine one or two like the strong advisor and peers but I can't think more. please note that I am not asking about the after-graduation job perspective, I mean What is the effects on the quality and contributions of a PhD student to study in a top-20 instead of a top-70 university. P.S: if it matters ranks are according to the US News portal. | What I'm trying to understand is, to what degree does the status/rank of the University (where one completes his/her Ph.D) matter while shaping his/her career after graduation? I would like to know the weight given to one's school in both the following cases: While applying for post-docs/faculty positions in academia While applying to industrial research labs For instance, I've read on some forums (I can't locate the link now) that while considering prospective applications for tenure-track faculty positions, very few Universities accept a candidate who has completed his/her Ph.D from a lower ranked school having a lesser "brand" value, irrespective of the fact whether he/she has published equally original work as his/her counterpart from an Ivy league college. How much truth is in this statement? It would be really great if someone already in academia, either as a newly-accepted faculty or someone on the Faculty Hiring committee could share their experiences/statistics on this regard. I'm simply interested to know the answer, without commenting at all on whether such a practice is justifiable. Similarly, what about recruitment to internationally acclaimed research labs (like or ) - what importance do they place on the pedigree of a candidate's college, before taking into consideration what they published ? I'm personally interested in answers related to the field of Computer Science (theory), but the question is applicable to any prospective grad student in any discipline in my opinion. Feel free to share your personal experiences post-Ph.D in detail, as that would give me (and future viewers of this question) about what its like to carve a career once you are out of school! |
PREFACE: I don't care about the merits of using a cutoff or not, or how one should choose a cutoff. My question is purely mathematical and due to curiosity. Logistic regression models the posterior conditional probability of class A versus class B and it fits a hyperplane where the posterior conditional probabilities are equal. So in theory, I understood that a 0.5 classification point will minimize total errors regardless of set balance, since it models the posterior probability (assuming you consistently encounter the same class ratio). In my real life example, I obtain very poor accuracy using P > 0.5 as my classifying cutoff (about 51% accuracy). However, when I looked at the AUC it is above 0.99. So I looked at some different cutoff values and found that P > 0.6 gave me 98% accuracy (90% for the smaller class and 99% for the bigger class) - only 2% of cases misclassified. The classes are heavily unbalanced (1:9) and it is a high-dimensional problem. However, I allocated the classes equally to each cross-validation set so that there should not be a difference between the balance of classes between model fit and then prediction. I also tried using the same data from the model fit and in predictions and the same issue occurred. I'm interested in the reason why 0.5 would not minimize errors, I thought this would be by design if the model is being fit by minimizing cross-entropy loss. Does anyone have any feedback as to why this happens? Is it due to adding penalization, can someone explain what is happening if so? | I am using glmnet where my dependent variable is binary (class 0, class 1). I want to report percentage accuracy of the model. So I use the predict function for my test dataset. However, the values returned are in decimals instead of being 0 and 1. So I set a threshold of 0.5, meaning if the predicted value > 0.5, I consider it as 1 and if predicted value <= 0.5, I consider it as 0. Next I create a confusion matrix by comparing the predicted and actual values of my test data. From this I find the accuracy. I have pasted my sample code below. I am not sure if this is the right approach for reporting the accuracy percentage for a glmnet model predicting a binary dependent variable. data <- read.csv('datafile', header=T) mat <- as.matrix(data) X <- mat[, c(1:ncol(mat)-1)] y <- mat[, ncol(mat)] fit <- cv.glmnet(X, y, family="binomial", type.measure="class", alpha=0.1) t <- 0.2*nrow(mat) #20% of data t <- as.integer(t) testX <- mat[1:t, 1:ncol(mat)-1] predicted_y <- predict(fit, s=0.01, testX, type='response') predicted_y[predicted_y>0.5] <- 1 predicted_y[predicted_y<=0.5] <- 0 Yactual <- mat[1:t, ncol(mat)] confusion_matrix <- ftable(Yactual, predicted_y) accuracy <- 100* (sum(diag(confusion_matrix)) / length(predicted_y)) |
I know some sql but don't quite understand the things behind the scene. And this question came to me the other day while I am taking shower... If we compare these two queries below: a. select * from table_abc; b. select id, name, timestamp from table_abc; which query is (theoretically) faster? My guess is a because in query b it takes time to pick out the 3 columns I want. But that's counterintuitive at the same time because that means getting less information takes longer. All comments/answers are highly appreciated! | On multiple questions here and on stack overflow i saw people saying in the comments and answers that select * from table is almost always an antipattern without any explaination why. Althrough I can sort of deduce why it is an antipattern. I may be looking over a detail that someone else with better understanding of the issue noticed. So here is my question, why people say that select * is an antipattern. |
I currently have a command in linux terminal that I run a lot which is pyclewn ==window=none ..... My question is if there is a way for me to assign a shortcut to this command I am using Fedora 20 | How could I execute a script in Shell when a shortcut key is pressed. Essentially what I need is when a shortcut key is pressed the script should read from a file and display that content in the terminal. |
As accurately as sources can provide, what were the Jedi death tolls in the immediate aftermath of Order 66: On Coruscant, and how many by Anakin's hand? Outside Coruscant, across the galaxy, to the opening shots of Order 66? In the immediate days after, when the "Grand Army of the Empire" was still actively hunting down those who managed to escape? In the context of this question, the immediate term ends when the inhibitor chips release their control of the clones i.e. when the actually-loyal-to-the-Republic-and-the-Jedi clone troopers regained free will. Edit: I'm looking for a breakdown, not a grand total. | Episode III obviously doesn't show ALL the Jedi being eliminated as a result of Order 66. What I've never heard, though, is how many Jedi were in existence at the time of Order 66. Is there any definitive count as to how many of them were alive at the time of the purge and how many were victims of Order 66? |
Show that $i$ is neither negative nor positive. Proof: Assume that $i<0$ $i×i>0×i$ Since $i<0$ $i^{2}>0$ Since $i^{2}:=-1$ So, $-1>0$ which doesn't hold and hence this is a contradiction to the fact. Next, assume that $i>0$ $i×i>0×i$ since $i>0$ $i^{2}>0$ Since $i^{2}:=-1$ So, $-1>0$ which again doesn't hold and hence this is a contradiction to the fact. This establishes the proof. Is this valid proof? | Can there be such a thing as positive and negative complex numbers? Why or why not? What about positive or negative imaginary numbers? It seems very tempting to say $+5i$ is a positive number while $-2i$ is a negative number. On an Argand diagram (complex plane) $+5i$ would be represented by a point above the horizontal axis while $-2i$ is a point below the horizontal axis. |
According to biblatex doc (p.80-81) : \Parencite is similar to \parencite but capitalizes the name prefix of the first name in the citation if the useprefix option is enabled, provided that there is a name prefix and the citation style prints any name at all. \Textcite is similar to \textcite but capitalizes the name prefix of the first name in the citation if the useprefix option is enabled, provided that there is a name prefix. My problem is that \parencite and \textcite capitalize the author name by default. Therefore, there is no difference between these commands (\textcite has the same behavior than \Textcite). I am using authoryear-comp style. It it a big problem for me because I cannot cite using \textcite. Indeed it will produces something like "according to NAME (2008), there is ...". The capitalized author name is ugly. MWE : \RequirePackage{filecontents} \begin{filecontents}{\jobname.bib} @Book{author00:_title, author = {Author}, title = {Title}, publisher = {Publisher}, year = 2000} \end{filecontents} \documentclass[12pt,twoside,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,french]{babel} \usepackage{lmodern} \usepackage{xspace} \usepackage[autostyle=true]{csquotes} \usepackage[style=authoryear-comp, hyperref, backend=biber, isbn=false, doi=false, url=false, ]{biblatex} \AtEveryBibitem{\clearlist{language}} \renewcommand*{\newunitpunct}{\addcomma\space} \addbibresource{\jobname.bib} \usepackage[colorlinks]{hyperref} \begin{document} \noindent \verb+\parencite{author00:_title}+ : \parencite{author00:_title}\\ \verb+\Parencite{author00:_title}+ : \Parencite{author00:_title}\\ \verb+\textcite{author00:_title}+ : \textcite{author00:_title}\\ \verb+\Textcite{author00:_title}+ : \Textcite{author00:_title} %\printbibliography \end{document} | I'm using biblatex to manage my citation in a natbib style : \usepackage[style=alphabetic,maxnames=6,natbib=true]{biblatex} However when I use the \citet command, the author's name is in a \textsc font, I would like to change this behavior so that the font used is the default one, but I could not find how to do this in biblatex's documentation. |
I have attempted to find the post which provides an explanation as to the circumstances in which we can treat $\frac{dy}{dx}$ as a ratio which appears to be used in solving separable DE's, but I have yet to find it. Can anyone provide the link please? Thanks | In the book Thomas's Calculus (11th edition) it is mentioned (Section 3.8 pg 225) that the derivative $dy/dx$ is not a ratio. Couldn't it be interpreted as a ratio, because according to the formula $dy = f'(x)dx$ we are able to plug in values for $dx$ and calculate a $dy$ (differential). Then if we rearrange we get $dy/dx$ which could be seen as a ratio. I wonder if the author says this because $dx$ is an independent variable, and $dy$ is a dependent variable, for $dy/dx$ to be a ratio both variables need to be independent.. maybe? |
I would like to pass an undefined number of optional arguments to a function. The optional arguments are stored a priori in a dictionary. As an example: def f(a=0, b=0, c=0): return a my_args = {'a':5, 'b':3} print(f(my_args)) The expected output would be 5, however it is {'a':5, 'b':3} | In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(param1, **param2): |
I need to read a whole file into memory and place it in a C++ std::string. If I were to read it into a char[], the answer would be very simple: std::ifstream t; int length; t.open("file.txt"); // open input file t.seekg(0, std::ios::end); // go to the end length = t.tellg(); // report location (this is the length) t.seekg(0, std::ios::beg); // go back to the beginning buffer = new char[length]; // allocate memory for a buffer of appropriate dimension t.read(buffer, length); // read the whole file into the buffer t.close(); // close file handle // ... Do stuff with buffer here ... Now, I want to do the exact same thing, but using a std::string instead of a char[]. I want to avoid loops, i.e. I don't want to: std::ifstream t; t.open("file.txt"); std::string buffer; std::string line; while(t){ std::getline(t, line); // ... Append line to buffer and go on } t.close() Any ideas? | How do I read a file into a std::string, i.e., read the whole file at once? Text or binary mode should be specified by the caller. The solution should be standard-compliant, portable and efficient. It should not needlessly copy the string's data, and it should avoid reallocations of memory while reading the string. One way to do this would be to stat the filesize, resize the std::string and fread() into the std::string's const_cast<char*>()'ed data(). This requires the std::string's data to be contiguous which is not required by the standard, but it appears to be the case for all known implementations. What is worse, if the file is read in text mode, the std::string's size may not equal the file's size. A fully correct, standard-compliant and portable solutions could be constructed using std::ifstream's rdbuf() into a std::ostringstream and from there into a std::string. However, this could copy the string data and/or needlessly reallocate memory. Are all relevant standard library implementations smart enough to avoid all unnecessary overhead? Is there another way to do it? Did I miss some hidden Boost function that already provides the desired functionality? void slurp(std::string& data, bool is_binary) |
I am new for Junit's and i wrote Singleton class Junit Test case in my below code but i am getting exception and second method for loop not getting to cover can some one help me please to get it solve Singleton public class MSA { private static final _msa = new MSA(); // TA is a singleton private ArrayList<MSThread> MSThreads = new ArrayList<MSThread>(); private String msaInfo = null; public String getMsaInfo() { return msaInfo; } public void setMsaInfo(String msaInfo) { this.msaInfo = msaInfo; } private MSA() {} public static MSA getInstance() { return _msa; } public void shutdown() { for (MSThread t: MSThreads) { t.shutdown(); } } TestClass @Test public void setMsaInfoTest() throws Exception{ MSA fixture = MSA.getInstance(); fixture.setMsaInfo("sample"); assertTrue(fixture.getMsaInfo() == "sample"); } @Test public void testShutdown_1() throws Exception { MSA fixture = MSA.getInstance(); fixture.shutdown(); } Error java.lang.AssertionError at org.junit.Assert.fail(Assert.java:86) at org.junit.Assert.assertTrue(Assert.java:41) at org.junit.Assert.assertTrue(Assert.java:52) at com.verizon.dtix.microsvcagent.MSATest.setMsaInfoTest(MSATest.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) | I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it and should it not be used? What's the difference? |
I been working on and with SSL certificate's for a bit now and my organization is thinking of going with a Wildcard certificate vs the Multi-domain san certificate we have now. What I need to know, is why we should not go the wildcard Certificate route? I know how they work, but I need to sell this to them. I know the advantages and disadvantages. I have been researching reasons why not to use and the only disadvantage I can really find is the same one every site or person says, " If the .key is compromised then the WCS is". I need a better reason why not to use it then that, because the multi-domain is the same way .key wise. We have and can put steps in place to make this safer. What we are looking at doing is going from 1 UC Multi-domain with hundreds of SANs and breaking it down with wildcards. this will also be running through a NetScaler SDX 11500. I am not a big NetScaler person but I understand it. If we enabled SNI can we load different certs and keys? Also do you know of more steps to make it safer. Thanks | Is there anything inherently more insecure about using a wildcard SSL certificate over a regular SSL certificate? We are looking to implement a subdomained web application (a la FreshBooks and BaseCamp, where users pick a subdomain), and one of our team members is concerned that a wildcard SSL approach is not secure enough (if so, how do FreshBooks and BaseCamp do it?!?). The alternate solution is to use a single subdomain, like https://ssl.domain.com and when a user types in http://user.domain.com we set the subdomain in the session, and immediately redirect the user's future requests to "" and use the session information to show the user's information. My concern is that if a user wants to send a link to their domain to a friend, they will copy/paste the URL in the browser (now https://ssl.domain.com) which will be our main home page, and not the user's home page. BTW, if I have missed a major best-practice for this kind of scenario, please let me know. |
To know if you are vulnerable, you can run: env X="() { :;} ; echo busted" /bin/sh -c "echo completed" env X="() { :;} ; echo busted" `which bash` -c "echo completed" If you see "busted" then you are vulnerable. Is there a patch yet? | Recently, there have been news going around regarding "CVE-2014-6271" (See ), which is a vulnerability in Bash. How do I know if I am affected by this, how can I fix it, and why should I care? This is designed as a canonical answer for this vulnerability, due to its scope and severity. |
I need to initialize a fixes size arrays quite often, like so: for( uint16_t q=0; q<SIZE; q++ ) array[q]=value; Array is defined as float array[SIZE]; Is there a nicer way of doing this, replacing with a macro or similar? p.s. Not allowed to use mem___ calls. | I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built right into the C syntax? |
Mike ( had broken | broke ) his mother's vase last night but he has not told her yet. Question: Some argue it must use "broke" instead of "had broken" because "last night" could not be used with past perfect tense. I notice some teachers preach a grammar rule: Adverb like "last night, last year, a few days ago" should not be used with past perfect tense; It should use past tense. But I never find any formal grammar books make that statement. Instead, I think it is quite a "weak grammar rule" which is often "violated" in some writings. I have quite often seen sentences like "He had taken the test last year." and similar ones in popular novels, news papers and magazines. I think "had broken" is a better answer here as it make the sentence more cohesive in meaning and logic, even though "broke" is ok too, at least grammatically. Maybe only in cases for a specific time point like "at 8 o'clock", we might have to use past tense. e.g, He broke the vase at 8 pm last night. Please enlighten me on this if my understanding is not right or there is some grammar rules prevailing here which I am not aware of. Your advise are appreciated very much! | I noticed that my American friends tend to use the past perfect form when they use the verb mention in its past form, almost despite of the context of the sentence. I hear them say "you had mentioned" a lot more often even in situations where the use of simple past would have been perfectly fine. Have you noticed it too and is it one of those unwritten rules, or is there a more formal explanation to it? It seems like there was more verbs like that, but I am having a hard time remembering it now. If I do, I will edit the post and likely change the title to accommodate other verbs. |
I want to install a Windows application which runs on .Net framework. How can I do this? | I wanted to install osu!, but it doesn't work when you go on PlayOnLinux (error message and nothing happens). Then, I followed . As the video showed (at 2:44,) I clicked on Run a .exe file in this virtual drive then I clicked on osu!install.exe and then I get this message: Can you tell me how to install this? |
I'm relatively new to Java, and I'm trying to use composition within a created a Resident class which extends another class, Person. I'm getting a null pointer exception error that points to this line of code: equipment.setEquipment(hasInitialEquipment); in my constructor in the resident class. I know that I must be doing something wrong but I'm really not sure what it is. Any help would be greatly appreciated. public class Driver1 { public static void main(String[] args) { Resident a = new Resident("Bob Smith", 74, "Male", 317, 'C', false, false, ""); a.writeOutput(); System.out.println(); } } The class Person public class Person { private String name; public Person() { name = "No name given"; } public Person(String initialName) { name = initialName; } public String getName() { return name; } public void setName(String newName) { name = newName; } public void writeOutput() { System.out.println(name); } } The Class Resident public class Resident extends Person { public static final int DEFAULT_AGE = 0; public static final int DEFAULT_ROOM = 0; private int age; private String gender; private int room; private char building; private boolean supervised; private Equipment equipment; public Resident() { super(); age = DEFAULT_AGE; gender = "Undeclared"; room = DEFAULT_ROOM; building = '0'; supervised = false; } public Resident(String initialName, int initialAge, String initialGender, int initialRoom, char initialBuilding, boolean needsSupervision, boolean hasInitialEquipment, String initialEquipmentType) { super(initialName); age = initialAge; gender = initialGender; room = initialRoom; building = initialBuilding; supervised = needsSupervision; equipment.setEquipment(hasInitialEquipment); equipment.setEquipmentType(initialEquipmentType); } public int getAge() { return age; } public void setAge(int newAge) { age = newAge; } public String getGender() { return gender; } public void setGender(String newGender) { gender = newGender; } public int getRoom() { return room; } public void setRoom(int newRoom) { room = newRoom; } public char getBuilding() { return building; } public void setBuilding(char newBuilding) { building = newBuilding; } public boolean getSupervised() { return supervised; } public void setSupervised(boolean newSupervised) { supervised = newSupervised; } public boolean getEquipment() { return equipment.getEquipment(); } public String getEquipmentType() { return equipment.getEquipmentType(); } @Override public void writeOutput() { System.out.println(getName()); System.out.println("Age: " + age); System.out.println("Gender: " + gender); System.out.println("Room: " + room); System.out.println("Building: " + building); if(supervised){ System.out.print("***Supervised Ambulation only***"); if(getEquipment()) System.out.println(getEquipmentType()); } } } The Class Equipment public class Equipment { private boolean equipment; private String equipmentType; public Equipment() { equipment = false; equipmentType = null; } public Equipment(boolean initialEquipment, String initialEquipmentType) { equipment = initialEquipment; equipmentType = initialEquipmentType; } public boolean getEquipment() { return equipment; } public void setEquipment(boolean newEquipment) { equipment = newEquipment; } public String getEquipmentType() { return equipmentType; } public void setEquipmentType(String newEquipmentType) { equipmentType = newEquipmentType; } public void WriteOutput() { if(equipment) System.out.println("Equipment: " + equipmentType); } } | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
What is the word for the words we use to address a person or people to whom we stand in a particular relationship. For example I usually address my friends as "boss". I greet them with "Hey boss, how are you doing?" Neighbouring words or terms include term of endearment which doesn't fit as endearment seems too affectionate a word for the context to which I'm referring. Similarly pet name is too affectionate and it's also used to tag a specific person rather than a collection of people. NB: Apologies if my wording is unclear. Edit: Emphasised collection of people to clarify why pet name or nickname aren't appropriate in my context. | For example, "dude," "man," "buddy," "pal," etc, when used to stand in for someone's name. "Hey, pal, how's it going?" Is there a word for terms like these? Or is "colloquialism" as close as we can get? |
If three cards are drawn randomly from a normal playing deck without replacement, what is the probability that two end up being black and one red? I did the problem and came up with 13/102. My Saxon book said 39/102 or 13/34. They got that by adding together the probabilities of the three color combinations, which are all equal to each other. But I don't care what order I draw those colors in. Why do they add together those three events when I only draw the three cards once? | If I draw three cards at random (without replacement) from a standard 52-card deck, what is the probability that two of the cards will be black and one of them will be red? Thanks! |
How to calculate double sum with power like this? $$\sum_{n = 2}^{\infty} \sum_{m = 2}^{\infty} m^{-n}$$ I have tried to search for the series formula equation but could not find one that fits for this. Is it possible to apply the geometric series formula to this one? If yes, how can we do it? gives me result $1$, but I don't know how can it be. sum (sum m^(-n) m=2..infinity) n=2..infinity | I'm not sure if I should call this "the sum of a sum" but I can't think of another phrase for it. Anyhow, I'm confused about excercises such as this one $$\sum_{j=2}^{\infty} \left( \sum_{k=2}^{\infty} k^{-j} \right)$$ where I want to compute the sum. I'm thinking maybe I could rewrite it as $$\sum_{k=2}^{\infty} \frac{1}{k^{2}} + \sum_{k=2}^{\infty} \frac{1}{k^{3}}+... $$ but I don't know where to go from there or if that is even correct thinking. (I just began my first course in linear analysis.) |
The following script works to cat all files in a directory without header but prints the file name. How can I cat without file name. tail -n +2 * >> Compile | I would like to concatenate several tables and just keeping the header in the first line (and thus not having a new header each time that a new table has been concatenate). Does anyone know how to do that? I am currently using: find "/dir/folder" name "*.dat" -exec cat {} + >> "/dir/folder/table.txt" but I can get rid of the header with that. |
For example I have the array: int IDs[]={1,21,5,3,12,23,2}; The number of pairs that are in the wrong order is 9. The pairs are: (21, 5) (21,3) (21, 12) (21,2) (5,3) (5,2) (3,2) (12,2) (23,2). So , my algorithm for this implies two for's: for(int i=0;i<IDs.length;i++) { for(int j=i+1;j<IDs.length;j++) { if(IDs[i]>IDs[j]) wrong++; } } The problem is that this has a complexity of n2 and I should have a complexity of maximum n*log n. | I'm designing an algorithm to do the following: Given array A[1... n], for every i < j, find all inversion pairs such that A[i] > A[j]. I'm using merge sort and copying array A to array B and then comparing the two arrays, but I'm having a difficult time seeing how I can use this to find the number of inversions. Any hints or help would be greatly appreciated. |
I have noticed lately that I've been lacking any space on my MacBook. I've looked at the storage data and noticed my System dir is taking up 65gb, on looking up online this issue the culprit is usually the snapshots/backup folder however mine is empty. I then ran sudo du -d 1 -x -c -g / to list the files and their space usage and got the following: 1 /home 0 /Developer 3 /usr du: /.Spotlight-V100: Operation not permitted 1 /net 0 /.PKInstallSandboxManager-SystemSoftware 1 /bin 0 /Network 1 /sbin du: /Library/Application Support/com.apple.TCC: Operation not permitted 9 /Library 7 /System 1 /.fseventsd 4 /private 1 /.DocumentRevisions-V100 0 /.vol 46 /Users 10 /Applications 1 /opt 1 /dev 0 /Volumes 3 /anaconda3 0 /cores 80 / 80 total Most of it seems somewhat normal to me (I have 120gb available net), do any of these dir's seem slightly off to any of you? | Every few days I get notices on my MacBook that it's running or run out of hard drive space. Curiously, restarting the computer will enable me to recover gigabytes of space (this past time, it was able to recover about 2.2GB). However, I can't identify anything in my personal activity that consumed that space. It's possible that it's a rogue iTunes podcast or a huge software update that my Mac is automatically downloading - would either of these reclaim the space upon a restart? One possibility that I can think of is that FileVault has some sort of disk leak, allocating but not freeing files. Does this make sense? Is there a tool that I can run to determine where this space is going? Assuming it is FileVault, should I try to disable it? What's the best way to turn of FileVault on a nearly full computer? |
Shortly: I have problem Undefined symbols for architecture x86_64. In details: I've build simple project to show my problem. //test.h template <class T> class Test { public: Test(T t); }; //test.cpp #include "test.h" template <class T> Test<T>::Test(T t) {} //test_main.cpp #include "test.h" int main(int argc, char **argv) { int param = 0; Test<int> test(param); } After all - I have this error (compile with -std=c++11): Undefined symbols for architecture x86_64: "Test<int>::Test(int)", referenced from: _main in test_main.o ld: symbol(s) not found for architecture x86_64 Also it's clear if I delete template and change everything to int - I'm fine. But I would really like to understand what is the correct way to call function from a class with a template. I know that there are some questions like this already around but actual reason why this problem happens - I didn't find. So please help me to understand! Some link to documentation with reason why what I'm writing is wrong would be very welcome! Thank you! Edit: this question is answered | Quote from : The only portable way of using templates at the moment is to implement them in header files by using inline functions. Why is this? (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.) |
Is there any way to save Reuben in Episode 4? | Is there anyway to stop Reuben from dying? |
The file named footer.php contains the copyright info: Designed by ... Is it OK to remove theme credits from footer? Is it legal? | I just wanted to know if it's ok to modify/remove links pointing to the designer of the theme. In my case I have "theme by" and the site's logotype, would it be ok to remove the logotype and write the site's name? Or remove it altoghether? Does it have to do with the particular designer of the theme? Thanks |
Einstein's equation in absense of any source (i.e., $T_{ab}=0$) $$R_{ab}-\frac{1}{2}g_{ab}R=0$$ has the solution $$R_{ab}=0.$$ But I think $R_{ab}=0$ does not imply that all components of the Riemann-Christoffel curvature tensor $R^c_{dab}$ be zero (or does it?). From this can I conclude that spacetime can be curved even in absence of any source? | According to Einstein, the space-time is curved and the origin of the curvature is the presence of matter i.e. the presence of the energy-momentum tensor $T_{ab}$ in Einstein's field equations. If our universe were empty (i.e. $T_{ab}=0$ and the cosmological constant $\Lambda$ is setted to be $0$) then I would expect only the flat solution to the vacuum field equations $$R_{ab}=0$$ Surprisingly there are non flat (or non trivial) solutions to the above equations, for example the Schwarzschild solution. This conflicts with the fact that the matter curves the spacetime, so what is the origin of the curvature for these non trivial solutions? I understand that mathematically $R_{ab}=0$ (Ricci-flatness) doesn't imply that the metric is flat, i.e. non trivial solutions are formally admissible, but I don't understand how this is explained physically. |
I have a PHP function to fetch users data but the joined tables share common field names like id, name etc. I am using SELECT * here. How can I display the data. function userData(){ global $pdo; $stmt = $pdo->prepare("SELECT * FROM users LEFT JOIN cities ON users.city = cities.id LEFT JOIN states ON cities.state_id = states.id LEFT JOIN countries ON states.country_id = countries.id WHERE users.id = :id"); $stmt-> bindValue(':id', sessionUser()); $stmt-> execute(); return $stmt->fetch(); } $user = userData(); I want something like: $user['cities.name'] $user['states.name'] But that doesn't work. What to do? | I have two tables in my database: NEWS table with columns: id - the news id user - the user id of the author) USERS table with columns: id - the user id I want to execute this SQL: SELECT * FROM news JOIN users ON news.user = user.id When I get the results in PHP I would like to get associative array and get column names by $row['column-name']. How do I get the news ID and the user ID, having the same column name? |
I wrote this program to sync multiple threads, the functionality of this prog is each runner thread gets some random value and we need to sort them in order but the prog some times get null pointer exception some times not. this is relayrace.java package com.mani.threadstrail; import java.util.Random; import java.util.LinkedList; import java.util.List; public class RelayRace extends Thread{ public static void main(String[] args) { // TODO Auto-generated method stub for(int i=0;i<10;i++) { RelayRace r= new RelayRace(); r.setName("runner-"+ i); r.start(); } try { Thread.sleep(1000); Runner.sortings(); Runner.printlist(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void run() { Random rand = new Random(); int n = rand.nextInt(50) + 1; System.out.println(Thread.currentThread().getName()+" "+ n); Runner r1 = new Runner(n,Thread.currentThread().getName()); r1.add(); } } this is runner.java package com.mani.threadstrail; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class Runner implements Comparable<Runner> { static List<Runner> a = new LinkedList<Runner>(); public int speed; public String name; Runner(int speed,String name){ this.name=name; this.speed= speed; } public synchronized void add() { a.add(this); } static synchronized void printlist() { for(Runner st:a){ System.out.println(st.speed+" "+st.name); } } static void sortings() { Collections.sort(a); } @Override public int compareTo(Runner o) { return -(this.speed-o.speed); } } | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
We use Principal Component Analysis for dimension reduction, why is it important? | Is singular value decomposition almost always useful in practice for enhancing the predicative power of a trained classification model? E.x. A dataset for classification has 20,000 features. Run SVD to convert them to top principal components and transform them to 300 features, and trained a classification model. When predict the class of a test instance, convert it to a 300d principal component feature vector, and use the trained model to predict its class. Are there some notable real datasets of numerous features (variables) in which dimension reduction by SVD would hurt the predictive power of trained classification models? |
I am getting an error message when I try to run my code Attempt to invoke virtual method 'android.view.Window$Callback android.view.Window.getCallback()' on a null object reference Here is the code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_the_game); Button l = (Button) findViewById(R.id.Edit); l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(theGame.this, EditWords.class); startActivity(i); } }); And here is the code for EditWords.java: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_words); Button l = (Button) findViewById(R.id.add); l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(EditWords.this, AddWord.class); startActivity(i); } }); Button x = (Button) findViewById(R.id.delete); l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(EditWords.this, DeleteWord.class); startActivity(i); } }); Button b = (Button) findViewById(R.id.Back3); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {Intent i = new Intent(EditWords.this, theGame.class); startActivity(i); } }); } } | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
When I am using Ubuntu, sometimes the network goes down and there is no option to bring back the wired network. There is always option for wireless, but no option for wired network. In such case I try sudo service network-manager restart (using a command line just to start the interface). This works sometimes, sometimes it takes many iterations and other times it never starts. In my country the network goes down without any reason. I even wrote a perl script to run above script for at least 10 iterations and scheduled it using Cron. Since lately I cannot start the network using above command unless I restart the computer. What is the problem with the computer, why can't a network restart become a first class citizen in Ubuntu and needs a computer reboot. Why isn't there an option that never goes down just like wireless network to start wired network. Is there something I am missing. The command sudo /etc/init.d/networking restart does not seem to do anything at all. | I tried to use sudo service networking restart and sudo /etc/init.d/network restart but they both crash the window manager and I can no longer use my keyboard for input into X. when I use the /etc/init.d/ method it complains saying that I should use the service utility e.g. service networking restart but it crashes just the same. Is there a GUI method of restarting networking? |
I am confused by whether or not to add "the" before a plural noun. For example, do the following two sentences mean something slightly different from each other? (1) We analyzed the potential implications of such practices for consumers. (2) We analyzed potential implications of such practices for consumers. | I'm helping someone learn English (second language), and I'm having trouble explaining when to use the and when not to. For example: Students learn better when teachers are passionate about teaching. versus The students learn better when the teachers are passionate about teaching. There's a subtle difference. The first one is a general statement, whereas the second might imply a study where a group of students learned better than another. Is the difference simply that, general v. specific? |
Example: I have the file "mybinaryfile", and the contents in hex are: A0 01 00 FF 77 01 77 01 A0 I need to know how many A0 bytes there are in this file, how many 01, and so on. The result could be: A0: 2 01: 3 00: 1 FF: 1 77: 2 Is there some way to make this count directly in shell or do I need to write a program in whatever language to do this specific task? | I'd like to know the equivalent of cat inputfile | sed 's/\(.\)/\1\n/g' | sort | uniq -c presented in for production of character usage statistics in text files for binary files counting simple bytes instead of characters, i.e. output should be in the form of 18383 57 12543 44 11555 127 8393 0 It doesn't matter if the command takes as long as the referenced one for characters. If I apply the command for characters to binary files the output contains statistics for arbitrary long sequences of unprintable characters (I don't seek explanation for that). |
I use biblatex with the biber backend and the alphabetic style. When I cite a paper which is written by many authors (eg. Aname Bname Cname Dname) the BibTex entry will look like this: [Ana+97] but I'd like to have [ABCD97] I tried the 'maxauthors' or 'maxbibnames' option to adjust this behavior but it didn't have any effect. I import the biblatex package with: \usepackage[ backend=biber, style=alphabetic, maxauthors=99, maxbibnames=99, sortlocale=de_DE, natbib=true, url=false, doi=true, eprint=false ]{biblatex} | I need to cite the following way: The first 3 Letters of the author + the year. Example: Kemper 2009 --> [Kem09] But I don't have any clue how to do that! |
Prove that $\sqrt{2\sqrt{3\sqrt{...\sqrt{(n - 1)\sqrt{n}}}}} < 3$. I have tried induction on $n$, but with no effect. | Problem: prove $\sqrt{2\sqrt{3\sqrt{\cdots\sqrt{n}}}}<3$ by induction. I tried some, but stopped in $\sqrt[2^n]{n+1}$. Also tried with $2\sqrt{3\cdots}<3^2$ and so on. |
Show that vectors $v_{1}, v_{2}, ..., v_{n} \in V$ are linearly independent only when $v_{1}, v_{1} + v_{2}, ..., \sum_{i \in [n]} v_{i}$ are linearly independent. I know it must be true, because its the definition of linearly independent vectors, but I don't know how can I prove that. | I'm having problems with the following problem: Let $V$ be a vector space over the field $F$. Let $n \in \mathbb{N}$. Suppose that $\left( v_1, \ldots,v_n \right)$ is a linearly independent family of vectors in $V$. Show that the families $\left( {{v_1},{v_1} + {v_2}} \right),\left( {{v_1},{v_1} + {v_2},{v_1} + {v_2} + {v_3}} \right),$ $\ldots,$ $\left( {{v_1},{v_1} + {v_2}, \ldots ,{v_1} + {v_2} + \ldots + {v_n}} \right)$ are linearly independent. This is my attempt: I take a typical finite subset such as $\left( {{v_1},{v_1} + {v_2}, \ldots ,{v_1} + {v_2} + \ldots + {v_n}} \right)$, where $n \in \mathbb{N}$. Then suppose that $\lambda_1{v_1}+\lambda_2\left({v_1} + {v_2}\right)+ \ldots +\lambda_n \left({v_1} + {v_2} + \ldots + {v_n}\right)=0$, where $n \in \mathbb{N}$. I know there is the trivial solution $\lambda_1=\lambda_2=\ldots=\lambda_n=0$, but I'm not sure how to check if there are others? |
We are on SQL Server 2008 R2 Standard Edition. Some tables are highly fragmented. I want to see if defragmentation will improve performance and is worth the effort and tables/indexes being locked during the process. Therefore I want to restore the full backup on a test environment and simulate a live environment. What is the best way to follow? How can I capture the events going on in a live environment for some period? What tools are available for this? Thank you | I want to perform performance testing on my test server. How can I capture workload from production and replay on my test server? Basically I'm looking for detailed steps so that I can replay the workload from production to my test environment. |
I am looking for good way of translating my native language way of saying something is impossible and will never be possible, i.e., Kan lungtat a par hunah le which literally means 'When our grindstone comes into blossom'. The grindstone which is used for sharpening knife can never sprout and grow tall and come into bloom. For example, So when someone asks for the impossible, we respond 'When our grindstone blooms' for emphasizing the impossibility. Is there an equivalent phrase in English? | In Persian, we say "When the blooms" when we want to express that an event: Never happens. (This is only the opinion of the speaker so it's not a fact) It's very unlikely to happen. It's going to take so long to actually happen. (It's so long that you'd be better off giving up expecting it) 3.1. We also use it when someone is always postponing something they have to do so you never actually see it happen. For example: Kyle: When are you going to pay my money back? Cartman: When the blooms. Now I don't know if I got the plant's name right because there are some other versions like: In any event, they have mentioned this plant in the idiom because apparently some versions of it actually never bloom. Others believe it's because farmers harvest them before they get the chance to bloom (e.g to make music instruments), so it never happens. I'd love to know the equivalent idioms or expressions for this. PS: I only know "When pigs fly" but I'm not a fan of it because the word pig sounds a bit rude to me and partly because it implies a strong impossibility which doesn't work for the #3 use. |
I have a trip next month to Moscow. I am flying to LGA and have 2.5 hours to switch to JFK before my departure on Aeroflot to Moscow. Is that enough time to switch airports? | I am planning a flight from Atlanta, Georgia to Manila, departing Monday, March 13th. I want to catch the flight to Manila at 11:54 am out of JFK. The earliest flight i could find getting into jfk from atl arrives at 10:27am. Is that cutting it too close? The other option is to fly into LGA. There is a flight that arrives in LGA by 8:10 am. Is that enough time to go by taxi from LGA to JFK and arrive at JFK by around 10 am on a monday morning? If I buy the ticket, does that mean the carrier(s) have left enought time for the transfer? |
What are SQL injection attacks on SQL Server? How can we prevent that ? | Can someone explain SQL injection? How does it cause vulnerabilities? Where exactly is the point where SQL is injected? |
I am learning c language for over a year now. But I still don't understand how pointers work. Can anyone suggest a good online resource to make concepts clear. | Why are pointers such a leading factor of confusion for many new, and even old, college level students in C or C++? Are there any tools or thought processes that helped you understand how pointers work at the variable, function, and beyond level? What are some good practice things that can be done to bring somebody to the level of, "Ah-hah, I got it," without getting them bogged down in the overall concept? Basically, drill like scenarios. |
Deleted content, including content that is deleted via spam and rude/abusive flags is still visible to users with enough reputation (generally 10k+, I believe). I think the Markdown rendering of this content should be changed so that links are not "active" and images are not displayed. Ideally, the Markdown render would vary based on how the post was deleted such that content that was deleted as spam would have no active links and rude/abusive content would have no images. From a practical standpoint, just turning the Markdown rendering off for deleted content would be enough. For example, on a site I am a moderator on, we have a user who is spamming/abusing the site with NSFW images. Our users are rapidly flagging, downvoting, and deleting the content and the site moderators are on top of the issue. I am hoping at some point the community managers (CMs) will purge our list of NSFW posts. Until that happens, a bunch of the posts on our front page are not safe for high rep users (those who can see deleted content) to view while at work. It seems the system try to hide the content from high rep users if it has been flagged, however, mods are still presented with the content. If a high rep user wants to interact with a deleted post they would eventually have to look at the content. Further, users do not always flag and delete in the best possible way. By turning off the Markdown renderer users would be "safer". | I'd like to suggest that the content of deleted answers, which is visible to 10k+ users, be hidden from view by default. Often times you'll see a user edit their deleted answer and replace it with something like this: <! -- Replacing answer with comment so Jon Skeet won't see my ignorance --> To clarify, I'm not suggesting that the answer be removed from the page altogether, just collapsed (for lack of a better word). Not only will this clean up the interface, it will hide those shameful moments that we've all had from public view. Here's an example: |
Problem. Let $(a_n)_{n=0}^\infty$ and $(b_n)_{n=0}^\infty$ be sequences of real numbers such that $\displaystyle\lim_{n\to\infty}{a_n}=a$ and $\displaystyle\lim_{n\to\infty}{b_n}=b$. Show that $$\lim_{n\to\infty}\frac{1}{n+1}\sum_{k=0}^{n}{a_kb_{n-k}}=ab.$$ My Attempt. It is trivial that $\displaystyle\lim_{n\to\infty}{a_nb_n}=ab$. I was considering to show this in the following fashion: $$\frac{1}{n+1}\sum_{k=0}^{n}{a_kb_{n-k}}-ab=\frac{1}{n+1}\sum_{k=0}^{n}{(a_kb_{n-k}-ab)}=:c_n.$$ Then it suffices to show $c_n\to 0$ as $n\to\infty$. However, this is a bit difficult as we have $a_kb_{n-k}$ instead of $a_kb_k$, which prohibits us from applying the product limit $ab$. That is the place where I get stuck. Hope anyone have good ideas on this. | Let $\{x_{n}\}_{n \in \mathbb{N}}$ and $\{y_{n}\}_{n \in \mathbb{N}}$ be two convergent sequences. I am trying to show that \begin{align} \lim_{n \rightarrow \infty} \frac{1}{n+1}\sum_{k = 0}^{n} x_{k}y_{n - k} &= \left(\lim_{n \rightarrow \infty} x_{n}\right)\left(\lim_{n \rightarrow \infty} y_{n}\right). \end{align} I think I just need some fancy application of summation by parts but I haven't quite figured it out yet. |
I have installed texlive-latex-extra and texlive-extra-utils packages on my Ubuntu 12.04, but when I try to \usepackage{adjustbox} the compiler asks me about packages such as adjustbox.sty, adjcalc.sty or trimclip.sty. How can I install all of them from the Ubuntu repositories. | I have install $ sudo apt-get install texlive-full on Ubuntu 10.04.2 but when I run I got this error about adjustbox. ! LaTeX Error: File `adjustbox.sty' not found Is there anyone know how to install/fix this error. |
How can I move the close window button from right to left side? Nautilus I upgrated the Gnome from 3.8 to Gnome 3.10.0.1. I already moved the maximize, minimize and close buttons to left side with the following result: Mozilla Firefox ...but it seems that the Nautilus (for example) close button is not moved. Why? How can I move it? didn't solve the problem. | Is there a way to the switch gnome-shell window buttons to the left? I've gotten so used to them being on the left that them being on the right has thrown me way off. (gnome shell has them defaulted to the right corner) |
A: "I read your annual sales report, but it's missing some information. B: "Oh, I didn't realize that. Do you mind my/me asking what exactly I missed?" Should the correct response be "Do you mind my asking what exactly I missed?" or, "Do you mind me asking what exactly I missed?" Which one is correct and why? | Do the following sentences mean the same? Do you mind if I open the window? Do you mind me opening the window? Do you mind my opening the window? for me they all mean the same, bit #3 is a little less common as far as I've seen so far. Do you agree with me? PS. I am more about the AmE register. |
Is there a way to do these two lines of code in one line? nc -l 17500 > listenToNetcat.txt chmod 754 listenToNetcat.txt | How can I interactively execute a command in Linux (zsh, if it matters) with a different umask from the default, for one command only? Perhaps a combination of commands combined in a single line? The new umask should apply only to that command and return to its default value for the next command entered. Ideally the command would be agnostic to the default umask in force before its entered (in other words, the default umask doesn't have to specified). |
Consider this, I want to add two languages on one keyboard with Gboard: English and French for QWERTY (English) keyboard. I open the settings but can't add language to the existing keyboard. (only applicable if multi-languages are enabled) So to activate it I have to add another keyboard (English) Now I have French support on the English keyboard and English support on the French keyboard. But I have two keyboards. What even is the point of this? And is there a way so that I can use only one keyboard (layout) with two languages? | I have been a SwiftKey user for a long time and for various reasons I am looking to switch to Gboard (one thing is the search feature). However, there is one thing that still keeps me to SwiftKey. I generally use English, French and Greek layouts. I really enjoy the multilingual layout feature of SwiftKey and I was hoping that Gboard would do it in a similar way. However, this is not the case. SwiftKey and Gboard both unify EN and FR layouts, however SwiftKey only really displays one option (fr/en) in contrast with Gboard that displays two options: fr/en and en/fr. I don't know the purpose of this, but it means that I have to change two layouts in order to write Greek, which I don't really like. Is this bothering anyone else? Has anyone found any solution to this "problem". |
class A{ int i; public: A():i(0){cout<<" A : "<<i<<endl;} A(int a); virtual int val(){ return i+1; } }; class B :public A{ int i; public: B():A(),i(0){cout<<" B : "<<i<<endl;} B(int a):A(a),i(a) { } int val(){ return i;} }; A::A(int a):i(a){ cout<<" A ; "<<i<<endl; A* ap = new B; cout<<" from A "<<ap->val()<<endl; ///expect 1 but got 0; } int main(){ A a(5); } I expected the return val of call ap->val() to be 1, since I thought virtual mechanism doesn't work in constructor, but here I got value to be 0, since ap->val() resulted in call to B::val(). Why ? | Why the following example prints "0" and what must change for it to print "1" as I expected ? #include <iostream> struct base { virtual const int value() const { return 0; } base() { std::cout << value() << std::endl; } virtual ~base() {} }; struct derived : public base { virtual const int value() const { return 1; } }; int main(void) { derived example; } |
I made a no bake cheesecake without gelatin. And instead of the parchment paper, I used aluminium foil to cover the container. Now, the dish has been in the freezer for two days and the cake is still runny. How can I insure that the cake is not runny? | Good day! I have made a no-bake cheesecake in a glass container. Since I could not find the parchment paper, I used a substitute- aluminium foil. Now, the dish has been in the freezer for past two days and still the cake is not firm. On the top, it's a little firm but from the corners, it's runny because of which, I cannot take the cake out of the foil. What should I do to ensure that my cake turns out like a normal cheesecake? |
I want to sum values associated with specific words. For example, calculate Sum for Food: Column A Column B Food $8.50 Food $5.10 Maintenance $12.00 Laundry $13.00 Loan $1,213.25 Tution $100.00 The result would be $13.60. Please let me know which formula I can use | Here's the excel table: In B16 I'd like to insert the sum of all the cells in the range B1:B10 that have "*" on the right. In this case B16 = 10 + 2 + 7 + 9 = 28 How can I do this with a formula? P.S. I'm using Excel 2010. |
Dear all I am currently having a LAMP installation with PHP v5 on an Ubuntu 16.x machine. I like now to update it with PHP v7 but I like to have both configurations available so I can easily migrate my websites to new PHP v7. The problem of LAMPP itself is you can not have multiple LAMPP versions installed in parallel because the LAMPP installation paths are "hardcoded" and can not be changed during installation. LAMPP itself supports also not FastCGI / PHP-FPM out of the box. It gets quite hard on an Ubuntu system to install php-fpm stuff with the standard packages because they are managed and installed outside of LAMPP and are pre-pared for the official apache installation on ubuntu (pre-defined paths etc.) Does anyone have experience and like to share as a step to step guideline here how to install PHP-FPM without the pre-defined packag installer (apt-get) so it can be integrated into LAMPP installation? | I've a Centos 7 with Apache, I want to compile php 7.0 and 5.6 and configure that as PHP-FPM. How can I configure Apache to allow users to change php version using .htaccess? Example .htaccess entry: AddHandler application/x-httpd-php7 .php |
Can you use "e.g." after you have listed something? I've been busy trying to figure out training, WHMIS e.g. | I was reviewing an English text as an exercise, English not being my mother tongue, and I came to this sentence: (...) with the two other articles that conclude several things about customers e.g.. It is (...) Note the double periods at the end of the sentence. Now I've got a gut feeling that this isn't right, but I can't find any rules about it. Is it even 'allowed' to put 'e.g.' at the end of a sentence, where something like 'etc.' would suffice? |
A textbook example asks you to prove that for the linear transformation $T\colon V \to W$ that it is one-to one if and only if $T$ carries linearly independent subsets of $V$ onto linearly independent subsets of $W$. The answer key gives the following solution: Suppose $T$ is one-to-one. Then let $S$ be a linearly independent subset of $V$, and let $S' = \{T(s)\mid s \in S\}$. (Notice that we’re not assuming that $S$ is finite.) Suppose there are some elements of $S’$ $T(s_1), T(s_2), \ldots , T(s_n)$ and scalars $a_1, \ldots, a_n$ such that $a_1T(s_1)+ \cdots + a_nT(s_n) = 0$. Then by the linearity of $T$, $a_1T(s_1) + . . . + a_nT(s_n) = 0$ $T(a_1s_1) + . . . + T(a_ns_n) = 0$ $T(a_1s_1 + . . . + a_ns_n) = 0$ But $T$ is one-to-one, so $a_1s_1 + \cdots + a_ns_n = 0$, and thus $a_1 = \cdots = a_n = 0$ because $S$ is linearly independent. Thus $S’$ is linearly independent. I don't understand this solution. Why does $(a_1s_1+...a_ns_n)$ need to equal 0 just because $T(\text{stuff}) = 0$? A one-to-one function doesn't mean that $T(1) = 1$ and $T(2) = 2$ etc... It simply means all numbers in the codomain must appear in the range. | Problem 4.3.32 in Linear Algebra, Lay: Let $V$ and $W$ be vector spaces, let $T:V\to W$ be a linear transformation, and let $\{\mathbf{v}_1, \dots , \mathbf{v}_p \}$ be a subset of $V$. Suppose that $T$ is a one-to-one transformation [...]. Show that if the set of images $\{T(\mathbf{v}_1), \dots ,T(\mathbf{v}_p)\}$ is linearly dependent, then $\{\mathbf{v}_1, \dots , \mathbf{v}_p \}$ is linearly dependent. This fact shows that a one-to-one linear transformation maps a linearly independent set onto a linearly independent set. All I can think of doing: If $\{T(\mathbf{v}_1), \dots ,T(\mathbf{v}_p)\}$ is linearly dependent, then there exist weights $c_1, \dots, c_p$, not all zero, so that $$c_1 T(\mathbf{v}_1) + \cdots + c_p T(\mathbf{v}_p) = \mathbf{0}$$ Since $T$ is linear: $$c_1 T(\mathbf{v}_1) + \cdots + c_p T(\mathbf{v}_p) = T(c_1\mathbf{v}_1) + \cdots + T(c_p \mathbf{v}_p)=T(c_1 \mathbf{v}_1 +\cdots + c_p \mathbf{v}_p)=\mathbf{0}$$ So the set $\{\mathbf{v}_1, \dots , \mathbf{v}_p \}$ must be linearly dependent. Am I missing something? And why must $T$ be on-to-one for this to be true? An example showing that it is not true if $T$ is not one-to-one would be great! |
I am considering the website of and can't really decide if it is a predatory journal or if it is merely a very obscure journal. As far as I am aware, it does look to be a real journal and there is no mention of article processing charges, but I cannot find information on the impact factor of the journal and cannot seem to find much more information about it apart from what is on its website. Do people have any advice on being able to tell when a journal is a predator journal or any signs to look for? I have checked on various lists of predatory journals online and cannot find it there, although I assume that just because a journal is not on any lists does not mean it is not predatory. | . While the reasons for his doing this are not yet public, this is a real loss of a valuable service. Does anyone know of similar services available to the general public? Edit: is definitely relevant, but that approach is more appropriate for finding top journals rather than identifying bottom ones. I.e., following that method would probably exclude lots of valid, lower-tier journals. Are there any approaches to easily identifying a predatory publisher? |
I am having difficulty understanding the answer to this question. How many functions are there with domain $A$ and codomain $\{0, 1\}$? $A = P(\{1, 2, 3, 4\})$. $|A| = 2^{|{1,2,3,4}|} = 16$, so there are $16$ possible inputs. For each of these inputs, we can choose whether to map them to $0$ or $1$. So there are $2^{16} = 65536$ such functions. I understand the first part ($2^4=16$), but the second part ($2^{16}$) is a little bit confusing to me. | In my discrete mathematics class our notes say that between set $A$ (having $6$ elements) and set $B$ (having $8$ elements), there are $8^6$ distinct functions that can be formed, in other words: $|B|^{|A|}$ distinct functions. But no explanation is offered and I can't seem to figure out why this is true. Can anyone elaborate? |
I'm a still learning PHP and I'm programming a .php Registration webpage, and I want to make sure that the e-mail is valid (if the user doesn't type @ or . he will get a error message). That's the e-mail part: $Email = $_POST['email']; $needle = '@'; $search = strpos($Email, $needle); elseif ($search == FALSE) { echo "Your e-mail is not valid."; } How can I make it with multiple letters instead of only @? I want to add the dot (.com) as well, I added it on $needle but it doesnt work. Thanks in advance. | Over the years I have slowly developed a that validates MOST email addresses correctly, assuming they don't use an IP address as the server part. I use it in several PHP programs, and it works most of the time. However, from time to time I get contacted by someone that is having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs). What is the best regular expression you have or have seen for validating emails? I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function. |
Are URL shorteners banned on SO? I have had several of my questions edited and the URL shortener removed. (I am using TinyURL.com.) Are there reasons for this or is it solely so a person can edit the question? I am using the URL shorteners because the site is in development and I do not want any links pointing to it for a few different reasons. | Related: | | Ban URL shorting services from being used in questions/answers. I have three major reasons to request this: It's abused to hide LMGTFY-Links (interestingly, this behavior ranges from the 20 rep Newcomer to the 50K User) It's used for inlined links, which negatively affects usability (I can't see where the link is taking me) It's used instead of proper formatting As requested by ChrisF, a few examples of misuse (all removed by now): Update as of 19th Aug '13: In the light of the recent , Id' like to suggest to reconsider the stance on this. Those spam attacks are mostly enabled by the fact that the spammers can hide behind shortened URLs (goo.gl in this case), making blacklisting of the original URL impossible. Banning at least the most well-known services would force spammers to use their original URL (or would block the attack as a whole), making it easier to directly target them. |
I tried to install crossover and after downloading the .deb from their website, I followed the steps as indicated when opening it with Ubuntu Software Centre: On 64-bit flavors of Debian and some Ubuntu variants, first open a terminal and run sudo dpkg --add-architecture i386 ; sudo apt-get update Since I have Ubuntu 16.04 LTS 64 bit I perform the command. But when copying and pasting that command into my terminal, it stopped at Fetched 535kb in 7sec and stalled there for about 20 minutes. I ended up closing it and tried to run both commands separately but after doing the sudo apt-get update command it also stalls again after "Fetched XXKb in XXsec." I restarted my computer and decided to run the software updater and it stays stuck at roughly 75% for hours. | appstreamcli is overheating my laptop by constantly using 100% of a core. My only solution is to kill it. Here's a screenshot of : I can kill appstreamcli with either sudo kill pid or sudo killall appstreamcli. But once I do sudo apt update, the appstreamcli process returns again and hangs the update. If I then kill it, I get the following output: Reading package lists... Done E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi' E: Sub-process returned an error code What is this process and why is it using so much CPU? |
I have an array of sets of numbers and words that are all put together in one string like so: "hello jane 7 14 1993 female" How do I tokenize a string like this and similar strings to assign each word to a separate variable if each word separated by a space bar is to go to its own variable like so?: string greeting = "hello" string name = "jane" string month = "7" string day = "14" string year = "1993" string gender = "female" Thank you in advance. | Java has a convenient split method: String str = "The quick brown fox"; String[] results = str.split(" "); Is there an easy way to do this in C++? |
Say I want to refer a user to , With the older, [faq] syntax, I could have done it easily using a hash after the word "FAQ": Please check the [faq#how-to-ask] How can I do the same with the new Help Center? Do I have to post a full [description](link) form? Or is there a better way? | Could the magic links be updated so that we can link to help center subsections? In the past, [faq#section] used to work, now neither [help#section] nor [help/section] work. Could this be added? As per Nick's request, I'm starting a list of shortcuts that would be nice to have; besides the [help#anchor] → /help/anchor ones. Feel free to edit more in: #benice → (preferably a section link to the "be nice" section) #bounty → #promotion → (preferably a section link) |
I was wondering how to prove that an ordinal $\alpha$ is countable if and only if the next holds: there is an order-preserving injection from $(\alpha,\leq)$ into $(\mathbb Q,\leq)$. | The usual "matchstick" representation of an ordinal number can be thought of as an order-preserving injection of that ordinal into the interval [0,1]. For example, here's a representation of $\omega^2$: One can use this technique to visualize even larger and larger ordinals; for instance, $\omega^3$ would look the same as the above, but each individual matchstick would be replaced with yet another infinite triangle leading to the next matchstick, so that there are three layers of infinite triangles. So long as there's an order-preserving injection from your chosen ordinal into $[0,1]$, this technique will work to help you visualize it. So my question is: what is the supremum of all ordinals for which an order-preserving injection exists in this way? Is it the first uncountable ordinal? The initial ordinal of $2^{\aleph_0}$? Something smaller? Something larger? |
I have a problem with my HTML5 webpage that I haven't been able to research an answer for. Im using swedish letters in the text (åäö) and started out by using UTF-8 encodig as such: <!DOCTYPE html> <html lang = 'sv'> <head> <title> </title> <meta charset='utf-8'> <meta name="description" content=' '> <link rel = 'stylesheet' href = './css/auroracss.css'> </head> This doesn't work for displaying the swedish letters in 3 out of 4 of my HTML5 pages, as I get the � chars when I preview. However, for the fourth page, using exactly the same head tag, the characters are displayed properly. When I switch out UTF-8 to ISO-8859-1 the opposite is true - displaying the characters will work fine for 3 out of 4 pages but the same one which displayed properly with UTF-8 will show � chars when the ISO enconding is applied. Everything validates. I would like to stick to only one encoding choice here and not mix them even though that may be a quick fix. What is the cause for the problem? | I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1. Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur? This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2. |
In the it states: @Override annotation informs the compiler that the element is meant to override an element declared in a superclass. I have a class that implements an interface and the implemented method statements have the @Override annotation. Does this mean (according to the docs) that the interface is a superclass of my class? But how can it be, considering that interfaces only contain 'empty' methods, not methods that actually do stuff? My code is LibGDX-related: public class MouseAndKeyboard implements ApplicationListener { private Texture plane1; private Sprite mainPlane; private SpriteBatch mainSpritePacket; @Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); ... | Should a method that implements an interface method be annotated with @Override? The says: Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message. I don't think that an interface is technically a superclass. Or is it? |
I have been trying to find a rule or set of rules to explain how 'a' and 'an' are used with uncountable nouns, mainly to understand the many exceptions that I have been thinking of recently. Consider the following sentences, for example - I would be happy if you showed me a little respect. A coffee everyday is not really bad for your health. He left the room in a hurry yesterday and has been missing since. There was a strange aroma in the air. There is a curiosity in you which can not be quenched. I have an unusual demand for you. These are just a few of the many, to be honest. And unfortunately, internet is filled with websites and tutorials that conveniently overlook these examples while talking about articles and uncountable nouns. Can someone tell me if there is/are any particular rule/rules to explain the usages here? | I can’t for the life of me figure out where to use a and where to use the — and where there is no article at all. Is there a simple rule of thumb to memorize? The standard rule you always hear: “If a person knows which item you are talking about then use "the" . . . doesn’t clear things up for me, as I have no idea whether or not they know. |
I know that $\sum\limits_{n=1}^\infty n^{-2}=\pi^2/6$, but shouldn't the sum of rationals be rational? Is this akin to $\sum\limits_{n=1}^\infty n=-1/12$? Or does that mean that, somehow, $\pi^2/6$ is rational? | For example how come $\zeta(2)=\sum_{n=1}^{\infty}n^{-2}=\frac{\pi^2}{6}$. It seems counter intuitive that you can add numbers in $\mathbb{Q}$ and get an irrational number. |
First, I exported my references list from EndNote X7 using 'BibTeX Export' and saved the text file as 'first_paper.bib'. Then I included the following code into my TeX file. \newpage % BibTeX users please use one of %\bibliographystyle{spbasic} % basic style, author-year citations \bibliographystyle{spmpsci} % mathematics and physical sciences %\bibliographystyle{spphys} % APS-like style for physics \bibliography{first_paper} % name your BibTeX data base This code is included in the template TeX file provided by the journal and I only edited the database name to 'first_paper'. This 'first_paper.bib' file is located at the same folder as the TeX file. I complied this code twice but I can't find References section in the final PDF file. What's wrong with this? | I've browsed the forums and found a number of posts that have addressed this issue, but none of the solutions seem to work for me. I have the following script that I just copied from the bibtex home page to get familiar with it. Instead of the citation number I get a question mark. I compile using Latex+Bibtex+Latex+Latex+PDFLatex+ViewPDF just as has been previously suggested and the problem persists. \documentclass[11pt]{article} \usepackage{cite} \begin{document} \title{My Article} \author{Nobody Jr.} \date{Today} \maketitle Blablabla said Nobody ~\cite{Nobody06}. \bibliography{mybib} \bibliographystyle{plain} \end{document} My bibliography (Bib.bbl) @misc{ Nobody06, author = "Nobody Jr", title = "My Article", year = "2006" } Looking at previous posts one thing that is concerning is that my .bbl looks empty as shown below. Further, I don't have a .blg \begin{thebibliography}{} \end{thebibliography} |
I'm using Android studio , sqlite database my code was working correctly , but when I added "posid" column to "contacts" table the program doesn't work logcat while insert contact ......... thanks for everybody can help me | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
How can I reload an imported file with python ? def ClickOpenMyFile(self): import myfileinquestion I want that unimport and import back if was already imported... It is supposded to work ? No error but don't work for me try: import myfile except: reload(myfile) | I have a long-running Python server and would like to be able to upgrade a service without restarting the server. What's the best way do do this? if foo.py has changed: unimport foo <-- How do I do this? import foo myfoo = foo.Foo() |
prove that characteristic of $\mathbb{Z}[i]/<2+2i>$ is $4$ and it has exactly $8$ elements. I need to know, is this below approach works for characteristic? My attempt I saw $c+di\in <2+2i>$ if $c+di=(2+2i)(a+bi)$ for some $a+bi\in\mathbb{Z}[i]$. i.e. if $c+di=(2a-2b)+ (2a+2b)i$ for some $a, b\in\mathbb{Z}$ i.e. if $2a-2b=c$ and $2a+2b=d$ i.e if $c+d=4a$ and $d-c=4b$ i.e if $\frac{c+d}{4}, \frac{d-c}{4}\in\mathbb{Z}$ So that from above, if we consider $4(p+qi)$ for any $p+qi\in\mathbb{Z}[i]$ we saw $c=4p$ and $d=4q$ and hence $\frac{c+d}{4}=p+q\in\mathbb{Z}, \frac{d-c}{4}=q-p\in\mathbb{Z}$. So that, $4(p+qi)\in <2+2i>$ for any $p+qi\in\mathbb{Z}[i]$. Hence for every $a+bi+ <2+2i>\in\mathbb{Z}[i]/<2+2i>$ we have, $4(a+bi+ <2+2i>)= 4(a+bi)+<2+2i>=<2+2i>=\text{ zero element of ring }\mathbb{Z}[i]/<2+2i>$ Hence characteristic of given ring is $4$. Further, i dont know how to show given ring has exactly $8$ elements. I saw various post on MSE for the question of above type but unable to understand the answer( I understand the case for $\mathbb{Z}[i]/<a+bi>$ when $a$ and $b$ are relatively prime. But here $a$, $b$ are not prime) Please help. | The question is : Show that $I=\langle 2+2 i\rangle$ is not a prime ideal of $\mathbb Z[i]$. Also find the number of elements in $\mathbb Z[i]/I$ and its characteristic. My try: I started with elements $2, 1+i \in \mathbb Z[i]$. Clearly, the product is $0$ in the coset representation. The part where i am struck at is the number of elements and the characteristic. Well, $2+2i+\langle 2+2i\rangle=0+\langle 2+2i\rangle$ Can we directly write $i^2=-1$ in the coset representation? |
Lately I have to extract few specific images from .pdf files and save them as image file. For example, the following is the image copied from a PDF (right click and copy image using Ctrl+C). When I paste the same either in LibreOffice Writer or an image editor like KolourPaint, I end up with a blank image something like this. Can anyone suggest how I can work around this issue? | Before I started using Ubuntu I used Nitro PDF reader to automatically extract images from PDF files. Is there a PDF reader for Linux that does this? I would like to be able to extract images faster/easier than when taking a snapshot. |
If I need to make a billboard design according to USA fie size. How can I make such bigsizes bilboard in my Adobe Illustrator? As while designing it starts hanging and takes a lot of time to save. How to hand over such a large file size to the Client in USA for getting it printed there? Currently I am assuming the standard size to be taken is Height - 14 feet and Width - 48 feet. Also how much standard font size etc. should I use while creating such big billboards? Thanks | For wall-sized graphics and large banners (e.g. 3m × 5m), what is an acceptable PPI for print? As I understand it 300 ppi is the typical for 'small' artworks (esp. for clean text resolution). However, for small artworks, the audience usually engages at a much closer distance. Therefore, in the interests of keeping a bitmap file down to a reasonable size, can you get away with a much-reduced PPI for a large format/banner print? |
I have a problem where I would like to generate a bimodal distribution from a given uniform distribution between different ranges of say, for example, (-1.0, +1.0), (-0.18, +0.18), (-0.12, +0.12) and (-0.15, +0.15). The example distributions can be viewed . So the problem is that you are sort of 'carving out' the bimodal distribution from the given uniform distribution. Again, I don't want to generate a standalone bimodal distribution! From a given uniform distribution, the bimodal distribution is to be 'carved out'. Is there a way to do it? Thanks | I have a problem where I have 5 examples of truncated bimodal distributions between different ranges of (-1.0, +1.0), (-0.18, +0.18), (-0.12, +0.12) and (-0.15, +0.15). The example distributions can be viewed . Please note that for all of the given example bimodal distributions, there is no zero values within the given distribution! The data distributions have values ranging between the given ranges EXCEPT of ZERO! I am trying to create a sampling technique which can create random samples by obeying the given bimodal samples in the examples. The samples to be drawn can be of any size/shape/dimension such as 784, 5000, etc. Any ideas how I can create such truncated bimodal data distributions between intervals 'a' and 'b' or [a, b] (both points are included)! Thanks! |
Currently this just displays 'Error': if(@mail($email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } How can I display the actual error? Thanks | I'm familiar with some of the basics, but what I would like to know more about is when and why error handling (including throwing exceptions) should be used in PHP, especially on a live site or web app. Is it something that can be overused and if so, what does overuse look like? Are there cases where it shouldn't be used? Also, what are some of the common security concerns in regard to error handling? |
Let $f:[0,1]\to\Bbb{R}$ be continuous. How do I show that $\lim_{n\to\infty}\left(\int^1_0{f(x)^n}\right)^{1/n}=\sup_{0\leq x\leq 1}f(x)$? I tried writing $\left(\int^1_0{f(x)^n}\right)^{1/n}=\left(f(x)^{n+1}/(n+1)\right)^{1/n}$. But I don't know what to do next. | I'd like a hint to solve the following problem: Given a $f$ continuos and positive on $[a,b]$ prove that $$\lim_{n\to \infty} \left[\int_a^b (f(x))^n dx\right]^{{1}/{n}}=\sup_{x\in [a,b]} f(x).$$ Thanks a lot! |
try { int* p = 0; *p = 1; } catch (...) { cout << "null pointer." << endl; } I tried to catch the exception like this but it doesn't work,any help? | Example int *ptr; *ptr = 1000; can I catch memory access violation exception using standard C++ without using any microsoft specific. |
I am trying to render an animation, I have set up the camera in the right position but not all of the object is showing in the camera view, like its in shadow. how can i fix this? Thanks | When you fly through your Blender 3D world, you can fly through things. However, sometimes I fly through objects, and before I even get close to them, the objects start cutting off(visually). See image: How can I stop Blender from doing this? Or at least make it do so, when I get closer to the object? There are some camera angles that I can't get because Blender cuts away the object in my view/cam |
I am trying to remove an object with a certain attribute from a list of Objects, I have red other questions about this problem but I guess I am missing something. this method doesn't work, because I guess you can not remove elements from a list while iterating through it, so I created a Dog removeDog = null; variable, which is set to the right dog during the loop, and after it finished to iterate I can just do animals.remove(removeDog); (I don't know if this is the best solution) for (Dog dog : animals.getDogList()){ if (dog.getDogName().equals(dogName)){ animals.getDogList().remove(dog); } } This method instead works perfectly, in my eyes it should have the same problem of the previous one, but in this case Java let me remove one or more elements during iteration, but I don't understand the difference. for (Dog dog : animals.getDogList()){ if (dog.getWeigh() > weight){ animals.getDogList().remove(dog); } } | We all know you can't do the following because of ConcurrentModificationException: for (Object i : l) { if (condition(i)) { l.remove(i); } } But this apparently works sometimes, but not always. Here's some specific code: public static void main(String[] args) { Collection<Integer> l = new ArrayList<>(); for (int i = 0; i < 10; ++i) { l.add(4); l.add(5); l.add(6); } for (int i : l) { if (i == 5) { l.remove(i); } } System.out.println(l); } This, of course, results in: Exception in thread "main" java.util.ConcurrentModificationException Even though multiple threads aren't doing it. Anyway. What's the best solution to this problem? How can I remove an item from the collection in a loop without throwing this exception? I'm also using an arbitrary Collection here, not necessarily an ArrayList, so you can't rely on get. |
I have read on the internet that the primary record for a domain (eg example.com) should be an A record, and that bad things happen if you use a CNAME record. I work for a web company that has several clients. Each client has their business domain (which they typically own), but I wanted to be a) able to update the server their site is hosted on without contacting them and b) have an alternate domain to access all their sites on. The company I work for has a domain that I control, eg mycompany.com To this end, for each client, I have created eg (client1.mycompany.com, client2.mycompany.com) records that point to our server that hosts the websites. Now, since many clients own their own domains, I ask the clients IT person to create a CNAME record for clientdomain.com that points to client1.mycompany.com. This allows me to update the IP address that client1.mycompany.com points to without involving the clients IT person because all they have is a CNAME record that points to something I control. This appears to work. However, I have read that creating a CNAME record as the primary record can lead to issues with email (some of these domains have MX records but typically the client has their own mailserver). The information I read didn't really go into much detail and I didn't quite understand it. Can someone please elaborate on why setting a CNAME record as the primary record is considered a bad idea, as it seems to work? | Is it possible to set a CNAME record at the top of a domain? (i.e. @ CNAME www, @ CNAME foobar.com., etc.) My ISP says that it's only possible to use CNAME's for subdomains but I've read somewhere else that is should be possible even if not recommended. |
In Ubuntu 14.10 LTS, I was able to set a terminal tab's title simply by right-clicking and choosing Set Title. This was using the default terminal application, gnome-terminal. In Ubuntu 16.04 LTS, I can no longer set the title, and the terminal application is still gnome-terminal. The option Set Title is no longer in the menu. Was this feature removed sometime between 14.10 and 16.04? How can I set a terminal tab's title in Ubuntu 16.04? | When I was using ubuntu 14.04, it's easy to set title. Just press F2 or move mouse to top menu. But there is no menu on ubuntu 16.04 and press F2 can't change the title. What should I do? |
I am using Ubuntu 18.04 LTS, Ubuntu will stop all supports in 2023.1. can I use 18.04 after 2023?2. Ubuntu will give an upgrade and I have to do this. | Apparently Shuttleworth announced at the (). But neither the nor have been updated to reflect that. What exactly is included in this ten-year support? I'm not looking for speculation or guesses or indications. I'm looking for verifiable, official information. |
I have run a series of Bayesian models with flat priors in which I obtain a posterior probability distribution for my coefficient of interest. The reviewer of my paper wishes us to classify these probability according to different strengths of evidences (strong, moderate, weak etc..). I have seen this done with Bayes factor, e.g., I wish to avoid running the models with and without the coefficient. Instead, I thought I could compare the posterior and prior probability. However, I have uninformative priors so I think Bayes factor would not work(?). But I wonder whether I can still follow this classification, e.g., under the null prior, I expect 50% of the coefficient to be negative. While my posterior probability is 5%. From that, can I infer a Bayes factor of 10 (0.5/0.05), which would be strong evidence? Or is there another classification scheme I could use? Thanks for any help and especially any references? | I have run a series of Bayesian models with flat priors in which I obtain a posterior probability distribution for my coefficient of interest. The reviewer of my paper wishes us to classify these probability according to different strengths of evidences (strong, moderate, weak etc..). I have seen this done with Bayes factor, e.g., I wish to avoid running the models with and without the coefficient. Instead, I thought I could compare the posterior and prior probability. However, I have uninformative priors so I think Bayes factor would not work(?). But I wonder whether I can still follow this classification, e.g., under the null prior, I expect 50% of the coefficient to be negative. While my posterior probability is 5%. From that, can I infer a Bayes factor of 10 (0.5/0.05), which would be strong evidence? Or is there another classification scheme I could use? Thanks for any help and especially any references? |
In the Harry Potter and The Order of the Phoenix, when Harry used the Cruciatus curse on Bellatrix after she killed Sirius Black, is there any specific reason why she remained almost completely unaffected by it? | OK so the scene where Harry sees Voldemort making Draco tutur Rowel brings a few questions to my mind. he felt the rage that did not belong to him posses his soul, saw a long room, only light by fire light, and the grate blond Death Eater on the floor,screaming and writhing, and a slighter figure standing over him, wand outstretched, while Harry spoke in a high, cold, merciless voice. "More, Rowel, or shall we end it and feed you to Nagini? Lord Voldemort is not sure he will forgive you this time...You called me back for this, to tell me Harry Potter has escaped again? Draco, give Rowel another taste of our displeasure... do it, or feel, my wrath yourself!" A log fell in the fire: flames reared, their light darting across a terrified, pointed white face- I remember in the Order of the Phoenix Harry tries to do the cruciatus curse on Bellatrix, it doesn't work. She say this is because Harry doesn't mean it, he doesn't want to hurt he enough. If she's right about that (I'm sure she is) I don't see how Draco is managing to make to make Rowel writhe and scream, because it is clear he doesn't want to be doing it. Also Harry was actually angry at Bellatrix and if his anger at her killing his godfather won't work... well you get my drift. I know Draco is probably better at magic, but I feel Bellatrix is right, you really have to want them to hurt for it to work. Next thing, Voldemort's having Draco do it why? Is he doing to upset Lucius, because that and lot of effort to go to, seeing as Voldemort is angry and he'd probably do a better job himself. Or is he trying to train himself a new soldier, I mean the other ones are getting old. |
The question is $n$ students are standing in a circle. Find the number of ways in which $k$ students can be selected such that no two of them are together. I know one method to do this by comparing it with a question like "find number of triangles that can be formed inside an $n$-sided polygon such that no side of triangle is common to the $n$-sided polygon" but that'll be valid only when $k=3$. I want to know general method to solve such questions and also the principle behind that method. Any help appreciated 😃 | In how many ways can we choose k items from n distinct items put in a circle. Then further extension of the question, if I want to find out the number of ways to choose k items from n distinct items in a circle such that no 2 are together. Thanks |
I cant download not a thing on Ubuntu download center.I dont know my root password. Its always wants sudo password.And I cant write it(ı dont even know it though) How can ı close or inactive it? | I'm working on a Ubuntu system, and my client has completely forgotten his administrative password. He doesn't even remember entering one; however it is there. I've tried the suggestions on the website, and I have been unsuccessful in deleting the password so that I can download applets required for running some files. Is there a solution? |
I have recently installed a new hard drive to my Ubuntu 10.0.4 box. I used System -> Administration -> Disk Utils to format the disk (ext4 file type) - but did not create a partition (is this advisable?). I have manually mounted the drive as /mydata. I want to have the machine automatically mount the device on startup/reboot. How may I do this? [[Update]] This is the output from running sudo fdisk -l on my system: Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000858bf Device Boot Start End Blocks Id System /dev/sda1 * 1 59334 476595200 83 Linux /dev/sda2 59334 60802 11789313 5 Extended /dev/sda5 59334 60802 11789312 82 Linux swap / Solaris Disk /dev/sdb: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table Disk /dev/sdc: 16.0 GB, 16026435072 bytes 254 heads, 63 sectors/track, 1956 cylinders Units = cylinders of 16002 * 512 = 8193024 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdc1 1 1955 15641929 c W95 FAT32 (LBA) | How do you make HDDs and partitions mount at startup on Ubuntu? I always keep my media and data files on separate partitions - one 2tb HDD and a 400 odd gig partition. I have been trying to swap the default folder location for the home directory to my other drives. It works when I change the /home/user_name/.config/user-dirs.dirs file to the directories I want, but only until I reboot the system. I am only assuming that the drives not mounting is the problem with it, but it would be helpful either way. If any one knows another reason for why the directories change back to default each time that would be good also. |
I don't understand why JS round me a 17 digits var. var foo = 89383122683146257; console.log(foo); // result is 89383122683146260 same result with a .toString() That make me crazy. Please, help | Is this defined by the language? Is there a defined maximum? Is it different in different browsers? |
how i make this knife that i made look like the reference photo at the end? i followed a node setup from here very usefull and understandble i think, but i dont know how to get this thing look like the reference photo , link of the my model xD | so I'm modeling a katana, and I would like to give it a proper "Damascus" style to the blade, and I was wondering if it's possible to achieve this in a way that doesn't involve me opening GIMP/Photoshop. The desired effect is this: So far I got this material: Ignore the red tint. So my questions are: How to "mask out" the black so I can control it, and apply the Principaled on top of let's say a brushed metal shader. Is there a way I can make the noise/musgrave/voronoi start in stripes and then go wavy? Maybe aWave texture and use a ramp to fade them? Thanks for any input! |
What does, Nietzsche in Beyond Good and Evil, mean exactly when he states: Whoever fights monsters should see to it that in the process he does not become a monster. And if you gaze long enough into an abyss, the abyss will gaze back into you. I don’t believe the question has been satisfactorily answered yet. By anyone. My own thought is that the “monster” is hate. And that in combating “hate” you become hate, naturally, as you hate the thing that hates you. In doing so you easily justify your own actions, even as they mirror those of the thing you hate, see Dresden in WWII. So, broadly speaking, in murdering the murderer, you are simply becoming him, in that you’re killing the thing you hate, as he did before you. You hate him for the “right” reasons. You murder him in the “name of justice”, but, in the end you’re murdering him because he murdered yours. You hate him for murdering yours, so you murder him and his in hate. Justice? Idk. Maybe. But what then is justice? Is it an eye for an eye? Works great in the short term, but does it in the long term? As to the Abyss. The abyss is where the black things lay. The evil things. In the end, the abyss is profound truth. Unadulterated. Nothing is as true as true unadulterated hate and evil. I wouldn’t even call it evil. More simple animal survival. It’s not the truth of the “good”, which can be veiled in so many layers of “justice” and thought mechanics, but the raw, animal, truth. The “you must die so that I can live” truth. The real truth of “an eye for an eye”. Beware it seeing you, seeing into you, and accepting you. Am I wrong? So many arguments go, he’s saying kill, just don’t kill too much. I think he’s saying the impossible thing, be killed, but do not kill at all. Or et al. I never know the distinction. Lol. | Nietzsche states: Whoever fights monsters should see to it that in the process he does not become a monster. And if you gaze long enough into an abyss, the abyss will gaze back into you. Source: Beyond Good and Evil In fiction (and in real life at times) people embrace the inner monsters (sometimes literal, sometimes figurative) to gain the power they need to defeat their foes, get to the next level, or grit through something they'd rather not do. If this is something that seems to work, why are we specifically warned against it? In any war, in any problematic situation where horrible things are happening, it can be impossible (or virtually so) not to use the selfsame tactics of those that oppose you. The saying goes "ALL'S fair in love and war" and even if you'll pay for doing it in the long run by being seen as a monster, by doing these horrible things (or at times even MORE horrible than those that oppose you), you'll have the satisfaction that you won, even though at day's end it was a morally a pyrrhic victory. But if you accomplish what you set out to do, sometimes it's worth it. But such things can't help but drag you through the soil of morality, dirtying you in the process. |
What makes this line of code execute? The code gives an output of 11, but I was expecting it to be 1 package methodcalling; public class MethodCalling { public static int cakes = 1; public final static int UNIT = 10; static{cakes += UNIT;} // what makes this line of code execute public static void main(String[] args) { System.out.println(cakes); } } | My question is about one particular usage of static keyword. It is possible to use static keyword to cover a code block within a class which does not belong to any function. For example following code compiles: public class Test { private static final int a; static { a = 5; doSomething(a); } private static int doSomething(int x) { return (x+5); } } If you remove the static keyword it complains because the variable a is final. However it is possible to remove both final and static keywords and make it compile. It is confusing for me in both ways. How am I supposed to have a code section that does not belong to any method? How is it possible to invoke it? In general, what is the purpose of this usage? Or better, where can I find documentation about this? |
I have inputted data into an array c_pid[] from the database. Now i'm trying to run a loop. If the the value an array is not null then the loop should carry on. Everything seems to run fine. I am getting the desired output. But one problem which i have is that for some reason it is showning me nullpointer exception. I have provided the code as well as the screenshot down below. I am trying to run this loop while(!c_pid[cnt].equals(null)){ after which im getting java.lang.NullPointerException error <%@page import="storage.data"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <% String[] c_pid = new String[100000]; String c = "", pna = "", pty = "", ppr = "", stock = "", imgpath = ""; //String myList = new String[10]; int a = 0, d = 0; int result = 0, count = 0; int setres; int[] arr = new int[100000]; String testval = "75"; int item_id = 0; data dt = new data(); String item = "", cartid = "", user = ""; String[] prdid = new String[60]; int cnt = 0; try { dt.st = dt.cn.createStatement(); String select_match = "SELECT user_prod_id, COUNT(*) AS rep " + "FROM cart_table " + "GROUP BY user_prod_id " + "ORDER BY rep desc"; dt.rs = dt.st.executeQuery(select_match); while (dt.rs.next()) { //prdid[a] = dt.rs.getString("user_prod_id"); //a=a+1; c_pid[cnt] = dt.rs.getString("user_prod_id"); cnt = cnt + 1; } out.println("<br/>---------xxx--------"); String select3 = "select " + "product_table.p_id,product_table.p_type," + "product_type.pt_id," + "product_table.p_name,product_table.imgpath,product_table.p_price,product_table.stock,product_table.add_date," + "product_type.pt_name " + "from product_table " + "inner join product_type " + "on product_table.p_type=product_type.pt_id " + "order by product_table.add_date desc" + ""; cnt = 0; int size = c_pid.length; out.println("Size of array is " + size + "<br />"); while (!c_pid[cnt].equals(null)) { out.println(c_pid[cnt] + "<br />"); cnt = cnt + 1; } } catch (Exception ex) { ex.printStackTrace(); out.println(ex); } %> | What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.