It seems like sed is not replacing the string on my code. What I intend for it to do is to change the property called "notification.enable" from false to true from server2 to activate, and, true to false in server1 to deactivate. It works when I do it individually using below but when doesn't when being called from a function. sed -i 's/notification.enable=false/notification.enable=true/g' /usr/config/activate.properties function prompt_activate_server2_config { activate="notification.enable=true" deactivate="notification.enable=false" dir=/usr/config filename=$dir/activate.properties output=$(grep "notification" $filename) if [ -e $filename ];             then sed -i 's/$deactivate/$activate/g' "$filename" echo "Activated in Server 2" echo $output;date fi         }  function prompt_deactivate_server1_config {     activate="notification.enable=true"     deactivate="notification.enable=false"     dir=/usr/config     filename=$dir/activate.properties     output=$(grep "notification" $filename)     if [ -e $filename ];                 then     sed -i 's/$activate/$deactivate/g' "$filename"     echo "Deactivated in Server 1"     echo $output;date     fi             }  I'm using function because I need to remotely execute the scripts from another server So I call them using below. All the 'execute' stuff is on the above function. What am I missing?  if [ "$selection" == 'Activate Config' ]; then  #Activate server1/deactivate server2# ssh user@server2 "$(typeset -f prompt_activate_server2_config); prompt_activate_server2_config" sleep 2 ssh user@server1 "$(typeset -f prompt_deactivate_server1_config); prompt_deactivate_server1_config"       fi

If I run these commands from a script:  #my.sh PWD=bla sed 's/xxx/'$PWD'/' ... $ ./my.sh xxx bla   it is fine.  But, if I run:  #my.sh sed 's/xxx/'$PWD'/' ... $ ./my.sh $ sed: -e expression #1, char 8: Unknown option to `s'    I read in tutorials that to substitute environment variables from shell you need to stop, and 'out quote' the $varname part so that it is not substituted directly, which is what I did, and which works only if the variable is defined immediately before.  How can I get sed to recognize a $var as an environment variable as it is defined in the shell?


Let $S$ be a ring with subring $R$, both PIDs.  Let $a, b \in R$ with gcd $r \in R$.  If $s \in S$ is the gcd of $a$ and $b$ when considered in the larger ring $S$, prove that $r = su$ for some unit $u \in S$.  I am trying to exploit the fact that the ideal $(a, b) = (s)$ and any other generator of the ideal $(a, b)$ is a unit multiple of $s$.  It is clear from the definition of gcd that $r | s$ which implies that $(s) \subset (r)$.  These ideals are generated in $S$, I have given some thought as to what I get from considering them as ideals of $R$.  Still I can not see how to proceed.  Any suggestions are appreciated.  Thanks in advance.

Let $R$ be subring of integral domain $S.$ Suppose $R$ is $\text{PID}.$ Let $a\in R$ be a greatest common divisor of $r_1,r_2$ in $R$. ($r_1,r_2 \in R$, not both zero). Could anyone advise me on how to prove $a$ is greatest common divisor of $r_1,r_2$ in $S?$   Hints will suffice, thank you.


we know that $S(n,k)$ is the number of ways we can partition a set with $n$ members to $k$ subsets ( each subset has at least one member). imagine we have a set with $k*n$ members. we want to partition this set to $k$ subsets such that each of them has $n$ members. how many ways can we do this ?

Let's have 2 numbers, N and K, where K divides N. The number of K-combinations from a given set S of N elements is a well known formula. Let's concatenate N/K groups (resulting in N elements) such as the resulting set is N. How many possibilities are there, i.e. what's the formula?  For instance:    N=4, K=2, C(4, 2) = 6 {1,2},{1,3},{1,4},{2,3},{2,4},{3,4}   The 3 possibilities are:     {1,2},{3,4}   {1,3},{2,4}   {1,4},{2,3}   I generated these combinations and I think the number goes like this:  (4, 2): 3 (6, 3): 10 (6, 2): 15 (10, 5): 126 (9, 3): 280 (10, 2): 945 (14, 7): 1716 (12, 4): 5775 (15, 5): 126126 (15, 3): 1401400   Apparently, the result always divides with (N-1).


Consider a classical mechanical system with generalized coordinates $q_i$, $i \in \{1,\dots\,n\}$. And Lagrangian $L$. Given a path $\gamma$ (with coordinates $\gamma_i$) and two times $t_1$ and $t_2$ you can calculate the action of $\gamma$:  $$ S[\gamma] := \int_{t_1}^{t_2} L(\gamma_i(t),\dot \gamma_i(t),t) \,\mathrm{d}t $$  Is there any general theorem which specifies conditions where the critical solution of an action is unique (for given boundary conditions)? I am also looking for a (reference with a) proof.

A few months ago I was telling high school students about Fermat's principle.   You can use it to show that light reflects off a surface at equal angles. To set it up, you put in boundary conditions, like "the light starts at A and ends at B". But these conditions by themselves are insufficient to determine what the path is, because there's an extra irrelevant stationary time path, which is the light going directly from A to B without ever bouncing off the surface. We get rid of this by adding in another boundary condition, i.e. that we only care about paths that actually do bounce. Then the solution is unique.  Of course the second I finished saying this one of the students asked "what if you're inside an elliptical mirror, and A and B are the two foci?" In this case, you can impose the condition "we only care about paths that hit the mirror", but this doesn't nail down the path at all because any path that consists of a straight line from A to the mirror, followed by a straight line to B, will take equal time! So in this case the principle tells us nothing at all.  The fact that we can get no information whatsoever from an action principle feels disturbing. I thought the standard model was based on one of those!  My questions are   Is this anything more than a mathematical curiosity? Does this come up as a problem/obstacle in higher physics? Is there a nicer, mathematically natural way to state the "only count bouncing paths" condition? Also, is there a "nice" condition that specifies a path in the ellipse case? What should I have told that student?


How can I use my native calendar in Drupal? I set Drupal to use Farsi and set Asia/Theran as default location, but the month names and years are still from the Gregorian calendar, even if they are translated in Persian.  Is there any coding method to use a calendar that is not the Gregorian one?

How can use non-Gregorian dates and calendars?  I adjust Drupal setting to my native language (fa) and native location (Asia/Theran) but month name and number of years also in Gregorian yet (however there are translated to my native language-persian).  I already use format_date() or date() in theme files, but this function is not locale-aware, which means that it always outputs English language data, such as day and month names and ordinal number suffixes.  I want to show the month names in the native language (e.g. Chinese, Islamic, Hebrew, Farsi/Persian) and use the national calendar (e.g. Irani, Shamsi, Jalali).  I want to understand is there any module or hardcoding solution in Drupal to show dates and calendars in other non-Gregorian calendars.  Any suggestions?


I need to replace a rim that is cracked around the spokes.  This is my bike:  (Whistler 70)  I can't find any info on my current clincher rim (700C) for my 32mm tires.  I'm looking to replace it with a rim that is "fast" on pavement and can handle well on dirt and gravel trails.  I don't know much about rim profiles or rim technology, etc, so I'm looking for some suggestions on manufacturers of rims that perform well and aren't too costly.  Also, any links to info on how to choose a rim would be helpful too!  Thanks!

