Does anyone here know how to print elements from the array one by one? I have this code here:   import java.util.ArrayList; import java.util.Iterator;  public class SimpleCollection {      private String name;     private ArrayList&lt;String&gt; elements;      public SimpleCollection(String name) {         this.name = name;         this.elements = new ArrayList&lt;&gt;();     }      public void add(String element) {         this.elements.add(element);     }      public ArrayList&lt;String&gt; getElements() {         return this.elements;     }      public String toString(){         String printOutput = "The collection "+ this.name+ " has "+ elements.size()+ " elements: ";         String e = "";         if(elements.isEmpty()){             return(printOutput+ " is empty.");         }if(elements.size()==1){             return "The collection "+ this.name+ " has "+ elements.size()+" element:"+ "\n"+ elements.get(0)+ "\n";          }             e = printOutput + "\n"+ getElements() + "\n";          return e;     }  }   The toString method of mine prints elements as an array: how can i print them one by one? Something like:  The collection characters has 3 elements: magneto mystique  phoenix
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]
Should I use the datetime or timestamp data type in MySQL? Would you recommend using a  or a  field, and why (using MySQL)?   I'm working with PHP on the server side. Long boot delay on Ubuntu loading/splash screen following regular dist-upgrade on clean SSD install (18.04) I'be been running 18.04 since a clean SSD install on the day of it's official release, without issues. Power on to login was seconds (max 10)  Then, I did a regular upgrade this morning:  $ sudo apt update &amp;&amp; sudo apt dist-upgrade   The packages installed/upgraded were:  Install: linux-headers-4.15.0-24:amd64 (4.15.0-24.26, automatic), linux-headers-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-modules-extra-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-modules-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic), linux-image-4.15.0-24-generic:amd64 (4.15.0-24.26, automatic) Upgrade: gnome-control-center-data:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-headers-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), gnome-control-center:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-image-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), linux-signed-generic:amd64 (4.15.0.23.25, 4.15.0.24.26), gnome-control-center-faces:amd64 (1:3.28.1-0ubuntu1.18.04.1, 1:3.28.1-0ubuntu1.18.04.2), linux-generic:amd64 (4.15.0.23.25, 4.15.0.24.26)   I rebooted once the upgrade had completed, and noted a 2-3 minute delay on the Ubuntu loading/splash screen (prior to login) (without any progress/activity indicated on the dots).  I powered off and tried to boot again, but am getting this delay consistently now. Also close down is much slower too.  Update #1 (2018-07-03): Analysis on systemd:  $ sudo systemd-analyze blame 3min 53.073s plymouth-quit-wait.service     2min 20.699s snapd.seeded.service          49.949s snapd.service           6.186s NetworkManager-wait-online.service           1.148s dev-sda2.device           1.098s plymouth-start.service   Showing that plymouth-quit-wait.service (which I now believe is related to the Ubuntu loading/splash screen) and snapd.seeded.service were by far the longest running services to initiate. So I compared the times before the dist-upgrade and after:  $ journalctl -u plymouth-quit-wait.service --since today -- Logs begin at Fri 2018-04-27 13:01:30 BST, end at Tue 2018-07-03 12:38:05 BST. -- Jul 03 04:15:43 user-laptop systemd[1]: Starting Hold until boot process finishes up... Jul 03 04:15:46 user-laptop systemd[1]: Started Hold until boot process finishes up. -- Reboot -- Jul 03 04:21:17 user-laptop systemd[1]: Starting Hold until boot process finishes up... Jul 03 04:24:52 user-laptop systemd[1]: Started Hold until boot process finishes up.   Before the upgrade plymouth-quit-wait.service took 3 seconds. After the upgrade it took 3 minutes 35 seconds  $ journalctl -u snapd.seeded.service --since today -- Logs begin at Fri 2018-04-27 13:01:30 BST, end at Tue 2018-07-03 12:42:14 BST. -- Jul 03 04:15:43 user-laptop systemd[1]: Starting Wait until snapd is fully seeded... Jul 03 04:15:43 user-laptop systemd[1]: Started Wait until snapd is fully seeded. -- Reboot -- Jul 03 04:22:47 user-laptop systemd[1]: Starting Wait until snapd is fully seeded... Jul 03 04:24:49 user-laptop systemd[1]: Started Wait until snapd is fully seeded.   Before the upgrade snapd.seeded.service took 0 seconds. After the upgrade it took 2 minutes 2 seconds.  Update #2 (2018-07-06): This morning's boot saw the return of the delay. So I guess we're still waiting for the kernel/plymouth/snapd update.  Update #3 (2018-07-12): The problem seems to be resolved, but I didn't see any update to snap or plymouth, and I'm still running 4.15.0-24 kernel. So I'm not sure which package update fixed the problem, or if it just resolved itself somehow. Reading the bug updates on launchpad it's unclear to me what was done (or is being done) to what package/s. If anyone can clarify that would be very useful. Which one is correct to say: "It's me" or "It's I"? I was taught at school that the following expression is not grammatically correct:  Who is there? It's me.  The correct one is:  Who is there? It's I.  Can you let me know which one is accurate? I have a dual boot setup with Ubuntu and Windows 7. I need to shrink my root Ubuntu volume in order to get some free space to create a new partition. Are there any Windows based tools that will do this for me? I tried booting up in gparted to do this but I cannot tell which partition is which since I cannot find the size (it displays everything in blocks). If a Matrix Has Only Zero as an Eigen-Value Then It Is Nilpotent Prove that a matrix with only zero eigenvalues must be nilpotent.   How will I be able to prove this? How to check if my eSATAp port provides 12V power? I have a Lenovo ThinkPad Edge 13" model 0217-2QG with eSATAp port.  How do i check if my port provides 12V power (enough to power a 3.5" HDD)? Why not use "which"? What to use then? When looking for the path to an executable or checking what would happen if you enter a command name in a Unix shell, there's a plethora of different utilities (which, type, command, whence, where, whereis, whatis, hash, etc).  We often hear that which should be avoided. Why? What should we use instead? I tried to update Grub so I run:  sudo update-grub  Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.   What exactly this warning wants to be changed? (I upgraded from 12.04 to 14.04 before)  This is my /etc/default/grub file:  GRUB_DEFAULT="0" GRUB_HIDDEN_TIMEOUT="0" GRUB_HIDDEN_TIMEOUT_QUIET="true" GRUB_TIMEOUT="10" GRUB_DISTRIBUTOR="`lsb_release -i -s 2&gt; /dev/null || echo Debian`" GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX="" With the listings package, I would like to color the integers out of strings and comments and out of keywords too. The question for coloring numbers     . Some answer handle the numbers occurring within comments, strings or barewords, but no solution given work when a keyword contain a number. Which is annoying because C and C++ have a lot of types with a number in them, like uint32_t.  Here is a small example.  \documentclass{standalone} \usepackage{xcolor} \usepackage{listings}  \definecolor{darkgreen}{rgb}{0.18,0.54,0.34} \definecolor{maroon}{rgb}{0.64,0.16,0.16} \definecolor{darkpink}{rgb}{0.75,0.25,0.5}  \lstdefinestyle{myc++}{     language=[ISO]C++,     keywordstyle=\color{darkgreen}\bfseries,     commentstyle=\color{blue}\textit,     stringstyle=\color{darkpink}\ttfamily, %     literate=*     {0}{{{\textcolor{red}0}}}1     {1}{{{\textcolor{red}1}}}1     {2}{{{\textcolor{red}2}}}1     {3}{{{\textcolor{red}3}}}1     {4}{{{\textcolor{red}4}}}1     {5}{{{\textcolor{red}5}}}1     {6}{{{\textcolor{red}6}}}1     {7}{{{\textcolor{red}7}}}1     {8}{{{\textcolor{red}8}}}1     {9}{{{\textcolor{red}9}}}1,     escapeinside={|}{|}, %     morekeywords={int32_t} }  \begin{document}  \begin{lstlisting}[style=myc++] // In comment: 42 int32_t in_keyword = 80085; char *in_identifier|2| = "And in string 1337\n"; \end{lstlisting}  \end{document}   And the result:    The star for literate avoid to coloring the digits inside comments or strings. The escapeinside avoid coloring the digits inside a bareword when specifically marked. But I have yet to find how to color int32_t as a keyword. I am trying to execute a web service call to our backend system when the opportunity is closed/won. I am attempting to do a  POST to our endpoint. All the api call is really carrying the account name and a few structural detail back (All listed below). My problem is that when the trigger executes I get the following error in the debug logs "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out".  The Process Builder Passing in the company name:   APEX Class  public class Play2 { @TestVisible static HttpResponse res;  @InvocableMethod public static void sendNotification(List&lt;String&gt; name) {        HttpRequest req = new HttpRequest();     Http http = new Http();     String payload = JSON.serialize(         new Map&lt;String, String&gt; {             'companyName' =&gt; name.get(0),             'salesforceAccountType' =&gt; 'Company',             'salesforceSynchStatus' =&gt; 'Enabled'         }     );      req.setEndpoint('https://TheEndPoint');     req.setMethod('POST');     req.setHeader('Authorization', 'The Mighty API KEY');     req.setHeader('Content-Type', 'application/json');      req.setBody( payload );     req.setCompressed(true);       try {         System.debug('Point 1');         res = http.send(req);         System.debug('Point 2');     } catch(System.CalloutException e) {         System.debug('Callout error: '+ e);         System.debug(res.toString());     } } } Effect on Google rankings if my site is down? What are the rules of parallelism? I've been reading a lot about it since yesterday and all I encounter is "They must have the same grammatical form"? What does this exactly mean?  I know how to make parallel sentences with gerunds. The things get trickier when it comes to using modifiers.  For example:     I love using the phone that you bought me and the computer.   On the left side of the conjunction there is a noun phrase that consists of an article + noun + another modifier and on the right side there is an article + noun.  They are both noun phrases but the first one has additional modifier. Is that still considered a parallel sentence?  Another example:     I like to swim and to feel good.   Here on the right side of the conjunction there is an infinitive and on the left side there is an infinitive + complement? Is that parallel? How do I change the MAC address of my network card? I have a local network in a Windows system where the Admin gives permission to the PCs by their MAC address. But he is on vacations and I have a new PC.  How can I change the MAC address of my new PC to have the same MAC address as the old one?  I know this can be used for spoofing the address, but this is local, so I don't think I will have a problem. OS X Internet Recovery doesn't see SSD drive I wanted to do a clean install and booted from OS X recovery partition. In disk utility I selected "erase" option. SSD was working correctly before that.  Now, if i startup, the only way to proceed is with Internet Recovery  since I cannot boot from hidden recovery partition. After I wait several hours for the recovery image download, I cannot see the SSD either in disk utility or OSX reinstallation.   In terminal   diskutil list   Shows only recovery image 1.8 Gb or so.  So did erase option destroy my ssd? Disabling Intel Turbo Boost in ubuntu Does a bad grade in one course (with otherwise OK record) affect graduate admissions? I'm currently an M. Phil student in Math and I failed a course last semester because I was not able to hand in a home work assignment (which was worth 40% of my grade) on time (I was 30 minutes late).   Apart from that I'd say I'm a fairly decent student, I got an upper second class honours bachelors degree, I have a B+ and A's for all my other courses in my current programme and I'm almost finished with my first paper to be published.   I've however been deeply worried about this failure as it would reflect poorly on my transcript if I were to apply to a Ph.D or another Master's programme.   Will my failing grade affect my chances of getting into a competitive programme or greatly lower my chances of getting a scholarship? Can't understand a proof: Let $a,b,c$ be integers. If $a$ and $b$ divide $c$, then $lcm(a,b)$ also divides $c$  Proof I've been shown:  Since $c$ is a common multiple of $a,b$, it means that $lcm(a,b) \leq c$.  So: $c=q\cdot lcm(a,b)+r$, $q \in \mathbb Z$ and $0\leq r \leq lcm(a,b)$  Since $c$ and $lcm(a,b)$ are common multiples of $a,b$, then so is $r$. But $m$ is the least common divisor, then it means $r=0$.   [Proof taken from: http://www.math.utah.edu/~wood/4400/hw1sol.pdf]  I cannot understand the last step... Why does it imply that $r=0$?   Thank you! Let $a,b,m,n$ be positive integers such that g.c.d.$(a,b)=1$ and $a^m+b^m|a^n+b^n$ , then is it true that $m$ divides $n$ ? I haven't seen this behavior out in the wild much, but it happened again recently and I was wondering if a flag could be automatically raised when this happens:   User posts answer Answer is down voted User deletes answer User posts exact same text as a new answer User effectively ditched down votes   Got down voted again? Wash, rinse and repeat. Profit (perhaps after modifying the post, which is what you should have done to begin with)    I feel that this should raise a duplicate content flag, with slightly stronger wording. Would this be possible to implement? Or, perhaps, don't let users post new answers if they have a deleted answer to a question. Rather, force them to edit and restore the deleted answer instead, unless locked by a moderator.  I do have a link, but I don't want a lot of people to descend on it and create an even bigger disruption. It happened exactly as I described. I remember being taught that the correct order of adjectives in English was something along the lines of "Opinion-Size-Age-Color-Material-Purpose."  However, it's been a long time and I'm pretty sure I've forgotten a few categories (I think there were eight or nine). Can anyone fill them in?