How to insert the result of ST_Intersection into another column when the result has multiple geometry types In PostGIS I have three tables table1, table2 and table3 of same type: CREATE TABLE tableX (     myid integer NOT NULL,     wkb_geometry geometry(LineString,4326) )  table1 and table2 are populated. I want to intersect the linestrings of table1 and table2 and insert the result into table3 like this: insert into table3 (     select         table1.myid,         ST_Intersection(table1.wkb_geometry, table2.wkb_geometry)     from table1, table2 )  The result of ST_Intersection() is sometimes of type LineString and sometimes of type MultiLineString. Therefore I am getting an error: ERROR:  Geometry type (MultiLineString) does not match column type (LineString)  And if I change the geometry type of table3 to MultiLineString I am getting the opposite error: ERROR:  Geometry type (LineString) does not match column type (MultiLineString)  What is an elegant way to store the results of this intersection, but preserving the original information if the intersection was LineString or MultiLineString? Is there no 'flexible' geometry type for columns which could hold results of both types? ( If possible I do not want to normalize the results with ST_Multi, because later I would need to decompose with ST_Dump )
Transforming geometry PostGIS column with unknown geometry type? I run PostgreSQL 9.1 and PostGIS 2.0. I have a table that contains one geometry column.   But that column contains point, polygons lines, etc.   So I set it like so,   ALTER TABLE jake ADD COLUMN jake_geom geometry;  and then I setted some constraints to make it geometry enabled, but not limited on a single geometry type  ALTER TABLE jake   ADD CONSTRAINT enforce_dims_geom CHECK (st_ndims(jake_geom) = 2);  ALTER TABLE jake   ADD CONSTRAINT enforce_srid_geom CHECK (st_srid(jake_geom) = 900913);   Now, I want to reproject the geometries in that column to 4326.   According to , for the transform to work, I need to set a geometry type.  (the TYPE geometry(MultiPolygon,2163) part)  but my column does not have certain geometry type. How do I proceed?  Or I can simply do  ALTER COLUMN geom USING ST_Transform(geom,2163);  avoiding to set a type?
The locker problem - why squares? There are 1000 lockers in a high school with 1000 students.  The    problem begins with the first student opening all 1000 lockers; next    the second student closes lockers 2,4,6,8,10 and so on to locker 1000;   the third student changes the state (opens lockers closed, closes    lockers open) on lockers 3,6,9,12,15 and so on; the fourth student    changes the state of lockers 4,8,12,16 and so on. This goes on until    every student has had a turn.      How many lockers will be open at the end?   I worked out this problem by doing it for 10 lockers. The pattern was obvious (1,4,9 remained open).It's easy to then say that 31 lockers remain open at the end. I don't quite understand why only square numbers remain open at the end. Is there some deeper reason? Storing Images in DB - Yea or Nay? Let $V$ be a representation with character $\chi$.  I would like to have a formula for the characters of the representations $\mathrm{Sym}^m[V]$ and $\wedge ^m[V]$ in terms of $\chi$.  Fulton and Harris presents such a formula for $m=2$, but not for general $m$.  Is there a "nice" such expression?  I found a paper by , but this doesn't seem to be what I'm looking for (it doesn't seem to give a general formula in terms of $\chi$).  In case the link does not work, here is the reference:  X. Zhou, P. Pulay. Characters for Symmetric and Antisymmetric Higher Powers of Representations: Application to  the  Number of Anharmonic Force Constants in Symmetrical Molecules. Journal of Computational Chemistry, Vol 10, Issue 7, (1989). Analyze a circuit with two diodes and two voltage rails I want to find \$I\$, \$I_{D2}\$ and \$V\$ in this circuit. The diodes are made of Silicium. I'm a beginner and normally I would assume the Diode bias and then apply KVL to see if it is true. However, I've only encountered circuits where the wire forms a loop.    How am I supposed to apply KVL in this case? If voltage is the difference in potential between two points, how can I find the voltage of V if one point is outside of the circuit, therefore, outside of KVL application? "A/An" preceding a parenthetical statement a cold vs flu / the flu Have you got a cold? Have you got flu? Have you got the flu?  Why can't we say a flu or the cold in the previous examples? So there are several types of transistors:   BJT JFET MOSFET   Combine all that with the various flavors of each (NPN, PNP, enhancement mode, depletion mode, HEXFET, etc) and you've got a wide array of parts, many of which are capable of accomplishing the same job.  Which type is best suited for which application?  Transistors are used as amplifiers, digital logic switches, variable resistors, power supply switches, path isolation, and the list goes on.  How do I know which type is best suited for which application?  I'm sure there are cases where one is more ideally suited than another.  I admit that there is some amount of subjectivity/overlap here, but I'm certain that there is a general consensus about which category of applications each of the transistor types listed (and those I left off) is best suited for? For example, BJTs are often used for analog transistor amplifiers and MOSFETs are generally used for digital switching.  PS - If this needs to be a Wiki, that's fine if someone would like to convert it for me I understand that you can (in principle) measure whether "free particles" (no forces) experience accelerations in order to tell whether a frame is inertial. But fundamentally, what determines which frames are inertial (i.e. what principle selects in which frames free particles will not appear to accelerate)? I've been told that the cosmic microwaves determine the ultimate rest frame of the universe, but that doesn't make sense to me, since one can still ask why that frame is an inertial frame.  Also, I understand that there are no real inertial frames in general relativity, but it seems like there certainly exists approximate inertial frames and we can ask why those frames are approximately inertial and not others. For example, in the frame of a person riding a merry go round, free particles appear to greatly accelerate; while in the frame of someone standing next to the merry go round there are no such great accelerations. Why does the guy (or gal) on the merry go round see free particles accelerating while the other guy doesn't.   And if you're gonna tell me that it's "the rest of the stuff in the universe" that determines whether the person on the merry go round sees free particles accelerate, I'll ask how you know that all that stuff is not spinning.  I hope this question sort of makes sense, it's been bothering me for a while and my study of relativity (most of special relativity and just the outline of general relativity) hasn't really clarified it for me much. How do you prove a number is prime? I am a software engineer but try to keep up with maths as I really enjoyed the subject at school. I just saw a great TED talk:   The talk states that the current largest known prime is $2^{57885161}-1$  This got me thinking - how does one actually prove whether a number this large is prime or not?  Is it just done by brute force via a computer algorithm or are there any well known mathematical techniques for doing so?  I would be really grateful for any pointers as I am eager to learn about these techniques (if they exist). QT MySql connectivity using Windows XP, Qt Creator 4.5.2(windows 32 bit) I don't think this has yet been covered in .  There was , however, it was not specifically talking about the case where the proper noun ends in a plural noun.  Feel free to vote to close if I am wrong.  What is the correct way to make a proper noun ending in a plural noun ending in an "s" possessive?  This frequently happens with corporations, e.g., "Dunkin' Donuts."  Should one work off of the fact that the entity is singular—suggesting Dunkin' Donuts's—or should one work off of the fact that "Donuts" is plural and ending in an "s"—suggesting Dunkin' Donuts'?  I expect that the answer might depend on dialect because some regions refer to corporations in the singular form ("Dunkin' Donuts is a company") while other regions refer to corporations in the plural form ("Dunkin' Donuts are a company").  I am specifically interested in American English, but would be interested in hearing answers for other dialects too. Fantasy novel: magic school, talking rabbit, character bites off another character's fingers The plotline as a whole is completely lost to me, but it was a big inspiration to my preteen self at the time and has shaped my creative development up to now. I'll list some of the big points that I can recall from it, if anyone has the vaguest idea what book I am referring to I would be so appreciative for any guess! I just want to reread it.   Main character is a delinquent of sorts, goes to a magic school. I don't remember there being any pictures in this book. There is a threesome between the main character and his two friends I believe it is a talking rabbit that says something along the lines of "My dear child, you are incensed", followed by one of the characters saying something like "Damn right I am!" A character that had been mentioned earlier but never made an appearance (he was banned for doing bad magic I think) shows up to fight and he bites off another character's fingers. Main character seeks out a magical white stag near the end of the novel because the stag can grant a wish if it's caught because he wishes to reset his timeline. The stag is able to speak. I am trying to write an if statement to test whether there are any files matching a certain pattern. If there is a text file in a directory it should run a given script.  My code currently:  if [ -f /*.txt ]; then ./script fi   Please give some ideas; I only want to run the script if there is a .txt in the directory. Usually, when we see two letters put together it is to define the pronunciation or to differentiate synonyms or just its foreign origins. But some words don't seem to have any reason to double up.     Why does vacuum have two of the letter U?  Why does aardvark have two of the letter A?  Why does llama have two of the letter L? If $a$ and $b$ are two roots of $x^4 + x^3 - 1 = 0$ prove that $ab$ is a root of $x^6 + x^4 + x^3 - x^2 - 1$. Built-in unit strings recognized by Quantity? Lightning Change Event Is there a way to catch the change event of a particular field/component? I saw on the AuraDocs that there is a valueChange event but trying to handle it makes the app throw an error on load. I was wondering if I could build some automatic field validation / search suggestions without relying on other js libraries. How to redirect apache /var/www to the home directory and access all the directories and files in my home directory? How do idle games handle such large numbers? Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers.  I am trying to implement an idle game however the largest number format supported by C# is decimal.   I am looking to support up to 10^500; that needs to be floating point  How could I handle this?  P.S. it needs to be cross platform i.e. pc, mac, ios, android and compatible with Unity TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows