I'm trying to build a simple app for Android can't figure out why my app keeps crashing I have traced it down to this line of code   WG.setRandomWord(words.get(rand.nextInt(words.size())));   I have check my logcat and it showing that my word file is not even being detected com.sagproductions.gamertaggenerator W/System.err: java.io.FileNotFoundException: words.txt: open failed: ENOENT (No such file or directory) but I have my file word file in the document structure.  for more context here is my code:  JAVA wordGenerator   package com.sagproductions.gamertaggenerator;   public class WordGenerator {     private String mRandomWord;     private int mRandomNum;      public WordGenerator(String randomWord, int randomNum){         mRandomNum=randomNum;         mRandomWord=randomWord;     }      public int getRandomNum(){         return mRandomNum;     }      public void setRandomNum(int randomNum){         mRandomNum=randomNum;     }      public String getRandomWord(){         return mRandomWord;     }      public void setRandomWord(String randomWord){         mRandomWord=randomWord;     } }     Java MainActivity    package com.sagproductions.gamertaggenerator;  import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView;  import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.lang.String; import java.util.ArrayList; import java.util.Random;  public class MainActivity extends AppCompatActivity {      WordGenerator WG;     private Button mSingleWordGenerator;     private Button mTwoWordGenerator;     private Button mThreeWordGenerator;     private EditText editText;      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          mSingleWordGenerator = (Button)findViewById(R.id.button);         mSingleWordGenerator.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {                 generateWord();                 editText=(EditText)findViewById(R.id.editText);                editText.setText(WG.getRandomWord(),TextView.BufferType.EDITABLE);             }         });          mTwoWordGenerator = (Button)findViewById(R.id.button2);         mTwoWordGenerator.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {              }         });          mThreeWordGenerator = (Button)findViewById(R.id.button3);         mThreeWordGenerator.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View v) {              }         });     }      public void generateWord(){         final File file = new File("words.txt");         ArrayList<String> words= new ArrayList<String>();         Random rand=new Random();          try(final Scanner scanner=new Scanner(file)){             while(scanner.hasNextLine()){                 String line = scanner.nextLine();                 words.add(line);             }         }catch(FileNotFoundException e) {             e.printStackTrace();         }         WG.setRandomWord(words.get(rand.nextInt(words.size())));     } }

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?


I don't understand how to properly format this particular thing (in block characters)    Just to fool around with script making, I made one that (I believe?) should open a terminal at startup:    #!/bin/bash   #start terminal at startup   #/usr/bin/gnome-terminal    The bit with the # (hash, pound or octothorpe symbol) causes the three lines to conform to one line, after I indented properly for block characters.  Without indents, I get this:    !/bin/bash  start terminal at startup  /usr/bin/gnome-terminal    How would I use block characters in the presence of the hash or pound sign?

How do I post text so that it is formatted as code?  What do I need to do so that my code shows up properly — not escaped or removed — when posted? And how to get the correct syntax highlighting?     For more information, see "" in the .


Let $a,b,c\in\mathbb{R}_{>0}$. Is it true that: $$ \left(\frac{a^2+b^2+c^2}{a+b+c}\right)^{a+b+c}≥a^ab^bc^c $$ I remarked that the inequality is (a bit weirdly) homogeneous, but couldn't use it. Also directly taking the logarithm doesn't seem to help; how to decide wether it's true?

Prove that $\left (\dfrac{a^2 + b^2 +c^2}{a+b+c} \right) ^ {(a+b+c)} > a^a b^b c^c$ if $a$, $b$ and $c$ are distinct natural numbers.  Is it possible using induction?


I have a long running python script that I want to do someting at 01:00 every morning.  I have been looking at the  module and at the  object but I can't see how to use these to achieve this.

I'm looking for a library in Python which will provide at and cron like functionality.  I'd quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on machines with no cron.  For those unfamiliar with cron: you can schedule tasks based upon an expression like:    0 2 * * 7 /usr/bin/run-backup # run the backups at 0200 on Every Sunday  0 9-17/2 * * 1-5 /usr/bin/purge-temps # run the purge temps command, every 2 hours between 9am and 5pm on Mondays to Fridays.   The cron time expression syntax is less important, but I would like to have something with this sort of flexibility.   If there isn't something that does this for me out-the-box, any suggestions for the building blocks to make something like this would be gratefully received.  Edit I'm not interested in launching processes, just "jobs" also written in Python - python functions. By necessity I think this would be a different thread, but not in a different process.  To this end, I'm looking for the expressivity of the cron time expression, but in Python.   Cron has been around for years, but I'm trying to be as portable as possible. I cannot rely on its presence.


Hi i have a table like some "Demo" in that i have two Columns (ID,Name),   I have table:    I want to get table like:    How Can i write sql query for this ?  --TIA

I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life).  In the original app, we used almost entirely ANSI-SQL compliant statements, with one significant exception -- we used MySQL's group_concat function fairly frequently.  group_concat, by the way, does this: given a table of, say, employee names and projects...  SELECT empName, projID FROM project_members;   returns:  ANDY   |  A100 ANDY   |  B391 ANDY   |  X010 TOM    |  A100 TOM    |  A510   ... and here's what you get with group_concat:  SELECT      empName, group_concat(projID SEPARATOR ' / ')  FROM      project_members  GROUP BY      empName;   returns:  ANDY   |  A100 / B391 / X010 TOM    |  A100 / A510   So what I'd like to know is: Is it possible to write, say, a user-defined function in SQL Server which emulates the functionality of group_concat?   I have almost no experience using UDFs, stored procedures, or anything like that, just straight-up SQL, so please err on the side of too much explanation :)


If I open a pattern table, the first line looks like: 2 2 .aa6l .ab3a4s What does the numbers mean and the rest of the file?

In my miktex folder I checked the hyph-en-us.tex file and found letter patterns written like this:  \patterns{     .ach4     .ad4der     .af1t     ... }   What do these dots and numbers mean?


I have a web page that should display the characters on web page in Chinese language, however currently it is not displaying so:  Till now, I have implemented below written code, but still not able to fix:  in my header file:  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />   mySql table is being set to:  CHARACTER SET utf8 COLLATE utf8_general_ci   The table shows Chinese characters without any fail. What else needs to be done to show the text on the web page?

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.


I am installing Ubuntu 14.04 alongside Windows 10 and am wondering how much space to set aside for the bootloader partition. I am also not sure about the swap space and am not sure if I need a swap space. Is that only for hibernation?

I'm going to install 64 bit 14.04 on a new machine with something like 1 to maybe 128GB RAM and even more RAM later. How much space should I allocate to the swap partition?   And especially: WHY those recommendations for these numbers?    (None of the existing answers  and  explain any of the why and are a bit dated if we look at 1GB or RAM and up)


I upgraded from 12.04 to 16.04 in two steps today and the PIM tools, like Kontact, no longer work due to Akonadi/MySQL problems. akonadictl start gives this output/error:  edA-qa@silent-red:~/.local/share/akonadi$ search paths:  ("/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/usr/games", "/usr/local/games", "/snap/bin", "/usr/sbin", "/usr/local/sbin", "/usr/local/libexec", "/usr/libexec", "/opt/mysql/libexec", "/opt/local/lib/mysql5/bin", "/opt/mysql/sbin") Found mysql_install_db:  "/usr/bin/mysql_install_db" Found mysqlcheck:  "/usr/bin/mysqlcheck" Database process exited unexpectedly during initial connection! executable: "/usr/sbin/mysqld-akonadi" arguments: ("--defaults-file=/home/edA-qa/.local/share/akonadi/mysql.conf", "--datadir=/home/edA-qa/.local/share/akonadi/db_data/", "--socket=/tmp/akonadi-edA-qa.zTSKeT/mysql.socket") stdout: "" stderr: "mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)\n2016-05-29T21:28:22.334244Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.\n2016-05-29T21:28:22.334305Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).\n2016-05-29T21:28:22.334359Z 0 [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files\n2016-05-29T21:28:22.334364Z 0 [ERROR] Aborting\n\n2016-05-29T21:28:22.334380Z 0 [Note] Binlog end\n" exit code: 1 process error: "Unknown error" terminating service threads terminating connection threads stopping db process Failed to remove Unix socket Failed to remove runtime connection config file Application 'akonadiserver' exited normally...   There is no /var/lib/mysql-files directory, but I'm not sure why it is looking for one. There is /var/lib/mysql directory, but shouldn't it be using the mysql setup in the .local/share/akonadi?  How can I fix this (preferably without losing my calendar information)?

I am using Kubuntu 16.10 and am unable to get Kontact to start because Akonadi will not start. Below is the output from akonadictl start.  It appears there is something seriously wrong with Akonadi. Does anyone have any ideas? Am I just sol? Can a downlevel version of Akonadi and Kontact be install?  trekker@trekker-HP-Notebook:/usr/bin$ akonadictl start Starting Akonadi Server...    done. Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) trekker@trekker-HP-Notebook:/usr/bin$ akonadiprivate_log: search paths:  ("/home/trekker/bin", "/home/trekker/.local/bin", "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/usr/games", "/usr/local/games", "/snap/bin", "/usr/sbin", "/usr/local/sbin", "/usr/local/libexec", "/usr/libexec", "/opt/mysql/libexec", "/opt/local/lib/mysql5/bin", "/opt/mysql/sbin") Found mysql_install_db:  "/usr/bin/mysql_install_db" Found mysqlcheck:  "/usr/bin/mysqlcheck" Using mysqld: "/usr/sbin/mysqld-akonadi" mysqld reports version 5.7.16 (Oracle MySQL) Executing:  "/usr/sbin/mysqld-akonadi" "--defaults-file=/etc/xdg/akonadi/mysql-global.conf --initialize --datadir=/home/trekker/.local/share/akonadi/db_data/" mysqld: [ERROR] Could not open required defaults file: /etc/xdg/akonadi/mysql-global.conf mysqld: [ERROR] Fatal error in defaults handling. Program aborted! Executing: "/usr/sbin/mysqld-akonadi" "--defaults-file=/home/trekker/.local/share/akonadi/mysql.conf --datadir=/home/trekker/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-trekker.LbKUAD/mysql.socket" Database process exited unexpectedly during initial connection! executable: "/usr/sbin/mysqld-akonadi" arguments: ("--defaults-file=/home/trekker/.local/share/akonadi/mysql.conf", "--datadir=/home/trekker/.local/share/akonadi/db_data/", "--socket=/tmp/akonadi-trekker.LbKUAD/mysql.socket") stdout: "" stderr: "mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)\n2016-11-18T19:16:26.102182Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.\n2016-11-18T19:16:26.102229Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).\n2016-11-18T19:16:26.102276Z 0 [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files\n2016-11-18T19:16:26.102279Z 0 [ERROR] Aborting\n\n2016-11-18T19:16:26.102290Z 0 [Note] Binlog end\n" exit code: 1 process error: "Unknown error" terminating service threads terminating connection threads stopping db process Failed to remove Unix socket Failed to remove runtime connection config file Application 'akonadiserver' exited normally...  trekker@trekker-HP-Notebook:/usr/bin$    It seems I have found a fix. Based on a thread I found in Kubuntu Forums, I did the following:  sudo mkdir /var/lib/mysql-files