These are my current rims: Wheeltech TD26 by Alex Rims (can't find much info about these online).  I need to replace the rear wheel as it is cracked (cracks on the rims around a few spokes) It's a 700C disc brake rim with quick releases.  What do I need to consider other than the size of the wheel when choosing a replacement?  I'll likely migrate over the cassette and rotor (if need be).  My knowledge of rims is limited so any help is appreciated!  Here is my bike:  (Must select Whistler 70 when on the site)


I keep getting NullPointerException when I try to access array elements from another class using the get method. My code uses a constructor to initialize the array, and it works just fine.  MagazineValue.class  public class MagazineValue {  public MagazineValue(){ } private String[]magazineName; public MagazineValue(String[] magazineName){       this.magazineName = new String[magazineName.length];     System.arraycopy(magazineName, 0, this.magazineName, 0,     magazineName.length);  }  public String[] getMagazineName(){     return magazineName; } }   The constructor here copy's array value from the argument to a private array variable. When I try to invoke getMagazineName() from another class, it shows that the array is still null. Is there any way I can solve this? It sure seems easy but it took me a lot of time.   FirebaseValueListner.class  public class FirebaseValueListner { public void setMagazineName(){     String[]magazineName={"African Daily" , "African Bussines", "African Women"};     MagazineValue setValue= new MagazineValue(magazineName); }   }  The FirebaseValueListner gets values from the Firebase database and saves it values to an ArrayList and later copy's the values to arrays. The arrays are passed to the constructor of the MagazineValues.  LibraryFragment.class `  public class LibraryFragment {  public static void main(String[] args) {     // TODO Auto-generated method stub     String[]magazineName;     MagazineValue getMagazineName;     getMagazineName=new MagazineValue();      magazineName=getMagazineName.getMagazineName();     System.out.println("Magazine Name : " +magazineName[1]);         }      }   `

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?


In a project that has a __main__.py, rather than  # __main__.py # def main...  if __name__ == "__main__":     main()   ...is it OK to just do:  # __main__.py # def main...  main()   Edit:  @user2357112-supports-Monica's argument made a lot of sense to me, so I went back and tracked down the library that had been giving me issues, causing me to still be adding the if __... line. It's upon calling python -m pytest --doctest-modules.   Maybe that's the only place that makes a mistake in running __main__.py? And maybe that's a bug?  Reproduced by putting the first example in the  in a __main__.py:  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― package/__main__.py ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― package/__main__.py:58: in <module>     args = parser.parse_args() /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py:1755: in parse_args     args, argv = self.parse_known_args(args, namespace) /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py:1787: in parse_known_args     namespace, args = self._parse_known_args(args, namespace) /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py:2022: in _parse_known_args     ', '.join(required_actions)) /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py:2508: in error     self.exit(2, _('%(prog)s: error: %(message)s\n') % args) /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py:2495: in exit     _sys.exit(status) E   SystemExit: 2 --------------------------------------------------------------------------------------- Captured stderr --------------------------------------------------------------------------------------- usage: pytest.py [-h] [--sum] N [N ...] pytest.py: error: the following arguments are required: N  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  Results (4.23s):

Given the following code, what does the if __name__ == "__main__": do?  # Threading example import time, thread  def myfunction(string, sleeptime, lock, *args):     while True:         lock.acquire()         time.sleep(sleeptime)         lock.release()         time.sleep(sleeptime)  if __name__ == "__main__":     lock = thread.allocate_lock()     thread.start_new_thread(myfunction, ("Thread #: 1", 2, lock))     thread.start_new_thread(myfunction, ("Thread #: 2", 2, lock))


I am new to Templates and trying to get name and item but I run into weird error. I thought the problem was the string so I changed to int but it didn't work. can you help me please. Thank you! when i delete the templates form cpp class i get many different errors even tho i am defining them in hpp file   Template.hpp  #ifndef Template_hpp #define Template_hpp  #include <stdio.h> #include <iostream> #include <string> using namespace std;  template <typename T1 ,typename  T2> class Temp { private:     T1 item;     T2 name;  public:     Temp();     Temp(T1 item, T2 name);     T1 getItem();     T2 getName();  }; #endif /* Template_hpp */   Template.cpp  #include "Template.hpp" #include <stdio.h> #include <iostream> #include <string> using namespace std; template <typename T1 ,typename  T2> Temp<T1,T2>:: Temp() {  } template <typename T1 ,typename  T2>  Temp<T1, T2>::  Temp( T1 item, T2 name) {     this->item=item;     this->name=name; } template <typename T1 ,typename  T2> T1 Temp<T1,T2>:: getItem() {     return this->item; }  template <typename T1 ,typename  T2>   T2 Temp<T1,T2>::getName() {     return this->name; }   main.cpp  #include <iostream> #include<string> #include "Template.hpp" using namespace std;  int main(int argc, const char * argv[]) {      //Error here      Temp<int,string>t1(10,"zaid");     t1.getName();     return 0; }   Error  Showing All Issues Undefined symbol: Temp<int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Temp(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


I'm writing a paper in LaTeX and want to include some figures from Matlab.  I have 2d plots and 3d surfaces to include.   Are there any guides to academic writing / published papers which show best practices of including Matlab-type figures? (Eg axis labeling, legends, angle of view for 3d surfaces) What's the best way to port my Matlab figures into LaTeX that'll allow me flexibility with axes, angle of view, etc. I can export as PDF to get the job done, but it looks quite amateur.

Which way of exporting Matlab graphics delivers the best result for inclusion in LaTeX? Is it possible to export scalable vector graphics, or even LaTeX graphics?


Is there a way to run Microsoft Office 2013 or 2014 on Ubuntu 14.04? Wine won't work.

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


I have numbers in cells in Excel. I want the numbers formatted so that if they have decimal places they show to a maximum of two, and if they have no decimal places it doesn't show any.  For example:  •   1 should be formatted as 1 NOT 1.00 •   0.75 should be formatted as .75 •   0.2 should be formatted as .2  •   0 should be formatted as 0   The closest custom format code I've come up with is 0.##. Unfortunately this formats 1.00 as 1. (note the extra decimal point).  How can I create a custom format code to remove the decimal point on cell values the report a full whole number?

I have numbers in cells in Excel. I want the numbers formatted so that if they have decimal places they show to a maximum of two, and if they have no decimal places it doesn't show any.  For example.    15 should be formatted as 15, NOT 15.00 14.3453453 should be formatted as 14.35 12.1 should be formatted as 12.1  0 should be formatted as 0   The closest custom format code I've come up with is 0.##. Unfortunately this formats 15.00 as 15. (note the extra decimal point).  To further complicate the issue, the spreadsheet is a result of an export from SQL Server Reporting Services. So no macros are possible. Oh well, it looks like 0.## is my best bet, and they can just live with the extra period.


I accidentally deleted my chrome browsing history. Is there anyway I can recover it?  I'm using Windows 7 Ultimate (2009)

I received a question from a co-worker recently about whether a manual delete of all browsing history, cookies, etc. from Google Chrome History can nevertheless be accessed by any software after the fact.  He came to me in confidence, afraid of what website browsing may be discovered by an advanced history search.  Any advice or knowledge on the topic?  Thanks in advance.


Is a temrinal emulator process a server?  If yes, what is its client(s)? How can I find out its client(s)? Thanks.   netstat output contains lxterminal processes. Does that mean that a terminal emulator process is a server based on unix domain socket?  $ sudo netstat -ap | grep -i lxterminal [sudo] password for t:  unix  2      [ ACC ]     STREAM     LISTENING     28665    1480/lxterminal      /run/user/1000/.lxterminal-socket-:0 unix  3      [ ]         STREAM     CONNECTED     28663    1480/lxterminal       unix  3      [ ]         STREAM     CONNECTED     28661    1480/lxterminal       unix  3      [ ]         STREAM     CONNECTED     28666    1480/lxterminal  A server is always (or usually?) a daemon, so it doesn't have a controlling terminal. lxterminal doesn't have one (?):  $ ps aux | grep -i lxterminal t         1480  0.1  0.3 473204 28232 ?        Sl   Nov21  22:39 lxterminal

Can you explain the following lines in the netstat output?  Active UNIX domain sockets (w/o servers) Proto RefCnt Flags       Type       State         I-Node   Path  unix  2      [ ]         STREAM     CONNECTED     37133819 /tmp/.lxterminal-socket:0-xralf unix  2      [ ]         STREAM     CONNECTED     37109191 /tmp/.lxterminal-socket:0-xralf


I have 53 MB of free storage on my internal Storage. But, still, when I am trying to re-install whatsapp messenger, (which is merely of 17.53 MB) after uninstalling it initially, it shows Insufficient Storage Space.  Specifications: Model Number : Micromax A58, Android Version : 4.2.2  What should I do to solve this memory problem?

Every time I go to install a new app, I get the message "Insufficient storage", and an unable to install anything!  I am using Samsung GT19060 my internal memory is 8GB. I have not downloaded anything but anytime I try to download something it will tell me low memory space.


I'm new to photography and would like to know a little more about zoom lens, The main thing I wonder about is this, I have a Fujifilm S4000 camera that claims to have 30x magnification.  The new camera I now own is a Nikon D60 with it's kit lenses (18-55) I was willing to get better lens to get a larger zoom range, and eventually reached 70-300mm lens made by Tamron ( Tamron AF70-300mm F/4-5.6 Di LD )  Now those lenses have a quite large range compared to what I have on my D60 right now, but when calculating the magnification ( 4.2x ) it's not even close to what the Fujifilm is offering.  So obviously I am missing something, or am I? Will I get more magnification with my D60 together with the 70-300 lens than the Fujifilm? Does the sensor size play a role here when it comes to that? and what else should I take into consideration when trying to compare the magnification between my cameras?  About the focus, what I was wondering about is the fact that some lens with big ranges like the 70-300 I stated above, claim to be "Macro" lenses, does that mean that they somehow have more focus range so that even if I zoom quite far I will be able to focus? I guess the question could be what would make zoom lens "Macro" lens?  Any info that would help me learn more would be much appreciated.

What is the rule to convert the 'mm' notation to the 'optical zoom' notation? I searched a bit and found this one:  optical zoom = maximum focal length / minimum focal length   For example a 18-55mm lens would have a 3x optical zoom, and a 18-200mm lens would have a 11x optical zoom. Is that right?


I am a bit confused by the definition of a $p$-adic group. I initially thought that a $p$-adic group was simply a group with $\mathbb{Q}_p$ as the underlying manifold, however this seems to be too vague, as I have seen definitions that mention Galois groups, local Archimedian fields, etc... I have also noticed that these groups seem closely related to typical Lie groups, like $GL_n ({\mathbb{R}})$. My question is, are $p$-adic groups also Lie groups? Also, does anyone know of a reputable textbook with a concise and self-contained definition of a $p$-adic group? Thanks

I saw the name $p$-adic group on a book I was reading, so I tried to find some related documents. Although I've found something on this topic, there is no definition.  Would anyone please explain the definition for a $p$-adic group to me? Thanks very much.


I remember reading a book back in the late 80s or early 90s about earth being invaded by aliens that looked a lot like insects.  I thought it was written by Gary Gygax but I can't figure out what they were called.  I think there were 3 books in the series.  The protagonist was a young man.   Sorry I can't remember any more than that.

Looking for a trilogy published around the early 80s.  Insect-like aliens are invading earth.  Humans' brains are placed in robotic bodies.  The protagonist is a child in one of these bodies.  He has to learn how to control the robot & conserve his battery power.  Once train, he can fight back against the aliens using heat-guns + physical attacks.    The aliens are landing/spawning on sites all over the globe.  Part of the plot is discovering a method to disrupt their staging points.  It was probably young-adult oriented.  If anyone remembers this, thank you.


I am very new to Linux so today I decided to get on it.I installed Ubuntu alongside Windows 8 that I use, everything on the installation went very smooth I left every option by default. I logged into Ubuntu and I wanted to access my Windows partitions that I had with Music,Movies,Games etc.. And I get this error when I try to open for example my " D:\ " :  Error mounting /dev/sda3 at /media/huntix/Shitz bro: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda3" "/media/huntix/Shitz bro"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Failed to mount '/dev/sda3': Operation not permitted The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option.

Whenever I boot Ubuntu, I get a message that it cannot mount my windows partition, and I can choose to either wait, skip or manually mount.  When I try to enter my Windows partition through Nautilus I get a message saying that this partition is hibernated and that I need to enter the file system and properly close it, something I have done with no problem so I don't know why this happens.    Here's my partition table, if any more data is needed please let me know.     Device Boot      Start         End      Blocks   Id  System /dev/sda1            2048    20000767     9999360   83  Linux /dev/sda2        20002814   478001151   228999169    5  Extended /dev/sda3   *   478001152   622532607    72265728    7  HPFS/NTFS/exFAT /dev/sda4       622532608   625141759     1304576   82  Linux swap / Solaris /dev/sda5        20002816   478001151   228999168   83  Linux


If accleration varies inversely with square of displacement then how can we find the time it takes to cover distance S?? My attempt I tried to use calculus  but didn't, work at all please help.

I have a background in calculus but don't really know anything about physics.  Forgive me if this is a really basic question.  The equation for distance of an accelerating object with constant acceleration is:  $$d=ut        +\frac{1}{2}at^2$$  which can also be expressed  $$d=\frac{\mathrm{d}x}{\mathrm{d}t}t+\frac{\mathrm{d^2}x}{\mathrm{d}t^2}\frac{t^2}{2}$$  (where x(t) is the position of the object at time t)  That's fine for a canonball or something like that, but what about a car accelerating from 0 to cruising speed?  The acceleration is obviously not constant, but what about the change in acceleration?  Is it constant?  I suspect not.  And then what about the change in the change of acceleration, etc. etc.?  In other words, how does one know how many additional terms to add in the series?  $$d=\frac{\mathrm{d}x}{\mathrm{d}t}t+\frac{\mathrm{d^2}x}{\mathrm{d}t^2}\frac{t^2}{2}+\frac{\mathrm{d^3}x}{\mathrm{d}t^3}\frac{t^3}{3}+\frac{\mathrm{d^4}x}{\mathrm{d}t^4}\frac{t^4}{4}\cdot etc. \cdot ?$$


the old problem searched many times but i still do not understand what i am doing wrong xD, this is my code:  `  package dev.codenmore.tilegame.worlds;  import dev.codenmore.tilegame.Utils; import dev.codenmore.tilegame.objects.Objects;  import java.awt.*;    public class World {  public class Object {      private int id = 0,                 x = 0,                 y = 0;     public Object(){      }      public void setId(int id) {         this.id = id;     }      public void setX(int x) {         this.x = x;     }      public void setY(int y) {         this.y = y;     } }  private int width, height; private int spawnX, spawnY; private int x, y, id, nr = 0; private Object[] objects;  public World(String path){     loadWorld(path); }  public void tick(){  }  public void render(Graphics g){     int i = 0;     for(; i <(width*height)/3; i++){         getObject(i).render(g, objects[i].x, objects[i].y);      } }  public Objects getObject(int i){     Objects o = Objects.objects[objects[i].id];     if(o == null)         return Objects.alpha;     return o; }  private void loadWorld(String path){     String file = Utils.loadFileAsString(path);     String[] tokens = file.split("\\s+");     width = Utils.parseInt(tokens[0]);     height = Utils.parseInt(tokens[1]);     spawnX = Utils.parseInt(tokens[2]);     spawnY = Utils.parseInt(tokens[3]);     objects = new Object[width*height/3];      for(int i = 4; i < width*height+3; i += 3){         id = Utils.parseInt(tokens[i]);         x = Utils.parseInt(tokens[i+1]);         y = Utils.parseInt(tokens[i+2]);          objects[nr].setId(id);         objects[nr].setX(x);         objects[nr].setY(y);         nr++;     }  }  }   ` the error occurs on line 64 when im trying to write data to my structure, which is telling me that am trying to write to empty memory but i dont know how to handle this on my own. Additional to that i have second question, is this the best way to do this ? i mean reading file and writing data to structure here is my file:  6 3 960 540 0 0 0 255 0 0 2 0 500 2 1620 500 1 0 790 255 0 0

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?


import math def hexToDec(hexi):     result = 0     for i in range(len(hexi)-1,-1,-1):         if hexi[i] == 'A':             result = result + (10 * math.pow(16,i))         elif hexi[i] == 'B':             result = result + (11 * math.pow(16,i))         elif hexi[i] == 'C':             result = result + (12 * math.pow(16,i))         elif hexi[i] == 'D':             result = result + (13 * math.pow(16,i))         elif hexi[i] == 'E':             result = result + (14 * math.pow(16,i))         elif hexi[i] == 'F':             result = result + (15 * math.pow(16,i))         else:             result = result + (int(hexi[i]) * math.pow(16,i))     return result   Even after reversing the range order and reimporting I still get the same results.

How do I convert a hex string to an int in Python?   I may have it as "0xffff" or just "ffff".


How can I obliterate a commit, but keep subsequent commits intact?  In this scenario, suppose I want to get rid of b but keep c.  $ git init $ for i in a b c; do date >$i; git add $i; git commit -m add-$i;done $ git log commit 39c976fa711b38d4c8161af9b6b4a9a91489d079 add-c commit 2913863926f8c3a3898a2763fe4384b6ca7227a0 add-b commit ff591ea43a84069e5effd28125b56243dc264336 add-a   doing a reset --hard will get rid of b, but also gets rid of c.  git reset --hard ff591e HEAD is now at ff591ea add-a   How can I perform this operation while keeping the add-c commit intact?

Suppose your git history looks like this:  1 2 3 4 5  1–5 are separate revisions. You need to remove 3 while still keeping 1, 2, 4 and 5. How can this be done?  Is there an efficient method when there are hundreds of revisions after the one to be deleted?


I am using Ubuntu 14.04  blkid= /dev/sda1: UUID="05cd7e6a-caf1-44bc-9900-92ec14c5ea34" TYPE="ext2"   /dev/sda5: UUID="J450yI-3go9-4Ps2-kdQm-lNH7-Go3J-FrvhOm" TYPE="LVM2_member" /dev/mapper/ubuntu--vg-root: UUID="9cd5d111-ec03-4298-803a-a65fdc8790ea" TYPE="ext4" /dev/sdb: LABEL="UDF Volume" TYPE="udf" /*This is Win 7 install*/   This is system monitor file system output:  Device                         Directory     Type  Total   Available /dev/mappper/ubuntu--vg-root   /             ext4  310.6GB 240.1GB /dev/sda1                      /boot         ext2  246.8MB 135.3MB /dev/sdb                       /media/name/udf     3.2GB   0 bytes   I would like to partition the first drive and install win 7 from sd card at /dev/sdb I am novice level, but am comfortable and competent to cut and paste into terminal. Open for suggestions for another method, no floppy drive but plenty of blank cd's and usb drives and sd card capacity.

I have Ubuntu on my laptop. Now I want install Windows 7 in a dual-boot. How can I do this? I can't lose my Ubuntu files, and I'm afraid that I might break . Go  for UEFI only!


At the end of , if the Omega is killed and the war won, why does Cage go to the camp to meet Rita? Is he not in the camp only because he was arrested?

In  William Cage is reliving the same day over and over again.   The time loop always starts with Cage waking up at Heathrow, after his meeting with the General.            But in his last jump he wakes up in the helicopter, en route to the General.                 (the images are from the trailer)  My Question:   Why did killing the "Omega" change the starting point of Cage's time jump? (I'm guessing the difference is only a couple of hours: Cage meets with the General, blackmails him, gets arrested and is transported to the military base at Heathrow)


