I've to redirect to the controller action method from non-controller class.  I am using HttpContext.Current.Response.Redirect();, it is redirecting me to my action method, but it's throwing an error      "Cannot redirect after HTTP headers have been sent".   public void MethodName () {      HttpContext.Current.Response.Redirect(url); }   I want to redirect form non-controller class void method.
When I call Response.Redirect(someUrl) I get the following HttpException:     Cannot redirect after HTTP headers have been sent.   Why do I get this? And how can I fix this issue?
Windows 10 "Enable NTFS long paths policy" option missing I am looping over the features of a shapefile containing multiple polygons. If  certain criteria are met, I want to save the current feature in a new shapefile.  I am doing this using GDAL 1.10.0 with Python 2.7.3  The code runs, creates the files I want, calculates the area correctly. In the shapefile that is created, the attribute table contains the propoer fields ('name' and FID). Two things are wrong:   No polygons are visible (in ArcMap). This seems to me particularly weird, because the polygons seem to me proper, in the sense that they are closed (and the area is calculated properly).  The coordinate system seems off (in Arc Catalog there appears in the bottom -20,9667 0,0000 (are these degrees??)), despite the fact that I am creating a projection file (they are in German national grid 3)   Any hints as to what the problems could be? I tried to put the relevant excerpt of the code below:  from osgeo import gdal, gdalnumeric, ogr, osr, gdalconst  ### prepare shapefile into which to save driver = ogr.GetDriverByName('ESRI Shapefile') path_matched = r'.../.../path' datasource = driver.CreateDataSource(path_matched) lyr_matched = 'matched_%s' % cur_id  # from above # Remove output shapefile if it already exists name_shpfile = lyr_matched + '.shp' if os.path.exists(os.path.join(path_matched, name_shpfile)):     driver.DeleteDataSource(os.path.join(path_matched, name_shpfile)) layer = datasource.CreateLayer(lyr_matched, geom_type=ogr.wkbPolygon) #layer.ResetReading() field_name = ogr.FieldDefn("name", ogr.OFTString) layer.CreateField(field_name)  ### prepare file in which I want to write the areas of matched polygons path_area = path_matched file_area = 'matched_area_%s.txt' % (cur_id) fobj_area = open(os.path.join(path_area, file_area), 'w')  ### original shape file containing all polygons shp = ogr.Open(shp_all)  # os fobj from above lyr = shp.GetLayer()  # loop over polygons in original shameful for FID in featList:     feat = lyr.GetFeature(FID)      # this is from the shapefile      cur_name = feat.GetField(1)      # ... work on conditions ...      if condition = true:         myPoly = ogr.Geometry(type=ogr.wkbPolygon)         cur_poly = feat.GetGeometryRef()         myPoly.AddGeometry(cur_poly)         cur_spat_ref = cur_poly.GetSpatialReference()          cur_area =  cur_poly.GetArea()         cur_area_string = "%s \t %f \n" % (gw_name_EZG, cur_area)         fobj_area.write(cur_area_string)          featur_dfn = layer.GetLayerDefn()         feature_abc = ogr.Feature(featur_dfn)         feature_abc.SetGeometry(myPoly)         feature_abc.SetField("name", cur_name)         feature_abc.SetFID(FID)         layer.CreateFeature(feature_abc)         myPoly.Destroy()         feature.Destroy()   # generate projection file prj_filename = lyr_matched + '.prj' file = open(os.path.join(path_matched, prj_filename), 'w') targetSR = cur_spat_ref targetSR.MorphToESRI() file.write(targetSR.ExportToWkt()) file.close()   datasource.Destroy() It shows no question owner, not even a simple name (without link).   What happened? sum of the residue at all poles of the rational function p/q is 0. We are given two polynomials p, q with deg(q)>1+deg(p). Show that the sum of the residue at all poles of the rational function p/q is 0.   How do I go about solving this? Is there a systematic way of solving cubic equations? In my text book, to solve cubic equations, I need to    find by trial &amp; error what $f(a)$ will make the equation 0. The factor will be $(x-a)$ then the other factor will be $Ax^2+Bx+C$ then I can solve using compare coefficient   But for te first part, is there any other way apart from trail &amp; error? Or is there some technique to guess the factor of an equation?   The question I am currently doing happens to be $2x^3+3x+4=9$   UPDATE:  $2x^3+3x+4=9$ should be $2x^3+3x+4=9x^2$   UPDATE 2  So I am going to try substituting   $x=\pm{1}, \pm\frac{1}{2}, \pm{2}, \pm{4}$  When $x=-\frac{1}{2}$, one of the provided answers,   $2(−0.5)^3−9(−0.5)^2+3(−0.5)+4=-18.75\neq 0$   did I make a mistake? I want to change the Message-ID header or better yet, discard it. I know everyone is going to ask "Why would you want to do that?" because I know it sounds weird to even write it.  Well I am developing a system that saves an incoming e-mail in EML format, changes it and sends it to the user, at some point the user can request to have the original EML sent to him/her. The issue is that when I re-send the EML it has the same Message-ID header which causes exchange servers to drop the re-send.  Of course I am hoping there is some option through postfix to do this, otherwise I will need to parse and change the EML but I rather not do that.  I tried to do this with "header_checks" and it works BUT I need to be able to do this conditionally, meaning only on a specific occasion, which I can identify by looking at the other headers, I want to remove the Message-ID. Essentially, I have a csv file that contain multiple columns, called cols.csv  1,a,100 2,b,200 3,c,300 4,e,400   and I have a new csv file that has one column, called col.csv  f g h i   I want to copy the items in col.csv and append them to the end of each line in cols.csv so that, cols.csv now contains those  1,a,100,f 2,b,200,g 3,c,300,h 4,e,400,i   is that possible at all? i tried join, paste, nothing worked Is there any built-in software or terminal method allowing me to view the hardware profiles on my system? Windows equivalent of such a feature would be Device Manager. How do the review limits work? I got the brand new Custodian badge today for reviewing posts. Inspired by that, I reviewed some more suggested edits. Now I ran into a limit:     You have no more suggested edit votes today; come back in x hours.   How is that limit calculated? I made 61 reviews today which seems to be some calculated limit.  I searched for an answer on meta but found nothing helpful. What are the increased possibilities (if any) of being able to crack a private key given the following:   The associated bitcoin (ECDSA Secp256k1-based) public key is known. The private key has been used to generate a public key from a different ECDSA curve and that public key is also known. It is known that the two public keys are derived from the same private key. It is known which ECDSA curves were used to generate the public keys. It is known which ECDSA curve was used to generate which public key.   Does it make any more difference if there is data that is known to have been signed by the private key and the signature(s) are known and the raw data is known?  EDIT: I should have pointed out that the conditions are ANDed, I.e. All conditions are known. Sorry, I should have been clearer the first time. I'm consistently receiving significant delays on Stack Overflow when opening the flag dialog on questions. Delays do not occur on any other StackExchange site I have checked. This started a couple days ago (as far as I can tell).  Delays occur not only when loading the initial screen, but also when loading the submenus. This is slightly confusing for a couple seconds (until you're used to it) since it appears as if the flag dialog has simply vanished.   What's going on here? I demand to know, otherwise somebody will be very upset.  Not me. I'm not going to get that upset over something like this.  But someone will.    Specs (though I know of several others who have this issue):  Windows 7 64-bit Chrome Version 30.0.1599.69m     Ping: 31ms Download: 6.88mbps   Upload: 1.07mbps I've encountered a particular type of writing occasionally and it being, derp, in writing, it's hard to tell whether there's an accent behind it. The English used seems to me to be simply incorrect, but I can't help but feel that the following features are part of a dialect or a regional style of English. One of the most glaring (and grating) features is the substitution of &quot;saw&quot; with &quot;seen&quot;.  He seen him at the shop the other day. I seen that you were looking for... etc.  The use of &quot;away (to)&quot; is also peculiar, if not incorrect.  He was away to open the door when... He was away to get what he had asked for. etc.  I haven't come across these forms very often, and even then it was accompanied by otherwise mostly correct English, which is what makes me wonder what the hell. This is more intellectual curiosity than anything else. Logistic regression with binary dependent and independent variables I use pgfplots for most of my plots. Now I need to add a . Is this possible with pgfplots or any other package? Unique (non-repeating) random numbers in O(1)? I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it. Is this possible? Texture packing algorithm What is a good texture packing algorithm?  Technically,  is , so a heuristic is what I'm really after. Generating correlated binomial random variables I was wondering if it might be possible to generate correlated random binomial variables following a linear transformation approach?  Below, I tried something simple in R and it produces some correlation. But I was wondering if there is a principled way to do this?  X1 = rbinom(1e4, 6, .5) ; X2 = rbinom(1e4, 6, .5) ;  X3 = rbinom(1e4, 6, .5) ; a = .5  Y1 = X1 + (a*X2) ; Y2 = X2 + (a*X3) ## Y1 and Y2 are supposed to be correlated  cor(Y1, Y2) Showing that $e^z=z$ has infinitely many solutions One of our review problems for my complex analysis final is the following:     Show that $e^z=z$ has infinitely many solutions in $\mathbb{C}$.   I've seen a few solutions online, but none of them have used material that was covered in our introductory complex analysis course. Would anyone be able to provide a simple solution?  I'm trying to think of ways to invoke bounding in some way but I can't seem to come up with anything. Why is Newton's method not widely used in machine learning? This is something that has been bugging me for a while, and I couldn't find any satisfactory answers online, so here goes:  After reviewing a set of lectures on convex optimization, Newton's method seems to be a far superior algorithm than gradient descent to find globally optimal solutions, because Newton's method can provide a guarantee for its solution, it's affine invariant, and most of all it converges in far fewer steps. Why is second-order optimization algorithms, such as Newton's method not as widely used as stochastic gradient descent in machine learning problems? I've got a custom loop that I'm using to display some Real Estate listings that will be available within 60 days. I'm calling it with the following function:   &lt;?php  $sixtydays = date('Y/m/d', strtotime('+60 days')); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $query = new PostsOrderedByMetaQuery(array(   'post_type' =&gt; array('post', 'real-estate'),   'meta_key' =&gt; 'Time Available',   'meta_compare' =&gt; '&lt;=',   'meta_value' =&gt; $sixtydays,   'paged' =&gt; $paged,   'orderby_meta_key' =&gt; 'Price',   'orderby_order'    =&gt; 'ASC' )); ?&gt; &lt;?php while ($query-&gt;have_posts()) : $query-&gt;the_post(); ?&gt;   While the loop works great, I can't get it to paginate. It shows the first 10 (my default) posts but doesn't show the pagination. The only way to display all posts is to show them on one page by adding 'posts_per_page' =&gt; -1, I have similar loops on other pages that have no problem paginating. The only difference with this one is that there are two meta keys that are filtering the posts.   I'm using WP Page Navi for this and the rest of my pages. I'm closing the loop and adding the pagination using the following code:   &lt;?php endwhile; // End the loop. Whew. ?&gt; &lt;?php wp_pagenavi(); ?&gt; &lt;?php wp_reset_query(); ?&gt;   How can I go about fixing this?