"Of all the visual arts, architecture affects our lives most directly for it determines the character of the human environment in major ways." I was reading an article and saw this sentence. I couldn't understand why this sentence is correct. Isn't "it determines..." a complete sentence itself?

Non-native speaker here. Be kind :)  From  Book 1, Chapter 7, "In the house of Tom Bombadil"     'Let us shut out the night!' she said. `For you are still afraid,   perhaps, of mist and tree-shadows and deep water, and untame things.   Fear nothing! For tonight you are under the roof of Tom Bombadil.'   I have doubts about the exact meaning of "for" in the previous sentences.    I believe the first time it indicates causation. Something like "Because you are still afraid ...". Am I right?  The second one is more difficult for me. In this case, it could be causation (the reason why the hobbits should not fear is that they are in a safe place), or just used to set  a specific time (tonight) like in . Which one is correct?


Today (Sunday 8th, 2020, week 9) there's a Bears at Titans game, FOX, at "Noon".  (That's central time)  In fact, what time would literal kickoff be ?  Is there a consistent formula for that? Or does it really vary by network? Team? Start time? (Evening, Monday, etc.)  Is there even a specific kickoff-time (even for one specific game), or is it random, do you have to get to the TV at the stated start time to ensure you don't miss?  Is the literal kickoff time published anywhere, perhaps on the team's pages?   What if anything is the "general formula"?

I'm always confused by the times for which college football games are scheduled.  If a game (say, like the Oregon/Ohio State game tonight) has a start time of 6:30 PM, does that mean that the kickoff occurs, quite literally, at 6:30 PM?  Or, does this 6:30 start time signal the commencement of "pregame" procedures, such as teams running out on the field, coin toss, etc?


Let $G$ be the group $ ( \mathscr{M}_{2\times2}(\mathbb{Q}) , \times ) $ of nonsingular matrices.  Let $ A = \left ( \begin{matrix}  0 & -1 \\   1 & 0  \end{matrix} \right ) $, the order of $A$ is $4$;  Let $ B = \left ( \begin{matrix}  0 & 1 \\   -1 & -1  \end{matrix} \right ) $, the order of $B$ is $3$.  Show that $AB$ has infinite order.    The only reasoning possible here is by contradiction as $G$ is not abelian. And so I tried, but I got stuck before any concrete development.  Any hints are welcome, Thanks.

Let $G$ be a group and let $a,b$ be two elements of $G$. What can we say about the order of their product $ab$?   says "not much":     There is no general formula relating the order of a product $ab$ to the orders of $a$ and $b$. In fact, it is possible that both $a$ and $b$ have finite order while $ab$ has infinite order, or that both $a$ and $b$ have infinite order while $ab$ has finite order.   On the other hand no examples are provided. $(\mathbb{Z},+), 1$ and $-1$ give an example of elements of infinite order with product of finite order. I can't think of any example of the other kind! So:   What's an example of a group $G$ and two elements $a,b$ both of finite order such that their product has infinite order?     Wikipedia then states:     If $ab = ba$, we can at least say that $\mathrm{ord}(ab)$ divides $\mathrm{lcm}(\mathrm{ord}(a), \mathrm{ord}(b))$   which is easy to prove, but not very effective. So:   What are some similar results about the order of a product, perhaps with some additional hypotheses?


I know this is a popular problem. I have read that the matlab-prettifier package yields good results. My Editor told me, I am missing this package, though. I don't know how to download the package to ubuntu. Apparently, I have to do it manually.  Anyways, are there any other ways?  I have tried the Matlab publishing option. It generates a code, which is more or less just a  \begin{verbatim} ... \end{verbatim}  It is not in color.

This question led to a new package:      Does anybody have a quick and easy way to typeset some relatively long MATLAB code in the appendix? I looked up a few methods, and the mcode package emerged as a possibility, but it seems to be unmaintained...  I have a ton of equations in my code, so I'd prefer a solution that avoids having to use $ to denote equations.  Also, if possible, if there's a way to keep all of MATLAB's "natural" coding colors (e.g. green for comments), that would be great...  Any idea?


So if the definition of continuity is: $\forall$ $\epsilon \gt 0$ $\exists$ $\delta \gt 0:|x-t|\lt \delta \implies |f(x)-f(t)|\lt \epsilon$. However, I get confused when I think of it this way because it's first talking about the $\epsilon$ and then it talks of the $\delta$ condition. Would it be equivalent to say: $\forall$ $\delta \gt 0$ $\exists$ $\epsilon \gt0$ $:|x-t|\lt \delta \implies|f(x)-f(t)|\lt \epsilon$. I guess what I'm asking is whether there is a certain order proofs or more formal statements need to follow. I know I only changed the place where I said there is a $\delta$ but is that permissable in a "formal" way of writing?

Can anyone please give an example of why the following definition of $\displaystyle{\lim_{x \to a} f(x) =L}$ is NOT correct?:  $\forall$ $\delta >0$ $\exists$ $\epsilon>0$ such that if $0<|x-a|<\delta$ then $|f(x)-L|<\epsilon$  I've been trying to solve this for a while, and I think it would give me a greater understanding of why the limit definition is what it is, because this alternative definition seems quite logical and similar to the real one, yet it supposedly shouldn't work.


can I install ubuntu touch in my android device???

With the announcement of the Ubuntu Phone OS I'd like to know what phone (and tablet) models are supported at this time.  Note from foss & Oli: We are making this the master question for all future "Will this work on <insert random tablet/phone/device here>?!" questions


Using this code, I can remove all words that start with affirm (lower case "a" at the beginning of the word.  But I can't get other versions, without respect to case, to be removed.  This is despite using "re.I" at the end of my re.sub statement. Any advice?   import re txt='affirmed and the affirmance and AFFIRMED and Affirm case' wordList = ['affirm\w+', '(ca\w+)'] for word in wordList:     txt = re.sub(word, '', txt, re.I) print txt   Output:   and the  and AFFIRMED and Affirm

The Python docs say:     re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string...   So what's going on when I get the following unexpected result?  >>> import re >>> s = """// The quick brown fox. ... // Jumped over the lazy dog.""" >>> re.sub('^//', '', s, re.MULTILINE) ' The quick brown fox.\n// Jumped over the lazy dog.'


I have conducted a small scale study investigating teachers mental health, covid-19 anxiety, work engagement and burn out levels. Now I would like to measure the relationships between the aforementioned scales. I calculated the mean score for each scale and run a simple Pearson’s correlation. I am wondering though if this approach is too simplistic. Is this the best approach when measuring different Likert-type scale questionnaires?

I recently conducted a online survey and are now having trouble deciding for the right analysis method. For example: I wanted to see if there is a correlation between Factor A and Factor B. However in my survey I did not ask the participants to directly rate Factor A and Factor B, but rather asked multiple subquestions for these two factors which were rated from 5(Strongly Agree) to 1 (Strongly Disagree). I created a sum score for item A and a sum score for item B by summing up the values of each subquestion and calculated the mean of the sumscores to measure them. So my question ist: Which method would be best to use here? I want to test if e.g. people with a higher score in Factor A would be more likely to decide for Factor B. I actually planned using Spearman or ANOVA depending on the number of independent variables, but I am not sure if that would really be the correct way to measure the correlation.


Surprised that nowhere in web or in MSE is asked it and  is the not considering all of the composite numbers.   Does $$\frac{1}{4}+\frac{1}{6}+\frac{1}{8}+\frac{1}{9}+\frac{1}{10}+\frac{1}{12}+\frac{1}{14}+ \frac{1}{15} + \frac{1}{16} + \frac{1}{18} + \dots$$ converge? If so, how?  Both the Harmonic series and the sum of the reciprocals of all the prime numbers do not converge which doesn't help to answer the question.

It can be easily show that the harmonic series $$\sum_{n=1}^{\infty}\dfrac{1}{n}$$ is divergent. Also it has shown that the infinite series of reciprocals of primes $$\sum_{p\text{ is prime}}\dfrac{1}{p}$$ is divergent.       I believe that the series $$\sum_{m\text{ is composite}}\dfrac{1}{m}$$ is also divergent.   But I have no idea to attempt for a proof. Any help will be appreciate. Thank you.


I have the following lines of code          BalancerMember http://server3:82 status=D         BalancerMember http://server2:80 status=D   I want to search for entries with port 82 and then want to wipe out status=D. So , it will look like this           BalancerMember http://server3:82   Tried this, but this will not work    grep :82 app.conf | sed -i 's/status=D/ /'   sed: no input files   I need the -i option with sed because I would like to make the change in file .  Any suggestions.

I have a code block as follows in a file:  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2   I want to search for all lines which had tc_ keyword and add status=D at the end of those lines. So, the above entries will become like this  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 status=D BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2 status=D   I am using the following command to achieve this:  sed -i '/tc_/a status=D' app.conf   But I can see status=D is being after a newline. I don't want a newline for this. It should be appended with a '' (space) .


I've seen many questions being closed on SO because they ask for recommendations on which components to use because it is often a matter of opinion.  I know this may also be the wrong place, but where should I ask?  It takes so much time to read up on every components (just to find that at least half of them are outdated or just never took off) and write some software to try every remaining available component out...

Can I ask questions about software application recommendations anywhere in the stackexchange system?  For example, I have a requirement, which will involve software and hardware.  I want to type this requirement up somewhere where possible readers will be able to recommend hardware and software solutions to my requirements?


We pronounce most of the characters as if they were words and not characters. For example,"C" is pronounced as "See" but when used in a word, we pronounce it as "K". This is the same case with other characters too.     So my question is, why not pronounce single characters the same way as they are pronounced in words?  In  question, it is answered how we started to pronounce single characters differently. Why not pronounce them in a similar way? It's thus easier to learn for children. Also many(or maybe most) languages use similar pronunciation.  Does anyone know why it evolved in such a way?

I don't know too many languages, but the ones I know have more elaborate names for their letters than the monosyllabicity of names for English letters. (E.g. - I'll pick on Greek here - ay instead of alpha, bee for beta, etc.)  How did these short names evolve, and when?  Further, why do nine of the letter-names (B, C, D, E, G, P, T, V, Z) end with "ee" (as in "bee"), while six others (F, L, M, N, S, X) begin with "eh" (as in "ef")?  And why do (H, K, Q, R, W, sometimes Z) have less orthodox names?  (Is "ar" for "R" a corruption of "ehr", perhaps?) "J" needs to be different, so as not to be confused with "G".  The remaining ones (vowels, incidentally: A, I, O, U, Y) I understand as not possible to fit into any regular pattern.  Maybe the answer is simply that letter-names, like the language, are not logically created; rather evolved erratically.  But I want to make sure.  Does anyone have any answers?


I am basically stuck at the part where it says w1 + w2 = 7 is equal to the number of integer solutions of x1 + x2 = 5. After that I am not sure how the book got n = 2 and r = 5. I am mainly confused and clueless about how x1 + x2 = 5 is equal to w1 + w2 = 7. Please explain and show me the steps and formulas and such used to figure this out

This question is generalization of different cases of  combinatorics problems that are generally asked.  We will find general way of arranging $n$ balls in $r$ boxes. Cases :    Identical Balls. Distinct Balls. Order considered. Distinct Balls. Order not considered.   Two cases arise in each case :    Empty boxes allowed. Empty boxes not allowed.   Please feel free to add any other cases or minor variations you might think can be generalized.


My question is could all I think of as real in this world, the pain, the happiness, sadness all just be part of some futuristic vr of some sorts that is making me think i am thinking and doing all im doing in real life when actually im in a simulated world? Could all every person I think is real, everything I think im eating just be a simulation? In this certain world, I assume the only thing that actually exists is my conciosness. So in a way, this is in a sort of solipism. But can it be disproved?

I am not questioning whether the simulation topic is outside science. I am asking what evidence there is or could be to resolve whether we are or not.   Living in a simulation has been a topic for philosophy since at least Descartes, with his 'evil demon not less powerful than deceitful'. Zuangzhi's 'Now I do not know whether I was then a man dreaming I was a butterfly, or whether I am now a butterfly, dreaming I am a man' could be argued to be a statement of the same idea. What I am interested in is, is can we get beyond speculation and make headway on this? How does the evidence stand, what tools do we have, and what implications might the different answers have?  Here I quickly summarize some of the main positions:    (2003), Nick Bostrom, makes the case we are in a simulation, on the balance of probabilities   (2017), Ringel & Kovrizhin, makes the case such a simulation is impossible using classical computers.  But that leaves quantum computers.  (2014) gives a more detailed idea of what being in a simulation might mean, as a kind of peer-to-peer reality  demonstrates a serious argument that the simulation hypothesis is the best answer to the Fermi Paradox.  Although as recently discussed on here, the existence of this paradox is open to dispute, and relies on a range of assumptions.   Anyone got anything else evidence based? Any models, or discussions of implications?


Here is 2 methods which result the same:  public class MessageManager {     public void SendMessage(string name, int count)     {         string message = "Hi " + name + ". I know you don't like cake, so I bought you " + count + " lollipops. Same thing, right?"; // No boxing. "count" was converted to string somehow.         //Console.WriteLine(message);     }     public void SendMessage2(string name, int count)     {         string message = String.Format("Hi {0}. I know you don't like cake, so I bought you {1} lollipops. Same thing, right?", name, count); // Boxing "name" and "count" + executing unnecessary code.         //Console.WriteLine(message);     } }   So I guess the second method will be slower then first because of boxing and executing some additional code which inside String.Format() method.  I have tested them with following method:  public static class PerformanceTester {     public static TimeSpan TestAction(Action<string, int> action)     {         Stopwatch timer = new Stopwatch();         timer.Start();         for (ushort i = 0; i < ushort.MaxValue; i++)             action("Alex", 1000);         timer.Stop();         return timer.Elapsed;     } }   And here is the usage of it:      static void Main(string[] args)     {         MessageManager mm = new MessageManager();          TimeSpan ts_m1 = PerformanceTester.TestAction(new Action<string, int>(mm.SendMessage));         TimeSpan ts_m2 = PerformanceTester.TestAction(new Action<string, int>(mm.SendMessage2));          Console.WriteLine("First message took time: " + ts_m1.ToString());         Console.WriteLine("Second message took time: " + ts_m2.ToString());          Console.ReadKey();     }   Output with my Intel® Core™2 Duo Processor E8200 (DEBUG):    Output with my Intel® Core™2 Duo Processor E8200 (RELEASE):   I saw String.Format used almost everywhere (guides, blogs, tutorials etc.) but it is actually slower than simple string concatenation. I know when I talk about C# I must not care about performance, but the results in this example is too awesome. The question is: "Is there any best practice where String.Format is actually better than concatenation of strings."

Let's say that you want to output or concat strings. Which of the following styles do you prefer?   var p = new { FirstName = "Bill", LastName = "Gates" }; Console.WriteLine("{0} {1}", p.FirstName, p.LastName); Console.WriteLine(p.FirstName + " " + p.LastName);   Do you rather use format or do you simply concat strings? What is your favorite? Is one of these hurting your eyes?  Do you have any rational arguments to use one and not the other?  I'd go for the second one.


how to display any number to 5 decimal places.  for example 0.0 to 0.00000, 12.63 to 12.63000. how to display any number to length 8.  for example 12.1 to 12.10000, 2.1234567 to 2.123456

What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standard method of rounding most people expect in most situations.  I also would like only significant digits to be displayed - i.e. there should not be any trailing zeroes.  I know one method of doing this is to use the String.format method:  String.format("%.5g%n", 0.912385);   returns:  0.91239   which is great, however it always displays numbers with 5 decimal places even if they are not significant:   String.format("%.5g%n", 0.912300);   returns:  0.91230   Another method is to use the DecimalFormatter:  DecimalFormat df = new DecimalFormat("#.#####"); df.format(0.912385);   returns:  0.91238   However as you can see this uses half-even rounding. That is it will round down if the previous digit is even. What I'd like is this:  0.912385 -> 0.91239 0.912300 -> 0.9123   What is the best way to achieve this in Java?


Whenever I start Minecraft a file called native text appears on my desktop. It is called 'Native file', and it is just a bunch of locations and junk that makes no sense to me.  If I delete it and start up Minecraft it reappears.  What does this file do? What is it's purpose? Please tell me what is going on. No mater what I do it will still not go away it comes back. Mods and feed the best,etc. there might be something corrupt about my minecraft, profile.

Once I click to run minecraft a small window appears saying "Downloading runtime", then three other folders appear onto my desktop: Game, Native Log, and Runtime. This really annoys me, as I have to keep deleting them after I am done with a session of minecraft. Why is this? It never use to happen before.


My if statement (the one holding all the others) is running as false and I don't understand what I'm doing wrong. Here's a portion of my code. I really appreciate any help I can get as this is a school assignment   import java.util.Scanner;  public class StatesOfWater {    public static void main( String[]args )    {      Scanner water = new Scanner(System.in);       System.out.println("Enter a unit ( C for Celcius and F for Fahrenheit): ");      String unit = water.next();       System.out.println("Enter a temperature: ");      int temp = water.nextInt();      String c = "C";      String f = "F";        if (unit == c) //not assigning, equaliziing      {          if ( temp <= 0)          {              System.out.println("The state is solid.");          }           else if ( temp > 0 && temp < 100.00)          {              System.out.println("The state is liquid.");          }           else if (temp >= 100.0)          {              System.out.println("This is a gas");          }          else          {              System.out.println("error2?");             }     }     else      {         System.out.println("error?");     } } }   Using () instead of == does not compile as im using Java 7.

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've switched to ubuntu for quite a while now but still cant install amd gpu drivers i have acer laptop with amd gpu when i try to install graphics drivers i get dependencies missing with the deb pkg i try to install(this pkg i got from amd official site product support) idk maybe the drivers are outdated or not supported in the ubuntu 20.04 or something like that this is what's written in graphics tab in setting ==> AMD® Hainan / AMD® Kabini my gpu is AMD radeon R5 M335 anyone help me pls and i'm not an advanced linux user

I have 14.04.5/16.04 or newer and an AMD GPU. I'm not getting the performance I want, and some programs say they need things like OpenCL.  I've heard about fglrx, but if I try to install it on my machine, it breaks and I have no GUI.  Is there anything I can do to get my AMD card working to its full potential?


Swift floating point arithmetic seems broken compared to C (and therefore Objective-C).  Let's take a simple example. In C:  double output = 90/100.0; // Gives 0.9 float output = 90/100.0f; // Gives 0.9   In Swift:  var output = Double(90)/Double(100.0) // Gives 0.90000000000000002 var output = Float(90)/Float(100.0) // Gives 0.899999976   What's going on? Is this a bug or am I missing something?  EDIT:  #import <iostream>  int main() {     double inter = 90/100.0;     std::cout << inter << std::endl; // Outputs 0.9     return 0; }

Consider the following code:   0.1 + 0.2 == 0.3  ->  false   0.1 + 0.2         ->  0.30000000000000004   Why do these inaccuracies happen?


I'm creating a form with both date and time fields. To help the user I'm using a placeholder value to demonstrate how the the respective formats should look like, but I'm not at all sure on what formats to settle.  What date and time format do most people in both continents compound understand/renders less validation errors?  For time I need Hours and Minutes. For date I need Year, Month, Day.

In an application when you are showing a date to someone (and you don't know their preferred format), what date format should you use?  USA or Rest-of-the-world?     For reference if anyone is not sure what these formats are, today's date would be:   USA = 10/07/2011 or October 7, 2011   Rest-of-the-world = 07/10/2011 or 7 October 2011   Assuming an equal probability that a user is from the USA or outside the USA, which format should I use?  Note, this question was largely triggered by the comments in .


From what I understand, you can sort a dictionary by items, keys, and values which will then show the respected part in a sorted list   sorted( d.items...) shows the entire entry, keys to keys, and values to values.  How would I go about showing only the values in a dictionary based on the key being sorted?  I've tried  sorted(d.values(), key = (lambda x:...) - but I'm not sure if I'm going about this the right way  d = { 2: (4,6) , 5: (3,2), 3: (5,9) } would be an example of a dictionary and I want it to display   { (4,6), (5,9), (3,2) } - ordered based on key but only show values.  I'm trying to only use the sorted function and not import anything else

I have a dictionary of values read from two fields in a database: a string field and a numeric field. The string field is unique, so that is the key of the dictionary.  I can sort on the keys, but how can I sort based on the values?  Note: I have read Stack Overflow question here  and probably could change my code to have a list of dictionaries, but since I do not really need a list of dictionaries I wanted to know if there is a simpler solution to sort either in ascending or descending order.


Well this  answered a  today, however his profile say "I no longer work at Stack Exchange". Did he join again to support Stack Exchange, or is he just a member?  I doubt because still he has a diamond.

As far as I know, the diamond symbol is given to the folks who  are the community elected moderators, for example,  are employees of the Stack Exchange, Inc., for example,   In those regards,  is neither a , nor is he a part of the  since March 1st, 2012. So my question is, other than the fact that he is the , is there any other reason why he still has the diamond symbol next to his name and whether he can still exercise his moderation abilities? :) Note: I do not have any problems with him having the Diamond Symbol. I just wanted to know the reason and whether he still has those privileges or not. In fact, I'd be very happy to know that he still has those privileges because, you know, he knows the site, the Best. :) Note: as of October 2017, .


Do I say "Slash" or do I just ignore the / all together? I have a powerpoint presentation coming up and I can't figure out how to say / for my presentation.

How to pronounce "slash" in giving an address, meaning the corner of 2 streets?  I live at 1/9 Park Lane. Should it be read as one slash nine Park Lane?


I was tinkering with a new command configuration, and I placed a repeating command block underground that gives me superspeed.  I forgot to take it's coordinates, and I left. I was testing range, and I found it NEVER. WEARS. OFF. I can't find it anymore, and I can't turn it off!! I'm in a superflat world, so I can't really remember the place from surroundings. And now I'm stuck with level 15 speed effect.  Is there a /testforblock command that will look in a large radius, not just one block?

I've placed a command block making it day all the time. I want to turn it off, but I've lost it. What's the quickest way to find it?


I download xshell.exe file and i try to excute it using terminal by typing ./xshell.exe But I can't excute it. How can I do it? Please help.

Can .exe and .msi files (Windows software) be installed in Ubuntu?


I'm using Composer PSR-4 to autoload classes, but when I try to call register_activation_hook using a classname if get the following error (same for register_deactivation_hook):   call_user_func_array() expects parameter 1 to be a valid callback,  class `Activation` not found   The Autoload portion of composer.json looks like so...   "autoload": {     "classmap": [],     "psr-4": {         "BlackOpz\\OOPBookPlugin\\Inc\\": "./src/inc"     },     "files": [         "src/support/exceptions.php"     ] },   ...which adds the following line to my vendor/composer/autoload_psr4.php file...       'BlackOpz\\OOPBookPlugin\\Inc\\' => array($baseDir . '/src/inc'),   My directory structure is like so...   oop-book-plugin  - assets    - composer (directory)    - filp (directory)    - kint-php (directory)    - psr (directory)    - autoload.php  - src    - css    - inc      - Activation.php      - Deactivation.php  - etc      - ...   My Activation.php looks like so...   /**  *  * @package     BlackOpz\OOPBookPlugin  * @wordpress-plugin  */ namespace BlackOpz\OOPBookPlugin\Inc;  class Activation {      /**      * Activate Plugin.      *      * @return void      */     public static function activate() {         flush_rewrite_rules();     } };   My Deactivation.php looks like so...   /**  *  * @package     BlackOpz\OOPBookPlugin  * @wordpress-plugin  */ namespace BlackOpz\OOPBookPlugin\Inc;  class Deactivation {      /**      * Deactivate Plugin.      *      * @return void      */     public static function deactivate() {         flush_rewrite_rules();     } };   My main class which looks like so...   // Load Composer Autoload. if ( file_exists( dirname( __FILE__ ) . '/assets/vendor/autoload.php' ) ) {     require_once dirname( __FILE__ ) . '/assets/vendor/autoload.php'; }  use BlackOpz\OOPBookPlugin\Inc\Activation; use BlackOpz\OOPBookPlugin\Inc\Deactivation;  // Instantiate the class. if ( ! class_exists( 'Book' ) ) {      /**      * OOP Book Plugin Class      */     class Book {          // This only works INSIDE the class with an instantiated class (below)         public function activate() {             Activation::activate();         }          // This only works INSIDE the class with an instantiated class (below)         public function deactivate() {             Deactivation::deactivate();         }     }      // The instantiated class.     $book = new Book();     $book->register();       // THIS WORKS     // register_activation_hook( __FILE__, array( $book, 'activate' ) );     // register_deactivation_hook( __FILE__, array( $book, 'deactivate' ) );      // THIS DOES NOT WORK     register_activation_hook( __FILE__, array( 'Activation', 'activate' ) );     register_deactivation_hook( __FILE__, array( 'Deactivation', 'deactivate' ) );  }

Has anyone used  and/or PHP namespaces within a plugin or theme?  Thoughts on using them? Any harm? Pitfalls?  Note: namespaces are PHP 5.3+ only. Assume, for this question, that you know you'll be dealing with servers that you know have PHP 5.3 or greater.


Just updated my Ubuntu to 18.04, but I couldn't find how to hide all windows with one click by the icon. In 16.04 it was something like "show Desktop" icon on the Ubuntu dock (left sidebar).

I am migrating from Unity to GNOME. One item I am missing is a "Show desktop" button (aka "minimise all windows") in the dash. How can I add this functionality to the GNOME dash (or Ubuntu dock in Ubuntu 17.10 and later), even if it means making a custom .desktop file?  (I know that I can use the Ctrl + Super + D   and that I can install , but I specifically want a button in the dash.)


I had previously dual-booted Ubuntu 13.10 with Windows 8. Then I upgraded it to Windows 8.1. Since then my GRUB has not been appearing. I started Ubuntu from my bootable USB drive and ran boot repair. It initially restored the GRUB. I even upgraded it to 14.04. The GRUB appears as long as I keep using Ubuntu. Even if I once start Windows from the GRUB, the GRUB menu does not appear on the next boot. It directly loads Windows.  Here is the link to my boot info summary

I have a Sony VAIO S series with Windows 8 preinstalled, and I installed Ubuntu 12.10 on a new partition. When the PC boots Grub is display, and I can choose between Windows 8 (didn't worked at the beginning, had to change Grub settings) and Ubuntu 12.10. When I select Ubuntu 12.10 everything is OK, but when I use Windows 8, and I restart Grub isn't displayed anymore (Windows 8 boots immediately).  I booted a Ubuntu 12.10 LiveUSB, used efibootmgr, and found out that Windows 8 (each time it boots) changes EFI default bootloader from Grub to Windows Boot Manager.  How do I change this in Windows 8? I read something about bcdedit, but it does not work or I don't know how to use it...


I have two vector layers as seen below, one is a landcover map showing the different habitats in a region and one is a grid of 4 x 4 km squares that covers the region.   I have to extend this grid to cover the whole landcover layer as currently it does not cover it properly, I could also create a new one but I need the current squares to stay in the same place. I can't find anything on expanding this layer or to create a new one based on the old one

How do I create a fishnet shapefile using QGIS?   The equivalent task of "Create Fishnet" in ArcGIS.


I try to parse a small part of a webpage. As I need to analyse a part of executed JS I can't use a HTML parser. Well, as what I have to find is "easy" I used preg_match().  When I validate my code in regex101.com everything seems to be ok and I get what I want. But when I execute my code it does not work correctly.  Example of what I try to parse:  // Setup SoundManager soundManager.setup({     debugMode: false,      flashLoadTimeout: 1000,     flashVersion: 9,     preferFlash: true,     url: "path/swf/",     useHighPerformance: true,     useHTML5Audio: false,     waitForWindowLoad: false,     onready: function() {         soundManager.createSound({             id: "radio",             serverURL: "rtmp://popradio.stweb.tv:1935/popradio/",             url: [{                 type: "audio/mp4",             }],             autoLoad: true,             autoPlay: true,              multiShot: false,             volume: volume,             onconnect: function( bConnect ) {                 setButtonStop();             },             onfailure: function() {                 setButtonError();             },             onload: function(bSuccess) {                 if (bSuccess == true) {                     setButtonStop();                 } else {                     if (window.onloadRetry != 2) {                         window.onloadRetry++;                         soundManager.reboot();                     } else {                         setButtonError();                     }                 }             },             onplay: function() {                 setButtonStop();             }         });     },     ontimeout: function() {         setButtonError();     } });   I just want the value of serverURL so I made :  if (preg_match('#serverURL: "(.*)",#', $html, $rtmp)) {     $streamurl =  $rtmp[1] ; ;     echo $streamurl ; }   But it never ends, it mades me a display of the whole webpage (from ServerUrl: )  What did I make wrong? I read the docs about preg_match(), but I did not find anything.

I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?


On Ubuntu 18.04 LTS, how to get:   Linux Kernel: 5.0 or newer. Mesa Library: 19.0 or newer. Intel Graphics Driver: ...? (latest) AMD Graphics Driver: ...? (latest) Xorg: ...? (latest)   I have two machines, one with a GPU from Intel, the other from AMD.  Another way to ask this question would be: how to optimize gaming (e.g. Steam) and make the most out of newish-hardware, specifically on Ubuntu 18.04 LTS?

I see the  package as part of the kernels you can install in Ubuntu.  What is hardware enablement (HWE)?


So far, I've used the word "the latter" to distinguish between two items or things. Like in the following sentence:     “This item is available in wood and in metal, but I prefer the   former.”   Recently, though, I've been wondering if it is possible to use "latter" to refer to the last item on a longer list? Like in this example:     "This item is available in wood, plastic, metal and paper. The latter   is the least expensive"   What is your take on this issue? Any feedback appereciated!

Former and latter are valid only when there are two choices.  If I have a list of more than two items, is there an elegant way to say the first one or the last one?


I  and went to check on the status of the flag.     What does active mean?

My flagging summary page displays "active" for a particular flag that seems to be not actioned yet. What does that mean?


Is it wrong to standardise a variable (e.g. polygenic risk score) and then centre it for use in multiple regression?

Do you ever center AND standardize variables in multiple regression? It seems as if standardization would automatically center variables...is this true?


I came accross two Solutions(both work):   public List<Label> foo1(ref ISomeInterface[] all)   or   public List<Label> foo2(ISomeInterface[] all)   Is there a diffrerence, does it matter which of them I take ? Interface is a reference value and will give the parameter as reference anyway and "ref" will also get the reference...I think I can dismiss "ref" ... I wonder why the compiler does not give me an error...

If I am passing an object to a method, why should I use the ref keyword? Isn't this the default behaviour anyway?  For example:  class Program {     static void Main(string[] args)     {         TestRef t = new TestRef();         t.Something = "Foo";          DoSomething(t);         Console.WriteLine(t.Something);     }      static public void DoSomething(TestRef t)     {         t.Something = "Bar";     } }   public class TestRef {     public string Something { get; set; } }   The output is "Bar" which means that the object was passed as a reference.


In my thesis, I want to use the statement "Chapter one" instead of "Chapter 1". Do I add specific changes into the following commands?   \titleformat{\chapter}[display] {\vspace{5cm}\filcenter} {\filcenter \LARGE\bfseries \chaptertitlename\ \thechapter} {1ex} {\vspace*{5ex}\filcenter\Huge\bfseries} [\vfill\clearpage]

In LaTeX, how do I change the chapter number to display as text? eg:  CHAPTER ONE not CHAPTER 1;  CHAPTER THIRTEEN not CHAPTER 13.


I am a member of the  (in beta) and I have a 770 reputation points.  Recently, I was reviewing Close votes posts and found that a user with just  of suggested edits.  But the review page says I need a minimum of 1000 reputation points to review a suggested edit.    How could that user do that?  Is this a bug?

When clicking "edit" I see:  Your edit will be placed in a queue until it is peer reviewed. We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.  Like:     Likewise, when I am not logged in, clicking "improve this question" or "improve this answer" shows:  You are not . Your edit will be placed in a queue until it is .  And when I click 'Save', I get:  Thanks for submitting an edit. It is only visible to you until it's been approved by trusted community members  Like:     Who can suggest an edit? Where do suggested edits go? Who can vote on a suggested edit? How do suggested edits get reviewed? Can I earn reputation? What about abuse or bad edits? Sometimes the Community user approves or rejects my edit. Why is that? When can I not suggest an edit? Is there a minimum change requirement for a suggested edit? How do I check my suggested edit history? I disagree with the reasons why my suggested edit was rejected. What can I do? How do I know whether there are edits waiting for review? Someone suggested an edit to my own post, and the reviewers took the wrong action. What can I do? Are tag wikis included in this scheme? What do the "Improve Edit" and "Reject and Edit" buttons do? Why are apparently valid links to rejected edits resulting in 404 errors?   For more information about editing, see "" in the .


I'm having a little problem getting an information. In my plugin, I got a situation where I have to throw, in a very specific situation, a 403 error. But I can't find in the documentation if there is a recommended way to throw a 403, because WP LOVES wrap everything it's own way.  So! Do you know a way to trigger a 403 manually ?  Thanks

Just see the following code snippet. I have came across this in one of the plugins that I am reading now.   if ( ! defined( 'ABSPATH' ) ) {   header( 'Status: 403 Forbidden' );   header( 'HTTP/1.1 403 Forbidden' );   exit; }   I understand that this script is sending an forbidden 403 header response to the browser for unauthorized access. But why two 403 headers ? Is the second one kind of fallback to the first one ?


What is the difference between: "It does finish successfully" versus "It finishes successfully" What is the difference and what's commonly used.

This morning I read this sentence (see ):     On July 24th and again on July 29th,   Egyptian police did shoot dead unarmed   African migrants attempting to cross   that border.   Why "did shoot" and not "shot"?


Requirements: Ability to contain generic class objects.  I am making a static library (actually several static libraries) to encapsulate OpenGL functionality into reusable classes.  I have a basic resource management class definition (which originally came from an external OGL tutorial site), that defines static maps:  class ResourceManager {     public:     static std::map<std::string, Shader> Shaders;     static std::map<std::string, Texture2D> Textures;     etc...   These have worked fine in the past, but now I am in need of something generic to handle containers of object types that will be declared outside of the scope of this library. Here is what I've managed to piece together after searching over the internet:  ... template <class T> static std::map<std::string, std::map<std::string, T>> MetaMap;  template <class T> static void AddData(T data, std::string name) {     //This line is the real issue     MetaMap[typeid(T)::name()][name] = data; }   As is required, I have another declaration of MetaMap in my .cpp file:  template <class T> std::map<std::string, std::map<std::string, T>>   ResourceManager::MetaMap;   The intended use of this in another project would look like:  ResourceManager::AddData<Shader>(spriteshader, "spriteshader"); ResourceManager::AddData<Texture2D>(spritetexCoin, "cointex"); ResourceManager::AddData<SpriteAtlasAsymetric>(SAasym, "asymatlas"); etc...   The templated AddData() method causes no issues when empty, but when trying to reference MetaMap from inside, causes the error: "C3245 - 'ResourceManager::MetaMap': use of a variable template requires template argument list"  Now, to me, this suggests that I need to place "< T>" somewhere around the reference to MetaMap in AddData.  template <typename T> static void AddData(T data, std::string name) {     MetaMap<T>[typeid(T)::name()][name] = data; }   Doing so clears up the compilation error, but presents a linking error: "LNK2001 - unresolved external symbol..."  This is as close to figuring this one out as I've gotten. Is this functionality actually achievable with C++? Because I've also read that:     "Templates are specialized at compile time so they are not still parameterized types at runtime"    and     "Templates, in contrast, resolve into ordinary types at compile time and the resulting types may not be specialized in other assemblies."   ...which kind of sounds like I'm dead in the water. Can this approach be made to work in the way I desire?  Thanks for your time.  RESOLUTION  I might as well update this question with my solution for the benefit of others. All in the header file:  template <typename T> class Mapper { public:     static std::map<std::string, T> myMap;          static inline void AddData(T data, std::string name) { myMap[name] = data; }// *(new T(data)); }     static inline T GetData(std::string name) { return myMap[name]; }     static inline T* GetData_ptr(std::string name) { return &myMap[name]; }  private:     //Private constructor     Mapper() { }  }; //Must be implemented in header. Linker will not be able to resolve the symbol if inside cpp file. template <typename T> std::map<std::string, T> Mapper<T>::myMap;   After battling this concept, I'm happy to see that the most elegant solution is the correct one.  This can be used from an external project in the following way, and without any need for setup or further initialisation (regarding the above requirement that myMap be implemented inside the header, but outside the class definition) :  Mapper<int>::AddData(6, "myint");  int temp = Mapper<int>::GetData("myint");  Mapper<Texture2D>::AddData(spritetexCoin, "texcoin"); Texture2D temptex = Mapper<Texture2D>::GetData("texcoin");  //Doesn't alter value referenced in Mapper temp = 9; //temp back to 6 again temp = Mapper<int>::GetData("myint");

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.)


I am just trying to find out the reverse and length of a string. Here is the snippet of the Code:       Console.WriteLine("Please Enter your String: ");         string InputString = Console.ReadLine();          char[] String_Array = InputString.ToCharArray();         int Length = 0;          foreach (char c in String_Array)         {             Length++;         }         char[] String_Reverse = null;         for (int i = Length - 1, j = 0; Length >= 0; Length--, j++)         {             //Here is the error I am facing, Null Reference Exception              String_Reverse[j] = String_Array[i];         }         string Reverse = new string(String_Reverse);          Console.WriteLine("Length of the String " + InputString + " is :" + Length + " and Reverse of the String is :" + Reverse);         Console.ReadLine();

I've just had to write a string reverse function in C# 2.0 (i.e. LINQ not available) and came up with this:  public string Reverse(string text) {     char[] cArray = text.ToCharArray();     string reverse = String.Empty;     for (int i = cArray.Length - 1; i > -1; i--)     {         reverse += cArray[i];     }     return reverse; }   Personally I'm not crazy about the function and am convinced that there's a better way to do it. Is there?


I have a questions about python sorting functions. I cannot digest how it works actually. Here is my class:  class DataScript(object):      def __init__(self, index, name, size):         self.index = index         self.name = name         self.size = size      def __cmp__(self, other):         if hasattr(other, 'getKey'):             if self.getKey() == other.getKey():                 return 0             else:                 if self.getKey() > other.getKey():                     return 1                 else:                     return -1      def getKey(self):         return self.size      def __iter__(self):         return self      def __next__(self):         self.index += 1         try:             return data[self.index - 1]         except IndexError:             self.idx = 0             raise StopIteration  # Done iterating.      def __repr__(self):         return '[' + str(data.index) + ', ' + data.name + ', ' + convert_bytes(data.size) + ']'   It is said that I have to give the list which I want to sort and the getKet function to get the sorting key. However when I try to run such a thing like this:  I get an error that something is not iterable or there is no getKey function for the object in question ? Here is how I call it and I have to say it has no sense for me. First example doesn't work and I'm guessing it cannot actually determine item index and doing nothing. Second example works and I don't understand why.   sorted(resultList, key=resultList.getKey)   or  resultList.sort(key=resultList.getKey)

I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves.  The list looks like:  >>> ut [<Tag: 128>, <Tag: 2008>, <Tag: <>, <Tag: actionscript>, <Tag: addresses>,  <Tag: aes>, <Tag: ajax> ...]   Each object has a count:  >>> ut[1].count 1L   I need to sort the list by number of counts descending.  I've seen several methods for this, but I'm looking for best practice in Python.


Progress bar position isn't proper in Feed screen.  App version: 1.0.21

Seems to be a bug the first time you launch the app where the refresh icon gets hidden by the section headers until the device is rotated.   Fresh launch:         After rotation:         It also reappears after you scroll another header into view. I'm guessing the headers are getting brought to the front and end up in front of the swipe refresh view.


I don't understand why the output is only Warren. And what does switch(money,money*2) mean?  #include<stdio.h> #define L 10 void main(){      auto money=10;      switch(money,money*2){         case L: printf("William");                break;         case L*2: printf("Warren");                break;         case L*3: printf("Carlos");                break;         case L*4: printf("Inqvar");                break;         default: printf("Lawrence");      } }


I have javascript code into xslt which should check image dimension. If width is greater than height to rotate img.  <script language="javascript">     var a = 3;     var b = 1;     if (a > b) {       document.getElementById("img1").style.transform = "rotate(90deg)";     }    </script>     I tried:  1) &gt;  2) <![CDATA[ --code --]]>  3) disable-output-escaping="yes"   But nothing works. In console see an error message    Thanks

i have a tiny little problem with xslt, js and html entities, eg. within a template:  <script type="text/javascript">     <xsl:value-of select="/some/node"/>     for (var i = 0; i &lt; 5; i++) {         //            ^^^ js error     } </script>  <script type="text/javascript">     <xsl:value-of select="/some/node"/>     for (var i = 0; i < 5; i++) {         //            ^ xslt error     } </script>  <script type="text/javascript">     <xsl:value-of select="/some/node"/>     // <![CDATA[     for (var i = 0; i < 5; i++) {         //            ^ becomes &lt;     }     // ]]> </script>   <script type="text/javascript">     <xsl:value-of select="/some/node"/>     for (var i = 0; i <xsl:value-of disable-output-escaping="yes" select="string('&lt;')"/> 5; i++) {         // works of course     } </script>   does anyone have an idea where my problem could come from? i always thought the xslt processor would leave the content of a <script/> element unescaped when using the html output method ...  i run libxslt2 version 1.1.24 on OSX which was installed using macportsports ...


What's the best adapter to connect a MBP Retina to a VGA data Projector?

I have an external monitor with a VGA connection. What is the best adapter to use for my Retina MacBook Pro? I think I've seen Thunderbolt to VGA, or USB to VGA? Or HDMI to VGA? What are the differences?


How are the deviance residuals (highlighted in yellow) calculated in logistic regression? Please help me to get a good understanding by using a clear example!  Image source: Google

I know that standardized Pearson Residuals are obtained in a traditional probabilistic way: $$ r_i = \frac{y_i-\hat{\pi}_i}{\sqrt{\hat{\pi}_i(1-\hat{\pi}_i)}}$$ and Deviance Residuals are obtained through a more statistical way (the contribution of each point to the likelihood): $$ d_i = s_i \sqrt{-2[y_i \log \hat{\pi_i} + (1 - y_i)\log(1-\hat{\pi}_i)]} $$ where $s_i$ = 1 if $y_i$ = 1 and $s_i$ = -1 if $y_i$ = 0. Can you explain to me, intuitively, how to interpret the formula for deviance residuals? Moreover, if I want to choose one, which one is more suitable and why? BTW, some references claim that we derive the deviance residuals based on the term $$-\frac{1}{2}{r_i}^2$$ where $r_i$ is mentioned above.


when I put the usb drive that contain XP files it appears to me a black window with this                    gnu grub version 2.02 beta2-36 ubuntu 3.12   minimal BASH- like line editing is supported for the first word, tab lists possible command completion. Anywhere else TAB lists possible device or file completions  grub>   Note:I am new with linux!

I have absolutely no experience with Linux, and I desperately need to get my computer back up and running again with Windows.  How do I remove Ubuntu and reinstall Windows?    Editor's note: many of the answers are about removing Ubuntu from dual-boot but keeping Windows (which is a bit complicated), while other answers are about removing Ubuntu from single-boot (which is easy: basically just format the disk while installing Windows). The question as written is ambiguous between dual-boot or single-boot.


I want to apply for Thailand and Malaysian visas, as I am visiting these 2 countries as a tourist.  Can I get a visa for these 2 countries, without having a round-trip ticket?  I'll book a ticket to Thailand, travel to Malaysia by road, and from Malaysia I have a return ticket back to India, will I be able to get a visa with this return ticket?

Someone told me I need a ticket out of Thailand in order to enter.  I am traveling to Thailand, on March 18th. I have a Ticket from Bangkok to Sweden booked for June 4th.   I will be staying in Thailand for 2 weeks when I arrive there, then traveling around Cambodia, Laos and Vietnam until June 4th when I leave.   With that ticket out of Thailand, will I be able to get in and get a (30 day) Visa-On-Arrival (or not because the ticket out is not within the first 30 days). Or do I need to show proof that I am leaving within 2 weeks of being there at first?


Consider the following PCB.  I notice some motherboards have such wavy tracks. Are there any purposes? Or it is there merely for artistic purposes?

On some PCB designs, specific traces are routed in curious ways. This probably has to do with high frequency design considerations and general signal behavior that I am not familiar with.  Let's take this PCB (somewhere from the web) as an example. It shows part of a PCIe card with SATA routing and DDR2 RAM:    I highlighted 4 areas that qualify as unusual trace layout (from my perspective).   What are those shapes supposed to achieve? How do designers come up with what pattern is required? Another example of wave shaped, antenna like routing. This is fairly rare. But obviously the designer deliberately avoided 45° traces. Why? Curves again and a single "pulse" within the trace. How can this have any significant effect?   So what are the use cases and benefits of this techniques?   I want to be able to take those into consideration when doing future PCB designs.


Can you please help me with the question:  How to proof that a bounded, open interval is not compact.

I learned that every compact set is closed and bounded; and also that an open set is usually not compact.   How to show that a concrete open set, for example the interval $(0,1)$, is not compact? I tried to show that $(0,1)$ has no finite sub cover.


When Garou fights heroes does he actually kill them or just severly injure them. If he killed them then that will leave the Hero Association at a huge loss and in previous episodes     When Garou fought the 8 heroes in Gatling Gunner's squad it seemed like some of them died.   Does he actually kill heroes?

Garou has beaten many heroes, but some of them at least in their first beating survived, such as Tank Top Vegetarian. Which heroes beaten up by Garou died?


According to the   Although some object to the inclusion of of in such phrases as all of the students and all of the contracts and prefer to omit it, the construction is entirely standard.  What are the reasons behind such objection? There must be some grammar involved: first the definite article the, and second both students/contracts are plural and countable. **** EDIT **** OED reads (here's the  for the website; if somebody needs to use the cdrom, PM me) : XII. Indicating a quality or other distinguishing mark by which a person or thing is characterized. (For OE. genitive; F. de; = genitive of quality or description.) b. qualified by all, indicating (temporary) condition:  1849 Thackeray Pendennis xvi, ‘Do you say so?’ Smirke said, all of a tremble  : A. adj. II. absol.  Followed by of: in sing. The entire amount, every part, the whole; in pl. Every individual, all the members or examples. (This const. is comparatively modern, and is probably due to form-assoc. with none of, some of, little of, much of, few of, many of.) Rare, exc. with pronouns, as all of it, of whom, of which, of them. Also, as much as, altogether, quite; for all of (cf. for prep. 26b) U.S., as far as concerns (a person or thing). [See pronominal examples under 2c.]

Is the word "of" optional in this instance? Is either of these considered preferable to the other?        Taste all our delicious treats.   Taste all of our delicious treats.


Where can I find the folder where I can see icons of my applications and click on them as I am accustomed to from other operating systems?  (N.B. Please see my comments re duplications.)

I want to use some applications shown on the Unity Launcher in a terminal, but I need to know the appropriate command to run them. How can I achieve that?


I'm looking for a simple method in tikz, where I can rotate text so that each letter in the text "sits" or is "stacked" on top of the successor letter. For example, the word "Environment" would appear as:  E n v i r o n m e n t   Thank you.

My simple question is how to set some text using tikz in a column e.g.  +---+ | A | | B | | C | +---+   I do not want to rotate the text so I can not use the rotate option or the set text along path method. Can give me a hint how to do it right?


I have an enum with 4 values and I am just curious as to whether it would be better to use for if/else statements to check what the value is, or use a switch statement.   When I say better I mean in terms of performance, as both are about as readable as one another.  Thanks

Switch statements are typically faster than equivalent if-else-if statements (as e.g. descibed in this ) due to compiler optimizations.  How does this optimization actually work? Does anyone have a good explanation?


A singularity would break physics wouldn't it? How does a massive star collapse and  suddenly fall into a point in space with no dimensions what so ever when it had a core and perfect balance between gravity and mass before its death?    This would certainly make no sense in the process right. Is there a simulation where this kind of behaviour is illustrated?  The only way the singularity of a black holes could make sense is when for example a massive star collapses due to gravity and its core being unable to fuse iron into a heavier element, the only thing left is pretty much the core being either iron or a new unknown element heavier than iron cough dark matter? cough .  This core's gravitational force is so strong that it bends light though if we were remove the force and just look under the hood of the object, we would simply just see a spherical object made out of iron or something heavier / unknown like perhaps dark matter.  TL;DR the core remains but we can't see it due to its gravitational force / strength thus a singularity would not exist.  How likely is that kind of concept? (I'm definitely not an expert in this field but I want to understand this concept better and see whether my ideas could possibly make sense)

Assuming we have a sufficiently small and massive object such that it's escape velocity is greater than the speed of light, isn't this a black hole? It has an event horizon that light cannot escape, time freezes at this event horizon, etc. However this object is not a singularity.  If a large star's mass were compressed to the size of, say, a proton, it would certainly have these properties but it would still not be a singularity as a proton does have volume.  The reason "physics breaks down" at singularities is because we cannot divide by zero, but as long as the proton-sized object has volume, physics won't "break down", yet we still have an event horizon and an object that is invisible (but not undetectable) from the outside.  I have read the answers to  related question. I'm not sure if they don't address my specific question or if I don't understand the answers.


As in subject: given a matrix $A$ of size $n$ with all elements equal exactly 1.   What are the eigenvalues of that matrix ?

This question aims to create an ""  of numerous questions that ask about determinants of specific matrices (I may have missed a few):              The general question of this type is  Let $A$ be a square matrix of rank$~1$, let $I$ the identity matrix of the same size, and $\lambda$ a scalar. What is the determinant of $A+\lambda I$?  A clearly very closely related question is  What is the characteristic polynomial of a matrix $A$ of rank$~1$?


I am trying to embed the scale of a map in the print composer expression builder or HTML frame. Effectively the value of the scale in the map item properties would come through into the text and be used as part of a standard text or HTML. This seems to be related to question:         In QGIS 2.6 (and earlier versions) there is an option to use the scale as part of an expression, however, it isn't possible to use this function in the Print Composer - I think it is probably to do with the need to stipulate which map item you are interested in the scale of (this doesn't seem to be possible using the scale function in the expression builder).   Can anyone suggest an alternative way of doing this or is what I suggest not possible and one to be captured as an enhancement request?   I am using QGIS 2.6 in Windows 7.

For work I always have to create a table with my name, project name, date etc. into my map layouts. I also need to include the scale like "1:150000" in that table.   So far I am solving that by including an html table with the html box function of the print composer. Is there a way to automatically include the right scale? So far I only managed to automatically include the date by using a little javascript. Maybe something similar is also possible for the scale?


Within an arcpy script, I've set up categories using the style sheet found in the ArcGIS installation folder. I have a couple categories created within the tool validator.  .... def initializeParameters(self):     self.params[2].category = "Intersections"     self.params[3].category = "Intersections"     self.params[4].category = "Intersections"     self.params[5].category = "Intersections"     return   This shows my parameters in their proper categories, however, when you start the script, the categories are shown expanded by default. Is there something in the style sheet I can change to make sure they are collapsed by default?    I'm also curious if anyone knows of a way to move these categories up and above some other "non category" parameters in the script.

The validation tab in your script tool properties allows you to put parameters in categories. The :     Put parameters in different categories. Categories are expandable   window shades with a collection of parameters.     I am using the categories to organize my parameters, so I don't care about the expandable/collapsible feature;  it just adds a lot of time to the user.  This is all within a normal toolbox, not a script toolbox.  v10.1    Does anyone know how to have these categories expanded by default?  Here is my only validation code.  I am only utilizing categories.  The other parts are the default.  def initializeParameters(self):     """Refine the properties of a tool's parameters.  This method is     called when the tool is opened."""     self.params[0].category = "General"     self.params[1].category = "General"     self.params[2].category = "Inudaciones"     self.params[3].category = "Cienegas"     self.params[4].category = "DrenajesPrincipal"     self.params[5].category = "DrenajesSensillos"     self.params[6].category = "Inudaciones"     self.params[7].category = "Cienegas"     self.params[8].category = "DrenajesPrincipal"     self.params[9].category = "DrenajesSensillos"     return


I installed Ubuntu 18.04.01 LTS alongside Windows 10 but GRUB doesn't have an option to boot Windows.  When I hold shift to bring up GRUB there is no option for Windows 10.  I tried to boot to the Windows drive from BIOS and it just opened GRUB and booted Ubuntu instead, so then I used boot-repair to restore the MBR and booted straight to the Windows drive and it said, "Operating System not found".    This answer recommended creating a custom entry at /etc/grub.d/11_windows using this code:  #! /bin/sh -e echo "Adding Windows" >&2 cat << EOF menuentry "Windows 10" { insmod ntfs insmod chain insmod drivemap set root=(hd0,1) drivemap -s (hd0) (hd1) chainloader +1 } EOF   When I loaded it from GRUB it said something like, "error: invalid signature".  Since none of that worked I used boot-repair's recommended repair and now it's back to booting Ubuntu when I try to boot the Windows drive.  Here's the pastebin it generated:   Sorry if this seems like a duplicate question, but I've tried all of the answers I can find, and none of them have worked.  Update  I can't find them all but here's a few of the answers that I have tried:   (When I loaded this answer from GRUB it said something like, "error: invalid signature".)   (This issue isn't exactly the same as mine, my Windows drive is not empty from Ubuntu. But update-grub didn't change anything when I rebooted.)   (os-prober gave no response when I used it here. Then update-grub didn't change anything.)   (The approved answer didn't work for me, I think because my PC isn't running UEFI. Karel's suggestion to use boot-repair to fix Windows boot files didn't work either, it still boots into GRUB with no Windows option when I load either hard drive.)   (When I make and load a custom entry, like in this answer, it says, "error: file "/bootmgr" not found".) Here is the code I used at /boot/grub/custom.cfg:  menuentry "Windows 10" --class windows --class os {    insmod ntfs    search --no-floppy --set=root --fs-uuid 4A42271C42270C6F    ntldr /bootmgr }   Update 2  I loaded up the Windows Recovery drive and tried the following:  C:  Bootrec /fixmbr “This operation completed successfully.”  Bootrec /fixboot “The volume does not contain a recognized file system.”  Bootrec /rebuildbcd “Scanning all disks for Windows installations. Total identifies Windows installations: 1 [1] C:\windows Add installation to boot list?” Yes “This volume does not contain a recognized file system.”  bcdedit “The boot configuration data store could not be opened. The system cannot find the file specified.”    I found this forum where they seem to be having a similar issue, and recommend using “chkdsk C: /r” so I tried that and it returned:  “Windows has scanned the file system and found no problems.”

I installed Windows 7, which ate Ubuntu's boot file. When starting up the computer, it now goes straight to Windows, without giving me the option of booting Ubuntu.   How can I get Ubuntu back?


Here's the thing, the right shift key of my macbook is stuck, so it always boots in safe mode once I turn the machine on. Worse, I cannot log in since my password has lower case letters.   I tried resetting the NVRAM by holding Command - Option - P - R and also went into the disk utilities, however nothing I can do there helps.  I looking for a way to disable the right side shift key or alternatively enable the bluetooth via command line, since I have a wireless keyboard, but I cannot make either work.  UPDATE:  I woke up today and the key was working fine. However I do not trust on it. Probably when the MacBook gets warmer it will stuck again.  I downloaded a software called KeyRemap4MacBook, which can be downloaded from . I followed this  in order to deactive the key, this is a temporal fix while I make some saving to buy a new one.

This is an attempt to write a canonical QA for this issue, as per the Meta post:   I expect it to be periodically edited with the goal of becoming a comprehensive information resource.  I have a MacBook Pro that has a key(Shift, Return,   Command, P, etc.) that doesn’t respond when pressed or is stuck in the down position.    It's possible that my favorite beverage was spilled (or some other liquid damage).  It's also possible that I have no idea what happened.  It was working yesterday and suddenly today it's no longer working.  Is there any way to bypass or remap the key?  Can I  have the system ignore it completely?  (This question can also apply to external USB keyboards or the Bluetooth keyboards)


Let $U \subset C$ be a simply connected open subspace and $z_1, z_2 \in U$. I want to show that then there exists a biholomorphic function $f: U \rightarrow U$ with $f(z_1) = z_2$, but I have no idea how to do so.

Let $\Omega$ be a simply-connected domain. Let $z_1,z_2\in\Omega$. Prove that exists an univalent function such that $f(\Omega)=\Omega$ and $f(z_1)=z_2$.   Since $\Omega$ is simply connected, one can apply Riemann mapping theorem to get $g:\Omega\to\mathbb{D}$ ($\mathbb{D}$ is the unit disk) with $g(z_1)=0,g(\Omega)=\mathbb{D}$. I thought taking $$f(z)=g^{-1}(g(z)+g(z_2))$$ thus $f(z_1)=g^{-1}(g(z_1)+g(z_2))=z_2$. On the other hand, $f$ does not map $\Omega$ to itself.  How can  I build a map which will satisfy the requirements above?


I want to write a method that copies my PaperPublication array:  public static PaperPublication[] copyBooks(PaperPublication[] array) {      PaperPublication[] copy = new PaperPublication[array.length];     for (int i = 0; i < copy.length; i++) {         PaperPublication temp = array[i];         if (temp != null) {             copy[i] = new PaperPublication(temp);         }     }     return copy; }   when I try and print out the copied array like this,  PaperPublication[] copy = driverClass.copyBooks(original); for (int i = 0; i < 12; i++)     {         System.out.println(copy.toString());     }   it yields the location, and not the values:  [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742 [LPackage1.PaperPublication;@15db9742   How do I write the code so it returns the values instead? (I already have an overwritten toString() method in my classes)

In Java, arrays don't override toString(), so if you try to print one directly, you get the className + '@' + the hex of the  of the array, as defined by Object.toString():  int[] intArray = new int[] {1, 2, 3, 4, 5}; System.out.println(intArray);     // prints something like '[I@3343c8b3'   But usually, we'd actually want something more like [1, 2, 3, 4, 5]. What's the simplest way of doing that? Here are some example inputs and outputs:  // Array of primitives: int[] intArray = new int[] {1, 2, 3, 4, 5}; //output: [1, 2, 3, 4, 5]  // Array of object references: String[] strArray = new String[] {"John", "Mary", "Bob"}; //output: [John, Mary, Bob]


I have a postgres database named aarons_db in ubuntu linux. I'm trying to delete a table called pnt within aarons_db. To do this, I am using the following command:  DROP TABLE pnt   Unfortunately, this does not appear to drop the table. My best guess is that there is some sort of admin privileges that I have not configured properly. The following shows the database, and commands used to try and drop the table.  What is preventing me from dropping the pnt table?  There is a similar question , although the user is running into a cache error, which is not happening in my case.

What is the difference between postgres=# and postgres-#? I tried googling it and looking on the official site but could not get a hit for the symbols.


Adapting the code from another question, but still having one problem:  \documentclass[11pt,a4paper]{article}   \usepackage{tikz} \usepackage{tkz-euclide} \usepackage{pgfplots} \usetikzlibrary{calc}  \begin{document} \newcounter{angle} \setcounter{angle}{220}   \begin{tikzpicture}  % Axis \draw[thick,-stealth,black] (-3,0)--(4,0) coordinate (A) node[below] {$x$}; % x axis \draw[thick,-stealth,black] (0,-3)--(0,3) node[left] {$y$}; % y axis \draw[black,thin] (0,0) circle (2.5cm); \node[black,below] at (2.7,0) {1}; \node[black,above] at (0.2,-3.2) {1};  %\draw[ultra thick,orange] (0,0) -- (\theangle:2.5cm |- 0,0) node[midway,below] {$\cos \alpha$}; % UpOn y axis  \draw (1,0) arc (0:\theangle:1) node at ($(\theangle/2:0.7)$) {$\alpha$}; \draw[dashed, cyan] (\theangle:2.5cm) -- (\theangle:2.5cm |- 0,0) node[sloped, rotate=180, yshift=8pt, midway] {$\sin \alpha$}; % vertical line \draw[ultra thick,red,rotate=\theangle] (0,0) -- (2.5,0) coordinate (B);  \foreach \x in {0,30,...,360} {\filldraw[black] (\x:2.5cm) circle(1pt);}; \foreach \x/\xtext in {         30/\frac{\pi}{6},         60/\frac{\pi}{3},         120/\frac{2\pi}{3},         150/\frac{5\pi}{6},         210/\frac{7\pi}{6},         240/\frac{4\pi}{3},         300/\frac{5\pi}{3},         330/\frac{11\pi}{6}         }     \draw (\x:2.8cm) node {\tiny $\xtext$};  \foreach \x/\xtext in {         90/\frac{\pi}{2}}         \draw (\x:2.7cm) node[xshift=4pt] {\tiny $\xtext$};      \foreach \x/\xtext in {         270/\frac{3\pi}{2}}         \draw (\x:2.7cm) node[xshift=-5pt] {\tiny $\xtext$};    \foreach \x/\xtext in {         180/\pi,         360/2\pi}         \draw (\x:2.7cm) node[yshift=4pt] {\tiny $\xtext$};               \begin{scope} \begin{axis}[     thick,     y=2.5cm,     axis lines=center,     xmin=0, xmax=360,     ymin=-1, ymax=1,     anchor=origin, at=(A),     xshift=3ex,     enlarge y limits,     enlarge x limits=upper,     samples=90,     xtick={0,30,...,360},     tick label style={font=\tiny},     ]     \addplot[domain=0:\theangle,ultra thick, no markers,cyan] {sin(x)} coordinate (C);     \addplot[domain=\theangle-1:\theangle,ultra thick, no markers,cyan] {sin(x)-sin(x)} coordinate (K);  \end{axis} \draw [dashed,red, thick] (B) -- (C); \draw [dashed,cyan, thick] (C) -- (K); \end{scope}  \tkzDrawPoints(B);  \end{tikzpicture} \end{document}   How can I make the x-axe having the angles in radians, as displayed on the unit circle.

Assume you have a trigonometric function, say for simplicity sin(x). When plotting the function, how can one place the x-axis markers on 0, pi/2, pi, 3pi/2, 2pi, instead of the default numeric values that pgfplots uses?


My garage door motor which opens and closes on a screw drive system has stopped opening my door. When I press the remote or button in the garage it attempts to open for just a second or 2 than quits. What is my issue? Do I need a new motor or can it be fixed....   So I recent had a Garage door "professional" come out to my house and look at my garage. I originally thought I was having a motor problem because it would only lift the door sporadically. After performing a 25 point inspection he believed he located the problem, which was the spring system from my Wayne Dalton garage door (torquemaster). He told me how horrible of a system they are and they don't fix them; because of that, they only replace the entire system and that would cost me $700 or more. So now I'm left trying to figure out what I need: torquemaster springs, bracket assembly, both, or if I need something completely different. I need some Wayne Dalton experience.

So I recent had a Garage door "professional" come out to my house and look at my garage. I originally thought I was having a motor problem because it would only lift door sporadically. After performing a 25 point inspection he believed he located the problem, which was the spring system from my Wayne Dalton Garage (torquemaster). He told me how horrible of a system they are and they don't fix them because of that they only replace the entire system and would cost me $700 or more. So now I'm left trying to figure out what I need, torquemaster springs, bracket assembly, both or if I need something completely else. I need some experience Wayne Dalton experience.


This is not a duplicate of Locking a file in Python   I have two scripts, one runs every 30 minutes, the other one runs every one minute. and they both use the same file to do few things.  at some point, every 30 minute they try to access the same file at the same time and they corrupt the file. I was thinking about using wait. but they are two independent scripts and I am not sure if this is possible.  Any idea?  I thought about using        with FileLock("document.txt")   The problem that arise is; if script-1 acquire the lock for "document.txt" then script-2 wants to access document.txt, is it going to wait that script-1 finish? or is it going to skip that line of code? as the 2nd one isn't an option? also. once the lock is acquired, how to remove it when it's no longer needed?

I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.


What's the best way of counting the number of elements in a iterable (through iteration), without storing the elements in memory?  Right now, I'm just doing sum(1 for x in iterable). I was hoping to find something in itertools, but there doesn't seem to be anything.

For example, files, in Python, are iterable - they iterate over the lines in the file. I want to count the number of lines.   One quick way is to do this:  lines = len(list(open(fname)))   However, this loads the whole file into memory (at once). This rather defeats the purpose of an iterator (which only needs to keep the current line in memory).  This doesn't work:  lines = len(line for line in open(fname))   as generators don't have a length.  Is there any way to do this short of defining a count function?  def count(i):     c = 0     for el in i: c += 1     return c   To clarify, I understand that the whole file will have to be read! I just don't want it in memory all at once


How can I change my login on all Stack Exchange sites to Google rather than Facebook?

I no longer use the service that I originally used to register, and would like to change the service I use to log in, or at least add a second account.  Is this possible? How do I change my login provider or associate a backup method to log in?     For more information, see "" in the .


After estimating the data using xtreg, re, I notice there're 3 different measures of R-squared, within, between, and overall R-2, so my question is, can I just report the overall R2 in this case since I'm using the random effects option? Thanks.

I'm performing a random effects analysis on panel Data, and I haven't been able to find an answer to the question, which R-square should I look at: within, between or random?  I know that for fixed effects I have to use within, but what about for random effects?  I am using Stata.


The past few years, I have been opening a new credit card that offers a intro bonus (usually $200 - $300 after spending $500 or $1000 within the first 3 - 4 months) and also 0% purchase APR for 12 months.  I let the debt accumulate over the 0% promotional APR period paying only the minimum each month.  Then I pay it off in full right before the intro rate goes away and stop using the card.  I then move onto a new card with similar arrangement and do the same thing.  I have an 816 FICO credit score with a long history (my AMEX card has been open since 2006 and I have had 2 different mortgages with one current mortgage) and never missed a payment, never paid credit card interest.  I don't plan to be taking out credit any time soon, but I want to keep my score high.  A few questions:   Once the intro APR goes away and I stop using the card, should I close it or leave it open with a $0 balance.  I currently have 3 open cards.  2 have no balance.  I'm using the one that still has the 0% intro APR. If I want to get more aggressive in capturing the cash intro bonus, would it hurt my credit if I use the card until I meet the requirements to get the cash bonus (usually by spending $500 - $1000 within 3 months) and then simply close the card and move on to another card with similar offer?

There are quite a few credit cards with exceptional sign-up bonuses (and then fairly average terms). If I signed up for one, fulfilled the spending conditions for the signup bonus, used that bonus, paid off the card and then cancelled it immediately after, would there be a significant impact on my credit history?  I suppose it would divert spending away from my primary credit card (the one I never close), which would reduce slightly the spending history I have on that card. Essentially, the record of my spending on these auxiliary cards would be erased when those cards were canceled. But is there a penalty to my credit score for closing a card beyond the loss of history that was on the closed card?


I am new to wordpress development. I am familiar with joomla's ins-and-out working mechanish, now i want to contribute or say learn wordpress. I found that every thing in wordpress is done through plugin and its hooks and filters. But before diving into writing some cool stuffs, i want to know how hooks registered in plugin executes ? which design patterns is implemented in wordpress plugin environment ?  OK, lets take  example.  add_action( 'wp_head', 'my_plg_function' ); function my_plg_function() {   echo 'I am called'; }     In above code, plugin's function is registered in wp_head hook, right ? Now what exactly does add_action function does and when wp_head hook runs, how my plugins function called ? Again I am new to this, i am trying to learn and create cool stuffs in wordpress. Any helps will be appreciated. Thanks

How does filters and hooks actually work in WordPress?  I'm asking about something advanced. How is it implemented in PHP? E.g how does it collect all the hooks from the different plugins and "attach" them to the core hooks etc.


In mainstream Marvel Comics, how does Charles Xavier pay for all the gadgets at the X-Mansion? I understand that the mansion itself has been in his family, but the Danger Room, Cerebro, the X-Jet, missile defense systems, and all of the advanced technology must cost and arm and a leg, not to mention the electricity and other materials to power them. And unlike Bruce Wayne over at DC Comics, Xavier doesn't have a company generating revenue to pay for it.  How does Charles Xavier pay for all the gadgets at the X-Mansion? Does one of the mutants have the power to print money?  This question was inspired by Atop the Fourth Wall's , which jokingly suggested that Xavier got a Pell Grant for the school to fund missile defense systems.

Charles Xavier's father was a "wealthy nuclear scientist". In the beginning, Charles personally bankrolled the Xavier Institute/X-Men using his family's money.   This included, but was not limited to things like upgrading the mansion to house the training levels, providing a helicopter (the predecessor to the Blackbird jet), providing and replacing uniforms, providing health care for injured students, and rebuilding/repairing the mansion and parts of the Danger Room  repeatedly.  These have all been recurring costs. The mansion has been damaged or outright destroyed a ridiculous number of times. X-Men can't get into a fight without someone's uniform getting damaged.   In one of the more recent stories (I believe it was an early issue of Wolverine & The X-Men), a comment is made about how the X-Men are pretty much bankrupt.  Where has all this money come from over all these years?   Xavier may have had a large war chest to start with, but no other income has ever been mentioned to my knowledge. Student's tuition could account for some of it, but there's no way that's going to fund everything.


I have two hard drives. One is a 256GB SSD and the other is a 1TB HDD. I installed Ubuntu to the SSD and that is where my /home directory resides. I would like to use the HDD for media storage. How can I point /home/user/music (and ~/movies, ~/pictures, etc.) to the larger HHD but keep my /home directory on the smaller, faster SSD?

I have multiple users on my home desktop. I am content with most of the default user directories, however I would like to make one change.  I would like to setup a common directory for Music (ie /home/common/Music/) that is writable to all users and Nautilus/Dolphin/whatever recognizes as the user's Music directory.  I know that it would involve changing the xdg user directory setup, but everything I see points that it is relative to the user's $HOME.  Is there a way I can specify an absolute path?