Convert string to int in C++
How can I convert a std::string to int?
Why Objective-C,PHP do not support method overloading? DNS settings on managed switches in LAN We have a Windows 2008 server that is connected to a managed switch with about 15 Cat5e connections and three fiber branches that go to different parts of campus. At each of these parts there is another managed switch that branches out to the LAN. Our cable Internet comes into one of these locations, goes through the supplied modem and into a Sonicwall.  Question: Under DNS settings on all the switches, should I list the LAN Server IP and/or just the Gateway IP (Sonicwall)? The speed of light is the same in all inertial frames.  Does it change from a non-inertial frame to another? Can it be zero?  If it is not constant in non-inertial frames, is it still bounded from above? Using the Pigeonhole Principle to show that $2$ of any $n+1$ numbers from $\{1,2,\ldots,2n\}$ sum to $2n+1$ I am a newbie in linux. I wanted to install ubuntu to my desktop. I currently have two partitions, Windows 8 in installed on one, and i have some important files in another partition. While installing ubuntu, if I chose "Replace Windows 8 with Ubuntu", do I lose the other partition too?   And are there other ways to leave the other partition as it is, and install ubuntu in the partition  where windows was installed. Printing an array to a file with each element of the array in a new line in bash What is the concept of erasure in generics in Java? Discovering transformations and interactions I am teaching myself regression using Regression Modeling Strategies by Harell and the author goes at quite the length to showcase the importance of modeling interactions and transformations of the initial variables. I can't help but wonder how to approach this in a more structured/automated way when dealing with a lot of potential variables.  Can we use recursive partitioning, for example, to somehow to do the work for us and then use the output as variables, shrink the estimates with LASSO to deal with colinearity and do a final step where we use some sort of filtering for feature importance.  In my mind this will leave us with a well specified model which can be manually inspected and improved if need be, but is this reasonable? Are there other ways to approach this? Are there some resources that deal with problems like this? How do I check if a list is empty? Cannot log into Area 51 with OpenID I recently tried many times to log into Area 51 with my Stack Exchange OpenID. Each time, I got this:    Then, I went to my OpenID account, and I saw this:    ...what is going on??  I have chrome, and extensions that block 3rd party cookies... is that the problem? How could Thranduil have met a dragon? Pointer to class data member "::*" I came across this strange code snippet which compiles fine:  class Car {     public:     int speed; };  int main() {     int Car::*pSpeed = &amp;Car::speed;     return 0; }   Why does C++ have this pointer to a non-static data member of a class? What is the use of this strange pointer in real code? I have a bunch of views/reports built for my client. The reviewers then click download csv for the excel file. They asked if the views could download themselves daily to a folder.  Is that possible? And could you share links or knowledge how to handle this. I have been trying to figure it out.  Note: Right now the user is downloading CSV's from Drupal 7, an install of Moodle 1.9 in a Drupal 6 Shell and Survey Monkey. After they download and combine using Excel, the user creates reports that way for the users we have come to our events. Being a Front-end developer, coding is not my strength. Note: this is intended to be a canonical question about summoning sickness.  "Summoning sickness", broadly, is the rule that stops you from attacking or paying {T} costs with a creature that you just played. But how exactly does it work? How does it interact with other rules and effects?  For example, if I'm trying to figure out how a creature is affected:   Does the status matter (tapped/untapped, face down/face up, etc.)? What if it came into play, but I didn't cast it? What if it's a token? What if it was on the battlefield when my turn started, but it wasn't a creature? What if it stops being a creature? What if it's a creature and also another card type? What if it's a double-faced card that just transformed? What if it changes control? What if it's a copy of another creature? Which of the creature's activated abilities can I use? Are any of its other abilities affected? Can I tap the creature to pay a cost that is not a {T} cost?   (These examples are primarily taken from questions about summoning sickness that have already been asked on the site) Taking the * of these two large shapefiles   locally using ArcMap takes appr. 10 min.   Over the last few weeks, I've tried to obtain the same results using other, open-source approaches without success. I am curious why only ArcMap seems to generate results in a reasonable amount of time without errors.   The approaches I've tried so far:  QGIS  The most straight-forward alternative. There are two "union" functions available in QGIS. One default (part of vector overlay), one based on SAGA. Both functions create the desired results on smaller samples but fail to run (or take forever) on my shapefiles. I tried running union for 30 minutes after which the progress bar was at appr. 4%    PostGIS  I've ingested the shapefiles on an AWS RDS instance running postGreSQL with PostGIS enabled. The approach is not so straight forward and requires a hideous long SQL query to obtain the same result. Most importantly, the query did not create a meaningful result on the full datasets. It did run properly on a sample though.   See separate question   CREATE TABLE test.sqlislelijk AS  -- input data with polys1 AS (   SELECT      pfaf_id as df1,     geom as g   FROM hybas06_v04 ), polys2 AS (   SELECT      aqid as df2,     geom as g   FROM y2018m11d14_rh_whymap_to_rds_v01_v01 ), -- intersections intersections AS (   SELECT df1, df2, ST_INTERSECTION(a.g, b.g) i, a.g AS g1, b.g AS g2    FROM polys1 a, polys2 b WHERE ST_INTERSECTS(a.g, b.g) ), -- per-row union of intersections with this row diff1 AS (   SELECT df1, ST_UNION(i) i FROM intersections GROUP BY df1 ), diff2 AS (   SELECT df2, ST_UNION(i) i FROM intersections GROUP BY df2 ), -- various combinations of intersections pairs AS (   SELECT df1, df2, i AS g FROM intersections   UNION ALL   SELECT      p.df1,     NULL,     CASE       WHEN i IS NULL THEN g        ELSE ST_DIFFERENCE(g, i)     END   FROM polys1 p LEFT JOIN diff1 d ON p.df1 = d.df1   UNION ALL   SELECT     NULL,     p.df2,     CASE       WHEN i IS NULL THEN g       ELSE ST_DIFFERENCE(g, i)     END   FROM polys2 p LEFT JOIN diff2 d ON p.df2 = d.df2   ) SELECT    df1 as pfaf_id,   df2 as aqid,   g as geom FROM pairs WHERE NOT ST_IsEmpty(g);   Google BigQuery  Google's GIS extension for BQ looks promising but I experienced weird behavior and internal errors, probably due to mixing of GEOMETRY and GEOGRAPHY objects. Also, the syntax is similar to PostGIS and a command of 1 line in geopandas takes >20 lines in SQL.   GeoPandas  Probably my favorite approach. The out-of the box approach does't give any results after running it for several hours. My latest approach includes tiling the shapefiles, use multiprocessing on each tile and merge them. Not very straight forward and one 10x10 degree tile till takes 40+ minutes to calculate.   See   It is the first time in my career that I am impressed by the performance of ArcMap. It seems that ArcMap handles this use-case much, much better than anything else. The issue seems persistent over all solutions I've tried so far. Is there something wrong in the underlying libraries of the open-source/alternative solutions?    Note that Union in ArcMap means something different than in the Shapely / PostGIS world. Improving how suggested edits are displayed in your activity history Issue 1: I find it a bit irritating that when I click the Improve button and further edit it, even if I mark it as helpful, only Community takes the credit for the approval. I know the topic itself will contain the link to the suggested edit, but my activity history only says that I made an edit, and not approved a suggested edit. The same holds true for marking one as unhelpful. The activity history should say I rejected an edit, and then made an additional edit. I know it's not often, but sometimes I do try to go back to a suggested edit I've rejected, but when I improved and rejected, it's not traceable for me as it doesn't show in my history or in the question's revision history. So if I don't remember what user suggested it, it's lost to me.  This issue also plagues the  which are awarded for approving and rejecting suggested edits, which essentially you have done, you're just not receiving credit for it. I suggest that when I mark an edit as helpful or not helpful, both me and Community be listed as the approvers or rejecters, unless another user is already listed in the appropriate place.  Update: Here is  of the confusion this causes.  Update 2: Also, when improving a post and marking it as "not helpful", it would be nice to be able to  along with it.    Issue 2: Expanding off the idea that users need more notice for suggested edits that get rejected, the activity history page is much too useless when it comes to listing the suggested edits a user has made. Literally all it does is list them. A user still has to click through to each one in order to find out if it was approved or rejected, or even if it's still pending. Take, for example, this screen shot of the suggested edit history:    Is it really necessary to say I suggested a suggested edit? Really? Of course I suggested it, it's a suggested edit. This isn't !  A good way to fix this would be to change the second "suggested" word into one of: pending, approved, or rejected. This would be a quick way to tell which edits have been approved or rejected and which ones are still pending. Users would be able to target out rejected edits and review them for the reasons. Something like this: C# 3.0 auto-properties — useful or not? Note: This was posted when I was starting out C#. With 2014 knowledge, I can truly say that auto-properties are among the best things that ever happened to the C# language.  I am used to create my properties in C# using a private and a public field:  private string title; public string Title {     get { return title;  }     set { title = value;  } }   Now, with  3.0, we got auto-properties:  public string Title { get; set; }   I know this is more a philosophical/subjective questions, but is there any reason to use these auto-properties except from saving five lines of code for each field? My personal gripe is that those properties are hiding stuff from me, and I am not a big fan of black magic.  In fact, the hidden private field does not even show up in the debugger, which is OK given the fact that the get/set functions do nothing. But when I want to actually implement some getter/setter logic, I have to use the private/public pair anyway.  I see the benefit that I save a lot of code (one vs six lines) without losing the ability to change the getter/setter logic later, but then again I can already do that by simply declaring a public field "Public string Title" without the need of the { get; set; } block, thus even saving more code.  So, what am I missing here? Why would anyone actually want to use auto-properties? How is the derivative of $\mbox{Trace}\left\{ X^T A X B\right\}$ with respect to matrix $X$ equal to $AXB + A^TXB^T$?  \begin{align}   \nabla_X \ \textrm{Trace}\left\{ X^T A X B\right\} = AXB + A^TXB^T \end{align}  where $A$ and $B$ matrices are given. How much set theory and logic should typical algebraists/analysts/geometers know? (soft-question) I know enough amount of set theory and logic to study grad-level math. However, I don't know more advanced set theory and logic, such as the ones on Kunen's or Shoenfield's texts. Although it's good to learn such advanced topics, I may not have enough time to do so, since I will probably put my emphasis on algebra, analysis or geometry as well as mathematical physics.   Although how much set theory and logic I should learn is totally up to what sort of analysis, algebra or geometry I will study, I want to know how much of them typical competitive algebraists/analysts/geometers know. If you are one of them, how much do you know? How to find patches with data in Raster and then how to extract those patches? I have a single band raster file as drawn in the labeled image attached.  The size of raster is around 4k pixel in each x and y axis. Large part of this raster is empty. Only in small portions of the raster contains data as labeled. Is there any efficient way I can extract rectangular patches around the data portions of the large tif raster file? Any pythonic way using gdal or rasterio or some other package. What I have done so far: I have followed from sklearn.feature_extraction.imageway to extract 2D patches where there is data as follows. from sklearn.feature_extraction.image import extract_patches_2d im = imageio.imread(largeFilePath) # reading the large image x, y = np.nonzero(im) # taking xy locations with non zero values  # determining xleft, xright, yleft and yright of the non zero area in  raster  xl,xr = x.min(),x.max()  yl,yr = y.min(),y.max()   #Extraing the non zero area from my original raster only_desired_area = im[xl:xr+1, yl:yr+1]  # my desired window to extract  window_shape = (480, 480)  # 2D Ptaches extraction B = extract_patches_2d(only_desired_area, window_shape, max_patches=100)  Issue: This doesn't have georeference information because I haven't used gdal or rasterio