When should the keyword 'this' be used within C# class definitions?    Is it standard to use the form "this.Method()" from within class? Or to just use "Method()"?  I have seen both, and usually go with the second choice, but I would like to learn more about this subject.
I was curious about how other people use the this keyword. I tend to use it in constructors, but I may also use it throughout the class in other methods. Some examples:  In a constructor:  public Light(Vector v) {     this.dir = new Vector(v); }   Elsewhere  public void SomeMethod() {     Vector vec = new Vector();     double d = (vec * vec) - (this.radius * this.radius); }
I want to use the "BackSpace" button as a shortcut key on nautilus. I want to return to the previous folder whilst browsing the Home folder, just like windows 7.   Also I want the same thing while using Firefox, In a way that when I press the shortcut key I will return to the previous web page. Efficiently select beginning and end of multiple contiguous ranges in Postgresql query I've got about a billion rows of data in a table with a name and an integer in the range 1-288.  For a given name, every int is unique, and not every possible integer in the range is present--so there are gaps.  This query generates an example case:  --what I have: SELECT * FROM ( VALUES ('foo', 2),               ('foo', 3),               ('foo', 4),               ('foo', 10),               ('foo', 11),               ('foo', 13),               ('bar', 1),               ('bar', 2),               ('bar', 3)      ) AS baz ("name", "int")   I'd like to generate a lookup table with a row for each name and sequence of contiguous integers.  Each such row would contain:  name   --  the value of the name column start  --  the first integer in the contiguous sequence end    --  the final value in the contiguous sequence span   --  end - start + 1  This query generates example output for the above example:  --what I need: SELECT *  FROM ( VALUES ('foo', 2, 4, 3),               ('foo', 10, 11, 2),               ('foo', 13, 13, 1),               ('bar', 1, 3, 3)      ) AS contiguous_ranges ("name", "start", "end", span)   Because I have so many rows, more efficient is better.  That said, I only have to run this query once, so it isn't an absolute requirement.  Thanks in advance!  Edit:  I should add that PL/pgSQL solutions are welcome (please explain any Fancy Tricks--I'm still new to PL/pgSQL). What is / how can I get a student-safe power supply for electronics projects?  I'm looking for a student-safe power supply for solder less breadboard.  I'm developing a course to teach electrical engineering to grade school students as an after-school program.  I'm wrapping up the first course and I've learned a lot, including that I need to find a safer power supply.  We're mostly using 9V batteries and connecting them to the breadboard via alligator clips.  After lots of searching, I'm realizing that I need to turn towards the expert community for guidance.  I hope that with the rise of the Makers  this question will become increasingingly relevant with time as more kids get into electronics.  Inextricably linked to this question is what is the minimum power source to use.  I've liked using 9V batteries since we can connect to them using alligator clips; but I worry that they are just a little too powerful.  I can imagine them somehow starting a fire with them.  My #1 priority is to keep the students safe.  Kids just have no concept that they can cause damage to themselves and property.  When I ask "where is that smoke coming from?" I'll get a gleeful response from the student that is seeing how many batteries he could hook together and short out.   I really need to limit the damage they can do.  I mainly don't want anyone electrocuted or anything to catch fire.  Kids will routinely attach LEDs backwards, leave them like that and then act surprised when they explode.   After safety, I want to protect the equipment.  Kids will hook up a LED backwards all the time.  After protection, I want to give the kids feedback as to what is going on.  A light that indicates power is on would be awesome.  A light or siren or circuit break that indicated a short would be awesome too.  Battery powered supplies are slightly preferred, just to keep upfront costs low and to avoid having to run outlets to each table.  Boundaries:   We are only using simple LEDs, BJT transistors, resistors and maybe a timer IC.    Similiar Questions:       References:  Course details are here:   We currently sometimes use  from the Squishy Circuits Store and/or a 9V battery with alligator clips.  Epilogue  I found it tougher than expected to find a suitable wall wart, so I'm listing what I finally found for future reference.  I'm about to test the following combination:         Epilogue 2  A year-plus in, I've decided to drop the in-line power switch since it wasn't obvious when it was 'on' vs. 'off'.  I'm instead relying upon the students to unplug the rat-tail from the supply, which is quick and easy.  Also, since I'm primarily using this for a squishy-dough project, I'm experimenting with with using two button batteries instead of a wall power. An integer is a $n$'th power if that holds true for all moduli. I have not been able to solve this problem. Any insights would be appreciated!   Let $x, n > 1$ be integers. Suppose that for each $k > 1$ there exists an integer $a_{k}$ such that $x − a_k^n$ is divisible by $k$. Prove that $x = A^{n}$ for some integer $A$. Mouse rotated 90 degrees What is the difference between $Q=\Delta U+W$ and $\Delta U=Q+W$? Is TV harmful to my infant's development? Why is polyploidy lethal for some organisms while for others is not? is the multiplication of number of chromosomal sets from 2n to 3n (triploidy), 4n (tetraploidy) and so on. It is quite common in plants, for example many crops like wheat or Brassica forms. It seems to be rarer in animals but still it is present among some amphibian species like Xenopus.  As I know in mammals polyploidy is lethal (I don't mean tissue - limited polyploidy). I understand that triploidy is harmful due to stronger influence of maternal or paternal epigenetic traits that cause abnormal development of placenta, but why there is no tetraploid mammals? string str1 = "12345ABC...\\...ABC100000";   // Hypothetically huge string of 100000 + Unicode Chars  str1 = str1.Replace("1", string.Empty);  str1 = str1.Replace("22", string.Empty);  str1 = str1.Replace("656", string.Empty);  str1 = str1.Replace("77ABC", string.Empty);   // ...  this replace anti-pattern might happen with upto 50 consecutive lines of code.   str1 = str1.Replace("ABCDEFGHIJD", string.Empty);   I have inherited some code that does the same as the snippet above. It takes a huge string and replaces (removes) constant smaller strings from the large string.  I believe this is a very memory intensive process given that new large immutable strings are being allocated in memory for each replace, awaiting death via the GC.  1. What is the fastest way of replacing these values, ignoring memory concerns?  2. What is the most memory efficient way of achieving the same result?  I am hoping that these are the same answer!  Practical solutions that fit somewhere in between these goals are also appreciated.  Assumptions:    All replacements are constant and known in advance Underlying characters do contain some unicode [non-ascii] chars Cycles not rendering with background image Where can I get an Ubuntu Installation CD/DVD/USB? 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. From 8th June there's been a  period for people entering the UK. From 10th July, travellers from  via a travel-corridor. If more countries are added to the list of exemptions then the date for each country will be later than the 10th July. If a traveller entered the UK from a country that is not on the exempt list and that country is added to the exempt list prior to the end of the 14 day self-isolation period does the self-isolation period end early? For example, if an individual entered the UK from France on the 5th July, should they remain in isolation for 14 days or does the isolation end on the 10th when France is added to the list of exempt countries? Flex-box: Align last row to grid Why don't planets have Circular orbits? Will installing Ubuntu using the "erase entire disk" option remove and erase all currently existing partitions? I'm considering ditching Windows 8 and doing a fully clean install of Ubuntu. However, I'm concerned because my computer came with a built-in 16 GB recovery partition that would need to be erased as well.   If I pick the "erase entire disk" option during installation, will it wipe out this recovery partition too? How many switches can be stacked/interconnected? Why does "for good" mean "forever"? A very recent and similar  was closed asks what "for good" means.  While general reference can answer the question, I became curious as to the etymology of the idiom.   around got me nowhere, which is unusual.  The closest I found was a thread in :     OED   for good (and all): as a valid conclusion; hence, as a final act, finally.    15.. Parl. Byrdes Aij, Than desyred al the Byrdes great and smal to mewe the hauke for good and all. 1603 in Crt. &amp; Times Jas. I (1849) I. 25 D’Auval.. is gone for good and all. 1687 CONGREVE Old Bach. I. i, Ay, you may take him for good-and-all if you will. 1711 SWIFT Jrnl. to Stella 4 July, This day I left Chelsea for good, (that’s a genteel phrase). a 1732 T. BOSTON Crook in Lot (1805) 37 He was obliged for good and all to leave his country. 1850 J. H. NEWMAN Diffic. Anglic. 324 Throw off, for good and all, the illusions of your intellect. 1882 W. E. FORSTER Let. To Gladstone 10 Apr. in T. W. Reid Life (1888) II. viii. 421 This morning we released Parnell—not for good, but on parole.   However, this only traces some historical usages, and suggests that for good and all used to be a more popular version of the current idiom.  Is there anything more substantial?  Why did "for good" come to mean "forever"? What should I do when my neural network doesn't learn? I'm training a neural network but the training loss doesn't decrease. How can I fix this?  I'm not asking about overfitting or regularization. I'm asking about how to solve the problem where my network's performance doesn't improve on the training set.    This question is intentionally general so that other questions about how to train a neural network can be closed as a duplicate of this one, with the attitude that "if you give a man a fish you feed him for a day, but if you teach a man to fish, you can feed him for the rest of his life." See this Meta thread for a discussion:   If your neural network does not generalize well, see: Best resources to learn bash scripting?