What's the difference between a package and an import? Please give an example.  Why can't we just use import java.util.*;? Doesn't it give access to all the others automatically?      import java.util.regex.Matcher; import java.util.regex.Pattern;  public class RegexMatches { public static void main( String args[] ){    // String to be scanned to find the pattern.   String line = "This order was placed for QT3000! OK?";   String pattern = "(.*)(\\d+)(.*)";    // Create a Pattern object   Pattern r = Pattern.compile(pattern);    // Now create matcher object.   Matcher m = r.matcher(line);   if (m.find( )) {      System.out.println("Found value: " + m.group(0) );      System.out.println("Found value: " + m.group(1) );      System.out.println("Found value: " + m.group(2) );   } else {      System.out.println("NO MATCH");   }  } }
It is much more convenient and cleaner to use a single statement like  import java.awt.*;   than to import a bunch of individual classes  import java.awt.Panel; import java.awt.Graphics; import java.awt.Canvas; ...   What is wrong with using a wildcard in the import statement?
What novel had an isolationist Earth and the rest of humanity in a war of attrition against aliens? Remove a child with a specific attribute, in SimpleXML for PHP Inform users of certain tags on the existence of a new SE-2.0 site and offer to automatically post the question there instead Take for example  both at SO and SU. Now that there's , (new) users asking a LaTeX question should at least be informed that there is a new Stack Exchange site dedicated to TeX and thus increases their chance of an answer. This should happen before the question is actually posted and ideally offer the option to post the question directly there instead (without the need to copy-paste).  LaTeX is just an example, there's also , ,  etc., and it is obvious that this can only be decided on a case-by-case basis which is why I certainly do not suggest migrating questions automatically when these tags are used. But informing users of that possibility would probably help the SE network in general. Why are we using a biased and misleading standard deviation formula for $\sigma$ of a normal distribution? test fails because of TestMethod do not support getContent call My below test fails because of Run Failures: TestRangehoodObjectionSheet.RangehoodObjectionSheetTest Methods defined as TestMethod do not support getContent call. I added the Blob thinking it might resolve but it doesn't work. What could be the problem here? Have I used the Blob correctly?  @isTest public with sharing class TestRangehoodObjectionSheet {      static testMethod void RangehoodObjectionSheetTest() {             String Build                = NBATRecords.getIdFromDeveloperName('Plan_Reviews__c','Building_Plan_Review');             Account a = new Account(Name = 'Test1' ,Type = 'Lead Acct',BillingState = 'CA',Industry = 'Business Services');             insert a;              Establishment_Record__c er = new Establishment_Record__c(Account__c=a.Id ,Project_Name__c = 'TestPreet',PremiseStreet__c='Manhattan ave',PremiseBorough__c='Manhattan',PremiseState__c='NY',PremisePostalCode__c='11102',Referral_Source__c='311',Data_Source__c='CAMIS',Phase__c='Initiate',Business_Status__c='Open' );             insert er;              Application__c ap = new Application__c(Establishment_Record__c=er.Id,Job_Number__c='222222222');             insert ap;              Plan_Reviews__c pr = new Plan_Reviews__c(Application__c =ap.Id ,DOB_Job_Number__c='222222222',RecordTypeId =Build,Objections__c='Pipe size not indicated');             insert pr;             PageReference pageRef = Page.RangehoodObjectionSheet;              Test.setCurrentPage(pageRef);               Blob content = Test.isRunningTest() ? Blob.valueOf('UNIT.TEST') : pageRef.getContent();              Plan_Reviews__c              p   = new Plan_Reviews__c(id=pr.Id);                ApexPages.StandardController sc  = new ApexPages.standardController(p);             System.assertNotEquals(sc,null);             RangehoodObjectionExtention    ext = new RangehoodObjectionExtention(sc);              ext.Savecopy();       } }   Actual class for the test:  public with sharing class RangehoodObjectionExtention { private final ApexPages.StandardController controller; private final Id                           planreviewID; public String imageURL{get;set;} public List&lt;String&gt; objlist {get;set;}  public string currentdate {get; set;}    public RangehoodObjectionExtention (ApexPages.StandardController stdController) {         controller   = stdController;         planreviewID = (Id)controller.getRecord().get('Id');         Date dt = Date.today();         currentdate = dt.format();         list&lt;Plan_Reviews__c&gt; prlist = [select FDNY_Objections__c from Plan_Reviews__c where id = :planreviewID limit 1];         string obj;         for(Plan_Reviews__c pr: prlist){            obj = pr.FDNY_Objections__c;             }         if(obj!=null){            list&lt;string&gt; objections = obj.split(';');             integer i =1;            objlist = new list&lt;string&gt;();            for(string o : objections){               objlist.add(i++ +'. '+o);            }         }         imageURL='/servlet/servlet.FileDownload?file=';         List&lt; document &gt; documentList=[select name from document where Name='RangehoodObjectionLogo'];         if(documentList.size()&gt;0)         {            imageURL=imageURL+documentList[0].id;         }       }          public PageReference Savecopy(){       PageReference p = Page.RangehoodObjectionSheet;       blob b = ApexPages.currentPage().getContentAsPDF ();       Attachment a = new Attachment();       a.body = b;       a.name = 'Rangehood Objection sheet Issued '+currentdate+'.pdf';       a.parentid = planreviewID;        insert a;        PageReference pref = new PageReference('/'+planreviewID);       return pref;    } } How can I combine hashes in Perl? What is the best way to combine both hashes into %hash1?  I always know that %hash2 and %hash1 always have unique keys.  I would also prefer a single line of code if possible.    $hash1{'1'} = 'red'; $hash1{'2'} = 'blue'; $hash2{'3'} = 'green'; $hash2{'4'} = 'yellow'; we are currently experiencing some issues with the ambiguity feature of apa for biblatex/biber (we use biber) in TexLive 2012.  What would be correct with the ambiguity feature:  Doe J., Peters M., Kramer N., Conan B. (2012) Doe J., Mayer M., Smith N., Walker J. (2012)  Citations in text (subsequent ones) - AS IS AND CORRECT Doe, Peters et al (2012) Doe, Mayer et al (2012)   But in case of different years, it shouldn't actually do this ...  Doe J., Peters M., Kramer N., Conan B. (2012) Doe J., Mayer M., Smith N., Walker J. (2009)  Citations in text (subsequent ones) - AS IS: Doe, Peters et al (2012) Doe, Mayer et al (2009)  Citations in text (subsequent ones) - HOW IT SHOULD BE: Doe et al (2012) Doe et al (2009)   Can anyone help here?  Thank you! Proof that $ p $ | ${ p^n \choose k } $ for any prime $p$ and $ k < p^n$ I know how to prove the fact that $ p$ | ${ p \choose k } $ (when writing it as a fraction, $p$ cannot be divided by any of the $1\times2\times...\times k$ or $1\times2\times...\times(p-k)$ because $p$ is prime).  When I try to apply the same rationale for $ p$ | ${ p^n \choose k } $ I get stumped because $p^n$ is in fact divisible by one of the $k! = 1\times2\times...\times k$, where $0 &lt; k &lt; p^n$.  If we take the example of $2^3$ and $k = 7$, we can easily see that $k! = 1 \times 2 \times ... \times 6 \times 7$, and $2$ clearly divides $2^3$.  How else can I approach this? If I've decided to update my SE avatar (in any of the various ways well described in the answer to this ), am I able to return to either the original stock image or previous avatar images I have used? Tangent bundle : is a manifold I have studied what a differentiable manifold is, and what a tangent space at a given point is, and read the proof that its dimension is equal to the dimension of the manifold. Here a tangent vector is a derivation on the germs of differentiable functions at a point.  Now I am trying to see that the tangent bundle is indeed a differentiable manifold. I get that for an open set $U$ in Eucliden space, it takes the form $U \times \mathbb R^n$ with the vector $\sum a_i x_i$ giving the tangent vector $\sum a_i \partial /\partial x_i$. Now the book says that it is "obvious" that these glue up and give a differentiable manifold.  I may be stupid; but I will be grateful if somebody can hold my hand through this "obvious" statement. mysql select distinct rows into a comma delimited list column Performance impact of updating target columns with same values ON CONFLICT This is a question about the inner-workings of Postgres (v10) and performance.  Given a table, github_repos, with a multi-column unique index on org_id and github_id columns, is there any performance difference (or other issues to be aware of) between the two bulk upsert operations below? The difference is that in the first query, the org_id and github_id columns are included in the UPDATE, whereas in the second query they are not. Since the UPDATE runs ON CONFLICT, the updated values of org_id and github_id will be the same as the old values, but those columns are included in the UPDATE because the underlying library I am using is designed that way. I'm wondering if its safe to use as-is or whether I should be explicitly excluding those columns in the UPDATE.  Query #1:  INSERT INTO "github_repos" ("org_id","github_id","name") VALUES (1,1,'foo') ON CONFLICT (org_id, github_id) DO UPDATE SET "org_id"=EXCLUDED."org_id","github_id"=EXCLUDED."github_id","name"=EXCLUDED."name" RETURNING "id"   Query #2:  INSERT INTO "github_repos" ("org_id","github_id","name") VALUES (1,1,'foo') ON CONFLICT (org_id, github_id) DO UPDATE SET "name"=EXCLUDED."name" RETURNING "id"   github_repos table:        Column       |       Type        | Collation | Nullable  -------------------+-------------------+-----------+----------+  id                | bigint            |           | not null |  org_id            | bigint            |           | not null |  github_id         | bigint            |           | not null |  name              | character varying |           | not null |  Indexes:     "github_repos_pkey" PRIMARY KEY, btree (id)     "unique_repos" UNIQUE, btree (org_id, github_id) Is there a way to change the process group of a running process? Is there a way to change PID, PPID, SID of a running process? It would make sense for the answer to be no, but I'd like to make sure. What's the best way to version CSS and JS URLs? Creating and configuring .bash_profile I was setting path for anaconda. an answer to a question  has the following solution. I searched for .bash_profile, but I can't seem to find it. How do I setup this file and get it to run on startup? Every time I think I have the curve modifier mastered, it throws me a another curve ball (no pun intended).  Why in  can I not get the lights to follow the spiral curve? When the modifier is activated, the lights are stretched and distorted along the curve.  I created the curve by converting it from a mesh (string of verts). Why does it not display like a normal Bezier? Is that related to my problem?  I am following all the "rules" that I am aware of, as detailed here: . The curve seems to run in the correct direction. The origin point is at the first point of the curve. The curve modifier on the lights is set to -Y which is the local orientation of the curve's direction.  What am I missing? Smoothing/generalizing polygon in QGIS? Is it possible to smooth or generalize a polygon in QGIS, perhaps by using a plugin like the generalizer-plugin for lines?  I could convert my polygons to lines, smooth them and convert them back to polygons but this is not working for my polygons because of several reasons. Complex number isomorphic to certain $2\times 2$ matrices? I have been trying to prove this, but I am having trouble understanding how to prove the following mapping I found is injective and surjective. Just as a side note, I am trying to show the complex ring is isomorphic to special $2\times2$ matrices in regard to matrix multiplication and addition. Showing these hold is simple enough.  $$\phi:a+bi \rightarrow \begin{pmatrix} a &amp; -b \\ b &amp; a \end{pmatrix}$$  This is what I have so far:  Injective: I am also confused over the fact that there are two operations, and in turn two neutral elements (1 and 0). Showing that the kernel is trivial is usually the way I go about proving whether a mapping is injective, but I just can't grasp this.  $$ \phi(z_1) = \phi(z_2) \implies \phi(z_1)\phi(z_2)^{-1} = I = \phi(z_1)\phi(z_2^{-1}) = \phi(z_2)\phi(z_2^{-1}).$$  So if we can just show that the kernel of $\phi$ is trivial, then it also shows that $z_1 = z_2$. The only complex number that maps to the identity matrix is one where $a = 1$ and $b = 0$, $a + bi = 1 + 0i = 1$.  Using a similar argument for addition we can just say that the only complex number $z$ such that $\phi(z) = 0\text{-matrix}$, is one where $a=0$ and $b=0$, $a+bi=0+0i=0$.   Surjective:  I forgot to add this before I posted, but I honestly don't really understand how to prove this because it just seems so obvious. All possible $2\times2$ matrices of that form have a complex representation because the complex number can always be identified by its real parts and since the elements of the $2\times2$ matrix are real then the mapping is obviously onto.  I have always had trouble understanding when I can say that I have "rigorously" proved something, so any help would be appreciated! Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name.  I tried using the "?" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use:  for item in self.inventory_names:     self.cursor.execute("SELECT weight FROM Equipment WHERE name = ?", item)     self.cursor.close()   I get the error:     sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 8 supplied.   I believe this is somehow caused by the initial creation of the database; the module I made that actually creates the DB does have 8 bindings.  cursor.execute("""CREATE TABLE Equipment      (id INTEGER PRIMARY KEY,      name TEXT,     price INTEGER,      weight REAL,      info TEXT,      ammo_cap INTEGER,      availability_west TEXT,     availability_east TEXT)""")   However, when I use the less-secure "%s" substitution for each item name, it works just fine. Like so:  for item in self.inventory_names:     self.cursor.execute("SELECT weight FROM Equipment WHERE name = '%s'" % item)     self.cursor.close()   I can't figure out why it thinks I have 8 bindins when I'm only calling one. How can I fix it? If a person holds prejudice against people because of their nationality, would that be considered racist? Would it be considered racist if a store owner believes all Canadians are thieves and does not let any Canadians into his store? Racism pertains to discriminating based on race, and (correct me if I'm wrong) Canadians are not a race. What would be an appropriate word to describe an individual such as the  store owner?  The discrimination is specific to Canadians, not foreigners in general. I'm looking for a word that could be applied to someone who lives in the country they discriminate against. For example if a Canadian announces "all Canadian culture is stupid!" what would that be called?