I have some paragraphs in my html as an example, and when I click on it, the JQuery click activates correctly and executes de function. However, I have a button that adds new paragraphs to de body but the new ones do nothing on click and I don't know why:  My html body           <h1> Test </h1>         <input type="text" id="newP" value="New paragraph">         <button id="add"> Add </button>         <p> Paragraph 1 </p>         <p> Paragraph 2 </p>   My js file  $(document).ready(function(){  $("p").click(function(){     console.log("Hello");     this.remove(); }); $("#add").click(function(){     $("#add").after("<p> " + $("#newP").val() + "</p>"); }); });   The 2 example paragraphs delete correctly and shows "Hello" but de new ones don't. I want to do something more complicated than just deleting them so I need to know why the function isn't working for them. (I must use JQuery)

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


I am not a graphic design student but digital painiting intrigues me quite a lot. I have been watching online lessons of it and have finally decided to buy a pen tablet. I want to pursue digital painiting as a hobby.   Budget is not a constraint for me (owing to the hige price difference between Bamboo and Intuous) but I want to use the money effectively.  Which tablet would you suggest me to buy?

I do some caricature, cartoons and illustrations, as hobby. I believe that I am okay'ish with pen and paper, but recently decided to go digital.  Given my budget, and a quick assessment of needs and reviews of various graphic tablets, I am thinking of ordering the Wacom Bamboo One CTE 660 Pen Tablet which as per specs is a wide-format 8.5"x5.5" entry-level tablet.  During my research I've found that I could potentially use it with Inkscape, since I am not in a position to make an investment in professional software. Although I am not aware of the real potential of Inkscape for my purpose. I think I can mostly make-do with vector-graphics, and occasionally embed bit-maps (s.a. for scene background).  My question is -   Since the table is of a particular size, which is roughly half or sometimes even a quarter of the paper size I use normally, would the experience be very different ? Given that I'd be using vector graphics, can I assume that "free-hand drawn" images will scale-up nicely? What are the other "free" (as in beer) alternatives for my purpose/use-case? Ideally, I'd prefer something that is not very resource hungry, as my PC isn't very powerful (yeah, living with a lot of constraints!).   Edit:  Finally I went ahead and got myself a Wacom Bamboo One 'Medium' (6x9) tablet. It is the entry-level product, but based on my first day experience, I think it is quite nice. I wasn't expecting anything pro-grade, but it seems to be pretty adequate. Build quality seems reassuring (i.e. not cheap, flaky plastic), is quite sleek, and pretty responsive. It worked out of the box. Without drivers, on Win 7, it worked as a mouse right-away. Worked in MS-Paint as expected (as a pen). On installing drivers and software, I got pressure-sensitivity and something called Bamboo-dock. It seems like a Widget-container, i.e. you can download applications online... pretty much the same crop that you see on Firefox, Opera, Chrome -- but seemingly hand-picked, and pretty relevant to usage with a pen. I like SumoPaint, which I've used before, and is not bad for decent drawings / illustrations.  Getting used to Pen, as a navigation / desktop-pointer tool, takes some getting used to. I think touch-phones and touch-pads have already mentally tuned us to direct pointing, but those devices have the display and touch-sensor aligned. When you are using the display and touch disjointed, it feels a bit odd, but not bad.  Thanks all for your comments.


I'm getting the following error on running sudo apt-get update :  sudo apt-get update                                                                 Get:1 http://dl.google.com stable InRelease 100% [1 InRelease gpgv 3,435 B] [Connecting to in.archive.ubuntu.com] [ConnectiSplitting up /var/lib/apt/lists/partial/dl.google.com_linux_talkplugin_deb_dists_stable_InReleaseIgn http://dl.google.com stable InRelease                                       E: GPG error: http://dl.google.com stable InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)   I tried:  $ cd /var/lib/apt $ sudo mv lists lists.old $ sudo mkdir -p lists/partial $ sudo apt-get update   But still getting the same error. Never faced this problem before. I was trying to install texlive-full and ran out of space during installation, apt-get install wasn't working then and gave the following output:  E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.   As per the answer here:  I tried:  cd /var/lib/dpkg/updates sudo rm * sudo apt-get update   And then this error occured. Now apt-get install is working fine but update isn't working. What is the solution?

I can use my mobile broadband to access Internet with Firefox but when I want to install any package from terminal or make 'apt-get update' command I got the following error:  got 'NODATA' (does the network require authentication?)   apt-get update output:  Get:1 extras.ubuntu.com trusty InRelease [213 B] 98% [1 InRelease gpgv 213 B] [Connecting to archive.ubuntu.com] Splitting up /var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_InRelease into data Ign extras.ubuntu.com trusty InRelease E: GPG error: extras.ubuntu.com trusty InRelease: Clearsigned file isn't valid, got 'NODATA' (does the network require authentication?)    output of `cat /var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_trusty_InRelease  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>404</title> <meta http-equiv="Cache-Control" content="no-cache"/> </head> <body> <p> Not Found </p> </body> </html>   output of wget:  wget -O - http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease  --2014-06-01 09:23:35--  http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease Resolving extras.ubuntu.com (extras.ubuntu.com)... 91.189.92.152 Connecting to extras.ubuntu.com (extras.ubuntu.com)|91.189.92.152|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 213 [text/html] Saving to: ‘STDOUT’   0% [                                       ] 0           --.-K/s              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>404</title> <meta http-equiv="Cache-Control" content="no-cache"/> </head> <body> <p> Not Found  </p> </body> </html>


Which is preferred usage:  The performance features Twain giving an overview of his life up till 1896, ...  -or:  The performance features Twain giving an overview of his life up until 1896, ...  I thought it was "until" but I recently saw "till" in print, so am not sure which is preferred.

What is the difference between till and until?    When to use till or until? Please explain with examples.


Situation A sorcerer in my party wants to use the cantrip "Lightning Lure" to pull a creature that isn't capable of flying into the sky while concentrating on the "Fly" spell. He uses his Metamagic "Quickened Spell" to cast "Lightning Lure" as a bonus action. The creature that isn't capable of flying fails its saving throw and is pulled 10 feet towards the sorcerer. So far so good, but right after that he wants to use his action to cast the cantrip "shocking grasp" during the same turn.  Question Does the creature that isn't capable of flying instantly fall in the described situation, making a melee spell attack impossible? (even though it's all happening within the same players turn) Or is the sorcerer in question able to cast his "Shocking Grasp" on the enemy just pulled with "Lightning Lure"?

Situation:  Alice the Aarakokra sees Bob the Battlemaster coming. She ascends to 605', just out of the 600' range of Bob's longbow.  Bob (Str 14) performs a running high jump 5' into the air and successfully hits Alice with his longbow, despite firing at disadvantage for long range. He spends one of his maneuver dice to perform the Trip Attack maneuver, and succeeds on the contested roll to knock Alice prone.  Alice is now flying and prone, so she falls. Falling does 1d6 bludgeoning damage per 10' fallen, to a maximum of 20d6.  Questions:   When does Alice start falling? It is on Bob's turn as soon as she's knocked prone, or some time else such as the beginning of her own next turn? When does Alice hit the ground? On Bob's turn as soon as she's knocked prone, or some time else?   These answers determine whether anyone can save Alice from her 20d6 of certain doom.   Is a reaction (e.g. casting Feather Fall) on Bob's turn the only hope? Can Alice's ally Charlie swoop in on his subsequent turn within the same round to catch her? Can Alice spend half her movement on her next turn to "stand from prone" and pull out of her involuntary dive? If Alice had expected to be shot down, could she have spent an action to be Ready to "stand from prone" while moving through Bob's airspace?


The code below represents one method of writing the program  using list comprehension and generators. comp = (num for num in range(2000, 3201) if num % 7 == 0 and num % 5 != 0)  print(comp) for item in comp:     print(item, end =", ")  This is another way of doing it, using again both list comprehension and generators, however this time, the code makes use of the * symbol inside of the print function. print(* (i for i in range(2000, 3201) if i % 7 == 0 and i % 5 != 0), sep=", ")  What is the reasoning behind * being used here, given that without it, iterating over the generator would be impossible.

In the following method definitions, what does the * and ** do for param2?  def foo(param1, *param2): def bar(param1, **param2):


//turns a string of integers into an int[] array // reversed is the name of the string of integers  Here is the code:      public int[] makeintArray(){           intArray = new int[reversed.length()];           for (int i = 0; i < reversed.length(); i++){               intArray[i] = reversed.charAt(i) - 48;               System.out.println("int " + i + " is " + intArray[i]);   }   System.out.println("IntArray is: " + intArray);   return intArray;   }  //Whenever I run this I get the integer array returned as "cf814a82@I[" rather than [3, 3, 8, 2, 3, 8, 2, 8]

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


When editing a post, you've got a markdown edit area, then some kind of preview packed below. If the post happens to be long - and actually about a few tens of lines make it long - it becomes impossible to see both what you are editing and the rendering, as scrolling the preview does remove the markdown from your sight.  This is I think a feature request: is it possible to have at least the preview scroll on its own? Or better, have it scroll on its own and focus at the very point we've just made some modification?  Or is it a problem with my browser? Or did I not search the site with adequate keywords?

When writing a long post, if you want to check the output as you go along, you have to keep scrolling down and then back up to see the preview of the output.  Which gets annoying after a post gets long enough.  I imagine on Math or other sites where there is a lot of rendered output this is an even bigger annoyance.  Is it possible to give the preview box a standard size, which could be elongated at the bottom, and able to be scrolled, just like the box I'm typing in right now?  That way, I could position my window so that the editing box and the preview box are both in full view at the position that I am currently working on.


I'm using Ubuntu Server (16.04) with "unattended-upgrades", and I've set everything in order to receive notification emails when this packages does its thing. Now I want to change the notification content for edit the text so I can add some data to it or make some text bold (examples given).  Where can I find the notification "template"?

I've recently built a server using 14.04.1 LTS, I wanted a very quick and simple way for it to let me know if, for example, it needed a system restart after installing upgrades.  I decided e-mail was the best option.  I've installed, configured and tested ssmtp to use one of my usual e-mail services.  Also, I've configured unattended-upgrade to e-mail me after any upgrades, at least initially.  Can I get the unattended-upgrade e-mail to come from a specific address?  I know I can do that using just mail or ssmtp directly but if I don't specify a "from" address then it defaults to my mail service's default account and I want it to be clear it came from this particular machine.  Where can I specify a "from" address for the mail command that unattended-upgrade uses?


I've created a webapp for a website with Chromium. The problem is that the icon it's a small size one and it doesn't look nice. How can I change the icon with one created by me?

So I've got the AskUbuntu chatroom (I'm just using this as an example, I've got other webapps that I've got the same issue with) saved as a "Application Shortcut" in Chromium, and the icon is really (And I mean really) low resolution. Example:    The top one is the default icon that's used for the Application Shortcut, the bottom is the AskUbuntu lens - so my question is, how can I use the icon that's used for the AskUbuntu lens.


I have started learning JSF recently I'm working on a JSF page along with a managed bean. now I'm trying to attach ajax functionality to my code but I'm facing a problem of null pointer exception. This is my index.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <h:head>   <title>Student Registration Form</title> </h:head>  <h:body>
Please enter user name and password
          <h:form prependId="false">         Username: <h:inputText id="username" value="#{student.username}" />

                  Password: <h:inputSecret id="password" value="#{student.password}" />

                  <h:commandButton value="Login">             <f:ajax execute="username password" render="out" />         </h:commandButton>                  <h:outputText id="out" value="#{student.greeting}"/>                       </h:form>  </h:body>    This is the Java code for the bean class package com.ahmed.jsf.Studen_Registration;  import javax.faces.bean.ManagedBean;  @ManagedBean public class Student {          private String username, Password;          public Student() {}      public String getUsername() {         return username;     }      public void setUsername(String username) {         this.username = username;     }      public String getPassword() {         return Password;     }      public void setPassword(String username) {         this.Password = username;     }     public String getGreeting() {         if(username.length() == 0) return "";         else return "Welcome to JSF 2.0 + AJAX" + username + "!";     } }  everything was working before adding the getGreeting function and the stacktrace states that the NullPointerException is coming from the getGreeting function

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?


According to a comment on the question , it's okay to formulate a question on a Meta site. I asked the question  but it got a score of -9. Somebody asked the question  except that it was about whether an already existing question should remain. I also once saw a question on Mathematics Educators Stack Exchange that was moved from its Meta site, that I can no longer find.  It seems that some people can find a way of formulating a question on a Meta site that gets accepted by other people. How can I learn how to do that? I'm not an expert in anything. I'm wondering if I just don't have enough of the right knowledge and experience to have any hope of that. According to kcrisman's answer to my question at , sometimes a question is not well accepted because there aren't enough users who have the skills to answer it. Do you think that maybe the same goes for some of the questions for formulating a question?  I know it appears to be promoting my own questions but what am I supposed to do? Of all the questions about a question that there are, it's so much easier for me to track down the ones that were either asked by me or were about one I asked. Other people don't seem to be having a problem with my question  even though it seems to be promoting my own questions.  I know that if I didn't believe the question  or the question  were worthy of asking, it would work better not to ask them even though I would have less information from which I could make this question more useful. Maybe I made a mistake asking the one at  but now that I asked it, I might as well refer to it. If I had a real good point to make in this question, I probably could have made it some other way by asking a totally different question. Maybe I wouldn't have thought of it but maybe after enough time of trying things and making mistakes, I will become so much better at thinking of things.

