If I have the following directories  a/ b/ c/d/ c/f/ g/   How can I  find -name "something" -type f in just a/ c/f/ and g/ without having to iterate through the list of directories I want and running find on it individually?  This is partially answered here:   But I have 100s of directories to include and exclude so I was looking for a better solution where I could just specify a list of directories as an argument or a file with the directory names in them.  Thanks.

I am on Linux (Ubuntu) and I am would like to exclude certain directories (like .hg) when I am doing a  find | less     I tried the following to exclude the .hg directory from listing, but does not seem to work.  find -type d \( ! -iname \.hg \) find -type d \( ! -name \.hg \) find -type d \( ! -iname .hg \)   How do I exclude .directory in a find command


I can start, PyCharm from a shell script in a subdirectory of /opt. I get a gray question-mark icon (see attachment) rather than the orange/green PyCharm icon (see attachment). Note that the correct icon is in the PyCharm directory out-of-the-box.  I can lock this gray icon to  Launcher, but this icon does not work to launch PyCharm.  How can I get a Launcher button  to launch PyCharm?  (Ubuntu 14.10)

I have installed PyCharm on my brand new Ubuntu 13.10 laptop.  To launch PyCharm, I find I must navigate to the directory that pycharm lives in, and execute it from there as such:  cd home/matt/software/pycharm/bin sh pycharm.sh   I hope this isn't asking too much, but I would like to be able to click on an icon in the Launcher to launch this application.  I tried right-clicking on the PyCharm icon in the Launcher when the app is running and selecting "Lock To Launcher" but this doesn't work (after pinning, when I try to run the software this way, the icon throbs in a very awkward manner a few times and does nothing).  A small app called Alacart was rumoured to be useful, but I have no idea how it works, and it appears useless.  I'm not sure why the authors teased us with a "Help" button if there are no help files written for us to view.  Further attempt has included reading page after page of technical documentation on how to write scripts that will somehow help me customize my experience.  How can I set up PyCharm to launch from the Launcher???


I read the proof of this theorem but the question i have is If $G/Z(G)$ IS Cyclic then $G$ is abelian therefore $G = Z(G)$ which implies that $G/Z(G) = \{e\}$. Am i right? For example If $o(G/Z(G)) =11$ then $G/Z(G)$ is cyclic therefore $G$ is abelian which implies that $o(G/Z(G)) = 1$ a contradiction. Please explain or correct me if i am wrong.

Continuing my work through Dummit & Foote's "Abstract Algebra", 3.1.36 asks the following (which is exactly the same as exercise 5 in ):     Prove that if $G/Z(G)$ is cyclic, then $G$ is abelian. [If $G/Z(G)$ is cyclic with generator $xZ(G)$, show that every element of $G$ can be written in the form $x^az$ for some $a \in \mathbb{Z}$ and some element $z \in Z(G)$]      The hint is actually the hardest part for me, as the quotient groups are somewhat abstract. But once I have the hint, I can write:  $g, h \in G$ implies that $g = x^{a_1}z_1$ and $h = x^{a_2}z_2$, so \begin{align*}gh &= (x^{a_1}z_1)(x^{a_2}z_2)\\\  &= x^{a_1}x^{a_2}z_1z_2\\\ & = x^{a_1 + a_2}z_2z_1\\\ &= \ldots = (x^{a_2}z_2)(x^{a_1}z_1) = hg. \end{align*} Therefore, $G$ is abelian.  1) Is this right so far?  2) How can I prove the "hint"?


