Is there a node.js method to read an index.html file and add new elements?

Question: I am trying to read my index.html file from my server.js in order to add a new  that links to a new html file I generate. I am using the POST method to do this and can successfully generate the new HTML file, however I am not sure how I can add a new  inside the index.HTML.
Here is my server.js:
    //POST method
  if(req.method === 'POST'){
    req.on('data', (data) => {
      let elementObj = querystring.parse(data.toString());
      element = elementObj.elementName;
      elementSymbol = elementObj.elementSymbol;
      elementAtomic = elementObj.elementAtomicNumber;
      elementDescription = elementObj.elementDescription;

      let newElement = fs.createWriteStream(`./public/${element}.html`);
      newElement.write(`<!DOCTYPE html>

<meta charset="UTF-8">
<title>The Elements - ${element}</title>
<link rel="stylesheet" href="/css/styles.css">

${element}

${elementSymbol}

Atomic number ${elementAtomic}

${elementDescription}

back

`);

      let indexElements = document.querySelector('#elements');
      let li = document.createElement('li');
      let a = document.createElement('a');
      a.setAttribute('href', `/${element}.html`);
      let elem = document.querySelector(`a[href = "/${element}.html"]`);
      elem.innerHTML = `${element}`;

      indexElements.appendChild(li);
      li.appendChild(a);

      res.end(data);
    });
  }

Here is my index.html:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>The Elements</title>
  <link rel="stylesheet" href="/css/styles.css">

The Elements

These are all the known elements.

These are 2

      Hydrogen

      Helium

The result I want in my newly, modified index.html (new 'Boron'
 added):
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>The Elements</title>
  <link rel="stylesheet" href="/css/styles.css">

The Elements

These are all the known elements.

These are 2

      Hydrogen

      Helium

      Boron

Comment: It's hard to tell exactly what you're trying to do because it appears you may be confused about what code runs on your server and what code runs in the browser.  But, (just guessing here) probably what you want is templates so you can create a shell for your HTML file and then use data to fill in pieces in the HTML shell and then send that to the client when requested.  I'd suggest a read here [Using template engines with Express](https://expressjs.com/en/guide/using-template-engines.html).  If you're not using Express for your web server, you probably should be.
Comment: @jfriend00 Thanks man, yes I understand that the DOM scripts don't belong on the server, but it is all I can think of what to do. Unfortunately, this is apart of an assignment and we're not allowed to use anything but node.js to do this.
Answer: Your question doesn't make it clear exactly what you're trying to do, but if these are your requirements:

You want to have an HTML template on disk.
That you can insert some content into based on some dynamic data.
You can't use anything other than plain node.js http server (so no existing template engines).

Then, you essentially have to build your own little template engine.  You can do that by reading the file into memory and then doing some sort of search/replace on some markers in the file to insert your content and then send that newly formed content.  Here's a general idea for how to do that:
Contents of template.html file on disk
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>The Elements</title>
  <link rel="stylesheet" href="/css/styles.css">

The Elements

These are all the known elements.

These are 2

      Hydrogen

      Helium

Server code for handling the POST
//POST method
if(req.method === 'POST'){
    req.on('data', (data) => {
        let elementObj = querystring.parse(data.toString());
        let element = elementObj.elementName;
        let elementSymbol = elementObj.elementSymbol;
        let elementAtomic = elementObj.elementAtomicNumber;
        let elementDescription = elementObj.elementDescription;

        fs.readFile("template.html", function(err, data) {
            if (err) return res.status(500).end();
            // build new content
            let newContent = "
${element}
";
            data = data.replace(//, newContent);
            res.send(data);
        });
    });
});


Retain socket connection in activity android

Question: I'm trying to create a service which controls the socket connection between client and server, to retain socket connection between activities of the client. This client's process is when user clicks on a connect button, a socket will be created and the client'll move to next activity, in this activity I created a button to send data to the server using the newly created socket. But the server seems not receive any data from the client when clicking this button.
Here is my Service
//ConnectionService.java
public class ConnectionService extends Service {
...
public class LocalBinder extends Binder {
    public ConnectionService getService(){
        return ConnectionService.this;
    }
}
private final IBinder myBinder = new LocalBinder();

@Override
public IBinder onBind(Intent intent) {
    return myBinder;
}

 @Override
public void onCreate(){
    super.onCreate();
    Log.i("Socket connection","I am on onCreate()");
}

public void isBoundable(){
    Toast.makeText(this, "Boundable", Toast.LENGTH_LONG).show();
}

public void getSocketInfo(){
    Log.i("Socket info",socket.toString());
}

public void sendMessage(String message){
    if(dos!=null){
        Log.i("Data_Transfer","Sending message");
        try {
            dos.writeUTF(message);
            dos.flush();
        }catch (IOException e){
            e.printStackTrace();
        }
        Log.i("Data_Transfer","Message sent");
    }
}

@Override
public int onStartCommand(Intent intent, int flags, int startId){
    super.onStartCommand(intent,flags,startId);
    //Log.i("Socket connection","I am in onStartCommand");
    Runnable connection = new SocketConnection();
    new Thread(connection).start();
    return START_STICKY;
}

class SocketConnection implements Runnable{

    @Override
    public void run(){
        //create socket connection
        try {
            //Log.i("Socket connection", "C: connecting");
            serverAddress = InetAddress.getByName(SERVER_IP);
            socket = new Socket(serverAddress, SERVER_PORT);
            //Log.i("Socket connection", "C: connected");

            dos = new DataOutputStream(socket.getOutputStream());

            Log.i("TCP client","C: sent");
            dos.writeUTF("Message from client");
            dos.flush();

            dis = new DataInputStream(socket.getInputStream());
            String msg = "";
            msg=dis.readUTF();
            Log.d("response",msg);

        } catch (IOException e){
            Log.e("TCP client","Cannot connect to server");
        }
    }
}

Activity created the service:
private ConnectionService boundService;
private Boolean isBound;

private ServiceConnection connection = new ServiceConnection(){

    @Override
    public void onServiceConnected(ComponentName name, IBinder service){
        Log.i("Connect","Creating service");
        boundService = ((ConnectionService.LocalBinder)service).getService();
        if(boundService!=null){
            Log.i("Connect","service bounded");
            boundService.isBoundable();
            responseFromServerView.setText("Connected");
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName name){

        boundService = null;

    }

};

private void doBindService(){
    bindService(new Intent(ShareImages.this,ConnectionService.class),connection, Context.BIND_AUTO_CREATE);
    isBound = true;
}

private void doUnbindService(){
    if(isBound){
        unbindService(connection);
        isBound = false;
    }
}

@Override
protected void onDestroy(){
    super.onDestroy();
    doUnbindService();
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.share_images);

    responseFromServerView = (TextView)findViewById(R.id.responseFromServer);
    responseFromServerView.setText("Connecting");
    sendDataBtn = (Button)findViewById(R.id.sendDataBtn);
    sendDataBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if(boundService!=null){
                boundService.getSocketInfo();
                boundService.sendMessage("New message");
                Log.i("Connect","Sent");
            }
            Toast.makeText(ShareImages.this, "Sent to server", Toast.LENGTH_SHORT).show();
        }
    });

    startService(new Intent(ShareImages.this, ConnectionService.class));
    doBindService();

}

Server code:
private class SocketServerThread implements Runnable {

    static final int SocketServerPORT = 8080;
    int count = 0;

    @Override
    public void run() {
        Socket socket = null;
        DataInputStream dataInputStream = null;
        DataOutputStream dataOutputStream = null;

        try {
            serverSocket = new ServerSocket(SocketServerPORT);
            MainActivity.this.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    info.setText("I'm waiting here: "
                            + serverSocket.getLocalPort());
                }
            });

            while (true) {
                socket = serverSocket.accept();
                dataOutputStream = new DataOutputStream(
                        socket.getOutputStream());
                dataInputStream = new DataInputStream(socket.getInputStream());

                String messageFromClient = "";

                //If no message sent from client, this code will block the program
                messageFromClient = dataInputStream.readUTF();

                count++;
                message += "#" + count + " from " + socket.getInetAddress()
                        + ":" + socket.getPort() + "\n"
                        + "Msg from client: " + messageFromClient + "\n";

                MainActivity.this.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        msg.setText(message);
                    }
                });

                String msgReply = "Hello from Android, you are #" + count;
                dataOutputStream.writeUTF(msgReply);
                System.out.println(messageFromClient);

            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            final String errMsg = e.toString();
            MainActivity.this.runOnUiThread(new Runnable() {

                @Override
                public void run() {
                    msg.setText(errMsg);
                }
            });

        }