This is that type of question, but it's fundamental.  Information on Meta Stack Exchange states I can ask anything related to the Stack Exchange websites, its communities and some other stuff, but I have questions such as this about just asking questions which is not directly connected to Stack Exchange.  The FAQ doesn't satisfy me completely. Where were the FAQ asked? Was it here?  If this question is legitimate (Not the greatest questions you've seen... I know) in the Meta Stack Exchange community then I can be more specific. I'm new to this and just trying to get to know how and what I ask in here.


I tried to install Code::Blocks by following this answer, but I cannot install the application:

I am using 64-bit Ubuntu and I want to install the Code::Blocks IDE. Is there any repository?


Show that if $AB = BA$, then  $$\exp(A) \exp(B) = \exp(B) \exp(A)$$  here is what i got so far: $$\begin{align}\exp(A) \exp(B) &= (I + A + {\dfrac{1}{2}} A^2 + {\dfrac{1}{6}}A^3 + \ldots)(I + B + {\frac{1}{2}}B^2 + {\frac{1}{6}}B^3 + \ldots )\\ &= I + (A + B) + {\frac{1}{2}}(A^2 + 2AB + B^2) + {\frac{1}{6}}(A^3 + 3A^2 B + 3AB^2  +  B^3 ) + \ldots\\  &= I + (A + B) + {\frac{1}{2}}(A + B)^2 + {\frac{1}{6}}(A + B)^3 + \ldots \end{align}$$  am i going the right direction so far...if so, how to get to show the rest until $\exp(B)\exp(A)$.  Thank you

I am working on the following problem. Let $e^{Mt} = \sum\limits_{k=0}^{\infty} \frac{M^k t^k}{k!}$ where $M$ is an $n\times n$ matrix. Now prove that $$e^{(M+N)}   = e^{M}e^N$$ given that $MN=NM$, ie $M$ and $N$ commute.  Now the left hand side of the desired equality is $$e^{(M+N)} = I+ (M+N) + \frac{(M+N)^2}{2!} + \frac{(M+N)^3}{3!} + \ldots $$  On the right hand side of the equation we have $$e^Me^N = \left(I + M + \frac{M^2}{2!}   + \frac{M^3}{3!}\ldots\right)      \left(I + N + \frac{N^2}{2!}   +   \frac{N^3}{3!} \ldots\right)   $$ Now basically this is as far as I got... I am unsure on how to work out the product of the two infinite sums. Possibly I need to expand the powers on the left hand side expression but I am unsure how to do this in an infinite sum... If anyone could give me an answer or a hint that can help me forward I would greatly appreciate it. Thanks


I'm working on a bash script tied to /etc/profile but instead of appending, I accidentally wrote over it, losing all its contents. How can I restore the file?

I'm working on a bash script that appends to /etc/profile but instead of appending, I accidentally wrote over it, losing all of its content. How can I restore the file?  I did search here but being new to Ubuntu, I don't know if the posted /etc/profile content I see in other questions is the default content.


I cannot change the parent user shown in my chat profile. I've deleted my GL&U account a few months ago, then people get the 404 error when trying to see my profile. When I click on change, this is what I get:

There a  who has no valid parent user. It is indicated that his chat account is associated to a Maths.SE account, which does not appear to exist. The user was still able to chat. Is it normal? If it's a bug, could someone look into it?  Edit: if you browse the Google cache for users named Skullpatrol, it turns out a single series of associated accounts. The user is now named . I don't know what went wrong, maybe an account merge or something like that, but it needs someone from staff looking into it with some superpowers. I also tried to update the parent user of the chat account to this "Rob" profile, but the interface goes all buggy on me (works for other users, fails only for this one):


The markdown >! a  >! b  >! c  Will be shown as a blockquote with ! in front of it:   a    b    c  Instead of a spoiler for 3 paragraphs (or 3 spoiler blocks, whatever).

While trying to assist with the formatting of a , I discovered there's not a lot of parity between how spoilers and quote blocks (which are superficially quite similar) handle nested Markdown formatting.  (Simple HTML works fine.)  For example, here's a variety of typical Markdown nested inside a quote block:     heading            paragraph  code block          nested         list                 even nested quotes!               with nested nested formatting!           Aside from the code and quote blocks not standing out due to matching background colors, everything works exactly as expected.  Sadly, the same is very much not true for spoilers:      ### heading   ---   paragraph       code block   - nested  1. list   > even nested quotes!  >  > - with nested nested formatting!   Eek!  Any chance of changing spoilers to act more like quotes?  Needing complex formatting in spoilers isn't a terribly common scenario, but when you do, the inconsistency is jarring and a bit frustrating.


I went over to the , filtered by "unclear what you're asking".  Instead I got to  voted as duplicate. With 2 votes only on duplicate.    I thought it was a one-off thing, but the next one it pulled up one for Too broad.    Just to make things clear -   these weren't audit reviews there weren't any flag votes from users who don't have 3k rep with flag close reason being other than what's selected as filter(ex: the duplicate/too broad posts didn't have "unclear what you're asking" flags so as to be picked in the review queue - I'm a Community Moderator at Super User so I can see the flags being applied on a post)

When browsing questions for a given tag, a review indicator has recently started showing up that links to the open review tasks for that tag.  For example, this is what I see when viewing :    The number 187 in the screenshot above would link to    However, clicking on that often opens review tasks that do not have the tag in question.  For example, it opened the following on successive attempts:   (c)   (java)  It seems that the filters are broken.  A sample screenshot (note the mention of the filter on the review page):


I want to read the memory map (/proc/PID/maps) of some process without being sudo. And that is trivial, unless, the process has capabilities. See what I mean: If I run: $ bash $ cat /proc/$$/maps  This works and I get the output! But if I run: sudo setcap "cap_net_raw+p" /bin/bash  And try the test case again: $ bash $ cat /proc/$$/maps  I get: cat: /proc/1151842/maps: Permission denied  I hope this is understandable. Thanks for your help

I observed the following phenomenon that I can not explain. After adding the CAP_SYS_ADMIN capability, unshare is no longer able to write to /proc/self/setgroups.   In fact, writing to this file requires the capability, but that is achieved by changing the user namespace. So why does adding the capability to the parent process prevents writing to this file?  me@myhost:~$ unshare -r root@myhost:~# exit logout  me@myhost:~$ sudo setcap cap_sys_admin=ep /usr/bin/unshare me@myhost:~$ unshare -r unshare: cannot open /proc/self/setgroups: Permission denied  me@myhost:~$ sudo setcap cap_sys_admin= /usr/bin/unshare me@myhost:~$ unshare -r root@myhost:~#   By the way: I am running Ubuntu 16.04.4 LTS with kernel version 4.4 and the version of util-linux (including unshare) is 2.27.1.


Wine allergy is my problem... not alcohol. I am also allergic to grapes, apples and cherries. Many recipes call for wine... what can I substitute?

If someone cannot or will not use wine for cooking, what would be a good substitute?   Question applies to both red and white wine.


I want to install amd graphic driver . I using ubuntu 20.04 . when i press install button , i get an error . please help me .    I will check this post every 2 minutes because I am getting tired of linux and I searching for a solution. please help me .

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


I'm downloading Mavericks on my Lion, but I don't know how to see the progress. When I go to the purchases tab on the app store, I see a blank button:

I've been try to download Xcode for work, but for some reason the Mac App Store is giving me a bit of trouble. Activity monitor shows some network usage, but in Launchpad it seems the download isn't moving.   When I go to the purchases panel of the Mac App Store, I see this.     No status, no pause button, in fact - the button has no text on it! I've tried restarting the App Store, restarting my computer, even removing the com.apple.appstore folder in /var/folders but alas, no luck.  Can anyone diagnose the issue? When I removed com.apple.appstore, Xcode still showed up on Launchpad, and clicking on it did nothing - it was frozen in time. So can I kill off this partial download and start new?


I remember this as a short film I saw in elementary school.  On some planet somewhere, or some future world, the sky is permanently overcast. There are all these kids, like in a school, but with (as I remember it) zero supervision. A girl who believes that the sun exists and will shine one day, is mocked and tormented by her classmates who know better. There's no such thing as the sun, they tell her.  They lock her in a... room of some type. And they're running around outside playing while she's curled up and crying in the room.  Suddenly the clouds part and the sun! there it is! shining down! And all the kids are amazed and happy and laughing!  And the girl in the... room... (and this is the only part I remember visually) sees a beam of sunlight coming through the crack of the door and holds her hand out into the beam of sunlight and smiles.  What is this I'm remembering???

I read this short story about 20 years ago, and I'd love to find the title and author. This is what I can recall about the story:   It takes place in a classroom full of kids (around 10 years old?) The planet always gets rain The kids lock the main character (a girl, I think) in the closet during the very rare occurrence of sunlight and she misses the entire event.    I know it's not much to go on, but I hope it rings a bell for someone!


I have a directory. It is empty. If i perform ls -lrt , it shows total 0  How do I specify an If condition to perform something, only if the directory is empty. I mean to ask how to capture that 0 value.

From a shell script, how do I check if a directory contains files?  Something similar to this  if [ -e /some/dir/* ]; then echo "huzzah"; fi;   but which works if the directory contains one or several files (the above one only works with exactly 0 or 1 files).


Good day ... working as a developer made me change my theme regularly, day and night, i have 2 themes "Light & Dark". i made a bash script to change the gtk-theme and shell-theme from cli, it works fine. However, when I issued the script via crontab, it fails to work and reports failure connecting to display and Dbus issues  here is my crontab    * *   *   *   *    DISPLAY=:0.0 /home/newton/scripts/dark-mode.sh   and here is my script  #!/bin/bash export DISPLAY=:0.0 export WAYLAND_DISPLAY=wayland-0  /usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Vimix-Dark-Laptop-Ruby'  /usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Vimix-Dark-Laptop-Ruby'    Please help me solve this issue, i think it will be helpful to lots of people. Regards Mohammed Gritli

I'm trying to change my wallpaper to a random image using Indrajith Indraprastham's suggested script here:    When I run the script from a terminal window, the bg changes just fine, but when it's run from cron, I'm mailed this error:     (process:21901): dconf-WARNING **: failed to commit changes to dconf: Error spawning command line 'dbus-launch --autolaunch=00216c114dcf433c9bb9009985d607d6 --binary-syntax --close-stderr': Child process exited with code 1   I would appreciate any suggestions.


A word for a choice that is made by someone to his advantage, but somewhat against his principles. Begins with 'co' I think. Not 'pragmatic'. More a suggestion  of manipulation, deviousness, slightly cynical, compromising for gain.

I am looking for an adjective akin to "loyal" and "disloyal" in that it describes someone's exact null association with both words. Someone or something with no allegiances whatsoever, a goes-with-the-highest-bidder kind of person. Someone or something that can be the perfect model companion or machine or tool or concept, and then without warning he/she/it may whimsically and deliberately, yet completely uncomprehendingly, do something utterly devastating or infuriating to you, and have no idea that you may have considered it wrong, or even may have legitimately believed they were going out of their way to act in your favor.  Benevolent, though perhaps unwittingly and unpredictably deleterious.  The words I am looking for are not these: "non-partisan", "ambivalent", "apathetic".


As a beginner, I will ask a question from a beginner. And I am a little bit lost with Latex packages documentation since there is, well, a lot of text ! (I prefer figures).  I read in Koma-Script manual this:     But often these floating environments are slightly misunderstood by beginners. They often ask for a fixed position of a table or figure within the text.   I need to write course materials (but not a book) with a lot figures and images and maths formulas. I would like to position the figures in the order and as close as possible from the text that reference them.  Having an image at the top or at the bottom of the page is sometimes not correct for me.  I tried to do this:  \documentclass[fontsize=12,a4paper,twoside,headheight=0.5cm,headsepline]{scrreprt} \usepackage[T1]{fontenc} \usepackage[bottom=2cm,footskip=15mm]{geometry} \usepackage{scrlayer-scrpage} \usepackage[utf8]{inputenc} \usepackage[frenchb]{babel} \usepackage{lipsum} \usepackage{a4} \title{Trying to Latexize my materials}  \KOMAoptions{BCOR=2mm,DIV=22}  \usepackage{eso-pic} \usepackage{graphicx} \usepackage{geometry,color,float}  \AddToShipoutPictureBG{%     \AtPageUpperLeft{         \put(10,-10){%             \raisebox{-\height}{\includegraphics[width=2cm]{example-image-c}}         }     } }  \usepackage{mwe} % for blindtext and example-image-a in example \usepackage{wrapfig} %not KOMA: is it compatible ?  \pagestyle{scrheadings} \cfoot{Le pied de page} \rehead{En haut à droite pair} \rohead{En haut à droite impair} \cehead{centre pair} \cohead{centre impair}   \begin{document} \maketitle \chapter{Starting} \section{My first section} \subsection{a subsection: introduction} This is my first \LaTeX document !   \begin{figure}[th]         \centering         \includegraphics[width=300pt]{example-image-a}         \caption{capt} \end{figure}   \lipsum[2] \subsection{an image in this section} There is an image below I want to comment now.  \begin{wrapfigure}{l}{0.5\textwidth} \centering \includegraphics[width=.98\linewidth]{example-image-a} \caption{A caption} \end{wrapfigure}  \lipsum[4]  \subsection{another image in this section} And another one here  \begin{wrapfigure}{r}{0.5\textwidth} \centering \includegraphics[width=.98\linewidth]{example-image-b} \caption{A caption} \end{wrapfigure}  \lipsum[6] \fbox{\begin{minipage}{0.9\textwidth}      ''text'' \end{minipage}}  \end{document}   But as you can see in document which is  (to download the document follow the link and then click the download button, do not right-click then "Save target as...").  the second A image is misplaced at the bottom (as well as the following text). And I don't want the second A image (left placed) to be so close to the bottom. I don't want neither the 1.1.3 subsubsection to be shifted to the right like this. I would like the paragraph to be wrapped and the the 1.1.3 section to be left justified.  I am less interested in a perfect typographic layout than in a technical documentation layout with, sometimes, more text (I have 30% text, 70% figures/tables/images).  What is a good way to do this using KOMA-script ? Or am I on a wrong path and should I change my way of writing it ?  My target type of document can be found here .

How to influence the position of float environments like figure and table in LaTeX?   This is a general question and should collect useful answers for all users. I hope we can use this as a reference


I usually save movies in the Movies folder of my Galaxy S5 to view them in my VLC app.  Turns out that the movies also appear in the Gallery app. I would really rather have the Gallery app only display images captured by the camera, rather than my movie media files.  Is it possible to limit the Gallery app to simply search the DCIM folder rather than the Movies folder as well? I suspect not - but then, is it possible to isolate my movies so they can only be found by VLC and not Gallery?

I'm enjoying Bejeweled 2, but don't want the 'backdrops', 'fonts', and multiple 'images*' folders in the Gallery. They're a pain to wade through when I'm trying to see my own pics.  Is there any way to remove them?  I've Googled a bit, but have only found other people complaining about the issue--no real solutions.


I'm currently designing a self-powered PCB with a STM32L432KCU6 and USB. After having done some research, it seems that it is necessary to connect the VBUS pin for detection purposes. However, is it also needed if I want not to use the detection feature? I would prefer establishing the USB connection by clicking on a button instead of automatically establishing it when VBUS is sensed.  I'm sorry if this is a trivial question, but I don't have much experience with USB so far.         – Schematic created using

A self-powered USB peripheral provides its own power, so is it okay to connect just D+, D- and GND to the host port, or do you always have to connect +5V as well, then wait for the negotiation phase for the device to tell the host that it is self-powered and therefore doesn't want any power, thank you very much?  The specific peripheral I'm looking at is based on an FTDI FT4232H USB-to-serial adapter, but I'm really hoping for a generic answer to the question.


I'm trying to find a way to validate an email address using CakePHP 1.2 without a model.  Can this be done?  If so, how can I validate an email address with CakePHP 1.2 without a model?  Thanks!

I have come across this .  Has anyone tried anything similar or does it work for you? Can you tell if an email customer / user enters is correct & exists?


I'm using JS as a way of changing the content of an SPA I'm creating. When I press a button to change the content the HTML changes from this:
   to this:
   Now part of my SPA has a div that contains a number of checkboxes, each representing a div, and so when I press the submit button, the next div that should be displayed will be the first item in the checkbox list that was selected.  I'm wondering if there's a way in JQuery for the code to "almost detect" which div is now visible. something like this:  if($('#selectDiv').isVisible()){     //JS code associated with this div. }   Any suggestions?

Is it possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle()?  How would you test if an element is visible or hidden?


I am trying to forward declare a bunch of template functions, which are present in the header file SelectionSort.h trying to learn about the working of function pointers. I tried reading this  still not sure how it fits my problem Here are the files - SelectionSort.h #ifndef SELECTIONSORT_H #define SELECTIONSORT_H  template<typename T, size_t N> void selection_sort(T (&arr)[N], bool (*comparer_func)(T, T));  template<typename T> bool ascending_comparer(T, T);  template<typename T> bool descending_comparer(T, T);  template<typename T, size_t N> void print_array(const T (&arr)[N]); #endif  SelectionSort.cpp #include <algorithm> #include <iostream> #include "SelectionSort.h"  template<typename T> bool ascending_comparer(T x, T y) {     return x > y; }  template<typename T> bool descending_comparer(T x, T y) {     return x < y; }  template<typename T, size_t N> void selection_sort(T (&arr)[N], bool (*comparer_func)(T, T)) {     for (size_t i = 0; i < N - 1; i++)     {         size_t smallest = i;         for (size_t j = i + 1; j < N; j++)         {             if (comparer_func(arr[smallest], arr[j]))             {                 smallest = j;             }         }          if (smallest != i)         {             std::swap<T>(arr[i], arr[smallest]);         }     } }  template<typename T, size_t N> void print_array(const T (&arr)[N]) {     for (const auto& item : arr)     {         std::cout << item << " ";     }     std::cout << std::endl; }  main.cpp #include <iostream> #include <iterator> #include "SelectionSort.h"  int main(int argc, char** argv) {     int arr[] = { 5, 4, 3, 2, 1, 0, -1 };     constexpr size_t len = std::size(arr);      selection_sort<int, len>(arr, ascending_comparer);     print_array<int, len>(arr);      return 0; }  So I am getting the linker error LNK2019 only when I try to forward reference them via a header file but it compiles successfully without any error too, not sure what is wrong here - 1>FunctionPointers.obj : error LNK2019: unresolved external symbol "void __cdecl selection_sort<int,7>(int (&)[7],bool (__cdecl*)(int,int))" (??$selection_sort@H$06@@YAXAAY06HP6A_NHH@Z@Z) referenced in function _main 1>FunctionPointers.obj : error LNK2019: unresolved external symbol "bool __cdecl ascending_comparer<int>(int,int)" (??$ascending_comparer@H@@YA_NHH@Z) referenced in function _main 1>FunctionPointers.obj : error LNK2019: unresolved external symbol "void __cdecl print_array<int,7>(int const (&)[7])" (??$print_array@H$06@@YAXAAY06$$CBH@Z) referenced in function _main  The above solution works if I straightaway copy the contents of SelectionSort.cpp into main.cpp. Any ideas for obvious mistakes I am making?

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


If one has a PhD in a similar field and goes apply for a Master's, will that hurt his/her chance of getting accepted? In the Statement of objectives, one can argue for some slight nuances between the PhD obtained and the desired Master's. Other reasons could be that the Master's school is a top school or wanting to move to the area the Master's is located in.

If a STEM PhD holder applies for a Master's in another STEM major, would this be an advantage or disadvantage in the eye of the admission committee?


My Stackoverflow rep for today is 155 but the Achievements drop down in top bar says 140. So, my total rep is messed up. I am 15 rep short. What could cause this error?  NOTE : The answer acceptance points for the question Syntax Explanation for end keyword are missing from Achievements + Total Rep score.

I've made 30 points on  today.   But this reputation is not showing up in the Achievements dropdown: accessible by clicking the icon to the right of the Inbox button.  My reputation counter is OK though.  Following the +2 on this question, I can see the +10 reputation for meta, but not the points for SO.


How many functions one-to-one  $\phi$  from $\{1,2,3,4,5,\}$ to $\{1,2,3,4,5\}$ such that $\phi(i)\neq i$ for $i=1,2,3,4,5$  my attempt:   the number of one-to-one functions  $\phi$  from $\{1,2,3,4,5,\}$ to $\{1,2,3,4,5\}$ is 5!=120  and given condition is  $\phi(i)\neq i$ for $i=1,2,3,4,5$ so these are 5  so number of one-to-one functions are   $\phi$  from $\{1,2,3,4,5,\}$ to $\{1,2,3,4,5\}$ such that $\phi(i)\neq i$ for $i=1,2,3,4,5$  =120-5=55  is i am right

I am trying to figure out how many permutations exist in a set where none of the numbers equal their own position in the set; for example, $3,1,5,2,4$ is an acceptable permutation where $3,1,2,4,5$ is not because 5 is in position 5.  I know that the number of total permutations is $n!$. Is there a formula for how many are acceptable given the case that no position holds its own number?


Suppose $\theta$ is a Uniform random variable on [0, 2$\pi$]. Let $X$ be $cos(\theta)$ and $Y$ be $sin(\theta)$. We have to show that $X$ and $Y$ are uncorrelated but not independent.  My solution:  $f_{\theta}(\theta) = \frac{1}{2\pi} $ ,    $0 < \theta < 2\pi$  Using LOTUS,  $E[X] = E[cos(\theta)] = \int_{0}^{2\pi} cos(\theta)\frac{1}{2\pi}d\theta$ = $0$  Similarly,   $E[Y] = E[sin(\theta)] = \int_{0}^{2\pi} sin(\theta)\frac{1}{2\pi}d\theta$ = $0$  $XY$ = $\frac{sin(2\theta)}{2}$. Therefore,  $E[XY] = \int_{0}^{2\pi} \frac{sin(2\theta)}{2}\frac{1}{2\pi}d\theta$ = $0$  Therefore $Cov(X,Y) = E[XY] - E[X]E[Y]$ = 0.  Correlation $\rho$ = $0$.  My question is:  Since $E[XY] = E[X]E[Y] (0 = 0 \cdot 0)$, wouldn't it also mean that they are independent. What am I doing wrong here?

Let $Z$ be a random uniformly distributed variable on $[0,1]$. Show that the random variables $X = \sin 2\pi Z$ and $Y = \cos 2\pi Z$ are not independent, but nevertheless Cov$[X,Y]=0$.  This is a homework assignment, but I'm a bit stuck.  My thoughts  We can see that $X$ and $Y$ are not independent, since both depend on $Z$. If we want to show this explicitly, then we need to show that $$f_{X,Y}(a,b) \neq f_X(a)\;f_Y(b),$$ where $f_{X,Y}(a,b)$ is the joint probability distribution function. But how can I find the (joint) probability distribution function(s) $f_X, f_Y$ and $f_{X,Y}$?   If I can find these functions, I can also solve the covariance problem. Is this the right way? Or is there a 'better' way to solve this problem?


I have checked far and wide for a fix for this. But to no avail. Nothing seems to work. I am trying to locate a Username and Password box to enter in the information. But it comes up with the error   selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="userName"]"}   I have tried to find using id but still no luck.Any ideas?  username_box = bot.driver.find_element_by_xpath('//*[@id="userName"]')   This is the inspect element  <input class="userNameField" maxlength="255" id="userName" name="userName" type="text">

When you are writing Selenium/WebDriver automation scripts you will probably run into the exception NoSuchElementException. You think your selector is working, but somehow the element cannot be found.  What strategy should I take to analyse different reasons that this might be the case?   What should I research and how? Good answers would contain example situations and how to resolve them. (e.g. verify selectors, frames, waiting, etc)


When a random variable $X$ is discrete, the definition of conditional expectation of $X$ with respect to a decomposition $\mathscr D$ is  $$ E[X|\mathscr D] = \sum_{i = 1}^m x_i \sum_{j = 1}^n P(X|\mathscr D_j)I_{D_j} $$ where $I_{\mathscr D_j}$ is an indicator function.   When random variable $X$ is continuous, The conditional expectation of $X$ with respect to a $\sigma$-algebra $\mathscr F$ is a nonnegative random variable $\def\E{\mathbf E}\E(X\mid \mathscr F)$, such that    $ \def\E{\mathbf E}\E(X\mid \mathscr F)$   is  $\mathscr F-measurable$ for all $A \in \mathscr F\\$, $$\int_A \def\E{\mathbf E}\E(X\mid \mathscr F)\, dP=\int_A X\, dP$$   I find it is hard to link those two definitions. In discrete case, conditional probability is defined first and we derive conditional expectation based on conditional probability. And it is a similar way as to define conditional expectation w.r.t random variable. But in continuous case, we first state that there exists a unique random variable, and just give it a name as $\def\E{\mathbf E}\E(X\mid \mathscr F)$. I wonder why this random variable can be viewed as a conditional expectation in continuous case and its link to discrete case.

Let $(\Omega,\mathscr{F},\mu)$ be a probability space, given a random variable $\xi:\Omega \to \mathbb{R}$ and a $\sigma$-algebra $\mathscr{G}\subseteq \mathscr{F}$ we can construct a new random variable $E[\xi|\mathscr{G}]$, which is the conditional expectation.     What exactly is the intuition for thinking about $E[\xi|\mathscr{G}]$?  I understand the intuition for the following:   (i) $E[\xi|A]$ where $A$ is an event (with positive probability).  (ii) $E[\xi|\eta]$ where $\eta$ is a discrete random variable.   But I cannot visualize $E[\xi|\mathscr{G}]$. I understand the mathematics of it, and I understand that it is defined in such a way to generalize the simpler cases that we can visualize. But nonetheless I do not find this way of thinking to be useful. It remains a mysterious object to me.     For example, let $A$ be an event with $\mu(A)>0$. Form the $\sigma$-algebra $\mathscr{G} = \{ \emptyset, A, A^c, \Omega\}$, the one generated by $A$. Then $E[\xi|\mathscr{G}](\omega)$ would be equal to $\frac{1}{\mu(A)} \int_A \xi$ if $\omega \in A$, and equal to $\frac{1}{\mu(A^c)} \int_{A^c} \xi$ if $\omega \not \in A$. In other words, $E[\xi|\mathscr{G}](\omega) = E[\xi|A]$ if $\omega\in A$, and $E[\xi|\mathscr{G}](\omega) = E[\xi|A^c]$ if $\omega \in A^c$.   The part which is confusing is that $\omega \in \Omega$, so why do we not just write $E[\xi|\mathscr{G}](\omega) = E[\xi|\Omega] = E[\xi]$? Why do we replace $E[\xi|\mathscr{G}]$ by $E[\xi| A\text{ or } A^c]$ depending on whether or not $\omega\in A$, but not permitted to replace $E[\xi|\mathscr{G}]$ by $E[\xi]$?     Note. In responding to this question do not explain this by using the rigorous definition of conditional expectation. I understand that. What I want to understand is what the conditional expectation is supposed to be calculating and why we reject one in place of another.


\documentclass[a4paper,12pt]{report} \usepackage[american]{babel} \usepackage{amsfonts,amssymb,amsmath,amsthm} \usepackage[table]{xcolor} \usepackage{pifont} \usepackage{marvosym} \usepackage{fancybox,fancyhdr} \usepackage{graphicx} \usepackage{eso-pic} \usepackage{yfonts} \usepackage{pdfsync} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[dvips]{epsfig} \usepackage{caption,subcaption} \usepackage{algorithmicx} \usepackage[ruled]{algorithm} \usepackage{algpseudocode}  \usepackage[backend=biber,style=apa]{biblatex}  \usepackage{booktabs, collcell, makecell, tabularx, threeparttable}     \newcommand{\tclr}[1]{\textcolor{black!70!black}{#1}}     \newcolumntype{L}{>{\collectcell\tclr\raggedright}X<{\endcollectcell}}     \renewcommand\TPTtagStyle{\bfseries} % optional \usepackage{siunitx} \usepackage{xparse} \NewExpandableDocumentCommand\mcc{O{1}m}     {\multicolumn{#1}{c}{#2}} \newcommand\tot{\mathrm{tot}} begin{document} \begin{table}%[!htp]     \small     \sisetup{table-format=6.2e-1,per-mode=symbol}     \setlength\tabcolsep{3pt} \caption{The QPSO update equations for different potential energy types}\label{3wavfun} \centering \begin{threeparttable} \begin{tabularx}{\textwidth}{@{} L l *{3}{>{$}l<{$}S} @{}} \toprule  {\bf Delta potential}  & {\bf QPSO update equation}\\  \midrule  Delta potential well & $x_i(t+1)=p(t)\pm\frac{\ln(1/u)}{2q\ln\sqrt{2}}\parallel x_i(t)-p(t)\parallel$\\  \midrule  Harmonic oscillator & $x_i(t+1)=p(t)\pm\frac{\sqrt{\ln1/u}}{0.47694q}\parallel x_i(t)-p(t)\parallel$\\  \midrule  Square well & $x_i(t+1)=p(t)+\frac{0.6574}{\xi q}\cos^{-1}(\pm\sqrt u)\parallel x_i(t)-p(t)\parallel$\\ \bottomrule \end{tabularx} \end{threeparttable} \end{table}  \end{document}

I'd like to have my figure captions with the word Figure x.x in bold, but the rest normal. Ideally, that would be in the header of the file, so that it applies to all the figures in my document. If it's not possible, is there a way to have a different ... distance to the edge of the page, so it's different from normal text? So for example, you would have: Normal text blah blah blah.  [actual figure] Figure 1.5: figure caption  I tried to use stuff like \usepackage[font=bf]{caption}, but it tells me I don't have caption.sty (or figure.sty if I replace caption by figure). I'd be also surprised if we needed a new package only for that. Is there a way to achieve one of the two? [edit] I've installed the caption package. It might be easier to get this done now.


This is not a duplicate of another question. I really like MAMP as it simplifies development and am just trying to figure out how to enable general query log.  I am trying to enable the general query log in MAMP 3.4 for mac  What I have tried   create file /Applications/MAMP/logs/mysql_sql.log chmod 777 /Applications/MAMP/logs/mysql_sql.log add the following by editing template my.cnf to the mysql section  general_log = 1 log = /Applications/MAMP/logs/mysql_sql.log Restart mysql   When I run queries I do not get anything written to that file.  Am I missing a step? My other changes such as mode take affect; just not this log.

This is a  about  the use of a *AMPP's stack.    I recently had a talk with some experienced people and they suggested to me not to use a WAMP stack, and instead install apache, mysql and php separately.  I don't understand why they have suggested this, though, so can anyone tell me?  Is there a particular disadvantage of WAMP, or a particular advantage to installing all of them separately?  Since a WAMP stack itself is composed of apache, mysql and php, then what's the difference between using the WAMP stack and installing them all separately?


Let $X$ be a Hausdorff space. Then $\forall x \in X$, the set $\lbrace x\rbrace$ is closed. Moreover, every finite subset of $X$ is closed.   I am having a hard time doing this one, can someone help me on this? How should I proceed?  Any help will be greatly appreciated!!

I find it difficult to understand one of the properties and the definition of Hausdorff spaces.   The property states that, "If $X$ is Hausdorff then every finite set is closed. How is this possible keeping in mind that the definition states that for two distinct elements you can find an open neighborhood around them such that their intersection is empty. Thus, wouldn't the finite set be open because you can always find an open neighborhood around distinct elements of finite sets?   Can someone please explain?


I've an implementation of a stack which aside from push, peek and pop returns the max Value. Here's my code.  static  class MaxStack{          private Node top;         private Node maxTop;          private class Node{             int data;             Node next;              Node(int item){                 this.data = item;                 this.next = null;             }         }          void push(int item){             Node p = new Node(item);             if(top == null){                 top = p;                 Node q = new Node(item);                 maxTop = q;                 return;             }             p.next = top;             top = p;             if(item > maxTop.data){                 Node q = new Node(item);                 q.next = maxTop;                 maxTop = q;             }                      }          void pop(){             if(top == null) throw new IllegalStateException("Popping off and empty stack");             top = top.next;             if(top.data == maxTop.data){                 maxTop = maxTop.next;             }            }          int peek(){             return top.data;         }         int peekMax(){             return maxTop.data;         }   In my client code when I use this class, I get a Null Pointer Exception in the pop method.  Can someone help me understand what's wrong here.

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?


In Ubuntu 17.10, when I log in using Wayland and try to run a GUI app using root access it says   unable to copy the user's xauthorization file   I tried   sudo chown sharif:sharif ~/.Xauthority   but the result was  chown: cannot access '/home/sharif/.Xauthority': No such file or directory   But in Xorg those apps run well.

I installed Ubuntu 17.10. Now I am having trouble with gksu:  $ gksu -dg synaptic No ask_pass set, using default! xauth: /tmp/libgksu-HgUjgQ/.Xauthority STARTUP_ID: gksu/synaptic/8760-0-alex-XPS-15-9530_TIME4974977 cmd[0]: /usr/bin/sudo cmd[1]: -H cmd[2]: -S cmd[3]: -p cmd[4]: GNOME_SUDO_PASS cmd[5]: -u cmd[6]: root cmd[7]: -- cmd[8]: synaptic buffer: -GNOME_SUDO_PASS- brute force GNOME_SUDO_PASS ended... Yeah, we're in... Unable to init server: Could not connect: Connection refused (synaptic:8767): Gtk-WARNING **: cannot open display: :1 xauth: /tmp/libgksu-HgUjgQ/.Xauthority xauth_env: (null) dir: /tmp/libgksu-HgUjgQ   If I don't use -g, the password dialog is disabled. So looks like a problem with creating a tty for root.  Any advice?


I created PHP function to list all users from table and want to sort it according the column (click on column name to sort ASC/DESC)  function getAllUsers($order_by, $format) {   global $conn;   $result = array();   try {     $query = $conn->prepare("SELECT * FROM user ORDER BY ?, ?");     $query->execute(array($order_by, $format));     $result = $query->fetchAll(PDO::FETCH_OBJ);   } catch (PDOException $e) {     echo $e->getMessage();   }   return $result; }   The PHP page is like this:  $order_by = array(1 => 'group', 'name', 'email', 'user_last_login'); $how = array(1 => 'ASC', 'DESC'); $sorting = 2; $format = 1; if(isset($_GET['format'])){   if($_GET['format']==1){       $format=2;   } else {       $format=1;   } } foreach(getAllUsers($order_by[$sorting], $how[$format]) as $user) {   echo $user->name. " ". $echo->user_last_login. "<br />"; }   The code returns me data, but it is sorted wrong (always according to the first column in the database. If I add particular name of the column to the function to be sorted data by, I get correct result. I would like to solve it by using variables in the function.  Thanks for help.

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?


I was looking for a file in the file manager when I noticed that I can access and view any folders and files in the other profiles from a standard account. So I'm wanting to know if I can make each profile private like they are in XP?

Why are my home folders accessible by other users on the same system by default?  I understand that I can change the permission of the home folders but want to know why this happened?  I have done nothing to make the folders "shareable" and yet I can easily navigate to any users home folder using Nemo 2.4.5 and see all their contents.  This is quite a privacy and security flaw and I'm not sure why it has defaulted this way on my system.  Under Users and Groups (items checked =) (both are administrator accounts)  User 1 = adm, cdrom, dip, lpadmin, plugdev, sudo  User 2 = User 2, sudo  Also of note is why User 2 has User 2 clicked but User 1 does not have User 1 clicked.  Both accounts appear to behave exactly the same.  Thank you for any tips in this matter.


$ declare -p ar declare -a ar='()'   $ declare -p mmm declare -- mmm="hello"   What does -- mean here? Does it tell some attribute of mmm?  Thanks.

I have seen -- used in the compgen command.  For example:  compgen -W "foo bar baz" -- b   What is the meaning of the -- in there?


can someone explain to me how i got these weird shadows and how to get rid of them?    And another problem, when I use a normal map in the princepled shader it's not working and affecting the color, why is that?    Thanks!   i already tried to recalculate the normals it didnt change anything

While rendering a mesh with smooth shading on, I get a dark region/shadow on certain faces. The effect is more evident when smooth shading is applied to a mesh containing ngons, with the ngons turning black when rendered.   The blackening effect is visible in the viewport too.  How can I solve this problem?


I am having trouble placing the random generator in the array, how can I get #20 random numbers from 0-9 in the array? Then you count the occurrences of those numbers.  import java.util.Random;  public class CountDigits {  public static void main(String[] args) {        Random digit = new Random();       int Random[] = new int [20];      int Digits[] = {0,1,2,3,4,5,6,7,8,9};       int Count [] = new int [10];        for ( int i = 0; i < Digits.length; i++) {           for( int j = 0; j < Random.length; j++) {              if ( Digits [i] == Random [j] )                  Count[i]++;          }      }       for ( int i = 0; i < Count.length; i++) {          if ( Count[i] == 1)              System.out.printf(" %d  occurs  1 time " , Digits[i] );           else             System.out.printf("%d occurs %d times" , Digits[i], Count[i]);       }   result so far:: 0 occurs 20 times1 occurs 0 times2 occurs 0 times3 occurs 0 times4 occurs 0 times5 occurs 0 times6 occurs 0 times7 occurs 0 times8 occurs 0 times9 occurs 0 times

How do I generate a random int value in a specific range? I have tried the following, but those do not work: Attempt 1: randomNum = minimum + (int)(Math.random() * maximum);  Bug: randomNum can be bigger than maximum. Attempt 2: Random rn = new Random(); int n = maximum - minimum + 1; int i = rn.nextInt() % n; randomNum =  minimum + i;  Bug: randomNum can be smaller than minimum.


I don't know why Java's designers didn't design java.util.Random objects to return random numbers like this:   rand.nextInt(minValue, maxValue);  I don't understand how to pass min and max values to this function. I've seen this recommended:  random.nextInt(max + 1 - (min)) + min  but what does that mean? Does that mean:   random.nextInt(FULL_RANGE + 1) + START_OF_RANGE  For example, if I wanted to generate values between -1 and 1, inclusive, is this how I do it:  int oneOfThreeChoices = rand.nextInt(1 + 1 + 1) - 1;


I'm trying to install the latest WINE, and I'm reading the readme, it's telling me to do the ./configure thing but when I do I get this message  bash: ./configure: No such file or directory   What am I supposed to do, and how do I fix it, I'm running Ubuntu 14.04, anything newer than this runs into some problems this is an old computer.

Can someone please explain how I can install  in the following ways?   By using the package manager? By downloading and installing a pre-built package?


If the plural of "moose" is "moosen," what's the plural of "animuson"?  Skimming MSE questions on the Android app tonight revealed  that was closed by ...twice:

Check out ; my name appears twice. I voted to close before made moderator pro tempore, and again afterwards, and my name appears in the list twice because of that. It's a very minor bug which admittedly will happen pretty rarely, but it should at least be on the bug report list.


Seems this should work via partial fractions; however, doesn't solve out for me. I recoginize that $e^{2x}-1$ is a difference of squares. Still doesn't decompose for me with partial fractions.  numerator is $e^x$  demominotor is $(e^{2x}-1)(e^x+1)$  $$\int \frac{e^x}{(e^2x-1)  (e^x+1)}dx$$

Evaluate  $$\int\frac{e^xdx}{(e^{2x}-1)(e^x+1)}$$  I tried to decompose the integrand into A and B partial fractions.  No success.


Is it possible to install Ubuntu Touch in Nokia XL (Software Version 1.2.3.2) ? My phone is not rooted.

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


I'm trying to use a local deployment of GeoServer. I've got a layer being exported as a WMS that I'd like projected in EPSG:3857 only. However, GeoServer adds in some defaults. If I'm using standard FTP programs (eg WinSCP), which xml files would I need to manually edit in order to take these out? I'm altering the layer's wmslayer.xml file but that doesn't seem to actually be having any effect.

I've got several layers in GeoServer, one of which I'm trying to use as a WMS in desktop programs (Manifold 8). I've set it up correctly, but whenever I bring it into Manifold, it projects the layer into EPSG:4326, which unfortunately can't work with my map - I need it in EPSG:3857. The layer in question is wrapped inside a more overarching layer definition, which contains all the layers - and coordinate systems that allow them all to be used flexibly. However, I want to put this layer on its own in the capabilities document, and only allow it to use EPSG:3857. How, in GeoServer, would I edit, or override, a capabilities document?


/Why is the output false here on comparing cat and dog references??/  public class Test {       public static void main(String [] main) {           final String cat = "length: 10";           final String dog = "length: " + "10";          System.out.println("Animals are equal :" + cat == dog);    }  }

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 just found at home I (an administrator user) can access other users folders under the C:\Users, even one of the folders belongs to another administrator account. I thought the folders under Users belong to specific user should be private. But they are not. Is this right? I am using Windows 7 enterprise and professional edition. Yes, there is a popup window to tell you you don't have permission but it will give you permission if you want.   I also found the Users folder by default is visible and accessible via Network. I don't think this is right.  All above are happened at home and I just setup a home network with an old netgear router.  All machines are my machines bought used with win7 professional and enterprise OSs.

Today I found something strange on my newly installed Windows 7 OS - my "users" folder C:\Users was shared and "Everyone" had full access... I disabled that and now it seems fine, however I'm a bit scared actually, I'd like to know what caused that and if my system is compromised.


The following LaTeX manuscript  \documentclass{article} \usepackage{xparse,minted} \NewDocumentEnvironment{MyMinted}{}   {\begin{minted}[escapeinside=||,mathescape=true]{c}}   {\end{minted}} \begin{document} \begin{MyMinted}    double diff(double (*f)(double), double |$x_0$|) {       return |$\frac{d(*f)}{dx}(x_0)$|;   } \end{MyMinted} \end{document}   produces (upon compilation with pdflatex -shell-escape) the following error message:  Runaway argument? ! File ended while scanning use of \FancyVerbGetLine. <inserted text>                  \par   What's the problem, and how can I fix it?

As a followup question to , I kind of want to do the same thing for minted as well, but I'm held back by the following:  I used the code from  but that doesn't seem to work so well for the latest version of minted (version 2.0 alpha 3). \mintinline works nicely in the latest version. Preferrably I wouldn't want to choose between the two.  Any known workaround to this?  \documentclass[10pt]{article} \makeatletter \IfFileExists{minted.sty}{% \usepackage{minted} \usemintedstyle{euryris} \usepackage{lineno} \def\gobble##1{} \renewcommand\DeleteFile[1]{} \newenvironment{MyEnvironment}{% works fine in v1.7 ?   \VerbatimEnvironment   \minted@resetoptions   \setkeys{minted@opt}{}   \begin{center}     \begin{minipage}{\linewidth}           \begin{VerbatimOut}{\jobname.pyg}} {%       \end{VerbatimOut}       \minted@pygmentize{python}       \DeleteFile{\jobname.pyg}     \end{minipage}     \end{center}} }{} \makeatother \begin{document}  \section{Environment} Have some python code: \begin{MyEnvironment} print(x**2) \end{MyEnvironment} ...as the pleasure is all mine.  \section{Inline code} Some serious inline code right here:~\mintinline{python}{print(x**2)}. Some seriously ugly \jobname.pyg to the right % works fine in v2.0 ? \end{document}   I'm also looking to embed \mintinline inside another macro. Not sure if the same recipe as lstinline applies?