It would be useful to have a page number like (see page # for more details) that is tied to a specific section or figure, and as a consequence, automatically updates the text to say where that page # of that section or figure is if a change pushes it to a new page. Can this be done?

Is it possible to make a reference to the page where a figure is rendered?  I would like to write something like   see figure~\ref{figure-xyz} on page NN   where NN will automatically be maintained by LaTeX. The figure that prompted my question is almost a page so it may be floated further in the doc.   I suppose it's possible, after all the figure-to-page mapping is generated by \listoffigures.


Trying to take data from scanner and pass it to a function that compares that data to an array, but when I send the data that the scanner receives it won't compare. Scan class Key.use(scan.nextLine().toString(), retrievedkey);  Key function that iterates through the array to compare the first parameter to the arraylist public static void use(String door, String[][] key){         var arraylength = key[1].length;         for (int i = 0; i<=arraylength;){             i++;             if (door == key[1][i]) {                 canOpen = true;                 System.out.println(canOpen);             }             else {                 canOpen = false;                  System.out.println(canOpen + " " + door + " " + Arrays.toString(key[1]));             }             return;         }              }      }  When sending data separately from the scan function the key function works. Ex: Key.use("Front door", retrievedkey)  But the scanner prints the input as "door" yet isn't read by the function. Any help? Thanks.

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 have already finished writing a book and I would like to produce this kind of table of contents as a summary.

In the tcolorbox manual we see the following toc format    I would like to reproduce it however I have no idea how to do it. I don't even know where to begin from. I am not familiar with the packages presented in the tcolorbox manual.   I would appreciate your  help.


I was reading from the book How to Think Like A Computer Scientist: Learning with Python when I came across the following question:  As an exercise, describe the relationship between string.join(string.split(song)) and song. Are they the same for all strings? When would they be different? (song had been defined as "The rain in Spain...")  After checking it out, however, I found that both are different strings. I tried using string.join(string.split(song)) is song and f is song where f had been assigned the value string.join(string.split(song)) and both evaluated to False. Why is it so?

My  has failed me.  In Python, are the following two tests for equality equivalent?  n = 5 # Test one. if n == 5:     print 'Yay!'  # Test two. if n is 5:     print 'Yay!'   Does this hold true for objects where you would be comparing instances (a list say)?  Okay, so this kind of answers my question:  L = [] L.append(1) if L == [1]:     print 'Yay!' # Holds true, but...  if L is [1]:     print 'Yay!' # Doesn't.   So == tests value where is tests to see if they are the same object?


Position is the integral of velocity.  However, position and velocity have different dimensions. How is this difference consistent with the conclusion that the integration sign is dimensionless?

I'm reading  and not sure if I understand integral dimension analysis. The idea is to "guess" integrals without explicit calculation, by just looking at their dimensions.  It's been a good decade since I last touched integrals so please bear with me!        My answer to the problem is that dimension of $\int_{a}^{b}f(x)dx$ depends on the dimension of the multiplication $f(x)*dx$, so while the integral sign is indeed dimensionless, if we have $f(x)$ being "length per second" and $x$ being "second" then the resulting integral will have "length" dimension.  But the author also tells that $e^{-\alpha x^2}$ is dimensionless and thus derives dimension formula for $\alpha$:        I don't understand why the $-\alpha x^2$ should be dimensionless. What if there's no $\alpha$ (or $\alpha=1$), in which case the exponent becomes $e^{-x^2}$ - will it have a dimension now? And if it won't, then why dimension of $\alpha$ should depend on  the dimension of $x$ at all?  Also, a final question - if we accept that the only dimension which affects the integral in question is the dimension of $x$, then setting it to "length" means that the integral dimension is "length". But integrals compute areas, don't they? I think that in this case the integral $\int_{a}^{b}f(x)dx$ will have a dimension of "length x 1" which is still area. Is this correct, is there a better explanation?


The following document  \documentclass{book} \usepackage{bookman} \usepackage{tocbibind} \makeindex \begin{document} \tableofcontents \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \chapter{Lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \section{lorem ipsum} \end{document}   produces the following pdf    How can I fix the overlap?

I'm preparing a document using the book class. In the table of contents, the space between the subsection number and title is too wide. How to reduce it?


The CellValueFactory throws a NullPointetrException (NPE) everytime the method is called from the GUI.   I read Data from an embedded Derby DB and turn it into a TableView - at least that's the goal. I already caught the NPE and the console gives the following output:  Cause: null  Message: null   StackTrace: [Ljava.lang.StackTraceElement;@79daf03c  I also checked the StringPropertys and they're not zero. Here's one, but I checked them for every row:  StringProperty [value: 170]StringProperty [value: Höhlenkrieger]StringProperty [value: null]      @FXML     // liegt auf test2, muss auf Optionen!      private void ladeTabelle() {      try {         SQLConnection.createDatabaseConnection("test35");          //Zeile 63 ist das Problem!         subfactionCol.setCellValueFactory(cellData                 -> cellData.getValue().subfactionProperty());         nameCol.setCellValueFactory(cellData                 -> cellData.getValue().nameProperty());         pointValCol.setCellValueFactory(cellData                 -> cellData.getValue().pointvalueProperty());     }// end initialize()      catch (NullPointerException npe) {         System.out.println("Cause: " + npe.getCause()     + "\t Message:   "+npe.getMessage()         + "\t StackTrace: " + npe.getStackTrace()         );     } }   And the code that produces the StringProperties          StatCard sC = new StatCard(name, faction, subfaction, unit_type, number_of_elements,                     pointvalue, units_in_collection, movementPoints, movemntOrderH, movemntOrderS,                     movemntOrderA, movemntOrderH, maneuvers, initiative, skillMelee, skillRange,                     attack1Name, attack1, attack2Name, attack2, attackMissileName, attackMissileRangeShort,                     attackMissileRangeLong, attack_bonus, overrun, size, armor_melee, armorRange, hitpoints,                     fear, moraleBreak, moraleRage, banner, musician, artilleryType, ballistic_range_short,                     ballistic_range_medium, ballistic_range_long, magic_points, commandPoints, controlArea,                     commandstars, special_rules);               SQLdataList.add(sC);         }     } catch (ClassNotFoundException | SQLException e) {         System.out.println("Fehler! exception. Cause: " + e.getCause() + "\n" + "\n"                 + "Message ist: " + e.getMessage());     }      SQLdataList_observable = FXCollections.observableArrayList(SQLdataList);      for (StatCard sC : SQLdataList_observable)      {          System.out.println(sC.pointvalueProperty().toString()                  + sC.nameProperty().toString()                  + sC.subfactionProperty().toString());     }   The StringPorperties are in the class StatCard:  public SimpleStringProperty subfactionProperty()  {     return new SimpleStringProperty(subfaction); }          public SimpleStringProperty nameProperty()  {     return new SimpleStringProperty(name); }  public SimpleStringProperty pointvalueProperty()  {     return new  SimpleStringProperty(Integer.toString(pointvalue)); }   I already googled the problem extensively, but so far I could not find a solution. I cannot figure out why the cellFactory gives zero, eben so the StringProperties are not.  Any ideas what I could try?

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?


First a tiny bit of background: I customized my father's OS X keyboard layout to add him a few specific characters (specific to Polish) on his regular azerty layout.  On OSX you can do this by creating / modification an XML file which you then place at a specific spot somewhere in the user's directories. This is all working very well. And it's important because this can be done without needing the "root" password, it can be done on a per-user basis.  It is working flawlessly seen more than one year.  Now I need to do the same on Windows and hence my question. I know next to nothing about Windows so I would need very detailed steps as to how I could do that.  And first I need to know if this can be done without needing to be "admin" on Windows?  Then, how should I go about it? Is auto-hot-key (AHK) the way to go? If so can AHK itself be installed without being root? And how would I then configure it?  And where can I "find" the characters? (can I copy/paste them from a website into AHK somehow?)  It looks like a lot of questions but it's really just one simple question:   How can I customize a Windows keyboard layout to add a few characters to an AZERTY layout without being admin?  It's basically the equivalent of the following SuperUser question (3 upvotes and two favorites), but this time for Windows:

I am used to typing in the "Programmer Dvorak" keyboard layout. To be able to install it, you need administrative rights, making it impossible for me to use it at school. My school runs an XP-enterprise network so I thought that there should be a way to install the layout to my roaming profile, which should not require Administrative rights and would allow me to use this layout, however this has not been the case.  I tried to ask IT to install it for me, but they refused because they deemed it unnecessary software.  I can compile the source code into the dll, but I don't know if it is possible to tell windows to use it as a layout, and if so how. Does anyone know?


so Im taking a course intro to python and one of the labs has me stuck. I have to take 2 inputs and divide them 3 times ex input is 2000 2 ex output is  1000 500 250 so the input 1 is divided by input 2 then that answer is divided by output 2 again and again then print the problem is that my output keeps putting a .0 at the end ex 1000.0 500.0 250.0 and that is wrong when I submit it heres what i got     user_num1 = input()     user_num2 = input()     a = (int(user_num1) / int(user_num2))     b = (int(a) / int(user_num2))     c = (int(b) / int(user_num2))     print (a, b, c)

Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:  >>> 6/3 2 >>> 6//3 2


The behavior of dash (and also bash) looks non-intuitive in this case. It seems that new_file is created before ls is executed. Is it specified in POSIX?

Considering  about the order of execution in the shell as it relates to redirection, and despite the fact that if a file doesn't exist it gets created first so that cat example.txt | shuf > example.txt doesn't complain that the file doesn't exist - which just confirms the order from what I understand - then why is it that about once every thousand times on my system the shuffle works when I do this (backup contains 15 static values each on their line)  for i in $(seq 1 1000); do     cp backup test     echo $i     cat test | shuf > test     cat test done   How can there seemingly be an exception to the ?


Running Windows 10 home.  I have six identical hard drives in the machine and I am getting a lot of errors like this from one of them:     The device, \Device\Harddisk4\DR4, has a bad block.   How do I find which drive letter this drive is?

I'm getting errors in Windows 10's event log stating \Device\Harddisk1\DR2 drive controller is having a problem. I know that the hard disk numbers depend on the BIOS and do not match the physical connections.  How can I tell which physical device this actually is? diskpart lists these devices:    Disk ###  Status         Size     Free     Dyn  Gpt   --------  -------------  -------  -------  ---  ---   Disk 0    Online          931 GB      0 B        *   Disk 1    Online         1863 GB   927 GB   Is \Device\Harddisk1 the "Disk 1" listed here? Is there some other way to determine what Windows 10 means by Harddisk1 ?  What is DR2?


Suppose I am implementing a game of two-player chess. Here is a shortened version of my implementation for simplicity's sake, omitting any irrelevant details. I have a class Piece from which the various pieces are derived. In this example I am only including the King piece.   extern enum piece_t; extern enum color_t; class Piece { public:     Piece() {}     Piece(piece_t t, char r, color_t c)         : type(t), representation(r), color(white)         {}      char getRepresentation()         { return representation; } protected:     piece_t type;     color_t color;     char representation; };  class King : public Piece { public:     King() {}     King(color_t color) { Piece(K,'K',color); } };   In another class, Board I define a member to instantiate King  class Board { public:     Board() { king = King(white); }     friend ostream& operator<<(ostream&, const Board&); private:     King king; };   Here is an example of main:  int main(void) {     Board game;     std::cout << game;     return 0; }   The problem is that the default constructor is being called. I know this is happening because my king object is being initialized with garbage.  My intention is for king to be initialized in Board's constructor:  Board() { king = King(white); }  From here I want the constructor from King which takes a color_t argument to be called, which will thereby call the constructor from Piece like so:  King(color_t color) { Piece(K, 'K', color); }  This is not what is happening. The default constructor (of either King or Piece or both) is being called. Is king's default constructor called when it is declared in the private field of Board? If this is the case, how do I alter the code so that king calls the appropriate constructor?

What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an implicit call to a no-arg super constructor is assumed - giving you a compile error if that's missing).


My question is how to prove a finite cyclic group $G$ has order (i.e. size) $n$ if and only if each of its generator has order $n$. Thank you.

Let $G$ be a finite cyclic group of order $n$ generated by an element $g$. I want to show that the order of $g$ is exactly the order of $G$.   My try:   We can write $G=\{g^i\;|\;i\in \mathbb Z\}$. Since $G$ is finite, we know that there will be identifications $g^i=g^j$ that will make $G$ finite. By the multiplication law on $G$ we must have $g^0=1$. Also if $i<j$ and if $g^i=g^j$ then $g^{j-i}=1$. I can see all these but not see why $g^n=1$ and not $g^k=1$ for all $0<k<n$? Thank your for your help!!


The process of neutrino oscillations is not very intuitive, hence a question. If an electron neutrino on its way from the sun turns into a tau neutrino, then for the energy to conserve, the speed would have to become slower. This however would change the momentum. For a single particle in an empty space, it seems impossible to change its rest mass without violating either energy or momentum conservation. Does this mean the rest mass of all neutrino flavors is the same or is there a better explanation from the standpoint of the physical sense?

I would like to better understand how neutrino oscillations are consistent with conservation of momentum because I'm encountering some conceptual difficulties when thinking about it. I do have a background in standard QM but only rudimentary knowledge of particle physics.   If the velocity expectation value of a neutrino in transit is constant, then it would appear to me that conservation of momentum could be violated when the flavor eigenstate at the location of the neutrino source is different from that at the location of the interaction, since they are associated with different masses.  For this reason I would think that the velocity expectation value changes in transit (for instance, in such a way to keep the momentum expectation value constant as the neutrino oscillates), but then it seems to me that the neutrino is in effect "accelerating" without a "force" acting on it (of course, since the momentum expectation value is presumed constant, there may not be a real problem here, but it still seems strange).   Any comments?


Finally got around to watching  last night, and I'm somewhat confused by the title.  I've got some possible references, and I'm not really sure if any of them are viable:   A reference to the men who died in the various mines A reference to all the people Dan Plainview killed A reference to the "war" that he had with preacher Eli Sunday A reference to his relationship with HW   Can anyone help me understand this?

I just saw the movie . When I had first seen the title of the movie I had assumed the movie to be a violent one with a lot of killing and hatred. But the story is completely different! Based loosely on the novel Oil! it's rather about the story of an 'oilman'.  So my doubt is; how is the title of the movie justified? Why didn't the makers name the movie The Oilman (I have read they didn't name it Oil! because it isn't directly based on the book) or Daniel Plainview or something like that? What is the significance of the title in relation to its story?


Given the matrix:  $A = \left(\begin{array}{rrr} k & 1 & 1\\ 1 & k & 1\\ 1 & 1 & k \end{array}\right)$ where $k$ is a real constant/number  Generally we know that the sum of the elements on the main diagonal equals the sum of all the eigenvalues: $tr(A) = \lambda{_1} + \lambda{_2} + \lambda{_3} = 3k$  Since this matrix is symmetric we know that the following holds true: $A^T = A$  Also since all of the rowsums are the same we can assume that the rowsum is equal to one of the eigenvalues, so we set: $\lambda{_1} = k + 2$  Using the identity matrix $I = \left(\begin{array}{rrr} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{array}\right) $  when solving $(A - \lambda{_1} I) = 0$ we find the first eigenvector to be $\vec{v_{1}} =  \left(\begin{array}{rrr} 1 \\ 1 \\ 1  \end{array}\right).$  Now my question is how can I find the two remaining eigenvalues?

For t∈R, let $A_t = \left( \begin{array}{ccc} t & 1 & 1 \\ 1 & t & 1 \\ 1 & 1 & t \end{array} \right) $. Find the Eigenvalues and Eigenvectors. Is $A_t$ diagonalizable for all t?  So I am thinking of approaching it like this. First, I find the characteristic polynomial of $A_t$ and use that to find the eigenvalues and their corresponding eigenvectors. Then I check if those eigenvectors are linearly independent for all t. If they are linearly independent, then $A_t$ is diagonalizable for all t, and if they're not, $A_t$ is not diagonalizable for all t.  Should I pursue this problem like this? Or is there a more efficient method? Thanks in advance!


Question: how to find last row_number in a table in SQL Server? For example, I have a table named Employee without any ID and don't wanna add any identity column.  EmpName | EmpSalary --------+---------- Amit    | 5000 Sumit   | 4500 Ajeet   | 5600   I tried this:  SELECT      ROW_NUMBER() OVER(ORDER BY EmpName) row_no  FROM     Employee   but it returns this:  row_no 1 2 3   but, if 3 is the last row_no, then I want:  row_no 3   now, please help me to solve this.

What is the most efficient way to read the last row with SQL Server?  The table is indexed on a unique key -- the "bottom" key values represent the last row.


I need to use a select query but my code keeps crashing because some of the names have apostrophes in it. I pull all data into a table and half way through it just stops because it hits a apostrophe.  My select Query:  $query = mysqli_query($dbh,"select * FROM show_invoice where id_show='$get_id' and status='UNPAID' and scratch = 'Unscratched'and show_deleted != 'Deleted' ORDER BY 'class_no' ASC")   There are 3 columns that will possibly contain apostrophes. Any advice on how i can stop it from crashing.

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


Users with gold tag badges can close a question as a duplicate of multiple other questions. When they do so they can also set the order that the duplicate displays in. I recently closed  and very deliberately arranged the list order:    However when I open the question in the iOS app, the duplicate order is reversed:

The order of duplicates is different between apps and web. :  iOS          App Version: 1.6.6.2 Device: Unknown (iPad7,3) OS Version: Version 12.2 (Build 16E227)   Android         App Version: 1.0.95 Device Manufacturer: LGE Device Model: LM-G710 OS Version: 8.0.0 (190492326deb8.FGN)   Web


The problem happens in the nested loop. In the first iteration everything is fine. The 2nd iteration over i, modifies the first list too and so on. Zeros across the 2d list should be diagonal   import math def calcpyth(p1, p2):     distance = math.sqrt(((p1[0] - p2[0]) ** 2) + ((p1[1] - p2[1]) ** 2))     return distance  tuple0 = (42, 288) tuple1 = (45, 326) tuple2 = (50, 364) tuple3 = (57, 400)  list = [tuple0, tuple1, tuple2, tuple3] zeros = [[0]*len(list)]*len(list) test = zeros  for i in range(len(test)):     for j in range(len(test)):         test[i][j] = calcpyth(list[i], list[j])

I needed to create a list of lists in Python, so I typed the following: my_list = [[1] * 4] * 3  The list looked like this: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]    Then I changed one of the innermost values: my_list[0][0] = 5  Now my list looks like this: [[5, 1, 1, 1], [5, 1, 1, 1], [5, 1, 1, 1]]    which is not what I wanted or expected. Can someone please explain what's going on, and how to get around it?


I have posted the picture, and it becomes annoying reading a single lined code snippet.  I am using Chrome version 57.0.2987.133 (64-bit) on macOS v10.12 (Sierra).  Why didn't Stack Overflow do this?...

Something is so annoying when a code snippet contains only one line of code, the scroll bar hides the code.  It would be good if the scroll bar have a specific area for it in the snippet box. See the screenshot:      Note: I'm using Safari v10.1 on macOS Sierra v10.12.4


This is a slightly different from similar posts in that the parenthesis are paired with an asterisk.  example input:     yada yada (* need to grab this text *) yoda   I thought  could be altered for this but my attempts fail.         //Regex regex = new Regex("\\((?<TextInsideBrackets>\\w+)\\)"); //original         Regex regex = new Regex("\\(\\*(?<TextInsideBrackets>\\w+)\\*\\)"); // my attempt         string incomingValue = "Autocycleprestartcase := 20;   (* Yayitme ve Konveyoru bosaltabilir *)";         string insideBrackets = null;         Match match = regex.Match(incomingValue);         if (match.Success)         {             insideBrackets = match.Groups["TextInsideBrackets"].Value;         }   Suggestions?  Also, I'd like to remove the enclosed text, with the enclosing parethesis/asterisk pairs, from the input line.  So the output of above would give me     yada yada yoda   and the value     need to grab this text   Thanks

I have a string User name (sales) and I want to extract the text between the brackets, how would I do this?   I suspect sub-string but I can't work out how to read until the closing bracket, the length of text will vary.


I am a regular use of SE both on the web and on iOS App.  I find it confusing that when reading a question on the web the asker's profile is on the right and the editor's profile is on the left while unexpectedly (to me at least) in the iOS App (and I'm guessing the Android one) the positions of these profile boxes are reversed.  I am alway mistaking the the editor for the asker on iOS.  Some annotated screenshots to illustrate my point:  Asker only on web... flush right.  Nice!   Asker only on iOS... flush left.  Nice!   Ask and edit on web... edit added to the left.  OK.   Ask and edit on iOS... edit added to the right.  Yuck.  This reverses the position on the web and confuses AllInOne.

The new attribution style on posts looks great, and brings some consistency with the website which is good. This is how it looks on an iPhone (in landscape, to emphasise the alignment; in portrait both boxes take up the whole screen width):        This is how it looks on the website:        Notice the switched order? That's confusing. Since the app version is aligned left it does make more sense in the order that it is, but since the website version is right aligned and the idea here is obviously consistency with the website could we switch the alignment and order to match?


Which of these is correct?   1.) "Nobody move and nobody gets hurt."   or should it be,   2.) "Nobody move and nobody get hurt."   Here's some related info in .