When "Connect to server" is pressed, the client sends message "Message from client" to server, and it works, server can receive this message. But after the connection, in the new activity, press another button to send "New message" string to server doesn't work, server doesn't receive the message, even when the boundService still exists. Anyone please help me to fix this.
P/S: is it the correct way to make a server handle multiple clients and a client which needs to retain the socket connection all the time??
Comment: Did you check `logcat`?
Comment: Yes, server didn't receive the "New message"
Answer: Your server implementation is not correct. After accepting connection your server should spawn a new thread and pass the socket returned by accept to it. This thread should then communicate with client as needed.
Your current implementation accepts a connection, reads first message from client and then loop returns to 'accept'.
Answer: This is just a guess.  But I suspect your service is running the same process as your Activity (and might not matter if it's not).
So when this code is invoked via the onClick listener:
public void sendMessage(String message){
    if(dos!=null){
        Log.i("Data_Transfer","Sending message");
        try {
            dos.writeUTF(message);
            dos.flush();
        }catch (IOException e){
            e.printStackTrace();
        }
        Log.i("Data_Transfer","Message sent");
    }
}

The dos.write call throws an IOException because you are attempting to do a blocking network call on the UI thread.


What's involved in moving a hot water tank to the garage

Question: After a recent electric hot water tank leak on the second floor - I've decided to relocate the tank to the garage.
On the other side of the block wall in the garage - I have the laundry room - so we can tap into the h/c lines.
The electrical panel is inside the house right near the entrance from the garage.
Lots of questions...
What should I be aware of while doing this - is this even a good idea?
Should I keep the tank on the concrete floor or should I use some kind of barrier (over even a drain pan)
Should I use expansion tank?
Can I just connect to the h/c water line currently feeding the laundry room?
Appreciate your feedback and guidance/suggestions.
Thanks
Comment: Information from [this answer](http://diy.stackexchange.com/a/51504/33) might be useful.
Comment: Oh man...thanks for mentioning this. The more I think of it, I'll have to live with the idea of keeping the tank on the 2nd floor.
Comment: An electric water heater is not a gas water heater, so much of that answer seems quite irrelevant. Well, I guess the parking block part is not gas-specific, but it's also not much of a hurdle .vs. repairing water damage.
Comment: Give us some pictures and guesstimates of how far it is from the laundry room to the heater's current location. I'm not seeing this as an impossible task by any means. Also where the cold water supply for the house travels and in what-sized pipe at present.
Answer: There are a lot of questions to ask before an answer can be given:
What climate are you in?
Is the garage heated or insulated?
Is the hot water heater gas, electric, oil, solar, nuclear, gerbil-powered?
Are going to do this yourself?
You can probably get some pretty good, free advice on this by calling one or two plumbers to come out and give you a quote and a recommendation.
It's a pretty big deal to move a hot water heater, even more so if it's gas or oil.  There's electrical code (220v?), pipes, etc.
What about just putting in a nice pan on the second floor with a drain under it...might be cheaper and easier...
source: none, i'm not a plumber or electrician, but I do a lot of my own stuff.
Comment: It's in FL - around Orlando area. It is electric. The plumbers have differing advice - which is why I am at this dilema. I have already had ceiling damage and some laminate flooring damage. There is a drain pan with a drain line still it overflowed. During my diagnostic tests to find why its leaking, I noticed the shutoff valve was also leaking - that water is not caught into the drain pan.
Comment: As an aside, you have a great opportunity to replace your ceiling and laminate flooring with things that aren't moisture-sensitive, like fiberglass-faced drywall and tile.
Comment: unfortunately, the laminate is brand new and of the best quality - 12mm top of the line. Even the cieling was repainted - basically the entire house was renovated. Which is why I am thinking can I afford another accident - by leaving the tank on the 2nd floor.
Comment: IMHO there is no such thing as "top of the line" laminate. If it's got an MDF base, it's going to be ruined by moisture post-haste.
Comment: Agreed...I was referring to the "sales pitch" from the flooring guys. What I meant to say it was not the 0.79 sq ft cheap looking stuff you get. And the vapor barrier as well as soundproofing padding I used was "top of the line as well".
Answer: Have you considered adding a drain and rigid metal drain pan to the water heater in its current location. That's likely to be a much saner approach?
To move an electric water heater, the new location needs the following:

220v outlet on its own circuit with heavy-gauge wiring rated for an electric water heater. This is doable. If there isn't already such a circuit, you can hire an electrician to put in a new one, and you said the panel is pretty close by.
An incoming cold water line, which will be harder, but if worse comes to worst, you can run a PEX line from the incoming cold water line on the second floor to the new location in the garage.
An outgoing hot water line that serves as a trunk feeding the rest of the house with branch lines going to the fixtures. This is going to be the deal-breaker. The previous location probably has the correct trunkline hot water plumbing. If you seal that off and make a new input in your garage, you'll be supplying hot water to your whole house through a former branch line, which is narrow. Hot water pressure may decrease, and the time it takes to get hot water to distance fixtures will rise quite a lot. And you may be able to run fewer hot water outputs at once.
Comment: If you have a skeevy underplumbed system at present (when you say "size of the line from the current tank is the same as any other" I recall a lot of older houses with the entire system, even the main trunks, on 1/2" pipe) You should have a slam-dunk for moving it and putting some 3/4" PEX lines in place to beef up the supply.
Comment: We were thinking of running a new 220 for the current tank into the garage leaving the old on in place.
You do bring up good points about hot and cold water lines. We were thinking of connecting to the cold line in the laundry room on the other side of the wall.
Now you've got me thinking about the hot water line...the size of the water line from the current tank is the same as any other line - but I'll check again. That would be a deal breaker.
See my comment below about the drain pan - may be I'll opt for that and ensure I buy a bigger pan to cover drips from the shutoff valve as well.


Unable to upgrade from 12.04

Question: I'm trying to upgrade from 12.04 but have been unable to do so.
Both, sudo do-release-upgrade and sudo do-release-upgrade -d have generated the same response:
no new release found.

Can anyone help?
Comment: Have you tried `sudo apt upgrade`?
Comment: Try `sudo apt-get update; sudo apt-get dist-upgrade`. If it gives you a bunch of updates, install them, reboot, then try those commands again.
Comment: I get no updates to install when I try those commands.
Answer: Your OS is almost at it's end of it's support life and is currently in late maintenance support, so OS upgrades may not be available for your OS. Take a look at this link for more info.
Comment: Upgrades to a new release are available until EOL.
Comment: so how can I upgrade from my current OS?

Unable to upgrade from 12.04


Why won't my furnace complete the startup sequence when powered by a portable generator?

Question: We recently had a power outage that lasted several days and the house was down to 41 degrees and expected power restore was several days in the future.
I purchased a 3500 watt (5250 starting watts) generator with the hopes to heat my house.
I only wanted to power the furnace and did not want to worry about having it connected to the house at all.  I purchased a single outlet and a plug and added them into the furnace line.   So when I want to plug in the furnace I first have to unplug it from the houses power and then hopefully plug it into my generator.
The Inducer fan kicks on, the ignition element heats up and the flames start.  Just before the blower fan kicks on the flames go out and the cycle starts over.
I am assuming I have 1 or 2 problems.
1) Grounding issue.
2) Dirty power
I would like to explore the grounding issue but am unable to find much on the internet that matches my symptoms (actually I am finding too much, but nothing that seems to fit exactly).  I do have a ground lead on my generator, where do I connect it to?  My house does have a few poles outside where things come in.  I do see a few green wires connected to a pole with a clamp.  can I connect my ground to that?   is there an easier way to test if this is it the problem first?   I've seen things about creating a neutral bonded ground plug and plugging it into a spare outlet on the generator but some reason shorting the neutral and ground didn't seem safe, but I am new to this.
If my issue is dirty power due to a cheap generator, am I out of luck?  Should I just sell the generator?
edit:
Furnace is about 20 years old.
Generator is not an inverter.
Furnace does not seem to have a method of delivering error codes.
Furnace works fine when I plug it back into the single outlet I added.
Comment: What size is the blower motor? It may be causing the voltage to droop and thus cycle restart. A 120v furnace may be taking all the available power from that leg assuming it's 240v 3500w rated a 1/3hp motor takes 7.2a once up to speed but getting there it will probably be drawing over 20a.
Comment: My furnace is over 20 years old
Comment: Also, my generator is not an inverter
Comment: Hello, and welcome to Home Improvement. I presume it all works when you move it back to house power? (Edit the new info into your question; that makes it easier to read.)
Comment: No furnace error codes? How do you know the blower is about to kick on? Does it try to?
Comment: I am assuming the next step after I see flames would be the blower comes on and that's when it dies, so i guess I am just assuming the blower is about to kick in.
Comment: All works fine when I plug it back into the new house outlet. Unsure of HP on fan. Not a big house.
No error codes that I can tell, no indicators on furnace.
Comment: Can you post the nameplate for the blower motor in the furnace?
Comment: My guess would be "dirty power", in a former job I had to run some computers (and some office lighting) off a generator. A cheap "contractor special" 8000W generator didn't work, the computers would barely start booting before they'd trip off and start over again. Two generators that did work were a Honda 6500W inverter generator, and a 20KVA trailer mounted diesel generator.
Comment: Just to update this thread.  I ended up doing the diy neutral bonded plug and my furnace works with the generator now.  Next step would be to try the house ground.
Comment: Be sure your extension corde is at least #12. You could simply have enough voltage drop to cause it to cycle down.
Answer: Many flame presence detectors use the relationship between Earth and one side of the Mains to sense a small current passing through the flame. If the voltage is not as expected, the flame presence / failure detection may not work.
So again, establishing the proper relationship between Mains and Earth is critical for proper operation.
Answer: I'd consult with the furnace manufacturer regarding whether the furnace electronics will function properly on generator power that might not be pure sine wave.  If that's the issue you're just wasting your time.  It's also possible that you could damage the electronics running on generator power.  There are ways to clean up the generator power, but none that will be convenient for your testing purposes.
I'd look at your generator's instructions carefully with respect to the neutral to ground bond rather than using a plug with neutral and ground bonded.  For safety and proper function of the equipment grounding system this needs to be done correctly.  I imagine if the generator is used standalone as you are using, rather than with a transfer switch, the neutral to ground bond needs to be in place.
It's possible that your furnace's control wiring in some place uses ground as a return path, and without the neutral to ground bond that path is not available.  (If this is the case it's likely a wiring issue that should be corrected, even though the furnace runs.)  But if this is the case, and the neutral to ground bond is missing, it's possible this could correct your issue.
Connecting the generator's ground lug to your existing ground rod may or may not correct the issue but again I'd defer to the generator manufacturer's instructions.  The furnace is probably always connected to ground by it's plumbing so bonding the generator's ground lug may keep everything at the same reference.
I keep referring back to the manufacturer's instructions for safety, I'd not get creative, you could wind up with damaged electronics or a serious safety issue.
Comment: I was on a project where someone plugged a high end surge suppressor into a standard (non-inverter) generator.  The surge suppressor did a great job until it started smoldering from all of the power it was dumping to clean up the waves.  Someone noticed and unplugged it before it caught fire, though.  But yeah, dirty power + sensitive electronics can be really, really bad.
Answer: I too suspect the (lack of) ground-neutral bond. So far as I'm aware there isn't any industry standard for ground bonding in portable generators: it's almost universal that portables in the US have a 3-prong outlet, and in many units the ground prong connects only to the generator chassis, leaving the hot and neutral to float.
My favorite remedy for ground-neutral bonding in portable generators I learned from Mike Sokol (http://noshockzone.org/). Get a regular 3-prong male cord end and put a jumper wire between the neutral and ground terminals. Reassemble the cord end and label it as a ground bond jumper. Plug it to an unused socket on the generator and test the furnace again.
A 20-year old furnace is likely to have a single LED which lights solid when all is well, or gives a series of flashes when there's some error. The control board is likely to be mounted in the blower compartment, and usually there would be a small window through which the LED would be visible -- though it may be dim, and it may be visible only when viewed on exactly the right axis. It could be easier to see if you remove the blower compartment door, keep all hands, long hair, clothing, etc clear of being drawn into the blower, and hold the blower door safety switch so that the control board can power on.
Supposing an indicator LED is found, it'll need to be decoded. Often there's a wiring diagram on a label fixed to the inside of the blower compartment door; the "magic decoder ring" for translating flash count to a meaningful trouble cause might be as simple (inconspicuous) as a footnote on that schematic.
Comment: One other note on your suggestion with the bonding plug -- I'd use the L5-30 outlet sometimes provided on larger portable generators for that if it is present.  That way, it won't get confused for a regular plug....
Comment: Well, I'm not sure about itty-bitty generators, but anything that's "contractor grade" MUST have its N-G bond factory fitted in order to comply with OSHA regs for jobsite use.
Comment: @ThreePhaseEel We definitely agree that OSHA requires a bond at the generator in some conditions (source: OSHA Fact Sheet: Grounding Requirements for Portable Generators), but I could not confirm whether OSHA requires the bond must be factory-installed. My very brief survey of current portables on the market found that the Honda EB4000 does have a factory-installed bond (per text in its user manual), while the EU3000iS does not (per the wiring diagram in its manual). Maybe my claim that "many" float goes too far -- but some current models do float. Bonding shouldn't be assumed.
Comment: Indeed -- oftentimes generators get horse-traded...
Answer: Had the same problem with my generator and gas furnace. When powered by generator (through a transfer switch) the fan kept cycling when no heat was called for. I was quite puzzled.  Did some research and discovered the bonded neutral in the generator was causing stray current flows. (Neutral and ground are already bonded in the house panel) Unbonded the generator neutral and the furnace worked fine. I fixed up a dummy 3 prong plug with the neutral and ground connected to make the generator bonded neutral again when not connected to the transfer switch.
Comment: Welcome to [diy.se]. I'm glad you got your situation working, however, your answer doesn't seem to add anything (except some narrative) to the already accepted answer from 18 months ago. Care to [edit] your post to add any additional details that may be helpful?
Answer: ==> Very helpful thread, thx: It was the grounding in my case.  <==

Straight winds took power out of our neighborhood some 10 years ago for a full 4 days. Bought a modified wave inverter (2500W/5000W peak) at a truck stop ($250) to run our fridge etc.
This winter (Feb 2021), power off again thanks to the SPP membership of our state with 13 others. Tried to run the gas furnace but it did not work. I blamed the inverter (modified wave = dirty power) and did not think of a grounding issue.
Bought a "Xantrex-817-2000-Freedom-X-2000-p" PURE SINUS wave inverter from DonRoweCOM to protect the electronics in the 2015 Trane gas furnace. It did not work either. Very frustrated, I searched the WWW.
I just today connected the ground to the chassis of the furnace (metal) which in turn connects to the ground that to the 15A fuse, then to the gas furnace. Now it works.
You may not need a 2000W inverter just for the gas heater alone (~700 Watt ave.). But do get a quality pure sinus wave inverter for clean electricity.
I run it from a 12 Volt battery that sits in a 2015 VOLT. The BIG battery charges the 12 Volt battery constantly from the BIG battery pack (battery for driving) when Volt is in PARK position. The same should work with a Nissan Leaf, I assume. No need for a battery bank ($$$) when you have 17 kWh parked in the garage.
On the Volt, I can draw up to 1400 Watts before the single care battery's voltage drops to <11 Volt.  A big battery bank would do better.  Thanks again to everyone who contributed to this thread.
Answer: Was looking at another forum with similar issues.  From what I can make out of it, when Furnace is wired to breaker panel (normal configuration), the board is looking for the neutral to be bonded with the ground in the main panel.
If a generators three wires (hot, neutral, grnd) are connected to the furnace,  the board does not 'see' the neutral bonded at the panel along with ground.
One suggestion was to make up your standard 3 prong plug from furnace to a receptacle going to the panel for normal operations.  When running generator,  run a neutral jumper wire from the primary receptacles neutral and share with gen neutral.  Then when the plug is put in generator receptacle the neutral wire is seeing the gen AND the panel neutral.  No harm, no foul, right?
If not done like that, the furnace's board doesn't 'see' that ground and neutral are actually bonded, .... as it would if coming from the main panel.
I shall contact my HVAC company for clarification.  During the Texas Winter Blackout,  I came very close to just wiring 12/2 from gen to furnace and just use wire nuts on panel/feed side, but something at the last minute made me not do it as I was more concerned about damage to the furnace board (not even thinking about it not running).  Would have taken a lot longer for HVAC guys to bring a new board than just waiting it out till power restored.  At least had double see-thru gas log fireplace and used 8 inch 12v computer fans to push some of the heat out.  Was NO fun, but survived 4 days with no power.  Did use Generator for inside fridge, coffee maker, WOK and blender for some margarita's :-]
Answer: I had the same problem and fixed it by grounding my generator. Here are the instructions from my manual (my generator has a grounding nut):


How to share the Workspace for Android SDK between Windows and Ubuntu?

Question: I'm sharing one workspace between those two systems, and as I'm developing for Android I need Android SDK, which is in Windows in D:/Android/sdk, on Ubuntu it's different path.
How can I make it to switch automatically at Windows to D:/.. and on Ubuntu to home/...?
Because now each time I switch systems, I have to point eclipse to the SDK.
Answer: Don't share file system, use a sane source code version system, like git or subversion. Because you should have that anyway, even if you work on your source yourself.
It's problems sharing projects with different versions of Eclipse or any IDE as it is, so doing that between two OS with different syntax and semantics would only drive you insane. Been there, tried that.
Comment: Thanks, I followed your advice and used Bitbucket (as I want to have my repos private) and EGit for an Eclipse. Works like charm. Thx
Answer: You have to options:

The first one and the best is to share a partition between Ubuntu and Windows.
In that partitions you can create a project from one system and then modify that project from the other OS.
NOTE: this partitions should have a compatible file system (recommended: NTFS)
Also you can work with a project saved on your Windows partition (as you're now). But this is not recommended because you will find incompatibility's issues.

IMO you should proceed with the first option
Comment: Yeah, that is part of the undesired effects. Personally, I not recommend to modify a project with two different platforms.
Comment: I'm doing it right now, but my questions is about how to share SDK, as Eclipse keeps path to it in workspace (.metadata), and in my case on each system it is different (so I have to go to options and manually correct it).


Fixing micro-cracks in a fiberglass tub

Question: I am experiencing leakage from my tub. It is inconsistent with a small amount of water, but it happens to leak onto the computers below. After multiple plumbers reviewed the plumbing and found no issues, we have come to the conclusion that is coming from micro-cracks in the tub. We have a temporary workaround with a bath mat and spreading our feet wider on the tub, but these are hacks.
We are trying to figure out a more permanent solution. The obvious answer is to replace the entire thing, but that is very involved and costly. Is there some kind of sealant that we could use or another similar strategy that would address the issue and avoid total replacement? While I have some home improvement knowledge, my experience is non-existing when it comes to installing and managing tubs and so am not sure if that will influence any recommendations.
TIA!
Comment: "it happens to leak onto the computers below" What? Computers stored under... your bath tub? Going to need more context about the bathtub's environment here...
Comment: No, my office happens is on the floor below my bathtub. The water leaks from the tub onto the computers on my desk on the floor below. It is a small flow and they are covered with a towel. Not ideal for sure. However, the temporary fix has stopped the problem. But as posted in the original question, it is really a hack, and I need a permanent solution.
Answer: Tub coatings are not intended to be structural. They're merely aesthetic (and maybe hygienic). A fix would involve bolstering the tub enough to stop flex movement (from underneath), plus a resurfacing, and even that may be unreliable.
That all would cost as much in time and expense as a new tub. Unless you're willing to bathe in the equivalent of a pickup bed coated with spray-on liner, you need a new tub.

Fixing micro-cracks in a fiberglass tub


Which personal damage reductions make other raid members suffer more damage from Inferno Slicer?

Question: When fighting Gruul in BRF, we noticed increased incoming damage from Inferno Slice when some people launch damage reducing/avoiding abilities, such as Divine Shield. We are unsure which abilities are safe to use. My guess is, that damage immunities will make the damage be split among others instead, like mentioned DS or Ice Block from Mages. But what about Deterrence and others such as Evanesce?
Answer: Inferno Slice deals physical damage to the tank, and direct fire damage plus fire damage over time to players in front of Gruul. Here we're concerned with the fire damage to the raid.
Any ability which grants immunity to fire damage will exclude that player from the damage split. This is basically just Ice Block and Divine Shield, though there are obscure ones such as The Void, which you may randomly get from using a Last Deck of Nemelex Xobeh (which can be kind of risky in a raid environment).
Abilities which absorb damage or provide a damage reduction percentage (which is effectively the same thing) should be safe to use, as the damage is actually delivered, but consumed by the ability. These include:

Death Knight: Anti-Magic Shell, Defile, Purgatory
Mage: Flameglow, Ice Barrier
Monk: Dampen Harm, Guard, Life Cocoon, Soul Dance, Touch of Karma
Paladin: Ardent Defender, Hand of Purity, Holy Shield
Priest: Clarity of Will, Guardian Spirit, Power Word: Shield
Warrior: Shield Barrier
Warlock: Dark Bargain, Sacrificial Pact

But I probably forgot a few. Obviously some of these aren't going to be very useful, and some are practically mandatory.
Whatever you do, the best strategy for dealing with Inferno Slice is still splitting the raid into two groups, one in front of Gruul and one behind, and alternating which group he hits.


unable to restore duplicity backup

Question: am unable to restore part of my duplicity backup, the file format is /media/ravi/TOSHIBA/Dejadup 090518/Part 2/duplicity-inc.20180507T183302Z.to.20180507T204510Z.vol1.difftar.gz. get a hash mismatch on trying to restore. kinldy help
ravi
Comment: Which version is this?
Answer: a hash mismatch usually tells you that a volume got corrupted on the backend.
you can use the <code>--ignore-errors</code> parameter as documented in the manpage to skip this error but probably all files that ended up in there will be unrestorable, check/save the console log to see which ones.
if your duplicity version still does not have the parameter, update to the latest duplicity 0.7.17 first. there are ubuntu ppa's available.
..ede/duply.net

unable to restore duplicity backup


What is Steam's "download now" icon?

Question: In the Steam client application there is a download now icon, here it is with hover over:

and by itself:

What is this icon?
It kind of looks like this Chinese character 不 but it wouldn't really make any sense why that would be the icon for download now.
Comment: @Mixxiphoid There's a bit more to it... See my answer.
Comment: It is a download icon... There is nothing more to it.
Comment: @SaintWacko The question was primarily asking about the icon, not the function behind it, but your right, there is more to it :).
Answer: The intent of the button is "Move to top of queue". It's an arrow pointing up, indicating that it's moving the selected item up, and terminating at a horizontal line which indicates the top bound of the queue.
Comment: It's nothing more than a descriptive graphic that's supposed to let you know that the current download will move to the top. It's not a *standard* or *universal* icon, it's just something that's supposed to intuitively make sense.
Comment: @user3306356 The icon used in the button similar to the character Unicode calls UPWARDS ARROW TO BAR (⤒), but my guess is that if Valve has given it a name it would be the "move to top of queue button".
Comment: @user3306356 I guess the technical name is "move-to-top" or "move-to-beginning"
Comment: is there a technical name?

What is Steam's "download now" icon?


From what conditions can captains come back and ambush you?

Question: My good buddy Thrak the Brave just finished up a good graug hunt today, and was proving to be a capable captain, so I made him my bodyguard. Minutes later, while I'm watching two other captains fight, he comes up behind me:

So I killed him. The game told me the battle ended with Thrak "killed". Later on in my play session however, he comes back:

So I killed him again. This time, the game told me the battle ended with Thrak "cleaved" (I chopped him in half this time).
Will I ever see Thrak again? Obviously captains can return from battle endings of "recruited", "killed", and likely "burned", "poisoned", "cursed", but what about endings like "decapitated", "headshot", or "cleaved"? How can I know that a captain is really dead, and won't ever return to try to kill me again?
Comment: I've had captains come back looking like Frankenstien's Monster, and one Captain claimed that Necromancers haven't allowed him to die for hundreds of years.  Looks like the only inevitable thing is Taxes.
Comment: According to comments on the subreddit, decapitation is no longer a guaranteed death in SoW (though it was in SoM). Decapitated orcs who come back have a giant scar around their necks. In SoM, decapitation was the only surefire way to kill an orc, so I'd hazard a guess that SoW no longer has any way of definitively killing orcs.
Comment: If that's the case then it seems likely to me that they can come back from anything probably
Answer: Orcs in this game are definitely persistent, that's for sure. As for how to guarantee they won't come back to gut you, it seems that in this sequel, there's very little to guarantee they won't come back.
This Kotaku Post covered the system in the prequel, Shadow of Mordor, and identified that not even decapitation (or lobotomy) ensured an Orc's demise, as the dev's had said:

Me: Regarding the nemesis system, do orcs only change their appearance/dialogue but still reappear if they SURVIVE a fight but still lose? Or do they ever come back to life (so to speak) to fight again the same way Talion does? I have one orc that I thought I killed but he's showed up to challenge me a few times since then, so I want to check if that's actually a possibility.
Monolith: If an Orc is not decapitated he can be scarred but cheat death and return to face you again. He should acknowledge this in his Showdowns and VO. This isn't like Talion where it is supernatural, it is just a result of them being extremely tough. You can decapitate a Captain by either

Using a Chord (Triangle + Circle) when your Hit Counter is charged or
Dominating him and selecting "Kill"

But, through testing, this has been proven to also not work. That being said however, there is one way to tell that an Orc is dead:

[...] there's a way to check whether or not an orc is likely to get back up off the ground. As the USGamer article points out, the best way to keep track of this is to go into the game's nemesis board after defeating an orc and see what their slot looks like in the aftermath of the fight. If the relevant orc is just lying there, there's a good chance he's not dead yet. If there's a little pile of skull and bones, on the other hand, you can rest assured that the guy's not coming back.

In Shadow of War, this "feature" seems to have been reinforced by the introduction of the "Cheating Death" feature, even in-so-far as to sport a ring-like scar around their neck, if previously decapitated.

However, as you see the body of the Orc on Army Screen, as long as the body does not disappear, that Orc or Olog has a chance to reappear and seek you out in combat again.

Again, the only hard indicator that an Orc is well and truly dead dead, not just pretending, is that they will appear as a small pile of skulls and bones on the Nemesis/Army board.
So, to answer your question: there is no, nor does there appear to be any particular "status" to ensure that an Orc is dead after defeat (either by betrayal or just general sport); only identifying whether or not they are dead.


How do I install the PS3 OS on a new HDD?

Question: My HDD is starting to make noise and I think it's time for me to change it. I have the old 60Gb PS3.
I was wondering the PS3 installs it's OS. Do I just have to switch the HDD and let the PS3 install it by itself? I don't think so. Does the option "Restore PS3 System" reinstall the OS on the hard drive?
What do I have to do to install the OS on the new HDD?
Answer: The PS3's OS is not stored on the HDD, but the internal flash memory of the PS3. So switching a HDD will not do anything to the OS. So nothing is needed to be done, to get the PS3 up and running, after a HDD switch.
The HDD only stores, Media files, save games, DLC etc.
Related question
Comment: That's how easy it is. The OS is simply not running or being stored on the HDD.
Comment: So you're telling me just to put the formated new drive and it will install.... Sounds too easy no ?
Comment: Wrong, the Ps3 OS is stored on the HDD internally, and you can Visit the Sony Support site ON how to do this Via a Usb Stick.
Answer: The "Restore PS3 System" option will delete everything from the hard drive and return all settings to their defaults.


Changing hover color of a responsive table

Question: I was trying a simple trick of changing hover color of a responsive table but failed.
I tried chaining the CSS but failed.
Do I need to add more CSS tags to make this happen.
Could you please help me to understand what is wrong in my approach.
Here is my code:
    <!DOCTYPE html>

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Table

The .table-hover class enables a hover state on table rows within a tbody:

            Firstname
            Lastname
            Email

            John
            Doe
            email@example.com

            Mary
            Moe
            firstname.lastname@example.com

            July
            Dooley
            firstname.lastname@example.com

Comment: It was working fine for me
Comment: Thanks Jayson. Can you confirm if you are able to see red color on hovering or grey color. Actually i want a red color on hover but I am able to see grey color
Answer: ``

this code make highlight even over table header, this one make highlight only over table body
``

Answer: You have to put style instead of script on the CSS
Here make it:

Comment: Yes it was a silly mistake where the required code was put in the script instead of style which is valid for css.


Atheros AR9485 wifi disconnects randomly

Question: I recently bought a new computer that has an Atheros AR9485 wireless NIC. So far it has been working ok except this one issue: Randomly (as far as I can tell) it will completely lose the internet connection. The indicator in the top panel will still say we are connected but the machine has no internet connectivity whatsoever.
I've been able to get it working again by simply disconnecting from my wireless AP and then reconnecting, but this is annoying. Is there anything I can do to make the connection more stable?
I have tried passing the nohwcrypt=1 to the driver, but that made it impossible to connect to any AP, it just infinity attempted to connect.
sudo modprobe -rfv ath9k
sudo modprobe -v ath9k nohwcrypt=1

I've also tried upgrading my kernel to Linux 4.0 but the problem persists.

Exact chip:
02:00.0 Network controller [0280]: Qualcomm Atheros AR9485 Wireless Network Adapter [168c:0032] (rev 01)

Driver:
$ ls /sys/class/net/wlan0/device/driver/module/drivers
pci:ath9k  platform:ath9k

and lsmod:
user@host:~$ lsmod | grep -e ath -e ndis
ath3k                  20480  0
bluetooth             491520  9 bnep,ath3k,btusb
ath9k                 147456  0
ath9k_common           32768  1 ath9k
ath9k_hw              458752  2 ath9k_common,ath9k
ath                    32768  3 ath9k_common,ath9k,ath9k_hw
mac80211              724992  1 ath9k
cfg80211              540672  4 ath,ath9k_common,ath9k,mac80211

output from wireless script: http://paste.ubuntu.com/12625978/
I'm running Ubuntu 15.04 on Linux 4.0.0-040000-generic on a Lenovo G510.
I'm wondering now if I could possibly have anything to do with my wireless mouse, which also operates on 2.4GHz..
Comment: @Seth quick google suggests forcing a bitrate on the wireless network - sudo iwconfig wlan0 rate 54M  ... does this help?
Comment: @fossfreedom No luck. I went a few days without a disconnect (which happens, like I said, it seems random), but today I had another disconnect.
Answer: I have a Lenovo with a AR9485 but I don't have any close neighbors with wifi and your channel and regulatory settings are the only issues I saw. I know chili555 would suggest using 20Mhz instead of 40 if you have that option on the wireless router
Here is one of his posts copied:

First, check the settings in the router. WPA2-AES is preferred; not
  any WPA and WPA2 mixed mode and certainly not TKIP. Second, if your
  router is capable of N speeds, I have better luck with a channel width
  of 20 MHz in the 2.4 GHz band instead of automatic 20/40 MHz. I also
  have better luck with a fixed channel, either 1, 6 or 11, rather than
  automatic channel selection. After making these changes, reboot the
  router.

Next, I recommend that your regulatory domain be set explicitly. Check yours:
sudo iw reg get

If you get 00, that is a one-size-maybe-fits-all setting. Find yours here
Then set it temporarily:
sudo iw reg set IS

Of course, substitute your country code if not Iceland. Set it permanently:
gksudo gedit /etc/default/crda

Use nano or kate or vim if you don't have the text editor gedit.
Change the last line to read:
REGDOMAIN=IS

Proofread carefully, save and close the text editor.
Next, I'd set IPv6 to Ignore in Network Manager
Answer: I've a Realtek based receiver that has the same problem. Disconnecting and reconnecting makes it working again. It is difficult to troubleshoot and it goes in the direction of 'opinion based' but as far as I can tell it is a matter of interference.
Many devices like microwave ovens, doorbells, remotes and of course other AP's use the same frequency band which obfuscates or weakens the signal of your AP. Your output file shows lots of other AP's and a relatively weak signal of yours.
The indicator you mention only shows there's a connection with an AP, it basically shows there's a carrier signal. The carrier signal is why you can scan for wireless networks. It does not tell you that anything useful is send or received. If your connection is secured it regularly changes the encryption key and depending on your settings it can even change channel. If the encryption key changes during a period of weak signal the receiver can loose track of it. However it does see the carrier and thinks it is still connected.
There are a few things you can try to improve the situation:

Move closer to your AP, but that's not really a solution. Nevertheless this really works.
Change the channel of your AP to one that's less crowded. You can try all the channels you can set.
If your devices support it try to change to the 5 GHz band which has more channels and is less crowded than the 2.4 GHz band.
If the problem persists buy a range extender although this actually worsens the situation in the long term because everyone buys range extenders so more or less there's a wireless war going on these days.
Comment: I think it is highly probable that what you are describing in paragraph two is what is happening. Unfortunately I am already within 30 feet of the router so getting closer isn't likely to help all that much. This Atheros card doesn't support 5GHz or I would try that. AFAICT I'm on the best channel for my neighbourhood already so that's unlikely to help as well :/ I do have another router but a friend is borrowing it. I don't think he is using it so maybe I can get it back tomorrow and see if that improves anything.
Comment: Well, upon looking at the whole channel business again it seems I hadn't picked the best channel. Changed it to 7, we'll see if anything gets better.
Comment: Well, there's no such thing as the 'best' channel. When your neighbors decide to change channels too then this channel can become crowded too. From a theoretically point of view channels 1, 6 or 11 are the best choices because those are the least affected by adjacent channels. However about everyone knows this so those are usually the most crowded channels too. Your choice might be indeed the best choice for a period of time. If it is allowed in your country and your devices support it you might want to try channels 13 or 14. Most people don't use those.


Dokku view logs? (hosted on digitalocean)

Question: So I just started using dokku (with postegres). My app works on Heroku so I'm pretty sure it's a deployment issue. The app seems to be running but is however hitting issues at log in. I did dokku logs my_app_name however the logs seems to be old. On heroku whenever there is an issue there is an corresponding log, but here I cannot find.
Any ideas are appreciated! Thanks!
Answer: To get a continuous log you can type:
dokku logs yourappname -t
It acts as the tail -f command on linux and mac systems.
Dokku logs - docs
Answer: I think you can try to use docker logs -f `cat /home/dokku/<app-name>/CONTAINER for getting access to the logs.
In case if you want to see the logs of the specific container:
docker ps
then find your container with postgresql for example and run docker logs -f <CONTAINER_ID>
I hope it could help you to find out the problem.
Out of the topic I found dokku-alt and using it in my current DO image. If you are working with Ruby it's working out of the box comparing with original dokku project.
Answer: The easiest:
dokku logs -t *app_name*

up to 300000 lines:
dokku logs -t -n 300000 *app_name* > logs.txt

complete log of container: (needs to be executed on server)
docker container list # to get the container id
docker logs *container_id* > logs.txt

Answer: It may not be the answer you are looking for but I was seeing the same issue. I just waited about 30 seconds and the logs were updated. I don't know why they are updated live, but they eventually came through.


sudo refuses my password

Question: I've just installed Ubuntu 12.04 and now that I want to install a program through the terminal with a command starting with sudo, the terminal says Sorry, try again.
I just don't get it, this is my user password which I check with through the Software Center.
What can be then wrong? (Is it possible that the terminal function differently than the rest of the OS in relation to ASCII keyboard?)
Please help.
Answer: Check CAPS LOCK. Passwords are case sensitive.

sudo refuses my password


is public static sql connection secure

Question: I am working on a windows service in c#, and perhaps I might use the same methods in my web application if it works. The main service is using a sqlconnection that is used for itself, retrieved from app.config using ConfigurationManager, and it creates a few threads of different types, to run several tasks. Each of these threads has its own connection (stored in class property).
public partial class MainService : ServiceBase{
    private static string SQLConnStr;
    protected static SqlConnection SQLConn;
}

class OtherClass{
    private sqlconnection sqlconn;
    private string connstr;

}

The part that I am stuck with, is that, when I create another object type, I need that object to be able to access the DB using OtherClass' connection. This new object is created and called in OtherClass for processing later on.
Is it possible to re-use the sql connection from OtherClass?
Is it safe and secure to make the sql connection string as public static?
Is the design I am using not good?
Comment: The best practice is to put your connection string in Web.config file.
Comment: The answer you want depends on the situation. If its a class library, everything will be compiled into a DLL. In that case it someone using that DLL will be able to access your connection string too (if it is public). This is not secure, I think.
Comment: u mean if I put the classes in a dll, it doesn't matter if it's private or public?
Comment: I forget to mention that the connection string is retrieved from the app.config file into SQLConnStr and connstr.
Comment: Kindly note the edit in my comment and also include the above information in the question.
Answer: pass it to OtherClass constructor ?
details with example:
public partial class MainService : ServiceBase{
    private string SQLConnStr;
}

class OtherClass{
    private string connstr;
    public OtherClass(string _connstr) { this.connstr = _connstr; }
    public foo() { using(var conn = new SqlConnection(connstr) { ... } }
}

Creating new SqlConnection each time is fine in .NET since there is connection pool.
Comment: It would be a last resort. I would not prefer to do that.
Comment: @Heather : Lets see, how about others who have answered the same question, doesn't it seems that yours is kind of an odd man out ? It seems based on your arguments under your answer I would expect you to understand that more people differ in a way that you thought that as an answer like that suits. You said `pass it to OtherClass constructor ?` now was that a question or an answer seems confusing to a 3rd person doesn't it
Comment: @Heather : Regarding the improvement of the answer how about an example like a method call passing the instance to a constructor would have added a little more on what your trying to say. Now I have also seen the answers that you made and those all seems fine and good to be considered but this doesn't, and what every one and me is trying to explain you is that if you have a one liner which is not a code I would suggest you to add it as a comment rather than anything else.
Answer: You should use the respective configuration mechanism. For applications/windows services this would bee the app.config file, for web applications it would be the web.config file and for DLLs, the settings should be copied from the DLL's app.config to the application's app.config/web.config as described here many times (DLLs don't read their config files, so the settings need to go into the application's config file).
That being said: Use the settings designer in Visual Studio to simply add a new connection string setting. If necessary, add it to other projects, too.
To use the connection string from class within the same project, you can then simply use Settings.Default.MyConnectionString assuming that the setting is named MyConnectionString.
Another exception for DLLs: Some DLLs don't need their own settings, but they need to access a database. In that case you could pass the connection string or even an SqlConnection to the function that requires database access.
Comment: I know. What I was after was to just rely on the standard settings mechanism and then use that setting throughout the code or pass it to DLLs. I read the question, you know? :D
Answer: There is a distinction between connection*string* and the connection itself. For the connectionstring (describing where you should connect to), you can store that in a config file so youu can easily change it.
The connection itself that is used to communicate with the database must be opened and closed. When you use datareaders, you can't usually use the same connection for simultaneous commands.
It is best to open a new connection as late as possible and close it as soon as possible. Let the built-in connectionpooling do it's thing to optimize the real connections.
Answer: I like your answers, but mine is the case of bad design, after looking into it a while. So I decided to create a public static query function in the MainService:
public static void qQuery(string querystr){
    using(sqlconnection conn = new sqlconnection(sqlconnstr){
        .....
    }
}

sqlconnstr is a private string in MainService which is initialized when the service starts.
I hope it is safe and secure way of doing it...

is public static sql connection secure


How do I force a higher resolution on Windows 7?

Question: I have a laptop, and I want to force the native screen to display 1080p. I know the display driver is capable of that because I have connected it to a 1080p screen before and it worked.
I am doing this because I want to establish a remote connection from my Raspberry Pi to the laptop. The Pi (an ARM linux machine) is connected to the 1080p screen. At the moment, the remote connection only covers part of the screen, as the laptop is only displaying 1366x768 (or something).
I want a software solution, if possible. Also, I want a server-side solution (that is, on the windows machine) as finding and using Linux software that works on the pi is a bit of a nightmare!
I am using TightVNC, though am prepared to try any package is free and which works well, as a server for Windows and client for ARM Linux.
Solutions I have tried that don't work:
'show all modes' on control panel (still didn't show the mode 1920x1080, which I know the graphics adapter can do)
ZoneScreen OS (wouldn't let me create a higher resolution)
Demoforge Mirage (um... didn't do anything. Maybe I didn't get how you're supposed to use it)
Answer: To force the raspberry pi to have a certain display. Go on boot folder cd /boot/
After that, open the config file with your editor (I use geany sudo apt-get install geany)
sudo geany config.txt

In this file, it should have two line that you have to uncomment it:
framebuffer_width=800
framebuffer_height=600

Just change the values of those variables and save the file.
You may have to reboot your raspberry pi
Comment: Sorry, the issue is I need to force the WINDOWS machine to output a higher resolution than it will permit me to.


Remove button when product out of stock Elementor PRO/Woocommerce

Question: I'd really appreciate some help if anyone knows the solution :)
I set up Product page template in Elementor Pro for Woocommerce product.
I added a custom button there "Reserve now" (class .reserve-button) which opens a stripe payment form.
I'd like to hide this button if the product is out of stock.
I've tried a dozen of different solutions and searched through lot of fourms, but Im really stuck :(
Here is one of them:
add_action( 'woocommerce_before_add_to_cart_button', function() {
global $product;
if ( !$product->is_in_stock() ) {?>
 <?php
}

});

Thank you in advance!
Answer: It seems every conditions you made properly but one thing that you missed is you added with a wrong action, because the woocommerce_before_add_to_cart_button action only fire when the button is enable, as you are checking with out of stock product and in that product there is no add to cart button, so your action is not fired ever. What you can do to add any other action like my code
add_action( 'woocommerce_single_product_summary', function() {
    global $product;
    if ( !$product->is_in_stock() ) {?>
         <?php
    }

});

Here I have added the style with the product summary action. You can choose any other action but not add to cart related any actions. Hope it will work for you. https://prnt.sc/5fGq-RFcaEFn .
Comment: thank you very very much for your response!
unfortunately, it sill doesnt work
the style doesnt end up on the product page for some reason
https://test.kilowattcars.com.au/product/nissan-leaf-aze3/ (reserve button should not be there)
Maybe it has something to do with the Elementor PRO plugin?


Microsoft XmlLite fails to detect end-of-element

Question: I'm using Microsoft's XmlLite DLL to parse a simple XML file, using the code in the example XmlLiteReader. The essential part of the code (C++) is
    while(S_OK == (hr = pReader->Read(&nodeType)))
    {
        switch(nodeType)
        {
        case XmlNodeType_Element:
            // Get name...
            WriteAttributes(pReader, es, attributes);
            break;
        case XmlNodeType_EndElement:
            // Process end-of-element...
            break;
    }

and
HRESULT WriteAttributes(IXmlReader* pReader, CString& es, StringStringMap& attributes)
{
    while(TRUE)
    {
        // Get and store an attribute...
        HRESULT hrMove = pReader->MoveToNextAttribute();
    }
    // ...
}

So, here's my question. With XML input such as
<?xml version="1.0" encoding="utf-8"?>
<settings version="1.2">
 <runID name="test" mode="N" take_data="Y">
  <cell id="01">
   <channel id="A" sample="something"/>
   <channel id="B" sample="something else"/>
  </cell>
  <cell id="03">
   <channel id="A" sample="other something"/>
   <channel id="B" sample="other something else"/>
  </cell>
 </runID>
</settings>

Everything works as expected, except that the /> at the end of each channel line, which indicates the end of the element channel, isn't recognized as the end of an element. The successive node types following channel are whitespace (\n), then element (the second channel).
How can I determine from XmlLite that element `channel' has ended? Or am I misunderstanding the XML syntax?
Answer: You can test if an element ends with /> by using the function IsElementEmpty.
Comment: Take care to observe the remarks in the MSDN documentation for IsElementEmpty. It needs to be invoked while the reader's current node is the element node, not any attribute nodes. From MSDN: ```You should save the value of IsEmptyElement before processing attributes, or call MoveToElement to make IsEmptyElement valid after processing attributes.```


Why is there a lawnmower in my kitchen?

Question: After meeting Max Yards in Bermuda Isles and winning the long drive competition, I was surprised to find a lawnmower in the middle of my kitchen when I woke up the next morning.
Interacting with the mower doesn't do anything special. It just makes a few random engine noises without any comment from the main character.
Why is there a lawnmower in my kitchen? Does it serve any purpose?
Comment: this is one of those unintentionally hilarious questions when you don't know the context
Answer: The lawnmower is a reward for getting a hole-in-one on the Bermuda Isles Aqua Golf range.
At the Aqua Golf driving range in Bermuda Isles, there is a small putting green surrounded by water about 160 yards out on a dock. Behind the green is a brick wall with a target you can bounce shots off of.

If you manage to sink your ball in the hole with a single shot, a man in the ticket booth will tell you to talk to him for a prize. As you could probably guess, the prize is a lawnmower shipped directly to your house.
The main character remarks that he doesn't know where he could even keep a lawnmower in his tiny house. Apparently he decided that kitchen was the best place.
As far as I can tell, the lawnmower serves absolutely no purpose other than taking up space in your house.

Why is there a lawnmower in my kitchen?


GNUMakefile and gcc: resolving the order of conflicting "-std=c++" requirements

Question: Many packages these days come with a configuration utility to help set compiler requirements. I can give more specific examples if required, but a Makefile that links against two libraries might have something like:
CPPFLAGS += $(shell PackageA-config --cflags)
CPPFLAGS += $(shell PackageB-config --cflags)

%.o : %.cc
    $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

Now let's say that PackageA requires at least c++11, and PackageB requires c++17, i.e. PackageA-config --cflags would yield -std=c++11 and PackageB-config --cflags would yield -std=c++17.  gcc will use whichever flag came last, and since all the standards are backwards compatible, this is fine and dandy.
But what if I write my Makefile in the "wrong" order, so that PackageB comes first? Now PackageA's -std=c++11 flag is the one that actually gets used, and compilation fails.
Is there a way to tell gcc to take the highest flag given, rather than just use the last one?  If not, is there a standard way to tackle this headache?  Failing everything else, can some guru come up with a fix by manipulating the Makefile variable?
Comment: The cheeky answer is just to stick in `CPPFLAGS += -stdc++17` at the end. Problem solved.
Comment: @Barry yes, except my particular use case is scientific grid computing where one usually builds against much older compilers. Even c++11 support is still not a given
Answer: There are a bunch of string functions that are pretty useful to know.
You can filter out the -std= flag:
filtered := $(filter -std=%,$(CPPFLAGS))

And then sort it in lexical order:
sorted := $(sort $(filtered))

And then just take the last one:
highest := $(lastword $(sorted))

Or, all in one go:
best_std_version := $(lastword $(sort $(filter -std=%,$(CPPFLAGS))))

This won't work if one of the standard versions is 98. It's like the Y2K bug all over again. But you can deal with that by filtering it out.
Comment: Or replace `98` with `03` which means the same thing and sorts correctly. To be really safe, you'd also want to replace `-ansi` with `-std=c++03`, and then punch whoever used the `-ansi` flag.


SplMinHeap and top

Question: I'm trying to extend PHP's SplMinHeap so I can limit the amount of items my heap can hold. The problem is, when I try to access the top element, which should be the min, it gives me the max value. The code I have so far is pretty simple:
class MyHeap extends SplMinHeap {
    public static $limit = 10;

    public function compare($value1, $value2) {
         return ($value1 - $value2);
    }

    public function myInsert($value) {
        if ( $this->count() < self::$limit ) {
            $this->insert($value);
        } else {
            var_dump($this->top());
        }
    }
};

When I insert the numbers 1 to 15 I would expect it to print 1 5 times, instead it prints 10. I also tried extending the insert method, using the same code as myInsert but replacing $this->insert with parent::insert. I just didn't know whether that would use my extended compare or the default one, that's why I switched it.
Strangely enough, if use a normal SplMinHeap and insert the same numbers I will get 1 when calling top().
Can anyone help me figure out what I'm doing wrong?
Comment: It seems that defining compare function defines the heap type. If you will create your own compare function - you will have your own heap type) Good luck.
Comment: @u_mulder which is probably a good reason for not doing so :)
Answer: The problem is the compare method.
Just change compare
public function compare($value1, $value2) {
     return ($value2 - $value1);
}

and you will get your SplMinHeap.
Also I think you should extend SplHeap class, not SplMinHeap.
Answer: I'm not sure what your compare method is meant to achieve, as it is doing exactly the same as the default compare method, but removing it resolves the problem. You have declared the compare method as public, which generate a warning as the method in the base class is protected.
Also you can override the insert method directly and everything will work fine:-
class MyHeap extends SplMinHeap {
    public static $limit = 10;

    public function insert($value) {
        if ($this->count() < self::$limit) {
            parent::insert($value);
        } else {
            var_dump($this->top());
        }
    }
};

SplMinHeap and top


Date Diff Function Assistance in Tableau

Question: I'm using Tableau Software to create a calculated field off of a database, which will be used to dynamically filter the data. Basically, if the date of birth is above 18 as of today, they should be filtered out.
I'm trying to get in a positive integer the difference between the date of birth of an individual (expressed in the database as [DOB]) and today in years. Once I return that date, I would like to evaluate whether it is above or below 18 years. I've been creating a date diff function, but I don't understand what I'm missing.
DATEDIFF('year',DATETRUNC('year',NOW()),DATETRUNC('year',[DOB]))

References:
http://onlinehelp.tableausoftware.com/v7.0/pro/online/en-us/functions_functions_date.html
Comment: Just to clarify, what is the actual problem you're having? Are you getting the right integer value but it's negative, or is the calculated field not working at all?
Answer: First of all, you need to modify your calculated field slightly so that it returns a positive integer instead of a negative one.
DATEDIFF('year',DATETRUNC('year',[DOB]),DATETRUNC('year',NOW()))

With that done, right-click in the Dimensions pane and create a new calculated field as follows:
IF [Age] < 18 then 1 else 0 END

Then drag this second calculated field on to the Filters shelf. When you do that, you'll get a pop-up window where you can select your filter values. Click the checkbox for "1", then OK and that should filter out everyone who is aged 18 or over.
Comment: This calculated field is not correct. It gives the wrong answer for people that are almost, but not yet, 18
Answer: The following calculated field returns true if and only if the person is 18 or more as of today
datediff('day', [DOB], dateadd('year', -18, today())) >= 0


Strange LINQ behavior - ToList returning empty set

Question: I cant understand why resultSet2 is empty!  Only the first assert passes!
List<Tree> resultSet1 = this.datacontext.Trees.Where(t=>t.RiskRating.Contains("bad")).ToList();

Assert.IsTrue(resultSet1.count() == 3);

List<Tree> resultSet2 = this.datacontext.Trees.ToList().Where(t=>t.RiskRating.Contains("bad")).ToList();

Assert.IsTrue(resultSet2.count() == 3);

Thanks!
Ashley
Answer: What does this.datacontext.Trees.ToList().Count() return?
Could it be something to do with your collation back at the database? The first example will convert the Contains("bad") method back to SQL, which might be case insensitive and return rows that contain "BAD" or "Bad". The second example wouldn't be case sensitive.
It'd be interesting to see what the values for RiskRating are back in the database, and what the SQL query getting executed looks like.
Comment: Ah you're right - it came down to case sensitivity!

Thanks Matt!
Comment: Do you know of anyway to to a case insensitive Contains on an ObjectQuery?


how to add single quotes to string in c#?

Question: I am adding mutliple values  to single string  , all the values should be like in this format '','' but I am getting "'',''" instead.
How can I remove these double qoutes? Here's the code I'm using:
string one = "\'"+ names[0, 0] +"\'"+","+"\'" + names[1, 0]+"\'";
string[] splitted = one.Split('\'');
string ones = "'" + splitted[1] + "'" +","+ "'" + splitted[3] + "'";

Comment: Maybe dumb question: are you sure the `"` are actually part of your string, and not just displayed in the debugger?
Comment: Have you tried using `string.Format` for building the strings? It could make your code a lot easier to read.
Comment: Are you sure the the `"` is not exist after the split ?
Comment: Your code works as is. Of course I assume the values in names doesn't contain a single quote. Right?
Comment: Rawling is right... If you are newbie for Visual Studio, might be u were trying to see the values during debugging. Don't worry your actual string won't contain double quotes ""
Comment: @Rawling ,In string its coming fine ,wen i debugging the javascript actually i am getting string like "'',''" but i need it like "''","''" .
Comment: @GAPS above values are recieving fine those vaues am sending to javascript it should only in single qoutes.but for me its reciving "'value1','value2'"
Comment: where is your `javascript` code then...@user1619151
Answer: You don't have to escape single quote like "\'" instead you can simply use "'", so you code should be:
string one = "'" + names[0, 0] + "'" + "," + "'" + names[1, 0] + "'";
string[] splitted = one.Split('\'');
string ones = "'" + splitted[1] + "'" + "," + "'" + splitted[3] + "'";

Comment: same thing even i have done ,in string it was coming fine actualley i am passing to javascript its automatically adding double quotes.
Comment: Why do single quote escapes even exist in C# if all strings are double quoted?
Answer: Not sure I fully understand, but there are two ways.
Output:  ".","."
var s1 = @"""."","".""";
var s2 = "\".\",\".\"";

Answer: The best way to encapsualte escape sequences and special characters within a string is the use of webatim character.
e.g.
String escSeq = "C:\\MyDocuments\\Movie";

can also be stored as:
string escSeq = @"C:\MyDocumens\Movie";

The @ character you must put before the string starts and outside the "" characters.
Answer: I just worked with your code..it works just fine..
Debugger will show: "'val1','val2'"
Actual Value  : 'val1','val2'
From the debugger point you will see "'val1','val2'" but actually it happens for every string values. but actually when you prints the value in a page you will see the actual value as 'val1','val2'
EDIT:
For sending those values to javascript what you can do is just set those values in Hidden fields and then fetch those value from that using document.getElementById('hidden_field').
Comment: $(document).ready(function () {
        var hiddenControl = '<%= inpHide.ClientID %>';
        var values = document.getElementById(hiddenControl).value;
        alert(values);
        var tweetUsers = [values];

        var buildString = "";
Comment: I am getting only for one value if i am giving multiple values its not working ,please give me some solution.
Comment: I am declaring string while debugging it as to come like "''","''" or else '','', but its coming like "'',''" , please check out my code  for (int i = 0; i < counts; i++)
                {

                    names[i, 0] = ds.Tables[0].Rows[i][3].ToString();

                }

                string one = "\'" +names[0, 0] + "\'" + "," + "\'" + names[1, 0] + "\'";
                string[] splitted = one.Split('\'');
                string onces = "'" + splitted[1] + "'" + "," + "'" + splitted[3] + "'";
                "string".Replace(@"\", "'");

                inpHide.Value = onces;
Comment: It still giving `"'val1','val2'"` in debugger but `'val1','val2'` in javascript...
Comment: @ Vishal Suthar Your right  if i keep alert box its showing only the values , but the thing is data is not recieving.its showing empty box.


Clear the Action items in Quickaction view android

Question: i am working with Quickaction in android.
i want to set the items of Quickaction dynamically but at the time of adding the items i want to remove the previews action items.
But there is no any property to remove or clear the Quickaction items.
please find -http://www.androidpatterns.com/wp-content/uploads/QuickActions.png
Quickaction like shows in image.
project - https://github.com/lorensiuswlt/NewQuickAction
for quickaction i am using above github project.
Please help me to out this mesh.
Thanks in advance.
Answer: Add this to QuickAction.java, then call resetActionItemList() when you want to recreate the list.
<code>/**
 * reset the action item list
 * added by G. M. on 5/14/2014
 *
 */
public void resetActionItemList() {
    actionItems.clear();

    mChildPos  = 0;
    mInsertPos = 0;

    if (mOrientation == HORIZONTAL) {
        setRootViewId(R.layout.popup_horizontal);
    } else {
        setRootViewId(R.layout.popup_vertical);
    }

    return;
}
</code>


Ubuntu GUI not logging in

Question: I'm using Ubuntu 14.04.1 LTS. It was working fine till yesterday, when I killed a process( user process - a perl script running a speech processing software ) running in the background as it took a lot of time to execute.
I restarted the system and I'm not able to log in through GUI anymore.
I tried the solutions posted here already through my terminal (Ctrl+Alt+F1) and changed .XAuthority and restarted lightdm. It does not fix my problem.
Also I tried changing my password and ran startx. When I ran startx, I waited for 9 hours and just got a blank GUI screen and I had to restart the system as there was not any progress.
How do I fix my problem ?
Comment: It would be very helpful to know which process you killed, please [edit] your question and add this information
Comment: I killed a perl script running a speech processing software
Answer: Someone or something has altered the permissions to your .Xauthority file. To get back the permissions to your user run the following command at TTY:
sudo chown $USER:$USER ~/.Xauthority
Now just try to login normally.

Ubuntu GUI not logging in


find match of string between variables

Question: I want to check if news_text variable contains the same string inside the text variable while looping. The string that news _text could have is :
"Yemen minister says Saleh trying to spoil transition http://t.co/aXOQPMzf"
and the string for the text variable is this
"RT @Reuters: Yemen minister says Saleh trying to spoil transition http://t.co/aXOQPMzf"
      for (var i = 0; i < full_array.length; i++) {
          var user = full_array[i].user;
          var date = full_array[i].date;
          var profile_img = full_array[i].profile_img;
          var text = full_array[i].text;
          var news_user = full_array[i].news_user;
          var news_date = full_array[i].news_date;
          var news_profile_img = full_array[i].news_profile_img;
          var news_text = full_array[i].news_text;

          if(text==news_text){
              geocode (user,date,profile_img,text,news_user,news_date,news_profile_img,news_text);
          }
    }

anyone that could help?
Comment: please search the Web/SO before asking: exact duplicate of [JavaScript: string contains](http://stackoverflow.com/questions/1789945/javascript-string-contains) :-)
Comment: I disagree - it needs something stronger that 'string contains'. It really needs a fuzzy striung match algorith. See my answer below.
Comment: Sorry i havent explained correctly. i want to get the first 10 characters from variable news_text and check if its inside the text variable
Comment: @PeterSmith: I don't think the OP asked for a fuzzy search - he might want a search that also finds substring matches, but nothing fuzzy and his example is a whole-string-search.
Answer: Given the complexity of fuzzy string matches I suggest that you look at sites like this
from Google - Yeti Witch. Google search for Soundex and JavaScript has other examples.
Good luck.
Comment: try to use if(news_text.indexOf(text)>0){ // Text exists}
Comment: you know why it gives me undefined for news_text. i checked the console, all the variables have strings inside of them.
Answer: just use
if (text.indexOf(news_text) > -1) // text contains news_text
    geocode(…);

Edit: if you only need to search for the first 10 chars of news_text, use
if (text.indexOf(news_text.substr(0, 10)) > -1) // text contains news_text
    geocode(…);

Comment: yeah but why does it give me text is undefined?
Comment: maybe because `text` *is* undefined? Your `text` variable needs to be a string (which was not enforced by your current code)
Comment: I run typeof over all text variables and it said undefined though all text variables have string inside of them.
Comment: No, obviously they don't. If your `fullarray` is the `newsarray` concatenated with the `usertweets` from [this question](http://stackoverflow.com/questions/12446776/how-to-request-twitter-api-without-entering-a-recursion), some of the objects have a `text` property but no `news_text`, the others have a `news_text` property but no `text`.
Comment: so its better not to concatenate the two arrays into one and do the checking between the two??
Comment: It seems like. Please, describe what you *want* not how you think it should work when asking any questions…
Comment: Can you check this fiddle and tell me why is not returning the user_tweets ?? http://jsfiddle.net/SLEd9/1/
Comment: Which two arrays? What is your goal in comparing them?
Comment: @fiddle: you can only return one value in a `return` statement, you are actually using the [comma operator](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Comma_Operator) in here
Comment: the two arrays are user_tweets and news_array. i want to place each news tweet(from news arrays) into a div along with users who posted for the same news on that news tweet.
Comment: So, actually you don't need to compare the whole `usertweets` with a news message, but only the result of the current search?
Comment: no i want to compare all the objects from user tweets so that i show all the posts related to that news tweet from the array news_array
Comment: so how can i return both arrays??
Comment: pack them into an object or array?
Comment: No idea where you got that `array=newstweets()` from - it's a callback! http://jsfiddle.net/SLEd9/8/
Comment: can you tell me what am doing wrong here?Am trying to get elements of the two arrays with the same urls. http://jsfiddle.net/SLEd9/10/
Comment: ok can you check this one i updated http://jsfiddle.net/SLEd9/12/ .thanks @Bergi !!!!

find match of string between variables


Help me with my Steam Downloads

Question: I want to play Ark, I bought it and want to download it. But. Garry's Mod is doing a download. But the Garry's Mod download will not start at all. If I press resume, it will say it's doing it but not doing anything at all. Is there a way to switch my Ark download from the Steam? So I can have Ark downloading instead of the stupid broken Garry's mod one. Without deleting any of my game data?
Answer: You can re-arrange queue of download, and cancel the update/download of Gmod. You can do this by right-clicking on any game that is downloading, then clicking Manage Downloads. An alternative way of accessing Download manager is clicking the Downloading sign on the bottom of the Library section.

You will see Gmod downloading on the top. Click the pause button. Then click the up-arrow on Ark below to initiate downloading.

If I wanted to pause Starbound, and update Unturned, I would click pause on top-right and then the up-arrow on unturned to start the download.
Comment: Actually, just clicking the up arrow should change the order.
Comment: @Powerlord I see. It does say **Download Now** on arrow hover

Help me with my Steam Downloads


Radon remediation in a part-time home

Question: We have a second home that we use approximately 1 week/month year-round, and more in the summer.   When we purchased the home in 2019, it was tested at 9pCi/L, and a remediation system was installed before closing, with subsequent testing at 1.4pCi/L.
I'm wondering if there's a point to running the system full-time, when we are only there part time (and especially now when our normal schedule isn't likely to happen for an extra month or two).  When we are not there, this system is the major energy consumer in the house, at approximately 2.5-3 kWh/day.   I have the ability to programmatically turn the system off and on, and I'm thinking I could either run it part-time (say 6h/day) or not at all, turning it on full-time several days or even a week before our anticipated arrival.   Given that the un-remediated readings were modest, it seems the risk doing this should be low.

Will having the system on, then off possibly create higher levels than previously existed (for example, because the continuous suction
has created new pathways for it)?
Would running the system on a daily cycle be more effective by sweeping whatever is seeping out of the group up more regularly?
Comment: It is most likely that running the system for as little as 8 hours will flush the basement  volume.   A remote-turn-on system is classiest, for sure,  but  even if you don't turn it on until you get there the sum exposure to you is small.  Radon mediation is aimed at keeping it safe for 24/7/365 living, not short vacations.
Comment: Have you actually put a Kill-a-Watt on the radon system and measured its draw?  Or did you infer that number in a "what else could it be" fashion? Because you could run 3-4 refrigerators on that draw.
Comment: @Harper-ReinstateMonica It was measured with a Z-Wave power reporting switch module.
Answer: Edited; I have only read testing reports and wired abatement pumps. I modified my answer based on the feedback. As I have said in other posts granite especially pink or rose can be a significant source of radon.
I would not run the system while you are away, I probably would open the house lower level windows or vents when you arrive. You may even want to set up a automated system that you can remotely turn on the abatement system the day prior to your arrival.  Exterior vents at the lowest level with make up air for a while would purge the home of this gas and purging and having the system running prior to arrival might work fine but test to verify if the numbers are low this can save $$$!
Comment: A counter top won't put out meaningful amounts of radon. Or rather - if it does, radon is the *least* of your worries. Radon is a problem because your house sits on top of thousand of tons of rock, not because half a ton of it.
Comment: Radon is about 7 times HEAVIER than air.  So it SINKS rather than rises.  Your advice is dangerous since opening the upper level windows will do nothing to relieve any radon trapped in the lower part of the house.  Radon abatement systems do NOT remove radon from the home but rather prevent it from getting in by removing it from the area under and around the foundation where it can infiltrate into the living space.  Left undisturbed, radon settles to the LOWEST part of the structure.
Comment: All the testing I have had done has shown up in upper levels, if radon was heavier than air how is it raising up and getting into homes with crawl spaces? The discharge is required to be above the home also I have wired several systems but not the installer of the plumbing. If it is heavier then the lower area vents would be the correct.
Comment: It's easily raised to upper levels because of air currents and such but it will be concentrated in places like basements.  Radon gas has a density of 9.73 kg/m3, which is VERY heavy where "air" has a density of about 1.225 kg/m3.  Anyway read about it here: https://www.epa.gov/indoor-air-quality-iaq/why-must-radon-be-vented-air-above-my-homes-roof-0
Comment: @jhw20 I did have additional testing in the original answer And have modified the answer, I find it strange the high concentrations on the 2 houses were on the middle and upper floors but the radon source on the middle floor house ended up being the granite counter tops.
Comment: @Vidarlo You are absolutely wrong here. After the counter tops were removed the count went from ~ 5.5 to zero !  I have seen this 2 times I did not know of it previously and have commented on in this forum several years back!
Comment: How was the radon content measured? Or did you just measure general radioactive decay close by the counter tops? Typical uranium content in rocks is <100ppm...
Comment: It just depends on the specific rocks that the countertops were made of.  Some rocks contain significantly more Uranium than others which is what generates Radon.
Comment: The measurements were on each floor by an inspection company the owners hired me to wire the abatement system the first time I was there the beautiful rose granite covered a large counter top and island, I was later called to remove the electrical Tombstones in the island as it was being removed the abatement system was disabled and the test came back at zero. This was my first experience , after that another but the levels were lower and the new owners had the abatement system and left the counter tops. All I know is that testing company tests for radon with large granite and rose has problem
Comment: @EdBeal I'm inclined to guess a false reading from radioactivity in the stone. For it to produce any significant amount of radon, it'd have to be rather active itself. Radon has a halflife of days; the uranium and radium have halflifes in thousands and tens of thousands of years. Thus, for there to be a significant amount of radon, there has to be a very significant amount of uranium or radium.
Comment: I know it is unusual in my area and both the homes that had above the accepted limits had pink or rose granite I did look it up and it is a cause and some quarries are worse than others.
Comment: @EdBeal It's still **really** improbable. Uranium, which has half life in tens of thousands of years decays to radium, which has half life in thousands of years, which decays into radon, which has half life in days. Each radon atom comes from a decay. For there to be a significant amount of short-lived radon, there has to be a **shitload** of long-lived uranium and radium, which will give off it's own radiation. A few hundred kilos will not do that. Look up [decay chains](https://en.wikipedia.org/wiki/Decay_chain#Uranium_series) for more information.
Comment: I provided the facts. This is not a discussion you have the right to down vote I disagree when I found an error in my answer it was corrected.
Comment: The problems is that the facts are probably not what you believe. I choose to point that out, so that errors are not left on the site. If you want me to elaborate my reasoning further, I'm happy to do so in [chat]. Please don't take this as an personal attack; it ain't.

Radon remediation in a part-time home


How to change SDE into a form such that I can apply Euler-Maruyama or Runge Kutta?

Question: How to get the following differential equation
$\dfrac{d^2q(t)}{dt^2} + (\Gamma_0 - \Omega_0 \eta q(t)^2)\dfrac{dq(t)}{dt} + \Omega_0^2 q(t) - \sqrt{\dfrac{2\Gamma_0 k_B T_0}{m}} \dfrac{dW(t)}{dt} = 0$
Where $W(t)$ is the Wiener function and $\Gamma_0, \Omega_0, m, k_B, T_0, \eta$ are constant with respect to time.
into the the form:
$dq(t)=a(q(t))\,{d}t+b(q(t))\,{d}W(t)$
such that I can apply Euler-Maruyama or Runge Kutta to solve this SDE using a computer to get the values of q(t) over time?
Answer: Do what is always done to reduce to a system of first order. Set $p=\dot q$ then
\begin{align}
dq&=p\,dt\\
dp&=-(Γ_0−Ω_0ηq(t)^2)p \,dt - Ω^2_0q(t)\,dt+\sqrt{\frac{2Γ_0k_BT_0}m}\,dW
\end{align}
You might also try to apply the Milstein method that has half an order more in the convergence rate.
A derivative-free 2-stage Runge-Kutta variant of Milsteins method is documented in wikipedia resp. the original research in arxiv.org


How to manually setup gulp task timeout to run more than 1 hour task?

Question: I want to run a gulp task that will last more than 1 hour (probably 6 hours or more).
At the moment, after one hour, I receive this message:
<code>[00:32:53] 'my-long-running-task' errored after 1 h
[00:32:53] Error: Timeout
...
at module.exports (C:\myproject\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\myproject\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\myproject\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\myproject\node_modules\orchestrator\index.js:134:8)
at C:\Users\user1\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js:72:20
at _combinedTickCallback (internal/process/next_tick.js:67:7)
</code>
The task is not totally killed (the launched process continues to run) but the other steps of task are not executed.
Do you know how can I raise this one hour timeout? Or totally remove it?
Comment: How about showing some gulp task code. otherwise WAG in config `options.timeout: 99999999999999`
Answer: I found the solution:
In gulp I am using sync-exec and it has a maxWait parameters.
<code>'use strict';

const gulp = require('gulp');
const exec = require('sync-exec');

gulp.task('my-task', () => {
  let maxWaitValue = 24 * 60 * 60 * 1000;
  exec(`my task which takes very long`, maxWaitValue, config.execSyncOptions);
});
</code>


Invalid Date display on google calendar

Question: I am creating events on google calendar using PHP.
Event is created successfully but it displays wrong time on calendar.
<code>$start = '2016-08-04T13:30:00.000+02:00';
$end = '2016-08-04T18:00:00.000+02:00'
$timezone= 'Europe/Zurich';

$service = new Google_Service_Calendar($client);
        $event = new Google_Service_Calendar_Event(array(
            'summary' => $eventname,
            'location' => $address,
            'description' => $description,
            'start' => array(
              'dateTime' => $start,
              'timeZone' => $timezone,
            ),
            'end' => array(
              'dateTime' => $end,
              'timeZone' => $timezone,
            ),
            'attendees' => array(
              array('email' => $contactemail),
            ),
            'reminders' => array(
              'useDefault' => FALSE,
              'overrides' => array(
                array('method' => 'email', 'minutes' => 24 * 60),
                array('method' => 'popup', 'minutes' => 10),
              ),
            ),
          ));

        $event = $service->events->insert($calid, $event);
</code>
Using this code the event is created successfully.
When i check the event on calender it shows wrong time.
See this url for it. http://awesomescreenshot.com/00b62fl6ed
And when i click on edit event then check the
Startdate and enddate is correct with time.
See this url for it. http://awesomescreenshot.com/0df62fkn00
but the issue is that it shown incorrect on calendar.
Please check my code and tell me what is wrong there.
Comment: Well as this code would not compile you are obviously not using this code. So what would be the point of us checking code you are not using for errors in code you are using
Comment: You check your code and find what is wrong! SO is **not a free Debugging service**
Comment: Looks just a timezone issue in your main calendar display. Are you using the same timezone? (Zurich +02)
Comment: @RiggsFolly:- i checked many times. but i did not find any issue.
Comment: Maybe you can try to check this [SO question](http://stackoverflow.com/questions/25257753/google-calendar-event-invalid-date-time-format-0001-12-28t234036-030628) and also check the suggestion.
Answer: You have the typo in your code. In the second row is missing semicolon at the end.
<code>$end = '2016-08-04T18:00:00.000+02:00';
</code>
However I think, that this error will be in google calendar setup . Try to look to google calendar setup on timezone if is in harmony of your timezone.
Comment: :- still same issue
Comment: In that case it's difficult to advise remotely. Try and check.
Answer: Working solution taken from http://php.net/manual/en/function.date.php
<code><?php

/**
 * Get date in RFC3339
 * For example used in XML/Atom
 *
 * @param integer $timestamp
 * @return string date in RFC3339
 * @author Boris Korobkov
 */
function date3339($timestamp=0) {

    if (!$timestamp) {
        $timestamp = time();
    }
    $date = date('Y-m-d\TH:i:s', $timestamp);

    $matches = array();
    if (preg_match('/^([\-+])(\d{2})(\d{2})$/', date('O', $timestamp), $matches)) {
        $date .= $matches[1].$matches[2].':'.$matches[3];
    } else {
        $date .= 'Z';
    }
    return $date;
}

?>
</code>

Background: From
  http://www.ibm.com/developerworks/opensource/library/os-php-xpath/ I
  saw "The published and updated elements use the RFC 3339 time-stamp
  format. "
And figured I ought google "rfc3339 PHP" to find a function that
  implements this format
Comment: :- still same issue

Invalid Date display on google calendar