private void drawSquare (Graphics g, int row, int col,         Tetrominoes shape){      Color[] colors={new Color(0,0,0), new Color(204,102,102),             new Color(102,204,102), new Color(102,102,204),             new Color(204,204,102), new Color(204,102,204),             new Color(102,204,204), new Color(218,170,0)     };     int x = col * squareWhidth();     int y = row * squareHeight();     Color color = colors[shape.ordinal()];  // **** NullPointerException here ****     g.setColor(color);     g.fillRect(x + 1, y + 1, squareWhidth() - 2,     squareHeight() - 2);     g.setColor(color.brighter());     g.drawLine(x, y + squareHeight() - 1, x, y);     g.drawLine(x, y, x + squareWhidth() - 1, y);     g.setColor(color.darker());     g.drawLine(x + 1, y + squareHeight() - 1,     x + squareWhidth() - 1, y + squareHeight() - 1);     g.drawLine(x + squareWhidth() - 1,     y + squareHeight() - 1,     x + squareWhidth() - 1, y + 1); }   Throws me a  nullpointerexception when I run the program and the terminal reference me in this line: Color color = colors[shape.ordinal()];
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
How can I delete my account? Is there a function to extract the extension from a filename? I have installed Ubuntu alongside Windows 8.1. But the wifi is not working in Ubuntu (perhaps the drivers are not present), which worked fine in windows. Also I cant connect with Ethernet since my laptop does not have an Ethernet port. So is there any way for me to connect to the internet in ubuntu? Edit: Output of the terminal command  lspci -knn | grep Net -A2:  vikram@vikram-Inspiron-11-3148:~$ lspci -knn | grep Net -A2 01:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)     Subsystem: Dell Device [1028:0018]     Kernel driver in use: bcma-pci-bridge vikram@vikram-Inspiron-11-3148:~$    I did what Pilot6 suggested. Here is the output:    vikram@vikram-Inspiron-11-3148:~$ sudo dpkg -i *.deb [sudo] password for vikram:  Selecting previously unselected package bcmwl-kernel-source. (Reading database ... 163804 files and directories currently installed.) Preparing to unpack bcmwl-kernel-source_6.30.223.141+bdcom-0ubuntu2_amd64.deb ... Unpacking bcmwl-kernel-source (6.30.223.141+bdcom-0ubuntu2) ... Selecting previously unselected package dkms. Preparing to unpack dkms_2.2.0.3-1.1ubuntu5.14.04_all.deb ... Unpacking dkms (2.2.0.3-1.1ubuntu5.14.04) ... Setting up dkms (2.2.0.3-1.1ubuntu5.14.04) ... Setting up bcmwl-kernel-source (6.30.223.141+bdcom-0ubuntu2) ... Loading new bcmwl-6.30.223.141+bdcom DKMS files... First Installation: checking all kernels... Building only for 3.16.0-30-generic Building for architecture x86_64 Building initial module for 3.16.0-30-generic ERROR (dkms apport): kernel package linux-headers-3.16.0-30-generic is not supported Error! Bad return status for module build on kernel: 3.16.0-30-generic (x86_64) Consult /var/lib/dkms/bcmwl/6.30.223.141+bdcom/build/make.log for more information. modprobe: FATAL: Module wl not found. update-initramfs: deferring update (trigger activated) Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for initramfs-tools (0.103ubuntu4.2) ... update-initramfs: Generating /boot/initrd.img-3.16.0-30-generic vikram@vikram-Inspiron-11-3148:~$ Ubuntu: Resize the root LVM(2?) partition I tried installing VLC Player yesterday, and I got the Requires installation of untrusted packages error.  I searched for hours for a solution to this problem, and finally came upon a suggestion that said to change servers for downloading updates from.  I did this, and it gave me a 404 error when I clicked on "Check" in the Update Manager.  I tried switching my server back to the main one (and after that, several other ones), but I am now still getting a 404 error:   And the other error I get when downloading or updating:   Edit: Output of cat /etc/apt/sources.list:  deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted #Added by software-properties  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse universe #Added by software-properties  ## Major bug fix updates produced after the final release of the ## distribution. deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates restricted main multiverse universe #Added by software-properties  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ precise universe deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu  ## team, and may not be under a free licence. Please satisfy yourself as to  ## your rights to use the software. Also, please note that software in  ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team.  ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse #Added by software-properties  deb http://us.archive.ubuntu.com/ubuntu/ precise-security main restricted multiverse deb-src http://us.archive.ubuntu.com/ubuntu/ precise-security restricted main multiverse universe #Added by software-properties deb http://us.archive.ubuntu.com/ubuntu/ precise-security universe  ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. deb http://archive.canonical.com/ubuntu precise partner deb-src http://archive.canonical.com/ubuntu precise partner  ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. What is the best way to clean lenses and filters? After removing dust with an air pomp and a brush, what are you using to remove stains from the lens and filters?  So far I'm using the liquid from a Giotto's CL 1002 cleaning kit for the lens, but I'm not sure what should I use for the filters, and if there is some better alternative.  Also, what kind of brushes are recommended? What is the problem that gets worse after you try to solve it? Example sentence - This problem is a _____ which gets complicated every time you try to solve it.   Is there such a word that represents a problem which will become worse if/when one tries to solve it?  Note - After seeing the comments and answers I'd like to add that this is not a can of worms or Pandora's box because it doesn't create a new problem but just worsens.   Example: Magic leaves protecting a fruit by enclosing it. Every time a leaf is touched, all the leaves close together further, that is more tight than before. Prove that the equation: $c_0+c_1x+\ldots+c_nx^n=0$ has a real solution between 0 and 1. Let $c_0,c_1,c_2,\ldots ,c_n$ be constants such that :  $$c_0+\frac{c_1}{2}+\ldots+\frac{c_{n-1}}{n}+\frac{c_n}{n+1}=0$$  I have to prove that the equation: $$c_0+c_1x+\ldots+c_nx^n=0$$  Has a real solution between 0 and 1.  Didn't know how to start...I thought that maybe I could use something about derivative...But I'm lost... Any help,much appreciated!!! Are +1/+1 counters different from +1/+1 effects? Is a +1/+1 counter I get from, say Unleash or Undying different than +1/+1 from something like  or ? $f,g$ continuous from $X$ to $Y$. if they are agree on a dense set $A$ of $X$ then they agree on $X$ Problem:      Suppose $f$ and $g$ are two continuous functions such that $f: X \to Y  $ and $g : X \to Y $. $Y$ is a a Hausdorff space. Suppose $f(x) = g(x)  $ for all $x \in A \subseteq X $ where $A$ is dense in $X$, then $f(x)  = g(x) $ for all $x \in  X $.   Attempt at a solution:  Put $h(x) = f - g $. Therefore, $h: X \to Y $ is continuous and $Y$ is Hausdorff by hypothesis. Also we know $h(x) = 0 $ for all $x \in A $ such that $A$ is dense in $X$. I want to show that $h(x)$ vanishes everywhere in $X$. We can show $h(x) = 0 $ for all $x \in X \setminus A $. Suppose $h(x) &gt; 0 $ on $X \setminus A$. Pick points $y_1,y_2 \in Y $. Since $Y$ is Hausdorff, can find open set $O_1, O_2 \subseteq Y $ which are disjoint such that $y_1 \in O_1$ and $y_2 \in O_2$. By continuity, $f^{-1}(O_1), f^{-1}(O_2)$ are open in $X$.   I know that if I can show that one of the $f^{-1}(O_i)$ lies in $X \setminus A $, then we would have a contradiction since we have non-empty open set in $X \setminus A$ and this implies $A$ cannot be dense in $X$. But this is the part I am stuck. Any help would greatly be appreciated.  Also, Would be be possible to prove this without using the Hausdorff condition on $Y$? How to get over "device or resource busy"? How can I search for one label but not another? What search query will return conversations that have the label Reading but not the label Ignore?  I've tried using label:reading -label:ignore but Gmail still returns conversations that have the label Ignore:    The query label:(reading -ignore) gives me the same results. Foreign key constraints failures Given the following tables:  CREATE TABLE `longdescs` (   `comment_id` int(11) NOT NULL AUTO_INCREMENT,   `bug_id` mediumint(9) NOT NULL,   `who` mediumint(9) NOT NULL,   `bug_when` datetime NOT NULL,   `work_time` decimal(7,2) NOT NULL DEFAULT '0.00',   `thetext` mediumtext NOT NULL,   `isprivate` tinyint(4) NOT NULL DEFAULT '0',   `already_wrapped` tinyint(4) NOT NULL DEFAULT '0',   `type` smallint(6) NOT NULL DEFAULT '0',   `extra_data` varchar(255) DEFAULT NULL,   PRIMARY KEY (`comment_id`),   KEY `longdescs_bug_id_idx` (`bug_id`),   KEY `longdescs_who_idx` (`who`,`bug_id`),   KEY `longdescs_bug_when_idx` (`bug_when`),   KEY `comment_id` (`comment_id`),   CONSTRAINT `fk_longdescs_bug_id_bugs_bug_id` FOREIGN KEY (`bug_id`) REFERENCES `bugs` (`bug_id`) ON DELETE CASCADE ON UPDATE CASCADE,   CONSTRAINT `fk_longdescs_who_profiles_userid` FOREIGN KEY (`who`) REFERENCES `profiles` (`userid`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=82727 DEFAULT CHARSET=utf8  CREATE TABLE `trace` (   `id` mediumint(9) NOT NULL AUTO_INCREMENT,   `comment_id` mediumint(9) NOT NULL,   `type` varchar(255) NOT NULL,   `short_hash` char(22) DEFAULT NULL,   `stack_hash` char(22) DEFAULT NULL,   `trace_text` mediumtext NOT NULL,   `quality` double NOT NULL,   PRIMARY KEY (`id`),   UNIQUE KEY `trace_comment_id_idx` (`comment_id`),   KEY `trace_short_hash_idx` (`short_hash`),   KEY `trace_stack_hash_idx` (`stack_hash`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8  ALTER TABLE trace ADD CONSTRAINT `fk_trace_comment_id_longdescs_comment_id` FOREIGN KEY (`comment_id`) REFERENCES `longdescs`(`comment_id`) ON UPDATE CASCADE ON DELETE CASCADE; ERROR 1005 (HY000): Can't create table 'bugs4.#sql-4bb_6f1d' (errno: 150)   MariaDB [bugs4]> show warnings;  | Level  | Code | Message | | Warning |  150 | Create table 'bugs4/#sql-4bb_6f1d' with foreign key     constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.  | | Error   | 1005 | Can't create table 'bugs4.#sql-4bb_6f1d' (errno: 150)                                                                                                                       |   Any idea why I get that error? FYI I looked it up and it appears that it was a bug but not anymore. Puzzle: Find largest rectangle (maximal rectangle problem) Derivative of determinant of a matrix I would like to know how to calculate:  $$\frac{d}{dt}\det \big(A_1(t), A_2(t), \ldots, A_n (t) \big).$$ What is so bad about singletons? I have seen other similar questions but they don't seem to be what I want, please correct me if I'm wrong.  For simplicity: delete the default cube, NumPad7, add cylinder, rotate X 90, then add torus with ext/int 1/0.75 and raise it above the cylinder. It should look like this:.  What I want is to deform the torus against the cylinder, but make it as if it's a projection. This means that, when looked from above, it will look like a normal, undeformed torus (volume changes), but when viewed with NumPad1, it will look like a round-end tube following the curvature of the cylinder, while still having the same round cross-section. To make it worse, my object needs to be deformed by a more complex surface, such as sin(x).  If I'd use soft body, it will look shrinked when looking from above, i.e. it will preserve the volume. If I use shrinkwrap, it either does a projection with its circumference intact, but all flat, or it will project it (similar to what I want), but only the bottom side vertices, like a curtain.  Mesh modifier gets me nowhere since I have to manually tweak the surrounding mesh, and curve modifier also preserves the length/volume, while also squishing the section of the torus at the bending points.  My question(s): is there a way to project (mold) the torus onto the cylinder while preserving it's cross-section? Can this be extended for more complex meshes to be projected or to be projected on?    This is, roughly, what the side view (along Y axis in the 1st pic) would look like after the deforming of the torus:    The unselected shape above is the torus (as it is in the first picture), and the selected shape is what it would look like after the deform, or molding, whatever you want to call it.  And here is what it would look like when seen from above (top view, along Z axis)): i.stack.imgur.com/HVOCo.png (can't add more than 2 pics)  The view would be the same before and after the torus is deformed. Wi-Fi speed on my laptop with RTL8723DE is a bit slow and its range is also very low, what to do? My Wi-Fi connection seems to be very weak and the range is very low. It drops by two bars if I just move to the next room and by two if just step outside.  The speed is also not fast as compared to what I get from the router on my desktop .  My laptop is a HP laptop with RTL8723de module. Can anyone help me in bumping up my Wi-Fi speed?  Result of lspci -nnk | grep 0280 -A3:  03:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. Device [10ec:d723] Subsystem: Hewlett-Packard Company Device [103c:8319] Kernel driver in use: rtl8723de Kernel modules: rtl8723de Suppose that $A, B, C$, and $D$ are sets with the cardinalities related as  $|A|=|C|$ and $|B|=|D|$. Prove that the cardinality of $A\times B$ is equal to the cardinality of $D\times C$.  I know that I must prove the bijection of the function $f: A \times B \to C \times D$, but I am not sure how to say this? Can anyone help me? Is there a standard "never returns" attribute for C# functions?