In English, the number 0 is treated as plural. It is then:   0 seconds 1 second    1.2 seconds   2 seconds     Shouldn't it be "nobody want to go there," instead of "nobody wants to go there"?  I also saw in TOEFL that "any __" should be used with a singular.  But I see it very common that it is a plural also.  Why is that?  (updated: example, "we don't have any apples any more" vs "If you get any apple, please let me know.")


I'm reading learning to reason by Nancy Rodgers, and in her textbook she says: (we have to derive $r$)  "To justify the validity of a proof by contradiction, we can argue as follows. When we assume $∼r$ is true and derive c and -c, we have proved the following implication: $$∼r⇒(c∧∼c)$$ Next we translate the above implication as an or-sentence. $$r∨(c∧∼c)$$ since $(c∧∼c)$ is false, $r$ must be true."  I dont really get this, "assume $∼r$ is true" blah blah.. "so $r$ must be true" how can $∼r$ and $r$ both be true?  One more doubt, I know she used this equivalence: $(p∨q)⇔ (∼p⇒q)$, but I dont get this either:  "it's blue or it's red $⇔$ if it's not blue then it's red" what if it's yellow though? both sentences would be false (correct since they're equivalent) but I can't say that since "it's not blue" it's red, because it's yellow! This is what the the textbooks seem to say: "since $(c∧∼c)$ is false, $r$ must be true." but how? what if it's another thing? I'm so confused, can you guys help me please?

Let's say that I prove statement $A$ by showing that the negation of $A$ leads to a contradiction.   My question is this: How does one go from "so there's a contradiction if we don't have $A$" to concluding that "we have $A$"?  That, to me, seems the exact opposite of logical. It sounds like we say "so, I'll have a really big problem if this thing isn't true, so out of convenience, I am just going to act like it's true".


I read that user mode process are preemptive but why not kernel mode process?

What is the difference between a "Non-preemptive", "Preemptive" and "Selective Preemptive" Kernel?    Hope someone can shed some light into this.


I have a limited internet connection and I want to update all Linux PCs that I have(almost 30) but it will need every PC to download updates individually. I need some service in Linux to download updates once and other PCs be able to get updates from that PC. Actually I need something like WSUS in windows server in Linux.

We've got a Squid web cache set up that is used for caching package downloads, so that all the machines here don't have to independently redownload everything. The installer prompts for a mirror and proxy. As long as every machine uses the exact same mirror (here, http.us.debian.org) and the proxy then it works.  That's somewhat annoying, as it involves going to 'enter information manually' and typing it in each time (as the installer would do ftp.us.debian.org, which Squid doesn't realize is identical).  The installer defaults to just mirror, is there a way to make that work? So I can be lazy and just hit enter a bunch?


Or if you can under some conditions, why is is a bad practice?

I realize connecting two different voltage sources in parallel is a contradiction (in an ideal circuit). But if I were to connect this in practice and measure the voltage across points A and B, what value of voltage would it show? And how much current would be sunk by the 5V battery? (Non ideal conditions)


Which sentence is correct?    Maybe we could visit the Bundestag when I am in Berlin.  Maybe we could visit the Bundestag when I will be in Berlin.    Thanks for help!

Should I say:     When I am 18, I'll take my driving test   or     When I'll be 18, I'll take my driving test   Which one is the correct sentence?


I installed CentOS on my laptop about 8 month ago, and  I want to know when exactly I installed it , how can I do that in CentOS 6.4 ?

I am on a CrunchBang machine and trying to write a script that needs to have the OS install date as a reference.  I searched and found this command:  ls -lct /etc | tail -1 | awk '{print $6, $7, $8}'   It prints  Mar 31 21:24   I did not understand the tail -1 part, but was able figure out that $6 $7 $8 are the 6th 7th 8th occurrences of the last line that the command is referencing.  However, I realized that the year cannot be included as the year was not displayed in the ls -ltc command.  Some people suggested finding the date /etc was created and some checking the /var/log/syslog etc. I thought these might be a little specific to the distro.  What is your recommendation for a truly distro-agnostic way to find the OS install date?


Here is what I remember:    Read in the late 80's or early 90's. Main character is a woman, but as a child, had been gender swapped to male. Recently "woke up" as a previous incarnation had been brutally murdered. Turns out that there is a male version of herself, an illegal clone. Takes place on a space station, so the extra clone is using valuable resources. The clone was created by mistake. Some criminals stole several clones and revived them, believing one of them would be worth ransoming.

I'm looking for a story - probably 90s or earlier and about 40 pages long.  A man is a "weather composer" who creates controlled tornados & storms as a kind of performance art.  The world he's living in allows copying & saving brain states, to be restored if an accident befalls the creator (who would lose all memories since their last backup).  One day he wakes up to hear that his earlier self had been killed, with no trace left of the body.  It turns out that his earlier self actually survived - and he eventually meets the original version of himself, who has changed gender to female.  In the end of the story, just as his illicit relationship to his original body is about to be found out, the AI controlling law enforcement & helping him with his compositions arranges a malfunctioning police vehicle long enough for him to make it to the airport & escape to more open-minded regions on pluto.


Inside a class, I have an enum and a private int:   public enum DOOR_STATE { IDLE = 0, OPENING, OPEN, CLOSING };  private int currentState;   Inside a method, if I do:  currentState = DOOR_STATE.OPENING as int;   I get an error message: "The as operator cannot be used with a non-nullable value type int"  But if instead I do:  currentState = (int) DOOR_STATE.OPENING;   The error goes away.  Could someone please explain the difference between the two casting methods ?

