How do I know if a house built in 1940 in Ontario, Canada has lead pipes?

Question: The current owner does not know but does this province have any laws regarding health issues from drinking water from old pipe systems or that they should be replaced? In the old days pipes were lead correct?
Edit: Temporarily, does a Brita filter remove lead?
Comment: Re: Edit: No. http://articles.chicagotribune.com/2011-09-14/news/ct-met-lead-water-filters-20110914_1_filters-cost-osmosis-systems-brita-pitcher  If you have immediate concerns that won't wait for a water test result, get some bottled water for drinking and cooking until you have the test results.
Comment: ...because it was built in 1940.
Comment: @Craig Hahahhahahhah.
Comment: The City of Toronto has a web page on lead pipes that offers some relevant tips: http://www1.toronto.ca/wps/portal/contentonly?vgnextoid=7bad606bc72c1410VgnVCM10000071d60f89RCRD
Comment: @Craig  Right but it could have been updated what is the easiest way to figure that out.
Comment: I was kind of cracking wise--I expanded on this in my answer and was going to delete the comment, but you beat me to it.  ;-)
Comment: @Ross Ridge:  Very useful!  Thanks!  The owner I'm renting from gets angry when I ask questions.
Answer: Step one - look. Lead is unlikely inside the house, but you might see a lead pipe coming in from the street, if there is one. Copper pipes soldered with tin/lead solder are pretty common. But so are threaded galvanized iron pipes.
Step two - ask the water supplier, if it's on a municipal system.
Step three - have the water tested - it won't tell you if the pipes or solder have lead, but it will tell you if you need to worry about it. Most municipal systems that have lead distribution pipes in service take care to adjust the water chemistry so the lead stays in the pipes, not in the water.
If it's on a well, the odds of lead pipes go way down, IME. But the odds of water chemistry that might release lead go up quite a bit, depending on the water source.
Comment: It's in Etobicoke. How do i know if it's munipical?
Comment: i.e. Toronto, so almost certainly you are. Look for a water meter? Call the Toronto water department.  http://www1.toronto.ca/wps/portal/contentonly?vgnextoid=35bcfe4eda8ae310VgnVCM10000071d60f89RCRD
Answer: Because it was built in 1940...
I'm sort of kidding. :-)  Still, there's a fair chance there's some lead either in the house or more likely in the supply line coming into the house.
Metal shortages during WWII did lead to various substitutes. There was a lot of steel/iron pipe in use then, except that iron became very valuable in the America's for the war effort (especially in the U.S., more than in Canada I suppose).
But bear in mind that lead solder was used to fit residential copper pipes until the 1990's, so even if you have copper pipes that were installed after the 1940's, you're likely to have some lead in your plumbing.
You're just going to have to inspect the pipes, or have an inspector check them out.
And as the other answer suggests, if you're concerned, get the water tested.
Comment: Is there such a thing as free water testing available?
Comment: I've read about shaping some aluminum foil into a bowl, putting tap water in it, letting it evaporate and looking for metallic sparkles in the salts left behind. I don't know about that... ;-)  But there seem to be fairly economical test kits available, for example this one for $12, and similar kits at home improvement/hardware stores: http://www.amazon.com/WaterSafe-Water-Test-Kit-Lead/dp/B000Q6QWZA
Comment: Also, not trying to promote brand names (especially ones I don't know too much about), but this business of epoxy-coating the insides of water pipes is kind of interesting: http://www.curaflo.com/
Answer: If by "old days", you mean Roman times, yes. Lead has not been used for drinking water pipes since medieval times.
You cannot remove trace lead compounds from water with cheap water filters.
Comment: Lead pipe was used on a massive scale in the U.S. in the 19th century, and in Europe and other already-developed areas for a very long time before that. Lead pipe didn't start getting phased out in the U.S. until the 1920's, but the lead industry fought back hard for decades, with the LIA (Lead Industries Association), leading the charge, including lobbying federal officials and printing books extolling the virtues of lead. This is tangentially related to the effort to keep putting lead in gasoline, as well. The CDC started establishing standards in the 1960's. Etc.
Comment: Well, this is a prize cow of an utterly incorrect answer. Not too hard to find lead service laterals still in service in many US water systems that were built as recently as 100 years ago and where it's economically impractical to replace the waterline to every single house. here's one: http://gbwater.org/water-quality/lead-and-our-water/questions-and-answers-regarding-lead-piping/
Comment: @Ecnerwal I can probably get behind the statement that cheap water filters aren't too likely to remove trace lead compounds, though.  :-)  If I lived in Green Bay, I might look into installing something like a whole-house reverse osmosis unit.
Comment: An inexpensive **pressurized** (faucet) filter meets lead reduction standards (and those standards assume 10 times more lead incoming than Green Bay has going on...) Whole-house RO is way over the top, but if you want to pay that much to flush the toilet...
Comment: @Ecnerwal Well, fair enough. I did say *might*. :-)  I'd be super tempted to put an under-the-sink unit anywhere anybody is likely to be putting water in their mouth, at least. But full disclosure, I'm the type who's kind of tempted to do that anyway, not just because of lead. I think whole-house RO units have been coming down in price, though, no?  ;-)
Comment: ...or if I was building new, using PEX, I might branch into two PEX manifolds and run all the toilets off an unfiltered manifold, and everything else off the filtered manifold--certainly kitchen and bathroom taps and the dishwasher, anyway.
Comment: "In 1986, Congress banned the use of lead solder containing greater than 0.2% lead, and restricted the lead content of faucets, pipes and other plumbing materials to 8.0%.This so-called "lead-free" brass can still legally contain up to 8% lead, and plumbing systems installed prior to 1986 can contain high levels of lead from both plumbing components and lead solder. The presence of lead in water from the tap is indicative of serious pipe corrosion that must be corrected for health reasons." [CuraFlo, history of piping materials](http://www.curaflo.com/Resources/HistoryofPipingMaterials.aspx>


Dynamic SelectField validation fails with: "Not a valid choice"

Question: Here's my code, i can't get past the "not a valid choice" on the SelectField, being it in the creation form or the editing one... The categories i'm passing it as choices are unicode, even so i tried various "coerce" settings in the Form SelectField
class ProductsView(MyModelView):
create_template = '/admin/edit-products.html'
form = ProductForm

def create_form(self, model=None):
    form = self.form()
    choices = list(db.db.categories.find())
    choices.sort(key=lambda x: x['order'])
    sorted_choices = [(str(cat['name']), cat['name']) for cat in choices]
    print sorted_choices
    form.category.choices = sorted_choices
    if model:
        form.name.data = model['name']
        form.order.data = int(model['order'])
    return form

    def edit_form(self, obj):
    try:
        pk = self.get_pk_value(obj)
        if not pk:
            raise ValueError('Document does not have _id')
        model = db.db.products.find_one(pk)
        form = self.create_form(model)
        return form
    except Exception as ex:
        print ex
        flash(gettext('Failed to edit product. %(error)s', error=str(ex)),
              'error')

Answer: You can create your custom SelectField and overwrite pre_validate method. Like this:
class MySelectField(SelectField):

    def pre_validate(self, form):
        for v, _ in self.choices:
            if your validation:
                break
        else:
            raise ValueError(self.gettext('Not a valid choice'))


Handle the cases when users input all one-of optional paramaters in API response

Question: An API endpoint I wrote supports two one-of parameters, and users are requested to supply values for one of them only, but ideally, they should not specify both.
{"A": "something", "B": "something"}

When users do not supply any of the two, an exception will be thrown.
However, I'm wondering how I should handle the scenarios when users put in values for both.
For the context, A is, loosely speaking, a subset of B. There's two opinions with my teammate:

When users input both, A shall prevail.
When users input both, a 400 exception is thrown to remind the users that we only need one of the two.

Thanks!
Comment: All depend if you want a default in case (1), if you well write your client code, only hacking attempt should be able to send both values. The choice (2) for me is better because I like to prevent all case like it does, it's easier to debug and you know what you really want and what is permit or not. If you choose default value, write it somewhere to not surprising your users. We can ask, why throw an Exception for none and not for all !? same case for me. Default or exceptions. It's just my opinion.
Answer:
However, I'm wondering how I should handle the scenarios when users put in values for both.

You could look to media types as an analog.
That is, suppose we had a specification for application/vnd.example.AorB+json, which defined the A field, the B field, and explicitly expressed that exactly one of those two options should be present.
Now when our endpoint gets a POST, or a PUT, with content-type application/vnd.example.AorB+json, we know the entity included in the body of the request should be a json document with additional constraints on the keys and values.
So by analogy, if the keys and values are wrong, our endpoint should reject the document in the same way that it would if the JSON structure itself were not well formed.
If you buy that logic, then the practical answer is to deploy an endpoint that expects json, send it something broken, and see what response you get back.  Then model your own design on that.
The WebDAV standard has an interesting discussion related to its definition of the 422 status code.

The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.

So you might look at your situation, and try to decide whether including both elements is "syntactically correct" or not, and choose the matching status code.
In practice, it really doesn't matter very much.  You SHOULD be explaining the specific problem in the body of the response, so human beings can figure it out what happened.  The different status codes are really meta data, so that generic components can figure out what to do -- but there isn't anything in the standard that tells generic components to handle a 422 differently from a 400.
So don't over think it.
Answer: If it's reasonable/meaningful to expect one property, you should only allow one property.
Strict APIs are helpful because they guide users much better to what the intent of the server and resource is.
One great tool for this kind of stuff, is to use something like json-schema to specify exactly what your server does and does not expect. Being able to specify that only 1 out of 2 properties can appear is one of its features.


how to hide a particular column in particular row in a grid using jquery

Question: can any body please help how to hide a particular column in particular row in a grid using jquery. i am able to hide.
i tried with below code to hide a column.
<code>    var orderSection=getSelectedGridValue("egwEnterAppealDetails","ddwOrderSection");
if(orderSection!=""){
       eval("$('[id*=ddwOrderSection]:input').attr('disabled','disabled')");
}
</code>
but in that case it is hiding that particular column in all rows but i don't want that.
i am not using any jquery grid table i my js.
i hope i am clear with my query please help me out. and please give some useful reference to how to work with jquery grid.
Answer: Use the nth-child pseudo-selector. It chooses the nth-child for every table row, thereby hiding the whole column
<code>  var n = 2; column number you want to hide
  $('#myTable tr td:nth-child('+n+')').hide()
</code>
Or
<code>  $('#myTable tr td:nth-child(2)').hide();
</code>
Answer: You can use eq(elementIndex) to hide particular column from table
$('#tblExample tr td:eq(Index)').hide();
OR
   $('#tblExample tr td:eq(Index)').css('display','none');
Example
$('#tblExample tr td:eq(1)').hide();
This will hide 2nd td from all rows within table "tblExample"
Answer: If we want to hide the particular column use the below code:
$("#gridid").jqGrid('hideCol', "columnname");
Note:When we hide the column in header row,it will be applicable to all the rows for that particular column.


restoring permission i have accidently given using chmod

Question: Accidently while changing the writing, reading rights for the folder, i gave all the rights for editing my HOME directory, using
sudo chmod -R 777 /home

I came to know about it, after seeing different color combo of highlighted directories, ( i.e. all the constituent directories are coming in green background with blue font )
now can anyone help me backing up original rights, or to fix this issue.
Comment: Are you the only user? Are there other users in the `/home` directory? Such as `/home/user`, `/home/user2`?
Comment: @user68186 currently i am the only user,
Answer: There isn't any way to revert it as far as I know, but to fix your problem, you can use this command to give directories 755 and folders 644 chmod:
sudo find /home/ -type d -exec chmod 755 {} \;
sudo find /home/ -type f -exec chmod 644 {} \;

Comment: i will see to it, but in addition to this, what problems i will be facing, as currently, i am the only user,
Comment: Running this command as the only user won't cause any problems. You might get errors with some applications, for example, SSH keys require chmod 600, and won't be usable without this chmod.


What is the document level timestamp in a LTV enabled PDF for?

Question: As i read from this Anser, ETSIs best practice for an LTV enabled PDF is to add a DSS and a document level timestamp. According to adobe, a document level timestamp isn't needed, only a valid CRL or OSCP response for every certificate.
I'm not sure if i understand what the document timestamp is for. As i understand it, this is used to add another DSS + timestamp before the last document timestamp is expiring, to expand the signature lifetime of the document.
Does that mean, if a add no timestamp, the document won't be LTV enabled anymore after the origin certificate is expired? But that would defeat the purpose of LTV.
Answer: Yay i found out what it's used for: It's all for security ;)
The timestamp is added to make sure that the CRL and OSCP responses where added when the signing key was still valid, otherwise the CRL and OCSP responses could be cached and added long after the key has expired or has been revoked.
But why does adobe show a PDF as LTV enabled when there is no document timestamp?
Comment: *why does adobe show a PDF as LTV enabled when there is no document timestamp* - I'm afraid that "LTV enabled" does not really mean that the PDF takes part in a LTV process but that it merely contains the required information to enter a LTV process without the need of additional external validation information.


