I am really struggling with migrating a custom plugin from QGIS 2.x to 3.x. Below is a code snippet that seems very straightforward, but I can't find documentation that I understand for setSourceCrs().    # First, make sure the point is not within a half meter of the start   # or end points.   da = QgsDistanceArea()    # Function call in API 2.x   # da.setSourceCrs(lyrDb.lyr.crs().srsid())    # My attempt is missing the second argument   da.setSourceCrs(lyrDb.lyr.sourceCrs())    line = parent.geometry().asPolyline()   n = len(line)   d = da.measureLine(line[0], p1)   if d &lt; 0.5:     return 0   d = da.measureLine(line[n - 1], p1)   if d &lt; 0.5:     return 0   As you can see, previously the only argument required for the function was an integer for SRID. The new API wants two arguments as shown below, but very little explanation. Taken from   void QgsDistanceArea::setSourceCrs (const QgsCoordinateReferenceSystem &amp; crs, const QgsCoordinateTransformContext &amp; context)       I think I have the first argument correct, but I have no idea about the second. What do I need to send for the context argument?   Are there any other sources for documentation for the API?  This solution worked for me. It essentially passes an empty parameter into context, but that's okay because I'm not doing a transformation. I tested and it works as expected.    # First, make sure the point is not within a half meter of the start   # or end points.   da = QgsDistanceArea()   context = QgsCoordinateTransformContext()   da.setSourceCrs(lyrDb.lyr.crs(), context)   line = parent.geometry().asPolyline()   n = len(line)   d = da.measureLine(line[0], p1)   if d &lt; 0.5:     return -1   d = da.measureLine(line[n - 1], p1)   if d &lt; 0.5:     return -1   For the record, though it helped, my question was not solved by , nor is it a duplicate IMO.  That question was specifically concerned with calculating an ellipsoidal area which requires a transformation. The code that I am migrating concerns only a projected layer, which does not involve a transformation.  I came here after spending hours searching for an answer, and in my opinion it is because the documentation for pyQGIS API is sparse at best. However, I fully admit that the post above helped me figure out my solution, assuming it is a solution. It appears to work, and that is all I can say. Surely, there must be a proper way to call setSourceCrs when no transformation is required.  That said, I am happy so feel free to do whatever is appropriate with this question. This is my first foray into StackExchange, and I'm not familiar with protocol.
I'd like to loop though each feature in a layer and calculate its ellipsoidal area using QgsDistanceArea() in PyQGIS 3.  Everything works fine on unprojected layers, but I get strange results when input layer is in projected CRS.  So far I have written this:  from qgis.core import *  def calculate_area(in_lyr_name, ellipsoid, units):     input_layer = QgsProject.instance().mapLayersByName(input_lyr_name)[0]      area = QgsDistanceArea()     area.setEllipsoid(ellipsoid)      features = input_layer.getFeatures()     feature_area = 0     error_features_counter = 0      for i, feat in enumerate(features):         geom = feat.geometry()         polygon_area = 0         try:             if geom.isMultipart():                 polygons = geom.asMultiPolygon()                 for polygon in polygons:                     polygon_area += area.measurePolygon(polygon[0])             else:                 polygon = geom.asPolygon()                 polygon_area = area.measurePolygon(polygon[0])              feature_area += polygon_area          except AttributeError:  # catches NoneType geometries (broken etc.)             error_features_counter += 1             pass      # calculated area is in sq. metres (see the "else" case)     if units == 'km²':         final_area = feature_area / 1e6     elif units == 'Ha':         final_area = feature_area / 10000     else:         final_area = feature_area     return final area, error_features_counter   How do I get a constant result that does not depend on the presence of projection?
What does "Package  has no installation candidate" mean? What does the above Error mean? What is an installation candidate?  I was trying to do  sudo apt-get install munin-memcached     and I get this message:  Reading package lists... Done Building dependency tree        Reading state information... Done Package munin-memcached is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package munin-memcached has no installation candidate   I googled for the problem and someone said to do a apt-get upgrade but it still did not solve my problem. How can a list be created, whose items are both    enumerated (a,b,c,d,...)  and allow for setting a description via \item[texthere] ?   Im am using MikTex on Windows. Converting string arrays into Map Normally, it takes three votes to delete.  It still does, though the mouseover tip for a question with one delete vote cast on it already appears to be stuck at '1'    And then after casting a delete vote on it:    And if I've cast the first delete vote:    The above examples are from P.SE, and while I don't have the privs to verify this being the situation on other sites, this has been confirmed on at least SO and is likely network wide.    Child meta dups:   SO: Is 512 bits a more secure hashing than 256 bits? Print two files in two columns I want to print two files in two columns -- first file on the left side and second on the right side. paste doesn't do the job, because it can only insert a character as delimiter, so if first file lines have different length output will be twisted: $ cat file1 looooooooong line line $ cat file2 hello world $ paste file1 file2 looooooooong line   hello line    world  If it was a command to add trailing spaces like fmt --add-spaces --width 50 the problem would be solved: $ paste &lt;(fmt --add-spaces --width 50 file1) file2 looooooooong line                                 hello line                                              world  But I don't know a simple way to do this. So how to merge and print several files horizontally without twisting? Actually, I just want to look at them simultaneously.  UPD: command to add trailing spaces does exist (for example, xargs -d '\n' printf '%-50s\n') But solution like $ paste &lt;(add-trailing-spaces file1) file2  does not work as expected when file1 has fewer lines than file2. I am getting my feet wet with Git and have the following issue:  My project source tree:  / | +--src/ +----refs/ +----... | +--vendor/ +----...   I have code (currently MEF) in my vendor branch that I will compile there and then move the references into /src/refs which is where the project picks them up from.  My issue is that I have my .gitignore set to ignore *.dll and *.pdb.  I can do a git add -f bar.dll to force the addition of the ignored file which is ok, the problem is I can not figure out to list what files exist that are ignored.  I want to list the ignored files to make sure that I don't forget to add them.  I have read the man page on git ls-files and can not make it work. It seems to me that git ls-files --exclude-standard -i should do what I want.  What am I missing? I wrote an algorithm to randomly generate terrain and I am trying to load and edit my results with blender.  The problem is that when I load my terrain in blender, the individual triangles are not linked together.     You can see when I shrink/flatten a subset the the faces, the rest don't follow and deform as a single mesh.  I tried deleting the faces and edges and using F to create faces from the points, but it does not give usable results.    How can I go about solving this problem? So I've been experiencing this in the last few days: sometimes when someone replies to my comment, and I reply to the reply, then the "add/show 1 more comment" link appears immediately after I post my comment. However, when I click it, it disappears and nothing is shown.  I don't think it's that OP is posting two comments of which he deletes the second one, because this has happened to me several times, even when I was replying within 2-3 seconds.  I do, however, believe that this is more or less the same bug as , except that I don't have to reload the page in order the link to be gone, and I also seem to be getting the erroneous behavior only if I reply to a comment which is itself a reply to an earlier comment of mine.  Unfortunately, I wasn't careful enough to take a screenshot last time this happened, but here's what I am talking about for those who like visual demonstration better: I am trying to customize the legend for this graph. First of all, I would like the legend width to be equal to the x-axis width. At the moment, I am setting the width of the legend via      /tikz/every even column/.append style={column sep=1.0cm}   and I could manually adjust this value so that length equals the x-axis width, but I guess that there is a more elegant way to set the width of the legend.  Second, I don't really like the little color rectangles in the legend. I only want one rectangle in front of every entry and not two. This rectangle does not need to have a border and should be vertically centred with the text. The alignment seems to be okay for the rectangle closer to the text, but not for one the far left.   Update: Thanks to Christian Feuersänger's comment, there is possibility to change the rectangles via   legend image code/.code={%     \draw[#1, draw=none] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);   or what Gonzalo Medina proposed  legend image code/.code={%     \draw[#1, draw=none, /tikz/.cd, bar width=3pt, yshift=-0.2em, bar shift=0pt] %     plot coordinates {(2*\pgfplotbarwidth,0.6em)};   Third, I would like to the legend entries to start next to the text "Legend:".  I don't really know if with these requirements it still makes sense to use legend or if it would be better to add everything manually via after end axis/.code and \ref{label}.  Graph    MWE  \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest}  \begin{document} \begin{tikzpicture}     \begin{axis}[                 ybar,                 height=6cm,                 title={Some plot},                 width=12cm,                 axis on top,                 y axis line style={opacity=0},                 axis x line*=bottom,                 tick align=inside,                 tick style={draw=none},                 xtick=data,                 ymajorgrids,                 major grid style={draw=white},                 xtick={1,2,3,4},                 legend style={                     at={(0.0,-0.15)},                     anchor=north west,                     legend columns=-1,                     /tikz/every even column/.append style={column sep=1.0cm}                         },             ]                    \addlegendimage{empty legend}             \addlegendentry{\textbf{Legend:}}                                \addplot coordinates {                 (1, 0.2064)                 (2, 0.3961)                 (3, 0.5961)                 (4, 0.7961)}; \addlegendentry[text width=45pt, text depth=]{legend a}             \addplot coordinates {                 (1, 0.3064)                 (2, 0.4961)                 (3, 0.6961)                 (4, 0.8961)}; \addlegendentry[text width=65pt, text depth=]{lengend b}     \end{axis}  \end{tikzpicture} \end{document} Why do I see different versions of node and nodejs I ran the following commands to install the stable version of node  sudo npm cache clean -f sudo npm install -g n sudo npm install -g n   Now, when I run node -v, I see v10.0.0, whereas nodejs -v returns v4.2.6. As far as I'm aware, node and nodejs are the same thing. Why am I seeing this? Thanks. Link renders differently on client and server side when preceded by a special character When editing a question on , I observed that a link which was not rendered in the post was hyperlinked in the edit preview (see pictures below). I tried reproducing it in the  to see if this also happens when the post is posted for the first time and observed the same. It seems to be a bug after the shift to CommonMark, leading to the different rendering of links on client and server-side. A link following a special character (without any space) is not hyperlinked in the post but is hyperlinked in the preview. A link separated from the special character with a white space appears to have no such problem. (see pictures below and my ). Link not hyperlinked in post  Same link hyperlinked in preview I'm trying to find a way to automatically clean/delete the temporary files from C:\Documents and Settings\user\Local Settings\Temp\ at shutdown/boot on my Windows XP Professional x64 SP2 machine.  The main reason for this is to clean Local Settings/Temp to remove old junk automatically. (I had thought I had this covered through Firefox settings, but I was only clearing temporary Internet files). Currently, there's around 3&nbsp;GB of temporary files, and I'd like to prevent this build up without having to remember to do anything on my part.  I have already looked at using  (explained in Super User question ), but it doesn't seem to touch that directory.  I'm aware of programs such as , but I would ideally like to use a solution that doesn't require additional software (so, I expect, something using a scheduled BAT/CMD script would be what I'm looking for).  One of the potential issues, I believe, is that there may be legitimate files in the Temp folder that may be needed on the next boot (for software installations or updates, for example) and the perfect solution would be able to distinguish those and leave them until they weren't needed (Note: I realise this perfect solution may not be reasonably possible).  I've already set up Disk Cleaner on a shutdown script, but when cleaning temporary files, Disk Cleaner doesn't clean this particular directory, and so I'm looking for alternative options (see Super User question  for a little more detail).  So, what are my options for automatically deleting the temp files from C:\Documents and Settings\user\Local Settings\Temp? Edge won't connect to internet, Skype for business won't screen-share, Windows Store won't update apps after Windows 10 version 1809 installed I ran into a problem after upgrading Windows 10 October 2018 to version 1809. After the Windows update I noticed the following problems with Microsoft applications:   Microsoft Edge could no longer connect to the internet even though Chrome, Firefox and IE 11 still could. Skype for Business (formerly Lync) no longer allowed me to share my screen or view another person's shared screen. The Windows Store could not connect to the internet to update apps. The Microsoft Feedback portal could no longer connect to the internet.   How can I resolve these network issues that seemed to cooincide with an upgrade to Win10 ver 1809? What's the difference between:        Have someone do something     Make someone do something   Get someone do something.      To have someone do something means to cause someone to do something. To make someone do something means to force someone to do something. To get someone do something means to persuade someone or trick someone to do something.  This is what the dictionary says but I saw they're sometimes interchangeably used, so dictionary definitions are not enough. "Important to me" or "Important for me" I cannot easily figure out which one is more appropriate to use:     It's important to me.        It's important for me.   Are they the same? If not, what's the difference? how to hide mesh but keep hair particles Trying to find a Sci-Fi movie, probably from the 50's or 60's I’m trying to identify a movie I saw when I was very young.  It was a “Saturday Matinee” playing on one of the local stations, and I likely watched it in the late 60’s.  So I expect that the movie is from the 50’s or 60’s.  I watched it in black and white, but it could have been a color movie on a black and white set. I clearly recall a scene where scientists enter a lab and some see something move past them in a blur.  Later in the movie, they come upon themselves in the same lab where they appear to be frozen and not moving.  Then they notice that their “other selves” are moving, just almost inperceptibly slowly.  They are encountering themselves but at a completely different time scale. Unfortunately, I don’t recall much else about the movie, just the idea that they encounter themselves once with the others flashing past, and again seemingly not moving at all.  If this rings any bells with anyone, I’d love some pointers to try to track this movie down. I would like to add a new cable outlet to an outside wall and wanted to find out what kind of drill bit is needed to drill through and feed the coax cable as well as anything else to be mindful of. Comcast wanted $70 for a new outlet installation ($30 install, $40 tech visit), so I figured I could do it myself. The part that I'm most unfamiliar with is how to properly weather seal it. The outside just has vinyl siding and there's no electrical outlets nearby.  So far, I think I need the following   Coax Cable Coax Cable Wall Plate Long drill bit Add a 3-way Cable Splitter to cable box Weather sealer? Please help me to draw the following diagram:  \begin{displaymath} \xymatrix{ H\ar[r]&amp;H .1={}_HI_Q\supset 1.Q&amp;Q\ar[l]_\epsilon^{\cong}  \\  &amp;R\ar[u]\ar[r]&amp;R\ar[u] } \end{displaymath}