Consider the following code:  void Handler(object o, EventArgs e) {    // I swear o is a string    string s = (string)o; // 1    //-OR-    string s = o as string; // 2    // -OR-    string s = o.ToString(); // 3 }   What is the difference between the three types of casting (okay, the 3rd one is not a casting, but you get the intent). Which one should be preferred?


Find  the limit of the series $\sum \frac{1}{n(n+1)(n+2)}$  I tried to wite it as a combination of partial fractions.but ot didn't telescope

I got this question in my maths paper     Test the condition for convergence of $$\sum_{n=1}^\infty \frac{1}{n(n+1)(n+2)}$$   and find the sum if it exists.   I managed to show that the series converges but I was unable to find the sum. Any help/hint will go a long way. Thank you.


I have a data set with a binary response variable, about 30,000 observations of 8 features, some are continuous and some are categorical.   This is an imbalanced data set, the ratio of negatives to positives is about 5:1. So the null accuracy (always predicting negatives) is ~84%.   I know that for imbalanced data sets accuracy is usually not a good metric. But in my context a high accuracy is desirable and because the imbalance is not extreme I think it is possible to improve. I would like to shoot for at least 90% accuracy.   I have tried various feature engineering techniques and machine learning models but I am not even able to hit 86%. For example, decision trees, logistic regression and random forests all give about 85.6-8% accuracy. I used cross-validation for finetuning hyperparameters and checked training accuracy to make sure there was no overfitting.   What could be the reasons for getting such a marginal improvement in accuracy over a dumb model?

Imagine a standard machine-learning scenario:     You are confronted with a large multivariate dataset and you have a   pretty blurry understanding of it. What you need to do is to make   predictions about some variable based on what you have. As usual, you   clean the data, look at descriptive statistics, run some models,   cross-validate them etc., but after several attempts, going back and   forth and trying multiple models nothing seems to work and your   results are miserable. You can spend hours, days, or weeks on such a   problem...   The question is: when to stop? How do you know that your data actually is hopeless and all the fancy models wouldn't do you any more good than predicting the average outcome for all cases or some other trivial solution?  Of course, this is a forecastability issue, but as far as I know, it is hard to assess forecastability for multivariate data before trying something on it. Or am I wrong?   Disclaimer: this question was inspired by this one  that did not attract much attention. It would be nice to have detailed answer to such question for reference.


If  <?=$var?>    is used only if short tags are enabled, then does that mean the regular version of that is:  <?php=$var?>   The second one doesn't work tho.

Here's the information :     There are four different pairs of   opening and closing tags which can be   used in PHP. Two of those, <?php ?>   and <script language="php"> </script>,   are always available. The other two   are short tags and ASP style tags, and   can be turned on and off from the   php.ini configuration file. As such,   while some people find short tags and   ASP style tags convenient, they are   less portable, and generally not   recommended.   In my experience most servers do have short tags enabled. Typing  <?=   is far more convenient than typing  <?php echo    The programmers convenience is an important factor, so why are they not recommended?


I'm trying to install Java, but it requires the "su" command. When I enter my password, the password field remains blank. I try to enter my password, but it remains blank. I press enter, just in case in the sight chance it's techincally entered and I can't see it. It gives me an Authentication Failed message and it makes me enter my password again. Finally, I just exit the terminal. I've read  and did not answer my question. My instructions are And maybe I'm using the wrong version of Java, so if that is, please point me to the correct version. Here's my system stats:  I'm using terminal, on Ubuntu 14.04 LTS.  Also, I installed Ubuntu about 4 hours ago, so I'm new.  Any help would be greatly appricated.  Thanks in advance, Ryan

I am running Ubuntu on VirtualBox and I can't access Su.   When I type su and enter my password it says permission denied. I want to create and edit files through terminal so I need to do this.


I am reading Royden and Fitzpatrick's book on Real Analysis, and I have a question about the length function on an interval in $\mathbb{R}$. Is it true that given $\{I_n \}_{n=1}^{\infty}$ of countable collection of open intervals in $\mathbb{R}$:   $$ \ell( \bigcup_{n=1}^{\infty}I_{n}) \leq \sum_{n=1}^{\infty} \ell (I_n)? $$  Where $\ell$ is the length function? It think this was implicitly used in their proof that the outer measure $m^*$ has the subadditivity property. I think it is true though, since, each $I_n$ might not be pairwise disjoint.

Prove that if $I$ is an interval of $\mathbb R$, covered by an infinite family $\{I_n, n\in \mathbb N\}$ of open intervals, then (where $\ell(I)$ denotes the length of $I$):  $$\ell(I) \le \sum_{n=1}^{\infty} \ell(I_n)$$  It is very intuitive but hard to prove (in a formal manner). The exercise gives the hint: prove that $\ell(I) = \sup\{\ell(K), \text{$K$ is a compact subset of $I$}\}$. I proved this, but I can't see how this hint makes the problem any easier to prove.   I thought about doing the following: If $I$ is unbounded, then we are done, so let's assume that it's bounded. Due to the connectedness of $I$, we can WLOG suppose that the $I_n$'s are such that $I_n \cap I_{n+1} \neq \varnothing$ for each $n$ (this would be the ideal situation, I guess). By the axiom of countable choice, we can find a sequence $(a_n)$ where $[a_n, a_{n+1}] \subset I_n$ for each $n$. Then:   $$\sum_{n=1}^{\infty} \ell(I_n) = \sum_{n=1}^{\infty} \sup  \{ \ell([a_n,a_{n+1}]) = a_{n+1} - a_n\}$$  Does this make any sense? How to proceed? Thank you.


The accepted age of the Universe is 13 billion years give or take. If you were a super space being and hypothetically had spent a large portion of this time sitting next to a black hole then your experience of time, in fact time itself, 'runs' at a slower pace at your location. Does this mean that at this point the Universe is younger? Is the conventional age of the Universe calculated assuming no effects of general relativity on the time calculation? Or am I completely deluded? Any related insight would be great also. Cheers

Well relativity teaches us that time interval between two events is a frame dependent quantity, then how can we say that our universe is 13.8 billion years old? Should it not depend on who is asking this question?


I've got something really weird.  Here is MWE:  \documentclass[a4paper,oneside]{book} \usepackage[english,russian]{babel} \usepackage{inputenc} \usepackage{listings}  \usepackage{fontspec} % fonts \setmonofont{Droid Sans Mono}  \lstset{     basicstyle=\ttfamily\small,     columns=fullflexible,keepspaces,     inputencoding=utf8 }  \begin{document}  \begin{lstlisting} ; sign-extend input 32-bit value to 64-bit ; расширить входное 32-битное значение до 64-битного ; (shift is arithmetical) ; (арифметический сдвиг) \end{lstlisting}  \end{document}   The file is encoded in UTF-8 encoding. Here is russian text interleaved with english. I'm running xelatex test.tex and here is PDF screenshot I've got:    As you may see, english text is fine, but as for russian one, numbers 32 and 64 are somewhat swapped at second line and also left bracket is at wrong position at line 4.   But why?  I've tried to move the text into external file and include it with \lstinputlisting, but result is the same.

I'm using the  package for formatting .cpp code in LaTeX. My code needs to have mixed English and Russian words in comments. The font must be monospaced (preffered Courier family).  /* Prints Hello World */    #include <stdio.h>    int main (void){        printf ("Hello World!"); // This is an english commentary        return 0; // А это русский комментарий     }   I`m using the following code as an example:  \documentclass{article} \usepackage{fontspec} \setmainfont{Times New Roman} \setsansfont{Arial} \setmonofont{Courier New} \newfontfamily\cyrillicfont[Script=Cyrillic]{Times New Roman} \newfontfamily\cyrillicfontsf[Script=Cyrillic]{Arial} \newfontfamily\cyrillicfonttt[Script=Cyrillic]{Courier New} \usepackage{polyglossia} \setdefaultlanguage{russian} \usepackage{listings}  \lstdefinestyle{CppCodeStyle}{ basicstyle=\footnotesize\ttfamily, language={[ANSI]C++}, keywordstyle=\bfseries, showstringspaces=false, morekeywords={include, printf}, commentstyle={}, }  \begin{document}  \begin{lstlisting}[style={CppCodeStyle}] /* Prints Hello World */ #include <stdio.h> int main (void){     printf ("Hello World!"); // This is an english commentary     return 0; // А это русский комментарий } \end{lstlisting}  \end{document}   As I result XeLaTeX (in MiKTeX 2.9) produces following PDF:  /* Prints Hello World */    #include <stdio.h>    int main (void){        printf ("Hello World!"); // This is an english commentary        return 0; // Аэторусскийкомментарий     }   Sorry, I don't have enough reputation to post images :( As you can see, all spaces in Russian are ignored.  How can I fix it?


I use Windows 10. How can I change the caps lock key to do backspace?

One of my laptop's keys has fallen off. Is there any way I can remap another key to serve as that key?  I'll 'sacrifice' the other key because I never use it.


I'm aware , but I'm able to consistently reproduce another strange aspect of the bug on step 5:   Edit my profile on any non-beta Stack Exchange site Click Save and copy changes to all public communities   My profile on all other sites, including the meta site of the main profile that was edited, now use the Identicon image  Navigate to my main profile on another site, click Change picture, and select "Gravatar" Click Save changes just for this community   My profile on the respective meta site still uses the Identicon image  Navigate to the meta site, and simply click Ask Question   My profile on the meta site now uses the Gravatar image    In the meantime, I've opted to upload my profile image manually rather than going through gravatar. That appears to apply the change to all my networks without issues, as far as I can tell.  I thought that reporting these bizarre reproducible steps might help narrow down the cause of the bug.

I recently updated my profile bio (from Arqade) and clicked 'Save and copy changes to all public communities'. This appears to have broken/reset my profile picture on all but Arqade. Note that I did not update my profile picture as part of my changes. Arqade:  Meta SE for comparison:  I haven't touched my profile picture in years. Is this a bug?  Update: It appears my profile pic across all communities has been set back to 'Identicon'. I went on to Stack Overflow and changed my profile picture back to 'Gravitar' and clicked 'Save and copy to all communities' again, but this did not update my profile picture anywhere but SO. (I did the same on Sustainability to be doubly sure). Update 2: This is a persistent bug - I had changed most of my SE communities back to my 'Robotnik' display pic over the past little while. Today I edited my profile again on Arqade, Clicked 'Save and copy' - and the display pic reverted back to identicon again across all sites. Update 3: I have re-uploaded my profile picture and the 'Save and copy' function worked. It appears that this is actually a bug to do with the old images from Gravatar.


Here are two sentences patterns:     Have you ever been to the opera when you lived in Milan?    and      Did you ever go to the opera when you lived in Milan?    What is the difference between them? How can we say, which is right sentence?

Non-native speakers often get confused about what the various tenses  and aspects mean in English. With input from some of the folk here I've put together a diagram that I hope will provide some clarity on the matter.  I offer it as the first answer to this question. Consider it a living document. Input is welcome, and good suggestions will be  incorporated into the diagram.    Nota bene: What this is not is a discussion of whether there are  more than two tenses in English. , to which this question is not intended to supply arguments one way or the other.  Here, the aim is to provide an overview of what constructions English-speaking people use for conveying information about actions referring to past, present, and future, and to provide it first and foremost to precisely the people who are likely to use "tense" as a catch-all term in their search, rather than to linguists who know better.  Breaking News There is now an excellent ELU blog article titled  . It is highly recommended reading.


It is impossible to understand geometry nodes by yourself if you are relatively new to blender. Please suggest me a free course/tutorial/pdf to learn everything about geometry nodes. I don't care if it is several hours long but I want to understand everything! Please help me out.

Since asking for tutorials, videos, resources, links to other content or downloads is considered off topic here, this is a specifically created Community Wiki which gathers resources for Blender and it has been approved by the .  Just write in the appropriate answer/section. If you have concerns, questions, post a  question, so we don't clutter the comments, but you can link your meta question from the comments.  Questions regarding such resources are not allowed anymore, except for very specific and on topic requests (ask on  if you're unsure about your question). Follow the instructions made in the question about how to post, what can be posted, etc.  Learning             Assets    (also see: )   Reference Images/Blueprints (also see: )    Tools    (also see: )      Other   Special Interest ()     Also see the .


Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, and why they didn't work.   "why they didn't work".  That's a stupid phrase. You don't know why it didn't work. How about "and what error you got" or "and what you expected to happen".  If folks knew why it didn't work, 90% of them wouldn't come here.

Note: the eventual outcome of this discussion involved dropping this particular off-topic reason, along with other changes. See:    —Shog     I was using the reason "demonstrate a minimal understanding" myself quite frequently, but the more I review, the more I have doubts about it and I think this reason can either be dropped entirely or at least rephrased, so I started to use "problems with code you've written must describe the specific problem" instead:     Questions asking for code must demonstrate a minimal understanding of the problem being solved.   So the poster has posted some description, maybe even a snippet of code and in his mind that already proves that he has that minimal understanding required. After all he described the problem and what he tried to solve. So telling him that he lacks that understanding is rather rude, and from the posters point of view doesn't even apply. What both version of the reason not emphasize is that a description of a problem is not various versions of     it doesn't work   but that we rather mean really specific details (see below). I can often see in the reopen review queue that the "improved" version just includes a more verbatim description, while what usually would be expected is some specific error message, a trace or a log, or whatever applies.  Then it continues with:     Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist   comparing it to:     problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.   Which says essentially the same, only in more detail.   So the "minimum understanding" reason is IMO a more rude version of the reason telling the user that an SSCCE is missing.  The intent of giving this reason is to tell the user that he needs to give exact details to be able to help him, so IMO a checklist would be much better. Something like:     Your question was closed because it may not provide enough details. Things you can do to improve your question to get an answer include:         Format the code in a way that makes it readable and easily understandable.   Provide the smallest working sample of code demonstrating the problem (link to SSCCE)   Include your input and output.   If applicable provide logs (i.e. Android debugging log, stack trace, etc.).   If applicable provide the exact error messages (compiler, etc.).      And something like this should be best included already in the banner that appears when a question is closed instead of being hidden in some pages you often enough have to actively looking for.  It might be helpful to adjust this, based on the tags or close reason, as I realize that I'm more focused on the programming area, and the above list may not apply to other areas of SO.  Update  Another thing I forgot to mention (but wanted to) is this:     Questions asking for code   Is IMO essentially an invitation of the type of questions     I have a problem, can you provide the solution? (with an optional please)   while     Questions concerning problems with code you've written   puts at least some emphasis on the fact that the poster has to put some effort himself in trying to solve the problem by providing the code which he used to attempt the solution.


Assume we have a full-wave rectifier bridge circuit connected to a load made of a resistor with resistance R and a capacitor with capacitance C in parallel to each other.  In the first quarter-period, the capacitor is obviously charging with the diode from the rectifier on (We assume it is ideal and that the connecting wires are ideal as well.). However, from the quarter period to the half of the period, I have no idea how to get an analytical formula and derive whether the capacitor charges or discharges.  How do we get an exact equation governing the capacitor and when exactly does it start discharging? Does it do so exactly at the quarter period or does it start discharging after a certain angle?

According to various sources, the ripple voltage of a full-wave bridge rectifier is   $$ V_r = \frac{V_s}{2}fCR $$  where \$V_s\$ is the peak of the input voltage source, \$f\$ is the frequency, \$C\$ is the capacitor and \$R\$ the resistor.  I have simulated this circuit on PSPICE, circuitlab, and built it in real life:   \$R\$ is \$4.7K\$ and \$C\$ is \$10 uF\$. Voltage source is sine wave with \$0 V\$ offset, \$5V\$ amplitude and \$40 Hz\$ frequency.  All 3 experiments give me a ripple voltage of approximately \$0.65V\$, but the formula gives me \$1.330 V\$ (twice as much).  What am I missing?


How can I introduce a line break into the labels of the end nodes in the following MWE? The Tikzpicture will include the line breaks if I remove the label=right: part and just leave label=' but that centers the labelabove' the node, rather than to the right.   How can I get the label to include the line breaks and also stay to the right of the end node?  \documentclass{article}  \usepackage[latin1]{inputenc} \usepackage{tikz} \usetikzlibrary{trees} \begin{document} \pagestyle{empty}   % Set the overall layout of the tree \tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3.5cm] \tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]  % Define styles for bags and leafs \tikzstyle{bag} = [text width=4em, text centered] \tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt]  % The sloped option gives rotated edge labels. Personally % I find sloped labels a bit difficult to read. Remove the sloped options % to get horizontal labels.  \begin{tikzpicture}[grow=right, sloped] \hspace{-60pt} \node(A)[bag] {$S(3)$ $(Bet~3)$}         child {                 node[bag] {$S(4)$ $Bet~4$}                                 child {node[end, label=right: {Some text \\ Some text \\ Some text }] {}                                 edge from parent node[below] {$Quit$} node[above]  {}                         }                         child {                                 node[end, label=right: {Some text \\ Some text \\ Some text }] {}                                 edge from parent node[above] {$Bid$} node[below]  {}                         }                         edge from parent node[below] {$LLL$} node[above]  {}         }         child {                 node[bag] {$S(4)$ $Bet~4$}                        child {                                 node[end, label=right: {Some text \\ Some text \\ Some text }] {}                                 edge from parent node[below] {$Quit$} node[above]  {}                         }                         child {                                 node[end, label=right:{Some text \\ Some text \\ Some text }] {}                                 edge from parent node[above] {$Bid$} node[below]  {}                         }                 edge from parent node[above] {$WWW$} node[below]  {}         }; \begin{scope}[]    \end{scope} \end{tikzpicture}  \vspace{60pt}    \end{document}