JMeter recording iOS native application that uses HTTPS leads to SSL handshake issue

Question: I have an IPAD hybrid app for our application. It tries to hit our https server during login process. I would like to use JMeter to record this simple flow.
I am running JMeter proxy server in my local machine.  I updated IPAD proxy details so that any activity will go via JMeter proxy - so that i can record.
I am able to record in JMeter the activities i do in Safari browser of the IPAD. But if i access my app in IPAD JMeter sends it as http request & records javax.net.ssl.sslhandshakeexception error . In the browser i can accept the SSL certificate. Not sure how it can be done in IPad.
I even tried to export the certificate from my browser , sent it to my email , accessed it in IPAD and installed. Still it does not work. Looks like it is a temporary certificate issued by JMeter.
If it is not https, then JMeter will be able to record the app activities.
Anyone has faced similar situation? how did you rsolve this?
Answer: Use jmeter 2.11 with Java 7 , it creates a crt file in jmeter/bin folder.
It is the CA that creates the certificates.
Send this file by mail and open it in Ipad and install it.
In test script recorder, put in the dedicated field HTTPS domains , the domains you are trying to hit, see:

http://jmeter.apache.org/usermanual/component_reference.html#HTTP(S)_Test_Script_Recorder

Restart Ipad and jmeter test script recorder and try again.


What are the requirements for national parks?

Question: I'm trying to place a national park here:

But the button to create one with the Naturalist is greyed out:

I know the civopedia lists the requirements for building a national park, but they are either wrong or I'm having a hard time understanding them:

The tiles must be natural wonders, Mountains or a tile with an Appeal of Charming or better. As you can see the top are both Breathtaking and the bottom ones are part of the Great Barrier Reef wonder
All four tiles must be owned by the same city. All tiles are within the boarders of Mbwila
The tiles for a diamond shape. All tiles are connected close to each other in a diamond shape
No tile can have an improvement or district on it. All tiles are in their initial condition.

So I'm probably missing something. Can someone tell me what's the problem?
Comment: I'm guessing because I don't understand the rules entirely myself, but I think this is not a diamond shape and that is the reason it doesn't work. If there is a possible placement, it is highlighted with white borders.
Comment: @MadScientist could you explain to me what makes this not diamond shaped and how a diamond shape would look like in the game? The white borders similar when you move great artist? I can't see any of them in my empire.
Comment: I only had one national park so far, and the diamond shape was vertical, yours is diagonal, and I have no idea if those count. If your naturalist is selected, you should see the white border around any valid tiles, and it looks like the borders visible for all the great persons.
Comment: @Ellesedil I will try, but this could take a lot of time since this title is 4 tiles away from the city. Those can't be bought and take a lot of turns to acquire
Answer: The problem is for sure that your diamond shape is diagonal instead of vertical. (Note that the Spring 2017 update, or an update prior to that, fixed the Civilopedia entry to specify that the diamond must be vertical.)

For this to be a legal configuration for a national park, it would have to include your Niter mine, the two land squares you want, and the rightmost of the water tiles you want to use. However, this is also conditional on your tiles being appealing enough since they are not natural wonders or mountains:

You're probably SOL unless you want to scrap your Niter mine and possibly plant a forest instead (I'm not sure if new-growth forest can be a national park or it's only old-growth (never cleared or planted)).
Frankly I think national parks are either underpowered or too hard to establish.
Comment: It's bizarre that they don't specify this, or show some kind of diagram. +1 For figuring it out.
Comment: Wow, that is a ridiculously limiting requirement. I hope they change that in a future patch.
Comment: You're correct. The national park has to be in a vertical shape (for god-knows-what reason). Removing the Niter also allowed me to create the park: [image](http://i.imgur.com/IIjIjLW.png)
Comment: I can confirm that planting new trees in a national park is possible.
Comment: Yea this needs to be fixed, took me two hours and three potential national park placements to find this and figure out why my angled diamond wouldn't create.
Comment: I can confirm that already planted second growth forests are valid (_sufficient appeal provided, of course_).
Answer: Step 1: find 4 tiles that fit the rules of a national park tile that are adjecent to each other
Step 2: use your unit on one of those tiles, preferably closest to the tile or on the tile you want in the park the most
Tip: planting forests increase the Appeal level of the tiles in the park


Android Studio -> AVD Manager -> Camera error Can't connect to the camera using webcam

Question: I'm trying to use the webcam for an Android emulator but whatever I do I get the Can't connect to the camera error.
Programs used:
Microsoft Windows 10 Pro, Version 10.0.16299 Build 16299
Android Studio 3.0.1
I have tried to start Android Studio as Administrator but the error is still there. However when I look at permissions for using the camera I can't see Android Studio or AVD Manager there. How can I fix this?
Comment: I have exactly the same problem. Have you figured out how to fix it?
Comment: @Neckster Nope I did not get it to work. Had to use a real phone.
Answer: I had this problem too. I managed to solve it by updating the Android Emulator. There was an update available in sdk manager.
After install the update my webcam started working properly on emulator.
Answer: Its because you have set both front and back camera to same hardware device which is webcam0. Try changing back to emulated and it will get fixed.
Answer: Change the camera settings (front and back) from Webcam0 > Emulated


How to draw a Plus/Minus on a Toggle Button based on Toggle State in WinForms

Question: public partial class Form1 : Form
{
    CheckBoxExt checkBox;
    public Form1()
    {
        InitializeComponent();
        checkBox = new CheckBoxExt();
        this.Controls.Add(checkBox);
    }
}
public class CheckBoxExt : CheckBox
{
    public CheckBoxExt()
    {
        this.Size = new Size(20, 20);
        this.Location = new Point(200, 200);
        this.Appearance = Appearance.Button;
    }
    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);
        var point = this.PointToScreen(new Point(0, 0));
        e.Graphics.DrawLine(new Pen(ColorTranslator.FromHtml("#666666"), 2), new Point(point.X + 5, point.Y + 10), new Point(point.X + 15, point.Y + 10));
        if (this.Checked)
            e.Graphics.DrawLine(new Pen(ColorTranslator.FromHtml("#666666"), 2), new Point(point.X + 10, point.Y + 5), new Point(point.X + 10, point.Y + 15));
    }
    ///
    /// to remove the focus dotted border over the control
    ///
    protected override bool ShowFocusCues
    {
        get
        {
            return false;
        }
    }
}