How can I insert a line break in a TikZ node? Simply putting \\ where I want the break doesn't work (see MWE).  Is there a way to make lines break automatically at some specified width?  And can I control the alignment of the text (left, right, centered, justified)?  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node {First line\\second line}; \end{tikzpicture} \end{document}


The formula for the exponent of the highest power of prime $p$ dividing $n!$ is $\sum \frac{n}{p^k}$, but the question is $n=1000!$ (really, it has the factorial) and $p=5$.  When I use Wolfram Alpha , I panicked because the number has $2,567$ decimal digits.  I think if I write this number I'd need paper all the way to the Amazon.  Perhaps I misunderstand the formula?

How does one find the highest power of a prime $p$ that divides $N!$ and other related products?  Related question: How many zeros are there at the end of $N!$?    This is being done to reduce abstract duplicates. See   and  for more details.


Through an ajax call, I am procuring URLs which I need to use to change the src of an img. However this is taking time. Meanwhile i need to show loading or something. How do i check whether $("#img#).attr("src","http:\\fsomething "); has loaded the image on the page or not?

I want to know when an image has finished loading. Is there a way to do it with a callback?  If not, is there a way to do it at all?


I know we can program and load program inside micro controller with easily available programmer with Computer based interface. But I want to know how same thing was being done in older days when No programmer or modern computer kind of interface was not available? Consider it as i am making a full project, so don't miss any steps.

This has just dawned on me that if you're writing an operating system then what are you writing it on? I ask this as I am reading a microprocessor fundamentals book from 1980 and this question popped in to my head:   How was the first microprocessor chip programmed?  The answer may be obvious but its bugging me.


I recently updated MikTeX on Windows 10, and now all my beamer slides are exported with 0 margin in the footer, so that the Author short name, short title etc is displayed all crammed up at the top of the footer. I am using CambridgeUS theme, but the problem is there in eg. Warsaw as well.  Minimal working example  \documentclass[10pt]{beamer} \usetheme{CambridgeUS}  \title[short title]{title}  \author[short author name]{author names}  \begin{document}  \begin{frame} Something text here \end{frame}  \end{document}   I've tried uninstalling and installing the beamer package to no avail, it looks like this when compiled:    Any help is greatly appreciated!

I just uninstalled TeX Live 2016 and installed TeX Live 2017 and I noticed that the vertical alignment of author and title in any beamer presentation with Warsaw theme has been disrupted. In this example the author is JESTIN and the title is Beamer Intro. How can I vertical center them?  Moreover, I just found the same bug in the beamer guide obtained writing texdoc beamer in the command prompt, in the part of a warsaw presentation.    Here is my code:  \documentclass{beamer}  \usetheme{warsaw}  \title[Beamer Intro]{Beamer - Introduction to \LaTeX{} presentation making} \author[JESTIN]{Jestin Joy}  \begin{document}  \begin{frame}   \titlepage \end{frame}  \end{document}


$G$ be a group of order $n$. $G$ has one and only one subgroup of order of every divisor of $n$. Then G is cyclic.  Is the statement true?  I know the statement "$G$ be an Abelian  group of order $n$. $G$ has atmost one subgroup of order of every divisor of $n$. Then G is cyclic." is true.  Can anyone please confirm me whether my statement is true or not?

Problem Suppose G is a finite group of order $n$ which has a unique subgroup of order $d$ for each $d\mid n$. Prove that $G$ must be a cyclic group.  My idea:   I try to prove it by induction. Let $p|n$ be a prime. Then by condition, there exists a unique subgroup $H$ of order $n/p$. Since $|gHg^{-1}|=|H|$, we must have $gHg^{-1}=H$ by the uniqueness part of the condition. So, H is a normal subgroup. Now, $|G/H|=p$ and thus $G/H=\langle x\rangle$ where $x^p \in H$.    However, I cannot continue.  My another idea is that first consider the case when $|G|$ is a power of some prime $p$. But, it still doesn't work.


I am confused, when we should use "OF" and when we should not. Example:  production guidelines or guidelines of production? safety requirements or requirements of safety?  Why do we use "angle of attack" and not "attack angle"?

Is there any rule for when it is better to use genitive case or noun as adjective? I'm not sure if there is any difference in meaning in this example:     The department of accounting       The accounting department   Can I also use both forms in situations like:     The restaurants of Paris / The Paris restaurants      The room window / The window of the room


I remember short sci-fi story about man, who was selected to be a colonist on some planet. He hadn't any superhuman abilities, excluding one - he was extremaly unlucky. Because of some colonization paradigm, sending people like him had a purpose - it allowed to see if a "normal" man can survive on a colonized planet.   It was story from short story collection of some American writer from 70s - 80s.

About 50 years ago I read a short story about a person sent to live on the moon with a robot helper.  Rather than a traditional high IQ athletic astronaut, the man is an average guy in every way.  The project is a test to learn how an ordinary person could cope with the rigors of colonizing a new world, thus aiding in planning future interstellar colonizations by ordinary pioneers.  At the beginning the man makes many mistakes and suffers a variety of accidents and injuries caused by his own clumsiness and other short-comings.  Without the robot helper he would not have survived.  However, as time passes the man becomes much more physically fit and competent in all aspects of survival.  However, at the same time he notices the robot seems to be less and less helpful, making its own mistakes with increasing frequency, often resulting in injury to the man.  The man finally realizes that the scientists who designed the project anticipated that with experience his competence would increase, thereby decreasing his value as a test subject representing ordinary and inexperienced pioneers on a new planet.  Therefore, the scientists programmed the robot to compensate for the man's increasing competence by becoming less competent itself thereby preserving the desired test environment.  The man decides he would be better off without the robot and pushes it into a deep crater, presumably destroyed by the fall.  For a few months everything goes well.  Then, without warning, the robot reappears, having climbed out of the crater.  The robot seeks to inflict on the man at one time all the many problems and injuries it should have caused during the months the robot was absent - which of course would kill the man.  The man outwits the robot (I forget how) and destroys it for good.  I would be very grateful if someone can identify the author and title of this story.


In the sentence above, why is "'s" used? Is it considered a possessive? It seems strange to state that the news "belongs" to today or the history "belongs" to tomorrow.

Why do we say the following?        I'll have an hour's wait at the airport      Today's lesson      Yesterday's programme    Two weeks' worth of groceries.      They are not possessive, or are they? Why is the possessive apostrophe used with time expressions and adverbs?


How can i make a long-exposure image like this :   For that task, do i need a special camera or can i do it with andtoid app ?

I would like to take a picture of a street during the day to depict how much traffic and cars there are on the street.  Is there anyway to do this with a long exposure photograph?  I have a Nikon D90 and I set the f stop down to 1/16 (the lowest of my lens) and set the time to 2 seconds. Doing this, the exposure is almost saturated when taken around 5pm with the sun setting behind a tree. Doing this, the cars passing by were very hard to make out against the stationary background, being visible as a blur in the color of the car.  Perhaps this is not possible and I should just do this at night where the cars lights are much brighter than the background.  Please suggest how else I might depict the traffic in a photograph?  Are daytime long exposure photographs even possible?


I want to pick a particular “short” word in an array of words, that is, words with at most three characters. For this example, if you are passed an array containing the strings  "Mary", "had", "a", "little", "lamb" and you are asked to return the second short word, you would return "a".  import java.util.*; public class Numbers {     String[] words = {"Mary", "had" , "a" , "little" , "lamb"};        int n = 2;        public String Numbers;        String[] word;        {           int counter = 1;           int length = 0;           int count = 0;            for (int i = 0; i < words.length; i++)           {              length = words[i].length();            if (length <= 3)            {               count++;               **word[count] = words[i];**            }           }           String answer = word[n];           System.out.println(answer);         }  }   When I run the code, it gives me a null exception error, and I'm not sure how to fix it.  The debugger told me it had to do something with the word[count] = words[i];  What is wrong with my code?

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?


This is again a question about  (also see ).  It seems we can write this process as $$X_t := \bigl(t - \text{Exp}(1) \mathbf{1}_{\{X_0 = 0\}}\bigr)^+ + \mathbf{1}_{\{X_0 \neq 0 \}}X_0\, .$$  Where $\text{Exp}(\lambda)$ is the exponential distribution (CDF: $1-e^{-\lambda x}$) with parameter $\lambda$.  Define the stopping time $\tau := \inf \{ t\geq 0 : X_t > 0\}$.  I've read the following explanation why this is not strong Markov:  $$\mathbf{E}_0 \bigl[f((X_{\tau + t}))|\mathcal{F}_\tau\bigr] = f(t) \neq \int f(y) \kappa_t(0, dy) = e^{-t} f(0) + \int_0^t e^{-s} f(t-s)\, ds\, ,$$  but that makes no sense to me... how can it be $f(t)$? Because $t \in I$ doesn't fit into a function $f\colon E^{\otimes I}\rightarrow \mathbb{R}$ (see  for the definition of strong Markov property. For this example $E = [0, \infty)$)...

$X(t) := 0 \;\; (t \leq \tau),\;\; t - \tau\;\;(t \geq \tau)$  with $\tau$ exponentially distributed.   Then X has the Markov property but not Strong Markov Property. But why ???? Can someone kindly explain in words and maths why the strong markov property does not hold?


I'm working on a little text-based adventure in Python 3.2 as I learn it in order to practise and become more familiar with the language. Anyway, I want to make it so that when certain actions happen, the color of the print text changes. How do I do this.  For example, the first text I want this to occur for is:  if 'strength' in uniqueskill.lower(): time.sleep(3) print('As you are a Warrior, I shall supply you with the most basic tools every Warrior needs.') time.sleep(3) print('A sword and shield.') time.sleep(1) print('You have gained A SWORD AND SHIELD!')

How can I output colored text to the terminal in Python?


I need to check the current directory and see if a file with an extension exists. My setup will (usually) only have one file with this extension. I need to check if that file exists, and if it does, run a command.  However, it runs the else multiple times because there are multiple files with alternate extensions. It must only run the else if the file does not exist, not once for every other file. My code sample is below.    The directory is structured like so:  dir_________________________________________     \            \            \            \       file.false    file.false    file.true    file.false   When I run:  import os for File in os.listdir("."):     if File.endswith(".true"):         print("true")     else:         print("false")   The output is:  false false true false   The issue with this is if I replaced print("false") with something useful, it will run it multiple times.  Edit: I asked this question 2 years ago, and it's still seeing very mild activity, therefore, I'd like to leave this here for other people:

How do I check whether a file exists or not, without using the  statement?


As I understand it, iCloud Photo Library works by uploading the full res photo to the cloud and keeps a smaller thumbnail lower res photo on the device. That being the case, how does google photos backup and sync work on iOS devices? How does it upload a photo I took last year when the photo on my iOS device is nothing more than a thumbnail low res photo?

If I have Optimize iPhone Storage enabled on my iPhone and my phone storage is completely full, I understand that iOS will only store a low-res thumbnail of many of my photos on the device. (The full high-res version of the image will only exist in iCloud and on devices with Download and Keep Originals enabled.)  But when only thumbnails exist on the device, how does that work in relation to other photo apps on iOS? For example, do third-party cloud-based photo apps (like Google Photos, Dropbox's Carousel, or Amazon Prime Photos) have access to the full high-res images from the iCloud Photo Library? Or will they only see the low-res thumbnails in some cases?


I know in C# you can do int.MaxValue or long.MaxValue to get the maximum for these two types, I was wondering if there are similar ways to get the maximum length for the string.   I don't see it . Also, I am aware that there are already questions being asked on max string length.   I am asking if there is an existing function that comes in handy where you can use it to set the condition when and when not to truncate your string to avoid program crashing. Or what is the normal approach?  E.g. Maybe something as easy as Max(string.length)?

What is the longest string that can be created in .NET? The docs for the String class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of internals. Would the maximum change on a 64-bit system?  [This is asked more for curiosity than for practical use - I don't intend to create any code that uses gigantic strings!]


Say I buy a game on Steam, download / install it on my machine, and then delete it.  Does it stay in my games library on Steam and can I download it again?  And if so, what about my saved game data? Does that persist on Steam for a game which has been deleted from my machine?

Can I uninstall purchased games from my computer and then later download them through Steam without having to re-purchase if I'd like to?   I'm running short on space on my laptop, looking to free up some space and wanted to be sure that I can safely re-download anything at a later time similar to how you can with the Xbox Live marketplace.


Please help me to setup a linux based server machine for sharing internet connection in my network. Since I am a new user, please assist me ...

I want to configure NAT for my network of 10 computers so that the data is transmitted via a single pc.   Can anyone give a good tutorial for it?


There are $n^2$ squares disposed in a bigger n by n square, like a grid. Something like [this][1]  The question is: how many rectangles can be formed using those squares? I saw this problem in a [blackpenredpen][2] (youtube maths channel) and decided to try and figure it out by myself, as I had an idea. The idea I had was to calculate the number of possible diagonals that could be made from picking any two squares in the grid, since one diagonal is all it takes to define a rectangle. It made sense to divide by 2, since $n \choose 2$ would yield 2 diagonals for each rectangle. So, I tried $\frac{n \choose 2}{2}$, but the results I got didn't match with the correct ones (I know the correct result, as it can be obtained by other methods, like the ones presented in the [video][2]). I had really high hopes for this idea and was disppointed when I got an incorrect result. I toyed and fiddled a little with the results I got, but to no avail. I did find out that for $n=8$ the difference between the result I got and the correct one was $7!$, which I found suspicious.  Can anyone help me figure out why my reasoning is not yielding the correct results? If I wasn't clear or there is something I should do better, please point it out. Thank you! I am enjoying this site.

I have come across numerous questions where I am given the picture such as the above one been asked "how many rectangles are there?". I have even come across some slightly different images that instead of rectangles you are supposed to find the number of triangles. Well, I was thinking whether there is any formula or strategy that is used to solve these problems without having to manually count every shape.  Help would be appreciated.  Thank you :)


I have an old Acer Aspire 4920 bought in 2008 or so with 1GB RAM, Intel Core 2 Duo processor. I had windows 7 on it. I erased it for obvious reasons and installed Ubuntu 16.04, but later felt its slow and 16.04 recommends 2GB RAM. So I erased it and installed 14.04 64bit which recommends minimum 512MB. I thought it will be fast because my RAM is double the minimum requirement. Unfortunately, it is slow as well. Does anyone know why? Is the RAM too low or should I try 32bit version? Please help.

For a given hardware configuration, how do I find out if Ubuntu will run on it? What considerations should I take into account when choosing an Ubuntu version and  such as:    with a lighter desktop than the usual Gnome and Unity  with the even lighter LXDE desktop   Obviously Ubuntu does not run on some processor architectures. So how do I go about choosing the right version and derivate. How can I find out the minmal system requirements?


I just finished my 3rd year in a combined pure/applied math program at a Canadian university.  I have been leaning towards pure math, but I'm not sure if I'll have done enough to go to grad school for it.  I've taken Real Analysis (single-variable, metric spaces, basic function spaces and topology), a standard course in complex analysis, and an introductory abstract algebra course (mostly rings and fields).  I've also of course done the basics in single/multivariable calculus, linear algebra, probability, and ODES.  Next year I was planning on taking measure theory, general topology, mathematical logic, and group theory, as well as some applied courses.  In addition I'm planning on working through Munkres' Analysis on Manifolds this summer.    Will this suffice for grad school, or do I need more higher-level courses?  Also, I've never written the Putnam or any other contests, or did research.  I'm probably not going for top grad schools, but would an average school admit someone on the basis of coursework, or do they expect more evidence of research potential?  EDIT: My question is specifically about my math background and math grad school, I don't see how this is really answered by the other question.

When applying to a PhD program in the US, how does the admissions process work? If an applicant is weak in a particular area, is it possible to offset that by being strong in a different area?  Note that this question originated from this . Please feel free to edit the question to improve it.


I have been receiving countless ddos attacks the last couple of weeks. Just now I caught one while I was running iptraf. Normally 99.9% of the packets used on my server are TCP packages, and not UDP. A few are used I see, but normally hardly any.  Now while the attack happened I noticed thousands of incoming UDP packets per second. Also tcpdump was showing this: .   I run CENTOS 5.6, and I only use it for nginx (80,443), ssh (22), ftp (21). I dont run nameservers, email or anything like that.  My question is. Can I block all incoming UDP traffic via iptables? Would this be effective against UDP ddos attacks? And if I can block all UDP traffic, would this cause any problems in linux?

This is a  about DoS and DDoS mitigation.   I found a massive traffic spike on a website that I host today; I am getting thousands of connections a second and I see I'm using all 100Mbps of my available bandwidth.  Nobody can access my site because all the requests time out, and I can't even log into the server because SSH times out too!  This has happened a couple times before, and each time it's lasted a couple hours and gone away on its own.  Occasionally, my website has another distinct but related problem: my server's load average (which is usually around .25) rockets up to 20 or more and nobody can access my site just the same as the other case.  It also goes away after a few hours.  Restarting my server doesn't help; what can I do to make my site accessible again, and what is happening?  Relatedly, I found once that for a day or two, every time I started my service, it got a connection from a particular IP address and then crashed.  As soon as I started it up again, this happened again and it crashed again.  How is that similar, and what can I do about it?


This is my code:   var FinalPath = Path.Combine(DestPath, FinalFile);  File.Copy(TempFile, FinalPath);   Destpath is "c:\Somepath\" and FinalFIle is "somefile.pdf" So FinalPath is: "c:\Somepath\somefile.pdf"  When Copy method is called i receive error (file already exists and throws an unwanted exception wich is not good).   How can i tell something like if(FinalPath.Exists = true)... ignore o continue ?

I would like to test a string containing a path to a file for existence of that file (something like the -e test in Perl or the os.path.exists() in Python) in C#.


Problem: By considering this sequence of numbers $$2^1 + 1,\:\: 2^2 + 1,\:\: 2^4 + 1,\:\: 2^8 +1,\:\: 2^{16} +1,\:\: 2^{32}+1,\ldots$$ prove that there are infinitely many prime numbers.   I am thinking that if I can show that every pair of numbers in the sequence are relatively prime then since each has at least one prime factor this would prove the existence of infinitely many primes. But I am new to discrete mathematics and number theory so I am not sure on how to proceed.

A Fermat number $F_n$ is of the form $F_n = 2^{2^n} + 1$  Furthermore, $F_n = 2 + F_0F_1F_2......F_{n-1}$ Now I already proved that  if $n \neq m$ then $\gcd(F_n,F_m) = 1$  Here is the proof  Without loss of generality , I assume that $m > n$ then we know that $$F_m = 2 + F_0F_1F_2........F_nF_{n+1}.....F_{m-1}$$ I assumed here that $n > 2 $ and $n < m-1$  Now we assume that $\gcd(F_n,F_m) = d$ then $d \mid F_n$ and $d \mid F_m$  Now if $d \mid F_n$ then $d \mid F_0F_1.....F_nF_{n+1}...F_{m-1}$ and so $d$ divides any linear combination of $F_m$ and  $F_0F_1.....F_nF_{n+1}...F_{m-1}$, In particular $d \mid Fm- F_0F_1.....F_nF_{n+1}...F_{m-1}=2$ and hence $$d \mid 2$$  Now since all Fermat numbers are odd then $d \neq 2$ and hence $d=1$  Now I want to use this to prove that there exists infinitely many primes.  I know that since Fermat numbers form an infinite sequence of increasing numbers and each Fermat number is relatively prime to all other Fermat numbers then we have infinitely distinct prime divisors for each composite Fermat numbers and we also add to those Fermat prime numbers.  I feel like there is a better mathematical argument that that novel that I wrote above :)


I'm having problems with the Chrome launcher icon for Ubuntu 14.04.  When I open Chrome for the first time, both via the icon launcher (call it icon1) that through any other way, it creates a new icon (call it icon2) in the Launcher; the default behavior, as you already know, should be to modify the clicked icon with a new background and an arrow on the left.  Then, if I move the mouse on icon2, it always display the same title (focus@will - google chrome) even if this page is not open in any chrome window.    Also, I can't use icon2 to open a new window because there is no such option; so if I leave only icon2 as the locked launcher icon, I'm unable to launch Chrome at all. Finally, when I type chrome in the dash, I have three different result.  This problem seems to be related to the last update (not too sure btw). I already tried to remove Chrome (without purge), but nothing changes.

After upgrading to Ubuntu 14.04 from 12.04 I have duplicate entries in dash.    How can I get rid of them?


Prove that $S_3\times \mathbb{Z}_2$ is isomorphic to $D_6$.  My attempt:  I tried to decompose $D_6$ as the internal direct product of subgroups $H$ and $K$ isomorphic to $S_3$ and $\mathbb{Z}_2$ respectively:  Let $H=\{1, r^2, r^4, s, r^2s, r^4s\}$  Let $K=\{1, r^3s\}$  $HK=D_6$  $H\cap K=\{1\}$  However, taking $h=r^2$ and $k=r^3s$, \begin{equation*} \begin{split} hk&=r^2\cdot r^3s \\ &=r^5s \end{split} \end{equation*} \begin{equation*} \begin{split} kh&=r^3s\cdot r^2 \\ &=r^3sr^2ss \\ &=r^3r^{-2}s \\ &= rs \end{split} \end{equation*} $hk\neq kh$  So, this doesn't work. How do I solve this problem?

im trying to show that $D_6  \cong D_3\times \mathbb Z_2$ as groups.  $D_n$ is the is the dihedral of order 2n  I know that it is possible to form all of the points in $D_6$ and in $D_3$ as compositions of $R$ the rotation operation (such that every vertex move one to the left) and T the reflection on one of the symmetry axis, so i tried to write it done and joining point that act the same, but for no use.


When you tun to the dark side is like you have been possesed by a demon? you lost your sanity? That bring me to the mind seeing how ...     Anakin kills all the young padawans   ...something that nobody (not insane) would do for most angry you are.

When I saw the original Star Wars saga as a kid, the concept of the Dark Side imprinted in me was quite simple. You did a bad thing, so you're a bad person so you go to the Dark Side and keep doing bad things.  Now, obviously this doesn't hold true in reality. In my mind it is perfectly reasonable for Luke to kill the Emperor and Vader and then just flee the Death Star and rejoin the Alliance. After all they are at war, those are enemy officers that have captured him and are taunting him by threatening with death of all loved ones and the whole operation was intended to kill the Emperor anyway.   The same would hold true for Anakin. He could have killed Mace Windu to save the Chancellor and Padme but that doesn't mean he's going to then go mad and kill all Jedis including children. It doesn't add up from a merely psychological point of view. He had a set of objectives and that made him want to keep the Chancellor alive (quite valid by the way, Mace Windu is quite clumsy on that) but just after killing him he goes into "Yes master I'll do whatever you say" which from a normal point of view will NEVER ever make sense.  In both cases it seems like the assumption is once you use the Dark Side you completely turn to the Dark Side and become a different person that you were before. That would be coherent with Anakin "dying" and Vader being born.  Is that the way the Dark Side works? Is there any canon information about what happens when someone turns to the Dark Side? Specifically to whether they become a different person or how he or she actually changes?  Note: Vader is angry after he finds out Padme is dead, even though he's already turned.  Example of what I mean. In Buffy they explain how people that turn into Vampires lose their soul and it's taken over by a demon, and thus they are, in all effects, a different person with their memories.


I am trying to delete a few thousand threads, more than I could do manually.  When I search for     label:github -label:dont_delete -to:me@example.com   I see threads with the dont_delete label.  Why?  How can I get only threads that are labeled github, but not labeled dont_delete and not to me directly?

What search query will return conversations that have the label Reading but not the label Ignore?  I've tried using label:reading -label:ignore but Gmail still returns conversations that have the label Ignore:    The query label:(reading -ignore) gives me the same results.


Today I made a simple test to compare the speed between java and c - a simple loop that makes an integer "i" increment from 0 to two billion.  I really expected c-language to be faster than java. I was surprised of the outcome:  the time it takes in seconds for java: approx. 1.8 seconds  the time it takes in seconds for c: approx. 3.6 seconds.  I DO NOT think that java is a faster language at all, but I DO NOT either understand why the loop is twice as fast as c in my simple programs?    Did I made a crucial misstake in the program? Or is the compiler of MinGW badly configurated or something?  public class Jrand {   public static void main (String[] args) {      long startTime = System.currentTimeMillis();     int i;      for (i = 0; i < 2000000000; i++) {         // Do nothing!     }     long endTime = System.currentTimeMillis();     float totalTime = (endTime - startTime);      System.out.println("time: " + totalTime/1000);  }  }   THE C-PROGRAM  #include<stdio.h> #include<stdlib.h> #include <time.h> int main () {      clock_t startTime;     startTime = clock();      int i;     for (i = 0; i <= 2000000000; i++) {         // Do nothing     }     clock_t endTime;     endTime = clock();      float totalTime = endTime - startTime;     printf("%f", totalTime/1000);      return 0; }

How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:


I have a jquery statement that replaces an image based on screen size    It only works on refresh though. I want it to automatically run when the user resizes their screen past my set of parameters.  I can't figure out how to do this.   JQUERY

What is the correct (modern) method for tapping into the window resize event that works in Firefox, , and Internet Explorer?  And can you turn both scrollbars on/off?


A 9 HD Yuan-ti Pureblood can innately cast the poison spray cantrip 3 times per day. The monster description says the save is DC 12, but it does not go into damage. So does it do 1d12 or 2d12 damage?

For PCs, cantrip damage increases with their total character level and not their class level ().  However, NPCs do not normally have class levels, and their stat blocks don't state a total character level.    How can I determine the number of damage dice to roll for an NPC's cantrip?   Should I use their number of hit dice as their total character level?   Should I use their stated Spellcaster level? (What if they don't have one?)   Some other method?     A couple of examples to illustrate my concern:    An Archmage (SRD p. 395) has 18d8 + 18 hit dice and is an 18th level spellcaster, so methods 1 & 2 here would produce the same result. Nezznar the Black Spider (LMOP p.59) has 6d8 hit dice and is a 4th level spellcaster, so methods 1 & 2 would produce different results.   The fact that Nezznar has more hit dice than spellcasting levels implies to me that Nezznar has, in some unspecified way, multiclassed - and that 6 would be his total character level - and the number I should use for cantrips, not 4 (his spellcasting level).   A good answer would also cover NPCs with Innate Spellcasting and no spellcasting level. See for instance:    A Green Hag (SRD. p 319) has 11d8 + 33 hit dice but no spellcasting level.


Sentences like "I do believe" or "I do love you" are common. But I was wondering what do they mean? I've never seen structures like this in grammar.  In fact I don't understand what is the diference between these sentences and ,say ,this simple one: "I believe" or "I love you"  Thanks in advance.

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"?


The activity monitor is showing strange things, like kernel CPU % usage being way above 100%, between 200% - 1.000%.    At the same time the cooling fan is running at max speed and the CPU temperature seems to be 47°. At the same time, everything started to react very slowly.  I am only running chrome with 3 tabs open.  What could be the problem? Am I reading the % correctly and why would it show >100%?

I have a Macbook Pro Retina with the following hardware:  Model Name: MacBook Pro Model Identifier:   MacBookPro11,1 Processor Name: Intel Core i5 Processor Speed:    2.4 GHz Number of Processors:   1 Total Number of Cores:  2 L2 Cache (per Core):    256 KB L3 Cache:   3 MB Memory: 8 GB Boot ROM Version:   MBP111.0138.B15   I recently updated to OS X El Capitan; I have had the same problem occur to me twice now and it's getting me mildly concerned.  I randomly have CPU usage spikes from kernel_task, the highest of which I have seen was 660% CPU. This is frankly an unacceptable and unnatural setting for my CPU (I typically have a total usage of about 2-3%). The highest I've screenshot is this:    The first time, I did not record what I had open. The next time, however, I was ready, and this is the exact list of what I had open:   Two YouTube video pages (using the processes Safari Networking with a max of about 44% CPU, typically stabilized at 8-10% and https://www.youtube.com, which got to around 51% CPU max, typically around 10-12%) Messenger. Doubtful that this had an effect, but, hey, you never know. Skype. This dude was running at a consistent 50% CPU usage.   It is worth noting that I had to close both YouTube windows to actually gain enough control of my computer to open Activity Monitor. None of the aforementioned processes were spiking, just kernel_task.  Also worth noting is my fans - the fans were on maximum, blowing cold air. Even though kernel_task was spinning at 660% CPU, there was no actual heat being produced, as far as I could see.  It's at this point where I force shut down the computer - I had about .5 frames per second (1 frame every 2 seconds, was looking at the clock) and was getting nowhere when it came to even attempting to fix it.  If there is a bug related to this that I have missed, or some wacky thing with OS X in general that I'm missing, please let me know, as this is extremely frustrating and more than a little disturbing.


I need to set the class as active  in li tag.Below is the header page of community which contains set of tabs.So on click of tab it should set the li tag class to active.It is setting the li tag to active but after page refreshes it is losing its value.Please someone help me   <apex:page title="{!$Label.site.site_login}" showHeader="false" sidebar="false"        standardStylesheets="false">  <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.4.2.min.js')}"  />     <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.6.custom.min.js')}"  />   <apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.6.custom.css')}"  />

                      <apex:outputLink value="{!$Page.Home}"       onclick="ChangeClass(Home);">Home</apex:outputLink>

                      <apex:outputLink value="{!$Page.Chatter}" onclick="ChangeClass(chatter);>Chatter</apex:outputLink>

                         <apex:outputLink value="{!$Page.page3}" onclick="ChangeClass(page3);>Room</apex:outputLink>

                         <apex:outputLink value="{!$Page.page4}" onclick="ChangeClass(page4);>Page4</apex:outputLink>

I have a header page with links to all the visualforce page as tabs.I need to highlight the tab on select of it.      <apex:page title="{!$Label.site.site_login}" showHeader="false" sidebar="false"       standardStylesheets="false"> <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.4.2.min.js')}"  />   <apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-ui-1.8.6.custom.min.js')}"  /> <apex:stylesheet value="{!URLFOR($Resource.jQuery, '/css/ui-lightness/jquery-ui-1.8.6.custom.css')}"  />

                     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">                                                                        </button>

                             <apex:outputLink value="{!$Page.Home}">Home</apex:outputLink>

                             <apex:outputLink value="{!$Page.Chatter}">Chatter</apex:outputLink>

                             <apex:outputLink value="{!$Page.page3}">Room</apex:outputLink>

                             <apex:outputLink value="{!$Page.page4}">Page4</apex:outputLink>

                     </apex:page>


I am creating the image of the PowerPoint file programmatically. And after saving the Images to the local drive I am getting the files using DirectoryInfo.GetFiles(). I am saving the image files with the sequence numbers.     My Files:   My issue is when I get the files, are not in the sequence I need them in. The files sequence which I am getting in the FileInfo[] is :    Can any one help me to solve this issue?

System.IO.Directory.GetFiles() returns a string[].  What is the default sort order for the returned values?  I'm assuming by name, but if so how much does the current culture effect it?  Can you change it to something like creation date?   Update: MSDN points out that the sort order is not guaranteed for .Net 3.5, but the 2.0 version of the page doesn't say anything at all and neither page will help you sort by things like creation or modification time.  That information is lost once you have the array (it contains only strings).  I could build a comparer that would check for each file it gets, but that means accessing the file system repeatedly when presumably the .GetFiles() method already does this.  Seems very inefficient.


In olden days of DOS, we had cd command to switch folders. The case does not seem same like DOS. Please help

I'm trying to follow  in getting my wireless to work. However I'm incredibly new at the whole Linux thing, and there is a part in there that I really just don't understand:     Go to your main extracted folder (It should be the DPO_RT3290_LinuxSTA_V2600_20120508 folder) and type the following:     make     sudo make install  When he says "Go to", does he mean go to the file window? Wen I'm there and type "make" and hit Enter, it just opens up the file. How exactly am I supposed to make this thing work? What he is trying to say? I really just don't get it. Can somebody help me to understand this, so I can get my wireless working.


Should the cardinal directions be capitalized when used as an adjective? For example,     They sailed throughout the eastern Baltic.

I am trying to capitalize Western Canada or western Canada properly and am wanting a definition for when the "ern" is added as a suffix to a locational distinction of a proper noun.  I believe the capitalization is related to the suffix and am grouping two questions.  After researching on the internet I have found a trend that areas of discrete area become capitalized along with their proper noun   East New York West Hollywood East London (Britain) East Los Angeles   Some locations have "ern" added to their locational modifier.    Web Examples (from government sites):   eastern Canada ( Western Canada ()   All the examples listed contain discrete areas.  The "ern" suffix is used for larger areas, but I am unable to determine when an area becomes large enough.


I want to develop BirthDay CountDown calculator in PHP  User input the date DD-MM-YYYY  I have a days differnce calculator, but it calculates the days from between two specified years.  $daysfrom = $_POST['daysfrom']; $daysto = $_POST['daysto']; echo 'Difference of days B.W ' . $daysfrom . '-'.$daysto.' are';     $daysto = strtotime($daysto);     $daysfrom = strtotime($daysfrom);     $datediff = $daysto - $daysfrom;     echo floor($datediff / (60 * 60 * 24));   And I have tried this calculate days between birthday.(I know this is not right)  User will input MM-DD-YYYY and it should calculate days between months.  Ex: - Input: 13-03-1993       Output: (Assume todays date is 10-03-2014), it should display 03 Days left   if (isset($_POST['daysto'])) {        $daysto = $_POST['daysto'];        echo 'Your birthday comes within ';        $daysto = strtotime($daysto);        $now = strtotime(date('d-m'));        $datediff = $daysto - $now;        echo $datediff / 60 / 60 / 24;      }

I have two dates of the form:  Start Date: 2007-03-24  End Date: 2009-06-26   Now I need to find the difference between these two in the following form:  2 years, 3 months and 2 days   How can I do this in PHP?