Here is my code, i customized CheckBox and sets it Appearance as Button so that it will act as Toggle button.
i need to draw a small horizontal line which will display as minus on the Button, and draw a small horizontal and vertical line which will display as Plus button. Hence it need to toggled, if it's in checked state plus need to be shown and if it's unchecked minus need to be shown over the toggle button
Thanks in Advance
Comment: What is your question?
Comment: PointToScreen() is wrong, just remove it.
Answer: I would use an imageList control and populated it  with plus and minus images respectively with desired resolution.
The BackgroundImage property of the control can be used to set "+" and "-" images.
And, don't forget to register CheckedChanged event of the control to toggle the BackgroundImage of the control.
Something like this for example -
    public Form1()
    {
        InitializeComponent();

        var checkBox = new CheckBoxExt();

        //My imageList contain two images, for "+" and "-"

        //Register chacked changed event for the control
        checkBox.CheckedChanged += checkBox_CheckedChanged;

        //Set the initial image as "-"
        checkBox.BackgroundImage = this.imageList1.Images[1];

        this.Controls.Add(checkBox);
    }

    void checkBox_CheckedChanged(object sender, EventArgs e)
    {
        if (((CheckBox)sender).Checked)
        {
            ((CheckBox)sender).BackgroundImage = this.imageList1.Images[0];
        }
        else
        {
            ((CheckBox)sender).BackgroundImage = this.imageList1.Images[1];
        }
    }


How to get how many days in current month in android

Question: I want to know the name of current date time and year and count how many days in current month
Answer: <code>int iYear = 2000;
int iMonth = Calendar.January;
int iDay = 1;

// Create a calendar object and set year and month
Calendar mycal = new GregorianCalendar(iYear, iMonth, iDay);

// Get the number of days in that month
int daysInMonth = mycal.getActualMaximum(Calendar.DAY_OF_MONTH);
</code>


Linker Input File Unused

Question: I am trying to install wget from source and am receiving the following errors:
make  all-recursive
make[1]: Entering directory '/linux1/tmp/wget-1.18'
Making all in lib
make[2]: Entering directory '/linux1/tmp/wget-1.18/lib'
  GEN      alloca.h
  GEN      c++defs.h
  GEN      warn-on-use.h
  GEN      arg-nonnull.h
  GEN      arpa/inet.h
  GEN      configmake.h
  GEN      fcntl.h
  GEN      langinfo.h
  GEN      locale.h
  GEN      netdb.h
  GEN      signal.h
  GEN      spawn.h
  GEN      stddef.h
  GEN      stdio.h
  GEN      stdlib.h
  GEN      string.h
  GEN      strings.h
  GEN      sys/file.h
  GEN      sys/ioctl.h
  GEN      sys/select.h
  GEN      sys/socket.h
  GEN      sys/stat.h
  GEN      sys/time.h
  GEN      sys/types.h
  GEN      sys/uio.h
  GEN      sys/wait.h
  GEN      time.h
  GEN      unistd.h
  GEN      unitypes.h
  GEN      uniwidth.h
  GEN      wchar.h
  GEN      wctype.h
make  all-recursive
make[3]: Entering directory '/linux1/tmp/wget-1.18/lib'
make[4]: Entering directory '/linux1/tmp/wget-1.18/lib'
  CC       base32.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       binary-io.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       c-ctype.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       c-strcasecmp.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       c-strncasecmp.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       c-strcasestr.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       cloexec.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       md5.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       sha1.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       sha256.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       dirname.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       basename.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       dirname-lgpl.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       basename-lgpl.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       stripslash.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       exitfail.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       fatal-signal.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       fd-hook.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       fd-safer-flag.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       dup-safer-flag.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       gettime.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       localcharset.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       glthread/lock.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       mbchar.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       mbiter.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       pipe2.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       pipe2-safer.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       quotearg.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       sig-handler.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       sockets.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       spawn-pipe.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       stat-time.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       strnlen1.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       sys_socket.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       tempname.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       glthread/threadlib.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       timespec.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       tmpdir.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       unistd.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       dup-safer.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       fd-safer.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       pipe-safer.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       uniwidth/width.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       utimens.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       wait-process.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       wctype-h.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       xmalloc.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       xalloc-die.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       xsize.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       xstrndup.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       asnprintf.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       fcntl.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       futimens.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       getpass.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ioctl.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       mktime.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       printf-args.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       printf-parse.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       strerror_r.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       vasnprintf.o
gcc: warning: /linux1: linker input file unused because linking not done
  AR       libgnu.a
  GEN      charset.alias
  GEN      ref-add.sed
  GEN      ref-del.sed
make[4]: Leaving directory '/linux1/tmp/wget-1.18/lib'
make[3]: Leaving directory '/linux1/tmp/wget-1.18/lib'
make[2]: Leaving directory '/linux1/tmp/wget-1.18/lib'
Making all in src
make[2]: Entering directory '/linux1/tmp/wget-1.18/src'
make  all-am
make[3]: Entering directory '/linux1/tmp/wget-1.18/src'
  CC       connect.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       convert.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       cookies.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ftp.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       css_.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       css-url.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ftp-basic.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ftp-ls.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       hash.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       host.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       hsts.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       html-parse.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       html-url.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       http.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       init.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       log.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       main.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       netrc.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       progress.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ptimer.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       recur.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       res.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       retr.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       spider.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       url.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       warc.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       utils.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       exits.o
gcc: warning: /linux1: linker input file unused because linking not done
if test -n ""; then cp "./build_info.c.in" .; fi
/usr/bin/perl "../build-aux/build_info.pl" \
    "../src/build_info.c"
if test -n ""; then rm -f build_info.c.in; fi
  CC       build_info.o
gcc: warning: /linux1: linker input file unused because linking not done
echo '/* version.c */' > version.c
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> version.c
echo '' >> version.c
echo '#include "version.h"' >> version.c
echo 'const char *version_string = "1.18";' >> version.c
echo 'const char *compilation_string = "'gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/linux1/etc/wgetrc\" -DLOCALEDIR=\"/linux1/share/locale\" -I.  -I../lib -I../lib   /linux1 -DHAVE_LIBGNUTLS -I/linux1/include -DNDEBUG '";' \
    | sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$/";/' >> version.c
echo 'const char *link_string = "'gcc  /linux1 -DHAVE_LIBGNUTLS -I/linux1/include -DNDEBUG  \
  /linux1 -L/linux1/lib -lz   ftp-opie.o gnutls.o ../lib/libgnu.a'";' \
    | sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$/";/' >> version.c
  CC       version.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       ftp-opie.o
gcc: warning: /linux1: linker input file unused because linking not done
  CC       gnutls.o
gcc: warning: /linux1: linker input file unused because linking not done
  CCLD     wget
/usr/bin/ld: cannot find /linux1: File format not recognized
/usr/bin/ld: cannot find /linux1: File format not recognized
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1501: wget] Error 1
make[3]: Leaving directory '/linux1/tmp/wget-1.18/src'
make[2]: *** [Makefile:1400: all] Error 2
make[2]: Leaving directory '/linux1/tmp/wget-1.18/src'
make[1]: *** [Makefile:1408: all-recursive] Error 1
make[1]: Leaving directory '/linux1/tmp/wget-1.18'
make: *** [Makefile:1364: all] Error 2

Any help on how to proceed would be much appreciated! Thank you.
Using Ubuntu 14.04.05 on a VM in Windows 10 and attempting to install Wget-1.18 from source. I have gnutls-3.5.9 installed from source in my own linux1/tmp/ directory
Comment: Where exactly in `linux/tmp` are the gnutls libraries and headers - what is the directory structure? How did you specify that to the configure script? BTW please post terminal output as text rather than images.
Comment: re the text output, will do thanks. As for the gnutls libraries and headers... they are in `/linux1/tmp/gnutls-3.5.9/lib`
Comment: Also, (in the comments below) note the flags I included on the ./configure in order to get that to work... I'm guessing that's part of the problem
Comment: In place of setting `GNUTLS_CFLAGS` and `GNUTLS_LIBS` on the `./configure` command line, try `--with-libgnutls-prefix=/linux1/tmp/gnutls-3.5.9`
Comment: Oooh!! That worked . . . kinda. Now it's throwing an SSL error but my guess is I need to link the version of openssl that I have in `/linux1` the same way. It seems like in your comments you're helping me solve the problems I had here: [link](http://askubuntu.com/questions/900257/how-to-determine-linking-programs)
Comment: It's often informative to run `./configure --help` to get a list of the optional component flags for the particular source package
Answer: You need to install libgnutls-dev
sudo apt-get install libgnutls-dev

emphasis on the DEV part :)
Comment: Not working still, unfortunately. I have gnutls installed, but I'm trying to compile wget into my own folder: `/linux1`; when I do `./configure --prefix="/linux1" --exec-prefix="/linux1"` I get stopped at an error that it cannot find GNUTLS, so I set the following:

`./configure --prefix="/linux1" --exec-prefix="/linux1" GNUTLS_CFLAGS=/linux1 GNUTLS_LIBS=/linux1`

That finds GNUTLS, and allows the configure to finish; but, I get the OP error when I run `make`
Comment: You installed libginutls-dev? you need the dev tools.
Comment: With apt-get I did... but, perhaps I need to do that from source too. Or find a way to tell apt-get that I want everything installed in my `/linux1` directory. Thanks for the help, I will do some searching...
Comment: @AntonRasmussen I'm confused - please clarify whether you want to use the `apt-get` versions of the gnutls libraries, or the ones you installed manually in `/linux1/tmp`
Comment: @steeldriver ... I'm required to install wget from source in `/linux1`. But, not required to install gnutls libraries from source... but, in an effort to fix the problem I installed gnutls 3.5.9 from source in `/linux1` and figured it would be best to use that version to build wget since I am trying to use the builds in `/linux1` as dependencies for other builds as much as possible--if need be. For example, I am using my own gcc built in `/linux1`to build everything instead of the gcc that I apt-get installed with build essential (which I, of course, had to use to build the gcc in `/linux1`).
Comment: @AntonRasmussen ah... OK. Good luck with that ;)

Linker Input File Unused


No coverage results in Android Studio when running shared test in KMM project

Question: When running the CalculatorTest in the KMM basic sample with coverage in Android Studio, why do I not get any coverage results?
Running the test

Coverage results
Comment: are you using mac? it runs fine to me
Comment: Yes. I've tested it on macOS, and also Windows and Linux. It doesn't work for me on any platform
Comment: Please open an issue youtrack.jetbrains.com/newIssue
Answer: I think there is some bug in Android Studio for KMM.
It run coverage successfully but does not show results in window.
To see reports you can export the results as HTML and open in any browser.
For my project also I was not getting results, but I was able to see by exporting it.


how to view pdf inside the app from url

Question: Guys i want to view the pdf file from url i have done some coding stuff but getting error .Please help me out.If there is another solution please give an suggestion
          @Override
        protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  Button  button = (Button) findViewById( R.id.mybutt );

    String pdf = "http://www.pc-hardware.hu/PDF/konfig.pdf";
    String doc="";
WebView  wv = (WebView)findViewById(R.id.webView);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setPluginsEnabled(true);
wv.getSettings().setAllowFileAccess(true);
wv.loadUrl(doc);
}

Layout
        <WebView
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/webView"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />

        <LinearLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="bottom"
            android:orientation="vertical" >

Comment: check this lib https://github.com/JoanZapata/android-pdfview
Comment: Make also sure to change the url for the pdf to an existing pdf (currently not the case).
Answer: You can simply load url in webview no need of iframe.
String pdf = "http://www.pc-hardware.hu/PDF/konfig.pdf";
wv.loadUrl(pdf);
Use these free open source lib for pdf loading.
https://code.google.com/archive/p/droidreader/
https://code.google.com/archive/p/apv/
Answer: Append your PDF URL after this
String pdfUrl="https://docs.google.com/viewer?url=<PDF_URL>";

Replace  by your PDF url then
wv.loadUrl(pdfUrl);

Like this
String pdfUrl="https://docs.google.com/viewer?url=http://www.pc-hardware.hu/PDF/konfig.pdf";

Answer: Change your doc string URL from
String doc="";

To
String doc="http://docs.google.com/gview?embedded=true&url=http://www.pc-hardware.hu/PDF/konfig.pdf"

Make sure that PDF is exist at url parameter path.
Answer: First of all, if the PDF is public.. you can use the google doc url.
Example,
public void showPdf(MarketStudy marketStudy) {
        String googleDocsUrl = "http://docs.google.com/viewer?embedded=true&url=";
        Intent intent = new Intent(activity, WebviewActivity.class);
        intent.putExtra("URL",googleDocsUrl+Uri.encode(marketStudy.getPath()));
        activity.startActivity(intent);
        activity.overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
}

But if the PDF is from the private server, you cant view it by using the googledoc url. or else it will show "no preview" message eventhough the pdf is exists. (My Case)..
I already tried using , <object>, WebView.. none is working..
so my solution for you is use this library MultithreadDownload and AndroidPDFViewer where you need to download it store in cache folder first and then display it on activity then delete it when activity stop or destroy.
Hope it helps..

how to view pdf inside the app from url


How to copy files from testdrive

Question: I had win 10 and I installed ubuntu. During the process I formatted the entire hard drive. Then I used testdisk on live usb. I can explore files in it but cant figure out how to copy and recover them.
Comment: okay, where are the files right now, the USB?
Comment: I'm not familiar with that specific software, but in general you can't store files on the partition you use for a Linux live USB.  And you can't store files on the disk you are recovering from either, for hopefully obvious reasons.  I *think* you just need to plug in another external drive.
Comment: If you meant `testdisk` see [my answer in section "copy single files"](http://askubuntu.com/a/286206/3940).
Answer: The answer at this link has really good information https://askubuntu.com/a/286206/3940.
To directly answer your question. Use another USB device or pendrive to copy the files to. If you don't have another USB device or pendrive, you can also copy to a writable DVD or CD. An external hard drive would be great.
Remember, don't copy any files to the old windows 10 drive and do not set testdisk to send results of the scans to the windows 10 drive either!

How to copy files from testdrive


setNeedsStatusBarAppearanceUpdate unrecognized selector

Question: I had an issue with my iOS phonegap app having the status bar overlap the webview in iOS 7. I found this answer which fixed the problem, but the second step, calling
[self setNeedsStatusBarAppearanceUpdate];

in viewDidLoad causes the app to crash in iOS 6 and throw unrecognized selector.
Answer: In the future, if you ever need to use something from iOS 7, such as setNeedsStatusBarAppearanceUpdate and you need to still support earlier iOS versions, you can first check if the selector is supported:
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)])
{
    [self setNeedsStatusBarAppearanceUpdate];
}

Comment: I tried that initially, but was getting an "undefined selector" error, and it would crash. Now it seems to work just fine on the simulator and on an iPhone running iOS 6. Go figure...
Answer: Turns out it is unnecessary to add [self setNeedsStatusBarAppearanceUpdate]; and the app ran fine in iOS 6 and iOS 7.


Custom folders for video content on Wowza Server

Question: I'm developing a video streaming app for android. I've used Wowza Media Server for this purpose, but the problem is that all video recordings are saved in Content folder inside Wowza installation folder.
Is it possible to save video files of each publisher in separate folder e.g.
<code>   Vidoes of PublisherA be saved in  ...\Content\PublisherA
   Vidoes of PublisherB be saved in  ...\Content\PublisherB
</code>
Thanks.
Answer: Yes.
Following the article How to record live streams (Wowza Streaming Engine) > Recording tab > Path

By default, the files are stored in the server content directory. If you want to store files in a different location, make sure that it exists on the computer and then specify its physical path. The path value can't contain any of the following symbols: less-than (<), greater-than (>), quotation (' and "), backslash (), pipe (|), question mark (?), and asterisk (*) characters.

You can use Wowza REST APIs http://www.wowza.com/forums/content.php?711-How-to-use-cURL-to-query-Wowza-REST-APIs#createrecord

Before we start, in my experience, you should add your IP address to IPWhiteList, by editing the file [install-dir]/conf/Server.xml.
For example:
<code><IPWhiteList>127.0.0.1,184.108.40.206,126.96.36.199</IPWhiteList>
</code>
Restart your Wowza Streaming Engine.
Use cURL like they wrote, change [outputPath] to your PublisherA or PublisherB.


R function to detect unused function arguments

Question: I'm looking for an R function that detects all the functions in an R package that have formal arguments that are not used in the body of the function. Does something like this exist?
Answer: I think the checkUsagePackage("packagename", all=TRUE) in the codetools package should check this.  It (among other things) tests "warnings about unused formal parameters".  The devtools::check() function might automatically invoke checkUsagePackage().


GDB remote debugging: make GDB wait for gdbserver to be started

Question: The normal way I know to remote debug is to start gdbserver on a target and then remotely connect from gdb (using target remote).
But, is it possible that GDB be made to wait on a port until gdbserver comes up on that port?
Answer: You can do this with a bit of python code. gdb.execute("command ...") will raise a python exception if the command gets an error. So we can have python run the target remote host:port command repeatedly, for as long as it gets a timeout error (which should resemble host:port: Connection timed out.).
Put the following into a file and use gdb's source command to read it in. It will define a new subcommand target waitremote host:port .
define target waitremote
python connectwithwait("$arg0")
end

document target waitremote
Use a remote gdbserver, waiting until it's connected.
end

python
def connectwithwait(hostandport):
  while 1:
    try:
      gdb.execute("target remote " + hostandport)
      return True
    except gdb.error, e:
      if "Connection timed out" in str(e):
        print "timed out, retrying"
        continue
      else:
        print "Cannot connect: " + str(e)
        return e
end

Answer: There's nothing built in, but there are a couple ways I think you can make it work.
One is to run gdbserver on demand on the target, say from inetd or equivalent.
Another is to run a proxy on the target, and have the proxy accept a connection but otherwise do nothing until gdbserver is ready.  I'm not sure offhand if this would run into timeout problems on the gdb side, though.


Push Notification Not shown even though push event received in service worker

Question: I have been working on service worker since last 15 days. Its pretty fast to learn but since then I am stuck on this notification support on my website.
The problem I am facing is notification is not shown even though its received in push event registered with service worker.
But it gets shown when some other desktop notification is received via services like pushcrew.com and you click see it in action then my notification gets displayed.
   <!DOCTYPE html>

      <title></title>
      <link rel="manifest" href="./manifest.json">

Manifest.json
  {
"name": "WorkIndia",
"short_name": "WorkIndia",
"icons": [{
  "src": "icon-128x128.png",
    "sizes": "128x128",
    "type": "image/png"
  }, {
    "src": "icon-144x144.png",
    "sizes": "144x144",
    "type": "image/png"
  }, {
    "src": "icon-152x152.png",
    "sizes": "152x152",
    "type": "image/png"
  }, {
    "src": "icon-192x192.png",
    "sizes": "192x192",
    "type": "image/png"
  }, {
    "src": "icon-256x256.png",
    "sizes": "256x256",
    "type": "image/png"
  }],
"permissions": [
    "notifications"
  ],
"web_accessible_resources": [
  "icon-128x128.png"
],
"start_url": "index.html",
"display": "standalone",
"background_color": "#3E4EB8",
"theme_color": "#2F3BA2",
"gcm_sender_id": "234031710894"

}
service-worker.js
  'use strict';

  self.addEventListener('push', function(event) {
  //  if (self.skipWaiting) { self.skipWaiting(); }

  var notificationTitle = 'Hello';
  var notificationOptions = {
      body: 'Thanks for sending this push msg.',
      tag: 'simple-push-demo-notification',
      data: {
        url: 'https://developers.google.com/web/fundamentals/getting-started/push-notifications/'
      }
  };
  if (event.data) {
      const dataText = event.data.text();
      notificationTitle = 'Received Payload';
      notificationOptions.body = "Push data: " + dataText;
  }

  console.debug('Received a push message', event);

 event.waitUntil(
     self.registration.showNotification(notificationTitle, notificationOptions)
 );
});

self.addEventListener('notificationclick', function(event) {
console.log('On notification click: ', event.notification.tag);
// Android doesn't close the notification when you click on it
// See: http://crbug.com/463146
event.notification.close();

// This looks to see if the current is already open and
// focuses if it is
event.waitUntil(clients.matchAll({
  type: 'window'
}).then(function(clientList) {
  for (var i = 0; i < clientList.length; i++) {
    var client = clientList[i];
    if (client.url === '/' && 'focus' in client) {
      return client.focus();
    }
  }
  if (clients.openWindow) {
    return clients.openWindow('/');
  }
}));
});

Console
(index):16 registration
(index):41 activating
(index):51 activated
(index):47 endpoint: https://android.googleapis.com/gcm/send/coiKeSkPta0:APA91bGUTJD6TciT1HANKGd…HqUEz5iQY7y9I_BVbDbPWIv0r7zfHyhlwFl91odzSIhr71IPXDK4ie6ok3yWTN-pflj16Vezq5
service-worker.js:20 Received a push message PushEvent {data: null, type: "push", target: ServiceWorkerGlobalScope, currentTarget: ServiceWorkerGlobalScope, eventPhase: 2…}bubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: ServiceWorkerGlobalScopedata: nulldefaultPrevented: falseeventPhase: 0path: Array[0]returnValue: truesrcElement: ServiceWorkerGlobalScopetarget: ServiceWorkerGlobalScopetimeStamp: 0type: "push"__proto__: PushEvent

Answer: You have permission for the notifications, but not for using gcm. This may be the reason for the issue you're having.
You'll have to add gcm in the permissions list (as indicated in the GCM Documentation).
"permissions": [
    "gcm", ... // Other permissions, like "storage"
]

Also, since the event function is already a callback, I don't see the need to have to use waitUntil to showNotification. Just call the function after the console.debug, it may help with the issue as well.
Comment: I have added gcm permission and tried also tried removing waitunitl but nothing seems to work. If you have some other place I can look for do let me know.
Comment: Also the funny part is I see the notifications when some other desktop notification appears then my website notification is also visible. I am clueless what I am missing. Also I have tried various demos online, they also have the same issue. I am supposing that this is more like some configuration issue then actually a technical issue


How can I fix this furnace filter slot to prevent filters bending?

Question: I noticed a problem with my furnace filter.  In the vertical slot where it gets installed, there is a channel along the bottom but not along the top.  As a result, the top corner of the filter furthest away from the opening will bend toward the blower motor and allow air to rush past the filter.  How can I fix that without taking apart the whole intake duct?

Dumb idea #1: Put a series of machine screws along the duct opposite of the filter slot.  The filter should push against them when air is flowing and no longer be able to bend.  The bad part: Would then be even more of PITA to line up the filter and get it in.
Comment: I think Ryobi makes a drill for that.
Comment: Call a furnace company and get them to sell you a 1" filter track, you can likely get in installed without taking everything apart.  I replaced on in one of my rental houses it was easy, I used a filter itself to level it, and I could reach where I needed to shoot a screw through the blower access panel.
Answer: Assuming you can find a channel at one of the big box stores you can slide the channel in and maybe screw it in all the way at the end so the screws don't interfere with the filter. In fact it seems like you don't even need a piece of channel. A piece bent like an L should work. When you screw it in offset it so the top of the L is not above the top of the filter. Attached is a drawing.
Comment: This worked pretty well.  At the big orange store I found aluminum angle stock.  I took the side off the furnace and was able to get inside the air return and drill+screw the angle stock in place as you suggested.
Answer: Buy a metal-framed filter that won't bend so easily. These are available from HVAC suppliers and usually include filter media that is washable/replaceable.


How much power can I supply for an EV charging circuit?

Question: I would like to install an EVSE. The main panel is in the garage and I should have no problems running conduit a few feet to the location where I plan on mounting the charger. I will make sure I get the correct breaker, wire size, and receptacle according to the specifications on the charger I end up getting. But before I buy a changer, I am curious to know how much additional power I can get from this panel. Obviously I can't just add up the capacity of all the breakers because they are already much greater than the main breaker. I suppose I should do a load-calc, but I have no idea how this is done. Do I need to look at the data plates on the back of all my appliances? This seems like it could be a lot of work.
If I just eyeball the loads, I guess that this service and panel should be able to supply another 30 amps without any problem.
I suppose that if I run the oven, all the burners on the range, the microwave, the AC, the dryer, a few hairdryers, and charge my car at the same time I might pop the main breaker, but this seems not likely for our family.
Comment: Have you read all the other questions about installing an electric vehicle chargers? What, specifically, remains unclear?
Comment: This isn't opinion based. I Don't want recommendations about which charger to buy or how how big I need, but how much available power this panel/service CAN provide.
Comment: I've a Tesla Model-X with a Level 2 charger rated at 48A, to which is connected to a 60A breaker circuit. In the summer when my A/C is running, sometimes the main breaker trips. I simply just limit the number of Amps the car is allowed to pull via the app.

Mostly I just leave it set at 25A, as my car mostly always charges overnight. If I need a quick charge for whatever reason, I just drive to the closest supercharger.
Comment: Your panel can provide 150 Amps if everything's turned off and stays off in your house.  If you provide the numbers @ThreePhaseEel is requesting, then you can subtract his number from the 150 amp maximum.
Comment: Product recommendations are off topic here. Also, no need to write HTML with any WYSIWYG editor in the 21st century. Just hit the Enter key.
Comment: Can you post the square footage of your house + the nameplate kW rating of your range and the Minimum Circuit Amp rating for your air conditioner, please? I should be able to get you pretty close to a serviceable load calculation with those three tidbits in hand + the panel photo you posted
Answer: TLDR: Get a load-sensing energy monitor + EVSE pair, and allow them to automatically adjust your EV charge rate on the fly to protect your house from overload.  EV charging is NOT a fixed rate, and can dynamically - well here, watch it happen in this video. Go to 29:30 to watch the auto-rate-change, though the whole video may be of value.
DO NOT rely on smart meter data of past usage.
First, that data isn't accurate.  It is there to set billing tariffs, it is not for the purpose of safely sizing wires and services. Suppose you start a 24-amp electric dryer at 8:40 and run it til 9:20.  It's only 20 minutes in each hour window, so it reports as an 8-amp peak for 2 hours. Really? An 8-amp dryer, so we can wire it with 16 AWG (10 amp) wire for that dryer?
Obviously no -- you need to look at equipment nameplates.
And even so, it presumes that your family will never change their energy use in the future, when they certainly will - particularly seasonally.
Even worse, if you have solar, that "usage" data will be poisoned by the solar production.  It's nice when you get solar, but you can't provision circuits on the assumption that it will be there.
A NEC Article 220 Load Calculation is the right way, and not that hard.

I suppose I should do a load-calc, but I have no idea how this is done. Do I need to look at the data plates on the back of all my appliances? This seems like it could be a lot of work.

That's just naysaying talk.  No, it's not that hard. You only need to do that for fastened-in-place loads and only fairly large ones (e.g. not lights or bathroom fan, not range hood, and not refrigerator - those are too trivial to bother measuring.)  So we're down to water heater, range, built-in A/C, furnace, dryer and a few other luxury items.
Just grab a worksheet off the web from any municipality (i.e. government page) - there are a lot of DIY clickbait sites full of "article marketing" - badly written articles stuffed with keywords to spoof Google. They used to pay Bangladeshis a penny a page to write them, now they use ChatGPT.
Here's one from Clark County NV, they all look about the same:

3 VA per square foot of "habitable space" (not garage/utility rooms). This is a "catch-all" to cover hard-wired lighting and any portable, plug-in consumer 120V toys like blender, toaster, hair dryer, PCs, electric blankets or whatever.  From here on out, we are only concerned with huge or fastened-in-place loads (having a plug does not exempt them).
1500 VA for each of the two kitchen general-use receptacle circuits
1500 VA for the laundry room circuit (which covers everything plugged into that 120V circuit: washer and gas dryer)
4500 VA (almost always) for the water heater
5500 VA (usually) for the electric dryer
A funny formula for ranges and ovens, see NEC 220.55.
Heating load >OR< A/C load, only the larger one
Ignore small-draw loads like refrigerator, freezer, range hood, bathroom fan, etc.  Refrigerators only take about 1 amp (120 watts) when they're running. On average it's more like 40 watts.  Freezers slightly less.

Then your formula gives you some favorable markdowns; these are to account for load diversity (you're not likely to run everything maxed out at once).
EV charging does NOT get ANY discount. It is the hardest "hard load" in your entire house, as it goes many hours at hard max rate.  (limited to 80% of breaker trip).
Yeah, so like 12 paragraphs to tell you it's not that hard. Great, Harper.
Or, skip all this stuff and use an energy management system.
Emporia already makes a home energy monitor, the VUE.  Their EVSE product is UL-listed to communicate with the Vue and tell the EVSE how much "headroom" there is on the service right now.  The EVSE will then dynamically adjust car charge rate to keep your power draw within the limits of your service.
This is a "silver bullet" for people who want the max possible charge rate for vanity, but also don't want to burn their house down.
I know the product selection in this category is slim, but it really is the silver bullet and stupidity avoider.
A case study in doing it wrong

I've a Tesla Model-X with a Level 2 charger rated at 48A, to which is connected to a 60A breaker circuit. In the summer when my A/C is running, sometimes the main breaker trips. I simply just limit the number of Amps the car is allowed to pull via the app. Mostly I just leave it set at 25A, as my car mostly always charges overnight. If I need a quick charge for whatever reason, I just drive to the closest supercharger.

That's the classic scenario that'll burn your house down. This person is foolishly betting the house on the main breaker working perfectly, apparently unaware these devices are built with a great deal of tolerance to avoid nuisance trips.
A big red flag: your main breaker should NEVER trip unless a flashy-bangy problem just happened, like a dryer shorting out internally.  If the main breaker is tripping from intentional overload, it's not overloading a little... it's overloading a lot.  This is a great way to burn your house down.  I expect an epidemic of this from fools with EVs wanting "the biggest charge possible" without knowing what they are doing. This is a threat to our freedom becasue heavy-handed legislation is likely to follow.
No one should be using "the app" to limit charging.  If only 25A is safe to use based on the house's Load Calculation, then the Tesla Wall Connector should be re-commissioned at 25A instead of 60A.
Just because you've gotten lucky so far doesn't make it safe.  Electrical safety relies on defense in depth, and you're not allowed to defeat/bypass all the layers except one.
I realize there's a testosterone-driven competition to have a faster EVSE than the next guy... but you're playing with fire. (of course that's part of the game, isn't it, just like a lot of "jackass" type activities we see on Tiktok.)
Honestly for the guy who's "just gotta have it" for vanity reasons, that's where you have energy monitor-based products where they are doing demand side management to let your car take full power during the moments the house has it to spare -- which is honestly, over 90% of the time.  House loads (other than EV charging) are really spiky - most loads cycle on/off intermittently, often automatically... and the Load Calculation has well-developed science to let you exploit that without creating danger.
Comment: @Rsf For the same reason they have load calculations at all, and generator interlocks. It doesn't work for end-users to "pinky promise" to be very careful managing those things manually.  The protections need to be automatic and built-in - either to the hardwired EVSE or the sizing of the socket.  All the mechanisms have been provided to do that (setting current at commissioning; or for socketed, a socket shape for every ampacity) and their use is a NEC or UL requirement.
Comment: @Rsf Still works the same way.  #1 you don't provision a 16A socket to your building unless you have appropriate headroom in your utility service Load Calculation *according to national rules for calculating that*.  #2 the EVSE must follow national rules re: load they put on a 16A socket.  If someone uses an illegal plug-in EVSE that takes full 16A in defiance of national regs, that's not the fault of the socket installer.
Comment: Can you explain what is wrong in limiting the charge current at the car's size, obviously after doing the proper calculations?
Comment: Imagine that someone else plugs in their car, not having set those settings, or you charge at someone else's house, and change the settings so it's filled up before you leave, or someone wonders why your car takes so long to charge, and changes the settings on your phone without your knowledge. The setting on the app is not a safety mechanism, but you're relying on it as if it is.
Comment: I am not saying it is wrong to use the proper equipment, but what's wrong with me having an external socket rated for 16 amperes (Europe here) and charging my car using 6 amperes? Yes, someone can come and try to charge their car using 16 amperes (all of our granny chargers are self limited to 16 amperes AFAIK) which is marginal and probably not safe but same person can also connect a heater or power tools to the same socket.
Answer: There are online load calculators, such as this one.
If your power company provides downloadable usage information, that can be a useful guide as well. Typically those provide either hourly or 15-minute information for up to a year. 15-minute data is best, as that is the standard for metering. They may provide kW (peak or average demand) or kWh (actual usage). What you are looking for is peak demand in Amps:

15-minute kWh - divide by 0.06
hourly kWh - divide by 0.24
15-minute kW - divide by 0.24
hourly kW - divide by 0.24

On the one hand, true peak demand would be best, but you will likely (in residential simple reports) only get usage or average demand. But since various parts of code effectively account for short-term moderate increases, this really isn't that much of an issue.
Ideal is to do both a load calculation and an analysis of the past year's usage and use whichever number is higher.
Once you figure that out, you will know how much headroom you have for EV charging. EV charging is a continuous load, so it is derated. For example, if you use a 20A circuit then you will actually only charge at 16A, 40A at 32A, 50A at 40A, etc. The breaker has to be sized based on the capacity of the wire, even though you will typically set the EVSE for 80% of that capacity.
You have a 150A main breaker. That is a little unusual - more common these days is 200A, and the panel may well be rated for 200A, so I suspect that is based on the utility service and/or the feed wire from the meter to the panel - i.e., you can't upgrade that without utility consent and making sure everything is just right.
The good news is that you have at least some gas appliances (presumably water heater, at least part of the kitchen equipment, furnace), small A/C (20A) and not a lot of extras, so my guess is you could install 30A or 40A without much of an issue.
But keep in mind that most people don't need more than 20A or 30A @ 240V to keep up with daily EV usage by charging through the night.
Also, do not install a receptacle. Install a hard-wired EVSE, whether Tesla or another brand. There is nothing gained by using a receptacle if you are going to leave the EVSE plugged in 24/7. If you actually need a high-powered receptacle for occasional other use (RV, welding, etc.) then you can install that on a separate circuit as you have plenty of space left in your panel. A receptacle adds another point of failure and in the latest NEC code GFCI is required for all garage receptacles including high-power 240V circuits which were previously exempt. Since EVSE includes GFCI circuitry, a hard-wired EVSE circuit is exempt from this rule.
Normally aluminum wire is worth considering for large loads. However, most (if not all) residential EVSE are not rated for aluminum wire, so use copper. Since you only have a short run that is not a big cost.
Comment: The smaller main breaker is sometimes an effect of solar input to the panel. I don't seen any red warning labels that usually go with that; But perhaps it was planned for.
Comment: That solar will be a further monkey-wrench to getting reliable data out of that energy usage data from the power company.  It's nice when solar helps you out, but you can't provision based on that.
Comment: @Harper-ReinstateMonica And for all the various reasons, I didn't say "load calculation **or** utility reports", I said "use whichever number is higher". So the people with the bitcoin miners and grow lamps that aren't included included in the load calculation (because they're plug-in loads that they don't want to talk about...) still have a good number to work with. And everyone else ends up just using the load calculation.
Answer: Every domestic EVSE can be programmed to limit the amount of current they allow the car to draw.
Smarter EVSE also have current probes that hook around the feeds of the panel to let the EVSE dynamically limit the charging current and this means it doesn't participate in the load calculation.
You are in luck given that your panel is right next to the place where you would put the EVSE. So the surcharge in bumping up the size of the wires to the EVSE is minimal.
So you can put in the max wire size and breaker but then limit the current at the EVSE if it would overburden your main breaker.


Floating point precision and physics calculations

Question: The gravity Vector2 in my physics world is (0; 0.1).
The number 0.1 is known to be problematic, since "it cannot be represented exactly, but is approximately 1.10011001100110011001101 × 2-4".
Having this value for the gravity gives me problems with collisions and creates quite nasty bugs. Changing the value to 0.11 solves these problems.
Is there a more elegant solution that doesn't require changing the value at all?

Video of the bug
http://www.youtube.com/watch?v=bRynch1EtnE

Source code
http://pastebin.com/jNkqa3sg
The first method (AABBIsOverlapping) checks for intersection betweens two AABB entities.
The second method (Update) is called for each body every frame.
I'll try to explain how the Update method works:

Add the gravity acceleration vector to the velocity vector
Create a temp vector (next) and set it to the velocity
Get bodies in the spatial hash in the cells around the current body
If there is an horizontal overlap, resolve it, set next.X and velocity.X to 0 and move the player
If there is a vertical overlap, resolve it, set next.Y and velocity.Y to 0 (or to 0.1 to prevent constant jumping from ceilings) and move the player
After the loop, if there were no overlaps, move the player
Comment: `0.11` can't be represented exactly either.
Comment: You didn't write anything about how your physics engine works. And that's most likely where the problem lies.
Comment: Strange... somehow it fixes the problem. My guess is that using 0.11 gives a small enough error that the physics engine is unaffected by it.
Comment: I'm updating the post with some source code.
Comment: Added. You may also want to see my comment to Krom's reply for more clarifications
Comment: I added a video to the original post... I hope it can be useful to show the problem
Comment: I looked at your code, as best as I can tell you need to round your values to a "grid". Your objects never totally touch - they are always slightly too high, or they overlap. The simplest fix is when you have a collision, manually set the bottom of one object equal to the top of the other. That way they will be at the same spot. You should have posted the code and video from the start. Old questions don't get many replies.
Answer: In short no. The usual solution is to never check for equality, and always check for a range +- epsilon (very small value).
Comment: Never checking for equality is a little strong. There are times when you want to do this, but not if the value you are testing is the result of a floating point calculation. This is none the less good advice, but it's far from clear that it's the root cause of OP's problem.
Comment: .NET includes appropriate base values [`Double.Epsilon`](http://msdn.microsoft.com/en-gb/library/system.double.epsilon.aspx) however you should scale this to match the scale of your numbers: see the remarks on the referenced page.
Comment: @Richard In fact what tolerance value you use when testing depends more on the algorithm used to calculate the number being tested than the scale of that number.
Answer: In physics being unable to represent a number shouldn't matter at all. The only thing that matters in physics is the accumulation of rounding errors.
I assume your problem is related to incorrect epsilon comparisons, or even comparisons without epsilon. But without more information I can't help you. If your code can't deal with small rounding errors it is flawed and needs to be fixed.
You could use Decimal for your math code, which can represent 0.1m exactly. But I don't think that's what you really need since your problem is most likely unrelated to the fact that 0.1 can't be represented exactly in float.

One potential problem I see in your code is that when resolving collisions you move out the body exactly to the collision border. Perhaps you need to move it out an epsilon further.
Comment: It's misleading because representability is very clearly unrelated to the problem at hand, but since OP has this misconception you are offering a way to prolong that.
Comment: I'd give this an upvote if it wasn't for the last paragraph which is very misleading.
Comment: In what way is it misleading? `Decimal` can represent `0.1` but it is most likely not the solution to his problem.
Answer: If non-representability is resulting in bugs in your code then your algorithms are flawed in some way. It's hard to say how they are flawed because you have not shared any details, but using a representable number won't fix it.
In fact 0.11 is not representable either and so if it solves your problem, it does so for some reason other than this.
Answer: In short - You can not work with floating-point values on PC as in real life. There's always gonna be precision loss and rounding errors due to limited amount of memory used to store the values within very wide ranges.
Always check for equality with some epsilon which could be half the step between working values, e.g. 0.1:
IsEqual(0.1, 0.2, 0.05) = false
IsEqual(0.1, 0.1001, 0.05) = true
IsEqual(0.1, 0.1499, 0.05) = true

or best precision at given scale and given floating-point format (e.g. 64bit has smaller epsilon than 32bit obviously) (you may need to check with your language for ways to obtaining that value):
IsEqual(0.1, 0.2, BestPrecisionAt(0.1)) = false
IsEqual(0.1, 0.1001, BestPrecisionAt(0.1)) = false
IsEqual(0.1, 0.1499, BestPrecisionAt(0.1)) = false
IsEqual(0.1, 0.1000001, BestPrecisionAt(0.1)) = true
//Where for example BestPrecisionAt(0.1) could be 0.00001

EDIT:
You said nothing about bugs you are having. So what is exactly wrong with 0.1?
I could only assume that your timestep is not precise enough, your objects speeds allow them to pass through each other inbetween collision checks. Is that correct? If yes - you should increase timestep resolution and/or check for collisions earlier.
Comment: That looks like at certain levels errors accumulate and each time step rounds/compares/reverses the values wrongly. Check your epsilon and timestep.
Comment: Add one cube and trace into your code in debug mode. See why it does not stays still. Probably some bug..
Comment: "So what is exactly wrong with 0.1?" -> It works perfectly unless the body is exactly at Y 128. If it is at Y 128 and there's an obstacle under it, it starts shaking.

It also has problems at Y 32: everything is pushed out horizontally. Game-breaking problem.

Maybe I'm doing something wrong - you may take a look at the source code, I added it in the original post
Comment: I'm not using any epsilon or checking timestep... How and where should I do that?
Comment: I added a video to the original post... I hope it can be useful to show the problem
Comment: I think I found the problem: float top = (body.CornerMin.Y - nextCornerMax.Y); should calculate the Y penetration. When the bug occurs -> top = (32 - 32.1) -> top = 0.99...~ //// so I think that since the entity isn't totally pushed up from the ground the next frame it gets pushed out horizontally... How can I prevent this? 32 - 32.1 should just be -0.1!
Comment: Wait... The same thing occurs in any other Y position. So that can't be the problem. I'm totally stuck here :(
Comment: I debugged for about an hour... Couldn't find anything else. I'm pretty sure the problem is floating point precision. You were talking about an epsilon before, where do I introduce it?


No water in the region

Question: When I started the game there was a lot of water in my region, but now when I switched to other cities where there was a water in valleys. The water was just absent.
I don't understand where the water disappeared?
Answer: As far as I know this could have been an side-effect of a mod.
You have some mods installed, which may remove the water in order to build bridges and something like that.
Comment: SC4 has no weather at all, except disasters
Comment: Are your right. Sim City 4 has no rain. It was the older ones who have it. I remove the second point, as it is not available in SimCity 4

No water in the region


Direct limits $A_0\to A_1\to... A$ with split monomorphisms.. should the maps $A_i\to A$ be split monos also?

Question: Let $\mathcal{C}$ be the category of $\mathbb{Z}$-graded rings. I have a sequence $A_i$ of $\mathbb{Z}$-graded rings, and split monomorphisms $\varphi_i:A_i\to A_{i+1}$ i.e. $$A_0\rightarrowtail A_1\rightarrowtail\cdots.$$ Let $A$ be the colimit/direct limit of this sequence, with morphisms $\psi_i:A_i\to A$. Are the $\psi_i$ necessarily split monos?
Does this work more generally in concrete categories?
Answer: This works in any category. To say $\varphi_i$ is split mono is to say there is a retraction $\rho_i\colon A_{i+1}\rightarrow A_i$. Then, you obtain morphisms $\rho_i\circ\dotsc\circ\rho_{j-1}\colon A_j\rightarrow A_i$ for all $j\ge i$. Then, since $\rho_i\circ\dotsc\circ\rho_{j-1}\circ\varphi_{j-1}=\rho_i\circ\dotsc\circ\rho_{j-2}$, it follows that these are compatible, so they induce a map $\chi_i\colon A\rightarrow A_i$ by the universal property of the colimit such that $\chi_i\circ\psi_j=\rho_i\circ\dotsc\circ\rho_{j-1}$ for all $j\ge i$. In particular, $\chi_i\circ\psi_i=\mathrm{id}_{A_i}$. Thus, $\psi_i$ is a split mono, as desired. This argument can be generalized to general filtered colimits.


What causes wet/damp concrete blocks in a newly built shed?

Question: Over three weeks ago, we had building contractors in to build a turf shed and today there was heavy rainfall all day and we noticed wet/dampness on the inside of the blocks. There are two coats of plaster on the outside of the shed.
Can anyone help?
Answer: Concrete and plaster are porous materials; water can penetrate them, and in fact cinder block is more or less a sponge for water. In addition, the mortar used to build the wall will have only just cured completely after three weeks, and while it's curing it will actively accept water.
To avoid this dampness, you should apply a sealant. There are sealants like Thompson's Water Seal which are designed to be re-applied regularly but which are clear and otherwise inconspicuous, or there are sealants like latex or tar-based coatings which are more permanent but also more obvious; your call. Sealing the outside is the better option when the option is available; by "outside", I also mean any courses of block laid down underground as a foundation, which requires you to dig a trench around this brand-new shed to access them.
Sealing the inside will prevent interior dampness, but it will also allow the block to continue to absorb water from outside the shed, and if you live in an area where deep freezes are a concern (the ground freezes deeply, thaws, refreezes, etc for several cycles each winter), the water trapped in these blocks will freeze, expand, and cause fracturing and eventual disintegration of the blocks and the shed.


Maven plugin - edit files in target (war)

Question: I am developing some little maven plugin and I need to edit some css and js files from target (not from src!). And I can't understand on what phase I can do it.
To get access to src I use the phases:generate-resources and the following code:
MavenProject project = (MavenProject) getPluginContext().get("project");
String projectDir=project.getBasedir().toString();

How can I get target when all js,css files are copied there but war file is not generated in order to edit some files from target and get final war with some modifications of js and css files?
EDIT
What for I need it. I have js files in my project: a.js, b.js. I want to obfuscate them via maven. I mean, obfuscate when I build project. And of course all files in final war must be obfuscated but the same files in src must be left unobfuscated.
Besides, I need to combine some obfuscated files into one file.
Comment: Why don't you obfuscate before generating the war ?
Comment: What is the purpose of that and why do you like to do this?
Comment: @khmarbaise I need do some operations with js (obfuscate them and form bundles of some of them)
Comment: @khmarbaise Is my approach to solve such problem wrong?
Comment: Can you show you full source code and the appropriate pom file from your plugin otherwise it's hard to guess what's wrong..
Comment: @fxm I don't understand your question. I do want to obfuscate before generating the war. I want to do it via maven. And I want to remove from final war unobfuscated files but of course to keep them in src.
Comment: @khmarbaise I posted the answer.
Comment: @fxm I posted the answer.
Answer: I found the answer. The problem is that we must add some logic between "prepare-package" and "package" phases. As we user maven-war-plugin we can do it using exploded goal. From official docs:

Create an exploded webapp in a specified directory.

And here it's necessary to remember one important thing that maven after version 2.0.1 copies resources twice so if we want to use maven 2.5 we must use <useCache>true</useCache>. So final solution:
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.5</version>
  <executions>
    <execution>
      <id>prepare-war</id>
      <phase>prepare-package</phase>
        <goals>
          <goal>exploded</goal>
        </goals>
    </execution>
  </executions>
  <configuration>
    <useCache>true</useCache>
 </configuration>
</plugin>

<plugin>
    <groupId>my plugin</groupId>
    <artifactId>...</artifactId>
    <version>....</version>
    <executions>
    <execution>
        <phase>prepare-package</phase>
        <goals>
            <goal>...</goal>
        </goals>
        </execution>
    </executions>
</plugin>


Is it truly never okay to call Component.getGraphics?

Question: MadProgrammer made a comment here stating that you should NEVER EVER use Component.getGraphics, which I generally agree with: In virtually all situations, it is wrong.
But take the case of this class I created years ago. I'm posting what I think is the relevant code. You can find the full code here
public class MouseDragOutliner extends MouseAdapter implements MouseMotionListener {
private class MyRunnable implements Runnable {
    public void run() {
        Graphics g = mComponent.getGraphics();
        if (g == null) {
            return;
        }
        Graphics2D g2 = (Graphics2D) g;
        Stroke s = g2.getStroke();
        g2.setStroke(DASH_STROKE);
        int x = Math.min(mStart.x, mEnd.x);
        int y = Math.min(mStart.y, mEnd.y);
        int w = Math.abs(mEnd.x - mStart.x);
        int h = Math.abs(mEnd.y - mStart.y);
        if (w == 0 || h == 0) return;
        g2.setXORMode(Color.WHITE);
        if (mCustomShape != null) {
            Rectangle r = mCustomShape.getBounds();
            AffineTransform scale = AffineTransform.getScaleInstance(w / (double)r.width, h / (double)r.height);
            AffineTransform trans = AffineTransform.getTranslateInstance(x - r.x, y-r.y);
            g2.transform(trans);
            g2.transform(scale);
            g2.draw(mCustomShape);
        } else {
            if (mShape == RECTANGLE) g2.drawRect(x, y, w, h);
            else if (mShape == OVAL) g2.drawOval(x, y, w, h);
            else if (mShape == LINE) g2.drawLine(mStart.x, mStart.y, mEnd.x, mEnd.y);
        }
        g2.setStroke(s);
    }
}

public void doMouseDragged(MouseEvent me) {
    mEnd = me.getPoint();
    if (mStart != null) {
        mComponent = me.getComponent();
        mComponent.repaint();
        SwingUtilities.invokeLater(mRunner);
    }
}
}

doMouseDragged is called from both mouseDragged and mouseMoved (when configured to). In case it's not obvious, what it does is call repaint on the component (so the component is ready to paint on), then run the mRunner after. I've used this in a number of situations quite successfully, with the benefits being that the component that the MouseDragOutliner doesn't need any customization (in paintComponent, specifically) to accomodate.
If it is truly never okay to call Component.getGraphics, can someone suggest a better solution for this?
Thanks!

http://sourceforge.net/p/tus/code/HEAD/tree/tjacobs/ui/drag/MouseDragOutliner.java#l66
Comment: Looks like a case for [JLayer](http://docs.oracle.com/javase/7/docs/api/javax/swing/JLayer.html).
Answer: I never like to say never. I think you just need to be aware of the drawbacks when using an approach that is not recommended.
The main point about getGraphics() is that the painting is only temporary. Whenever Swing determines the component needs to be repainted you will lose the custom painting. For example, try creating your outline and then minimize or maximize the frame and the outline will be lost. If you use Alt+Tab to switch application in Windows you will also lose the painting.
I agree in this case it is not a high probability the user will do something like that, but it may cause problems and result in a bug report. So you need to decide if you care about this problem or not. Who knows, maybe this is a requirement so it is not a big deal?
As suggested by @kiheru you can probably use the JLayer class. I don't think JLayer was part of the API when you created your code. I am not that familiar with it but the Swing tutorial has a section on Responding to Events when using the JLayer class, which seems to indicate you can do what you want.
When using a JLayer you can't dynamically add the functionality to any component (the way your code does). You need to add the functionality at design time, but I don't think that should be a problem.


Order of Header files being included in a C++ app

Question: Is there software/tool to see the order in which header files are being included after compilation of a C++ application? I find myself often running into circular dependency issues and seeing the "undefined reference" error message :(
UPDATE #1
I am familiar with header include guards and I am using them, but for some reason I'm still  having an issue with circular dependency.
In my case, I have many situations where a class A uses class B, and vice versa. In those cases, I use forward declaration for example  "class B;" at the top of A.h and vice versa.
Should it ever be the case where I'll need to do "#include "B.h"" at the top of A.h? Or is "class B;" sufficient on its' own at the top of A.h?
UPDATE #2
Hello, below is a snippet of the code that I am having trouble compiling/linking. There are 3 classes below:
A.cpp
#include "A.h"

namespace sef
{
    A::A() {
        // TODO Auto-generated constructor stub
        b = 0;
    }

    A::~A() {
        // TODO Auto-generated destructor stub
    }

    bool A::execute()
    {
        C::connectAndSaveFile();
        b->start();
        return true;
    }
}

A.h
#ifndef A_H_
#define A_H_

//#include "B.h"
class B;
#include "C.h"

namespace sef {

    class A {
    public:
        B* b;
        bool execute();

        A();
        virtual ~A();
    };

}

#endif /* A_H_ */

B.cpp
#include "B.h"

B::B() {
    // TODO Auto-generated constructor stub
    engine = 0;
    bool result = engine->execute();
    cout << result << endl;
}

B::~B() {
    // TODO Auto-generated destructor stub
}

void B::start()
{

    cout << "B::start()" << endl;
}

B.h
#ifndef B_H_
#define B_H_

#include <iostream>
#include <string>
using namespace std;

//#include "A.h"

namespace sef {
    class A;
}

class B
{
public:
    sef::A* engine;

    B();
    virtual ~B();
    void start();
};

#endif /* B_H_ */

C.cpp
#include "C.h"

C::C() {
    // TODO Auto-generated constructor stub

}

C::~C() {
    // TODO Auto-generated destructor stub
}

void C::connectAndSaveFile()
{
    cout << "C::connectAndSaveFile()" << endl;
}

C.h
#ifndef C_H_
#define C_H_

#include <iostream>
#include <string>
using namespace std;

class C {
public:
    C();
    virtual ~C();

    static void connectAndSaveFile();
};

#endif /* C_H_ */

I seem to be getting the error:
***g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\A.o" "..\\src\\A.cpp"
..\src\A.cpp: In member function 'bool sef::A::execute()':
..\src\A.cpp:23:4: error: invalid use of incomplete type 'class B'
In file included from ..\src\A.cpp:7:0:
..\src\A.h:12:7: error: forward declaration of 'class B'***

Comment: Use [header include guards](http://stackoverflow.com/questions/8020113/c-include-guards) and [forward declarations](http://stackoverflow.com/questions/7757519/forward-declarations) properly, instead of asking for a tool to solve these problems (which is OT anyway)!
Comment: If you need software to figure out what headers are being included in what order you're doing something wrong.
Comment: @NerfHerder that wouldn't fix a circular dependency problem.
Comment: A snippet of code that produces one of your errors would go a long way toward helping us recommend a way to solve the circular dependency.
Comment: In answer to "should it ever be the case where..."; the answer is yes. A forward declaration of `B` only lets you use pointers and references to `B` (as a first approximation); you will need the full B.h if you want to use a `B` by value or use any of its members.
Comment: I seem to be getting the message: g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\A.o" "..\\src\\A.cpp"
..\src\A.cpp: In member function 'bool sef::A::execute()':
..\src\A.cpp:23:4: error: invalid use of incomplete type 'class B'
In file included from ..\src\A.cpp:7:0:
..\src\A.h:12:7: error: forward declaration of 'class B'
Comment: Are you familiar with header include guards (http://stackoverflow.com/questions/14290026/linking-h-files-with-c-with-ifdef-header-guards)?
Comment: Thank you. I see. I have updated my original post. I am familiar with header include guards and forward declaration but I can't seem to figure out why I am still getting undefined reference issues.
Comment: Thank dlf, I am going to add a snippet of code right now
Comment: Hi all. I have updated the original post with sample code. I stripped it down to the bare minimum as much as I could. I seem to have a trouble getting this to compile together. I am not sure when to use forward declare and when to include
Comment: ou should be able to compile the header files on their own.
Answer: Your forward declarations are a good start, but in addition, A.cpp will need to include B.h and C.h since it dereferences a B* and calls a static function in C. Similarly, B.cpp needs A.h since it dereferences an A*. There may be other issues too, but that should get you on the right track.
Long story short, a forward declaration of class A only tells the compiler that A is the name of a class. This is enough for it to know what you mean when you say A* or A& (or a couple of other things), but if you want to actually call a function on an A, or access a member variable, or return/take an A by value, or have a variable of type A1, you need the complete definition of A from its header.
1 Basically, any operation that requires the compiler to know either sizeof(A) or information about its members/ancestors.

Also, this wasn't your question, but this code will give you undefined behavior:
B::B() {
    // TODO Auto-generated constructor stub
    engine = 0;
    bool result = engine->execute();
    cout << result << endl;
}

You're effectively setting engine to null and then calling a function on it.
And even further off the original topic, it's generally considered bad practice to using namespace std in a header file because everyone who includes it will be forced to use that namespace too, whether they want to or not.
Comment: Thanks for your answer dlf. I guess my question is... how come forward declaration is not needed here? They both depend on each other. I am trying to figure out when i should forward declare versus use include
Comment: I made the modifications:  A.cpp includes B.h and C.h    ... and B.cpp includes A.h   ... but now I am seeing the error message: "B" does not name a type
Comment: A.h does need to forward declare `class B` so the compiler can make sense of `B* b`. That's all the information that's needed there. But A.cpp actually decomposes a `B`, so it needs the full B.h. You should leave the forward declarations you already had in the different headers, but also add the includes I mentioned to the cpps.
Comment: Omg. I see what you mean now!
Comment: Thank you for your help dlf. My next question is...  so this entire time I've had the impression that for A.cpp, the only thing it would ever need is A.h at the top. And I had the impression that every include/forward decl should be inside A.h. But now it seems that sometimes the A.cpp file will need to include other header files. Is this the standard approach of including headers?
Comment: Is it correct to say...  I should only include necessary class/header information in A.h   and  include other header files in A.cpp if other class member functions/variables are used?
Comment: In general, you should minimize the practice of including headers in headers because this can blow up your build times by making everything depend on everything else. Sometimes you've got to do it, but I, at least, will always opt to put a forward declaration in the header and the include in the cpp when it's possible.
Comment: Your second comment came in while I was typing my last one. Yes, that is exactly right.
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/55020/discussion-between-user1456962-and-dlf).
Comment: Hi dlf, I have a question. What if I just combined two lines each time, wouldn't something like this solve any scenario : "class B; #include "B.h" "
Comment: In a sense yes; but a) the include would make the forward declaration redundant, and b) routinely using includes where a f.d. would suffice can get you to a place where changing one "hot" header means you need to recompile most of your project.