Why do screw thread diameters vary from their nominal values?

Question: I'm trying to identify several screws. Guides online are fairly straightforward - measure the diameter of the thread part, and pitch if possible. However, none of my screw measurements make any sense. I've ruled out my caliper as the cause.
Here's some of my measurements (Suspected screw: Expected -> Actual):

Known M2.5: 2.5mm -> 2.43 mm
M3: 3mm -> 3.38 mm, 0.5mm pitch
M4: 4mm -> 3.88 mm
Known 5/16": 0.3125" -> 0.305", 18 threads/inch

My measurements seem to be off my 2% to 10%. Am I missing something? Is my M3 screw actually M3.5 or M4? I can't find, say, 3.38mm on any screw charts (example)
Comment: Could you provide the threads per inch or cm that may provide us with a SAE corse or fine pitch screw.
Comment: ***Weird size screws*** in metric are probably normal size screws in Inch/number.
Comment: @EdBeal The 5/16" has 18 threads/inch as measured. The suspected M3 screw has a pitch of 0.5mm.
Comment: What problem are you trying to solve? This isn't the type of question we handle here. It's speculative at best.
Comment: @isherwood I'm trying to identify screws for a DIY project, yet none of my measurements match charts online
Comment: Well I have some 5/16-24 that are used with electrical equipment. Did you know there are different thread pitches for metric? Having been a maintenance type of person for many years I can tell you machine screws do not vary or they will not fit but there are different pitches in both metric and "English".
Comment: @EdBeal Good point. Yes, I'm aware. I'm designing in Fusion 360, and thread pitch is required. I've measured them as best as I can.
Comment: @EdBeal fine pitch metric screws are rare, and are *probably* a red herring here
Comment: @chris h, I work in a lumber mill and our equipment uses them when I worked at HP we also used them so I would not say rare in industry where metric equipment is used I find them commonly so much so that I have a pitch gauge exactly like monkey posted and plastic screw size templates like ecrnewal mentions.
Comment: @EdBeal, sure, I've seen them in work (optics lab) where you also get extra fine (M3x0.25) and ridiculously (not an official name) fine (M3x0.2), as well as things like 1/4-80. But for adjustment, not for general fastenings. For a DIY design, or even in work when not absolutely needed, they're best left in the box of odd screws and something normal used (for me, M4x0.7 or M6x1 by default)
Answer: Metric screw diameters are always below nominal.
The nominal size is as if the thread came to a sharp point, and it doesn't.  For the exact amount see Wikipedia, from where I lifted this drawing (thanks to user Inductiveload).

Note the P/8 (i.e pitch/8) flat on the outside (top) of the external thread.  This means the outside diameter (roughly doing the trigonometry) is about 0.2×pitch less than nominal.  Taking your M4, with  a pitch of 0.7, you'd expect an OD of 4-0.2*0.7=3.86, an almost perfect match to your 3.88.  Similarly for you M2.5.
So your 3.38mm OD screw isn't M3.  The diameter is good for M3.5, but that has a 0.6mm pitch.  I don't know how you measured the pitch, but that's a fairly easy error.  Without a thread gauge I'd measure the length of 10 (or more) turns, and divide to get the pitch.
M3.5 is rare, but common in British and some European electrical hardware, usually slotted (e.g. it holds our sockets and light switches to the back boxes).  I have seen socket head M3.5 on a metric version of an American product, where a UK engineer would have used M4
Answer: It stands to reason that most threads will measure slightly below nominal. That's much less of a compatibility problem than if they're too large. It's probably due to threads being cut or cast using tooling for the actual shank diameter, where slightly too much material is removed either intentionally or due to manufacturing tolerances.
To that point, I'd be willing to bet that your M3 is actually an M3.5. It being so would put it in line with the negative variance of all your other examples.
Answer: For machine screws:
You can either purchase a screw identifying plate (with labeled threaded and sometimes clearance holes), or you can purchase known nuts that you keep track of and thread "suspect" screws into them. There are also dedicated thread pitch gauges which are far more accurate than trying to "eyeball count" threads against a ruler.
Aside from your caliper appearing to read a bit on the small side, the most likely cause of confusion is trying to force a metric fastener to be "english" or an "english" fastener to be Metric. This leads to misreading your measurements slightly to fit the bias (and that can be where a thread gauge that simply won't allow you to fake it can help get you on track.)
Depending how deep in the rabbit hole you go, there's also the "Actual 'English' issue" of getting into Whitworth threads rather than SAE "inch & Number" threads. They are a different thread shape, more an issue with antiques than current production now.
Comment: Whitworth screws have one common use: camera tripods are 1/4-20 Whitworth (3/8-16 Whitworth is also used to attach heads to tripods).  These are semi-compatible with the much more common 1/4-20 UNC for light duty.
Comment: Seriously, @ChrisH? I had absolutely no idea...
Comment: @FreeMan I use both, as 1/4-20 UNC is used on non-metric optics lab kit, but sometimes I want to integrate cameras. If you're gentle it's fine, but the thread on the bottom of a camera isn't always very strong or deep. I'm not convinced all cameras follow the standard, but good ones do
Answer: Quite frankly, you need a thread gauge:

https://www.amazon.com/ChgImposs-Imperial-Whitworth-Industrial-Measurement/dp/B07J9V9JTK/


Specify point release on d-i preseeding

Question: Can I specify point release, say, "12.04.3" instead of "precise" in preseed.cfg for kickstart installation?
When I specify precise in d-i mirror/suite like
<code>d-i mirror/suite precise
</code>
it will install "12.04.4" which I'm not willing to.
Comment: Can you tell why don't you want 12.04.4?
Comment: Thank you for the comment. I need it to build completely same environment as a customer has, inside closed network. I will use it to reproduce the procedure and problems the customer faced. The application is outside of Ubuntu but there are some packages dependencies. I found building 12.04.3 is quicker way rather than downgrading, surveying dependency, and so on.
Answer: Sorry, that is not possible.
The preseed file will always pick up the current version so this will always be the latest point release.
Comment: Thank you very much for your comment. I searched for the way but came to the same answer. I will build a 12.04.3 local repository to achieve my purpose. Thank you again.

Specify point release on d-i preseeding


How to have `e2fsck` use `-E discard` by default?

Question: I want to run e2fsck with the arguments -E discard by default, eg when I create a /forcefsck or if the machine wasn't shutdown cleanly.
(I'm trying to stop my VMware guest's *.vmdk files growing constantly)
How do I give default options to e2fsck?
Answer: Not sure if this is what you are asking about, but you can always use an alias...
alias e2fsck='e2fsck -E discard'

Comment: This won't work in the `touch /forcefsck` or dirty filesystem at boot time case.


Compare data in df1 and df2 columns based on third df3 and get data for matched row data from df2 last column

Question: I have 3 dataframes in
df1

srno
col1
col2
col3
col4

1
a1
a2
a3

2
b1
c2
c3

3
d1
b2

4
e1
e2
e3

df2

srno
col1
col2
col3
col4

1
a1

g1

2

b2

g2

3

c2
c3
g3

df3

priority
col_combination

1
col1

2
col2,col3

I am looking for below output
df1

srno
col1
col2
col3
col4

1
a1
a2
a3
g1

2
b1
c2
c3
g3

3
d1
b2

g2

4
e1
e2
e3

I have tried multiple ways but not able to achieve this, I am new to Python coding, any way to achieve this?
Below code I tried it does match and return found/not found but could not yet able to assign df1[col4] = df2[col4] for matching rows.
for i in df3.index:
    if "," in df3.loc[i,"col_combination"]:
        print("multi column values to handle later")
    else:
        df1['col4'] = np.where(df1[df3.loc[i, "col_combination"]].isin(df2[df3.loc[i, "col_combination"]]),'found','not found')

Comment: Hi Mulak, welcome to SO! Could you please provide an example of the code that you have tried so far?
Comment: Do you want 'g3' or 'g2' in 4th column, 2nd row, in your expected output?
Comment: Thanks Papadopoulos for looking into this, I want to update df1[col4] with matching values from df2[col4] by matching df1 columns with df2 based on priority sequence in df3 and column combination in df3[col_combination]
Comment: Thanks @GezaKerecsenyi for looking into this, as I mentioned I tried multiple ways but could not achieve success, below code worked for me to do upto match but not yet able to assign values to df1[col4]. Updated code in post
Answer: del df1['col4']

# read every condition in df3
# and merge related df2 columns to df1
# with the condition column

for i, row in df3.iterrows():
    priority = row['priority']
    col_list = row['col_combination'].split(',')
    df1 = pd.merge(df1, df2[col_list + ['col4']], on=col_list, how='left')
    # rename every merge df1's new col4 to priority no.
    df1.rename(columns={'col4':priority}, inplace=True)

print(df1)

#    srno col1 col2 col3    1    2
# 0     1   a1   a2   a3   g1  NaN
# 1     2   b1   c2   c3  NaN   g3
# 2     3   d1   b2  NaN  NaN   g2
# 3     4   e1   e2   e3  NaN  NaN

priority_list = df3['priority'].tolist()
obj = df1[priority_list[0]]
# use combine_first to merge priority(columns) 1, 2
for priority in priority_list[1:]:
    obj = obj.combine_first(df1[priority])

# re-assign
df1['col4'] = obj

print(df1)

#    srno col1 col2 col3    1    2 col4
# 0     1   a1   a2   a3   g1  NaN   g1
# 1     2   b1   c2   c3  NaN   g3   g3
# 2     3   d1   b2  NaN  NaN   g2   g2
# 3     4   e1   e2   e3  NaN  NaN  NaN

# finally del priority columns
df1.drop(priority_list, axis=1, inplace=True)


Convert the program interface to another language interface VB.NET

Question: What is wrong with the code to convert the program interface to another language interface? In Visual Basic .NET (Visual Studio 2019)
<code>Imports System.Globalization
Imports System.ComponentModel

Public Class Form1
    Private Sub ArButton_Click(sender As Object, e As EventArgs) Handles ArButton.Click
        Languages.changelanguge("ar")
    End Sub
    Private Sub EnButton_Click(sender As Object, e As EventArgs) Handles EnButton.Click
        Languages.changelanguge("en")
    End Sub
End Class

Public Module Languages
    Public Sub changelanguge(ByVal languge As String)
        For Each obj As Control In Form1.Controls
            Dim lang As ComponentResourceManager = New ComponentResourceManager(GetType(Form1))
            lang.ApplyResources(obj, obj.Name, New CultureInfo(languge))
        Next
    End Sub
End Module
</code>
Answer: What is happening when you run the code? I was implementing this recently and the below link assisted a lot.
https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo?view=netframework-4.8
Comment: I was use NET Framework 2 so code not work . now i change it to NET Framework 4.7.2 & code perfect now , thanks


How to set the environmental variables in ubuntu to install lua?

Question: Great day guys,I am trying to install the Lua on ubuntu.Inorder to set the environmental variables for Lua how can i procede?Thanks in advance
Comment: did you follow any link?
Comment: ya i followed this book,but not mentioned clearly http://www.amazon.com/Beginning-Lua-Programming-Kurt-Jung/dp/0470069171
Comment: post the lines mentioned on that book about setting up environmental variable for lua.
Answer: Move on to your home directory and then edit the .profile file.
Edit your .profile file with a command like gedit ~/.profile.
Append the following to the end of the file:
**export LUA_DIR=/usr/local/lib/lua/5.1**

To apply the right changes you can source .profile.


Error in SAP BI when trying to send report to destination

Question: When I select a report and try to send it to a destination I get this HTTPS error but cant find more info as to why I am getting that.

HTTP Status 500 – Internal Server Error
Type Status Report
Message javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.el.PropertyNotFoundException: Error getting property 'dsGridContainer' from bean of type com.businessobjects.clientaction.shared.sendto.SendToDestinationBean
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Apache Tomcat/8.5.13

Anyone had such or can point me in the right direction ?
Comment: If it's a bug from SAP software and not your own program, this question is not relevant for stack overflow. Prefer searching and asking in SAP forum or SAP support. Or in [super user](https://superuser.com).
Answer: It is saying that a setter(void) or getter(return type of its global variable of the same name and the variable it "returns") method with the name "dsGridContainer" in a bean class that is in a shared library application .jar file that has been loaded has an error when called.
*note a setter and getter (and also an "is" boolean method) have an associate global variable of the same name as the methods.
You may be able to get a better comprehensive error output in the server error.log file.


Java tree nodes from enum values

Question: I populate my JTree with nodes from enum values. But the nodes display in all uppercase text. This is undesirable as I would like the nodes to display in lower case.
example:
public enum DaysOfTheWeek {

    MONDAY("Monday", "MON", "First day of the work week."),
    //etc ...

    private final String fullName;
    private final String abbrvName;
    private final String description;

    DaysOfTheWeek(String fullName, String abbrvName, String description) {
        this.fullName = fullName;
        //etc ...
    }

    public String getFullName() {
        return fullName;
    }
}

I have tried:
List<DefaultMutableTreeNode> daysOfWeekNodes = new ArrayList<>();

for(DaysOfTheWeek dotw : DaysOfTheWeek.values()) {

        daysOfWeekNodes.add(new DefaultMutableTreeNode(dotw.getFullName()));
        daysOfWeekNodes.get(dotw.ordinal()).setUserObject(dotw);
}

The node displays as: MONDAY
But I want it to display as: Monday
text based graphic example:
Days
    |
    ---Monday
    |
    ---Tuesday

not
Days
    |
    ---MONDAY
    |
    ---TUESDAY

How do I get my tree node associated with the enum value, but its text on the tree to use the full name String? Or in other words, how to set a tree node user object but have its name different?
*note - an easy fix is to go against convention and name my values how I want them displayed in the tree, not all uppercase.
Comment: This code looks good. The problem is probably at the point of display, not at the point of tree creation. Can you post the display code?
Comment: Don't really have any display code. I just add the tree to my panel after it is created.
Answer: You need to use a TreeCellRenderer.
Here is one way to implement this:
import java.awt.Component;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;

public class TestTree {

    public enum DaysOfTheWeek {

        MONDAY("Monday", "MON", "First day of the work week."), TUESDAY("Tuesday", "TUE", "Second day of the work week");
        // etc ...

        private final String fullName;
        private final String abbrvName;
        private final String description;

        private DaysOfTheWeek(String fullName, String abbrvName, String description) {
            this.fullName = fullName;
            this.abbrvName = abbrvName;
            this.description = description;
        }

        public String getFullName() {
            return fullName;
        }

        public String getAbbrvName() {
            return abbrvName;
        }

        public String getDescription() {
            return description;
        }
    }

    public class MyTreeCellRenderer extends DefaultTreeCellRenderer {

        @Override
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row,
                boolean hasFocus) {
            Component cell = super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
            if (value instanceof DefaultMutableTreeNode && ((DefaultMutableTreeNode) value).getUserObject() instanceof DaysOfTheWeek) {
                ((JLabel) cell).setText(((DaysOfTheWeek) ((DefaultMutableTreeNode) value).getUserObject()).getFullName());
            }
            return cell;
        }
    }

    private JFrame f;
    private JTree tree;

    protected void initUI() {
        DefaultMutableTreeNode root = new DefaultMutableTreeNode("Days");
        for (DaysOfTheWeek dotw : DaysOfTheWeek.values()) {
            root.add(new DefaultMutableTreeNode(dotw));
        }
        final DefaultTreeModel model = new DefaultTreeModel(root);
        tree = new JTree(model);
        tree.setRootVisible(true);
        tree.setShowsRootHandles(true);
        ToolTipManager.sharedInstance().registerComponent(tree);
        tree.setCellRenderer(new MyTreeCellRenderer());
        f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setLocationRelativeTo(null);
        f.add(new JScrollPane(tree));
        f.pack();
        f.setVisible(true);
    }

    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                new TestTree().initUI();
            }
        });
    }

}

Take a look at the JTree tutorial.
Comment: @JavaPVT The clean and correct way to do what you want is to use a `TreeCellRenderer`, no doubt about that. I would really not recommend to change the name you gave to your enum constants. I would not recommend to override `toString()` either. People always start by saying, it was just to do a very small thing, quick & dirty, but eventually this gets into something bigger and bigger and you see odd bugs appear.
Comment: Wow, I was not expecting to have to craft a custom tree cell renderer in order to change the tree node text.
Comment: @JavaPVT you could also directly set the FullName of the days of the week as the user object of the DefaultMutableTreeNode but then you only manipulate `String` which is not really recommended.
Comment: I guess the really easy way would be to go against convention and just name my enum values not in uppercase.
Comment: @JavaPVT Not recommended: your UI should not depend on the way you coded. Actually, there is a simpler way but it is not recommended either. You could override the `toString()` method of your `enum` and return the "fullName". But `toString()` is only meant for developers, not for display.
Comment: VERY interesting ... but not sure if I should do it :)
Answer: Make a change here:
  List<DefaultMutableTreeNode> daysOfWeekNodes = new ArrayList<DefaultMutableTreeNode>();

Then try this:
  titleLabel.setText(node.getFullName());

Comment: Unfortunately, it doesn't seem the node will type cast to my enum object.
Comment: Actually, just realized, the label is not the problem. I want to the node text to display "Monday" not "MONDAY" which is how the enum value is typed in the class.

Java tree nodes from enum values


mold problem in basement

Question: I had some insulation put on half my basement wall.  Since then I have been having a problem with mold.I know my basement walls leak. Could wet insulation cause mold? If so is it bad mold. Alls I know is I have white stuff growing everywhere in basement., and there are no visible leaks.
Comment: do you have pictures?
Comment: if you know your walls leak, don't finish the basement.
Answer: White fuzz on the walls of the basement may be harmless mineral deposits called efflorescence from slow water movement, not mold.
Answer: Nothing but rigid foam or spray foam should be put directly on basement walls.  If you reading the Building Science documentation on basement environments you will see that if moisture is introduced on the walls there needs to be a proper gap for the water to drop and evaporate.  Without airflow the water isn't going anywhere and to make matters worse the area is slightly warmer than the surrounding are because it is insulated.
Answer: Moisture provides an environment where many molds thrive. Insulation reduces air flow along the wall surface, reducing the the ability of moisture to be dissipated by evaporation. Additionally, many molds thrive in moist, warm environments. Evaporation creates a cooling effect. When evaporation is restricted, the surface temperature is warmer, and the insulation helps keep it that way.
Wet insulation does not directly cause mold, unless it was contaminated with spores. It does create an environment that is conducive to mold growth.

mold problem in basement


Moving diagonally in 2d canvas JavaScript game

Question: I've scoured the web for this answer.  If it is buried in a StackOverflow answer somewhere I apologize.
I am working on a 2d canvas JavaScript game.
I am handling arrow key input with onkeydown and onkeyup events.
I store this input in an object called Keys.
var Keys = {
    up: false,
    down: false,
    left: false,
    right: false
};

This is what my event handlers look like:
window.onkeydown = function(e){
     var kc = e.keyCode;
     e.preventDefault();

     if(kc === 37) Keys.left = true;
     else if(kc === 38) Keys.up = true;
     else if(kc === 39) Keys.right = true;
     else if(kc === 40) Keys.down = true;

     move();
 };

window.onkeyup = function(e){
     var kc = e.keyCode;
     e.preventDefault();

     if(kc === 37) Keys.left = false;
     else if(kc === 38) Keys.up = false;
     else if(kc === 39) Keys.right = false;
     else if(kc === 40) Keys.down = false;
};

Then each time the keydown event occurs, I call my move() function:
var move = function(){

    if(Keys.up){
        hero.y -= 10;
    }

    else if(Keys.down){
        hero.y += 10;
    }

    if(Keys.left){
        hero.x -= 10;
    }

    else if(Keys.right){
        hero.x += 10;
    }

    main();
}

The move() function calls my main() function which just draws the map again.
I'm trying to avoid looping the game, and instead update the map each time the player moves.
So my problem arises when I try to move diagonally.  I am able to do it, however once I release the second key pressed, my character stops.
For example:
Right key pressed and then up key pressed, character moves northeast.
Up key released, player stops.
However, if I release the right key, the character continues moving up.
Another glitch is when I hold both left and right, the character will move left,
but I want it to stop moving.
Comment: If you add `move();` to the bottom of the `window.onkeyup` function, does it improve things?
Comment: No, I would of thought that would work though :/
Answer: You mention that you want the player to stop moving when you press the left and right keys simultaneously. It appears you should be able to easily do this by replacing the else if statements in move with if statements, resulting in a move function similar to:
var move = function(){

    if(Keys.up){
        hero.y -= 10;
    }

    if(Keys.down){
        hero.y += 10;
    }

    if(Keys.left){
        hero.x -= 10;
    }

    if(Keys.right){
        hero.x += 10;
    }

    main();
}

Comment: That does stop the character... but it doesn't fix the problem of when I lift up the second key pressed, my character stops moving.  I want the character to continuously move after I release one of the two keys pressed.
Answer: Quickly sketched an example, jsfiddle: http://jsfiddle.net/ofnp4vj4/
HTML:

JS:
var Keys = {
    up: false,
    down: false,
    left: false,
    right: false
};

var hero = {
    x: 0,
  y: 0
};

var log = document.getElementById("log");

window.onkeydown = function(e){
     var kc = e.keyCode;
     e.preventDefault();

     if(kc === 37) Keys.left = true;
     if(kc === 38) Keys.up = true;
     if(kc === 39) Keys.right = true;
     if(kc === 40) Keys.down = true;
 };

window.onkeyup = function(e){
     var kc = e.keyCode;
     e.preventDefault();

     if(kc === 37) Keys.left = false;
     if(kc === 38) Keys.up = false;
     if(kc === 39) Keys.right = false;
     if(kc === 40) Keys.down = false;
};

function main() {
  /* body */

    move();

  log.innerHTML = "x: "+hero.x+", y: "+hero.y;
};

function move(){

    if(Keys.up){
        hero.y -= 10;
    }

    if(Keys.down){
        hero.y += 10;
    }

    if(Keys.left) {
        hero.x -= 10;
    }

    if(Keys.right){
        hero.x += 10;
    }
}

setInterval(main, 100);


Cement around decorative bricks leaves grey/matte coating on bricks

Question: I'm installing a decorative brick wall (individual thin bricks) for the first time. I glued all the bricks and now I'm working on the cement (mortar) around the bricks. I did a few rows yesterday for a test. While applying the mortar, some fell on the bricks. I wiped the bricks with a dry cloth as much as I could but the bricks are now covered with a thin "coating" that makes them pale and matte.
Q1: How can I clean the bricks?
Q2: How should I work the rest of the wall to avoid that?
Answer: Q1:
I would try a stiff brush and water.  If this does not work, you may be able to try a muriatic acid solution, but I would look at the manufacturer's recommendations first.  Depending on the brick color and type, this may discolor the brick.
Q2:

Apply the grout using a grout bag to minimize the mess.
When the joints are filled, wait until the grout is the consistency of wet beach sand.
Go over the joints with a brick jointer.
As you are jointing, periodically wipe down the brick surface with a wet mason's sponge to remove any grout from the brick face (clean the sponge out in a bucket of water as you go).
Comment: Muriatic acid is very effective.
Answer: After you finish, but before it cures, try powerwashing them.  Start with low pressue or back up a ways at first to make sure you dont ruin the new mortar, then move closer or increase as you can.
Comment: This is an indor wall.


Sides created by angle bisector

Question: If I have triangle ABC with side lengths a,b,c, and I have an angle bisector coming out of point A, which divides side a into two sections at intersection point P, what is the length of BP and PC?
Answer: This is well known property of bisector. $\frac{BP}{CP}=\frac{AB}{AC}$. So you have a system
$\frac{BP}{CP}=\frac{b}{c}$ and $BP+PC=a$
The solution to the system is $BP=\frac{ac}{b+c}$ and $CP=\frac{ab}{b+c}$
Comment: @user123706 Just to confirm, you know about the angle bisector theorem?
Comment: I do now, yes. thank you!
Answer: You have enough information to solve each of the two triangles you get. For example, for $\Delta ABP$, you have the angles $\tfrac{1}{2}A$ and $B$, and the side $b$. Probably the easiest approach is to find the third angle (using angle-sum=$180^\circ$) and then use the law of sines.

Sides created by angle bisector


Using Node.js, make a new XMLHttpRequest during or after a XMLHttpRequest

Question: I am very new to Node.js and XMLHttpRequest, so please bear with me if this is a question with a simple answer.
I am currently trying to crawl a friends webpage (with his permission of course) which hosts videos and subtitles. I want to do this by writing a Node.js command line application. Currently, I am just trying to get to the link of the video and the link to subtitle. This is what I have so far:
#!/usr/bin/env node

var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var htmlparser = require("htmlparser2");

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {

    // HTML source
    var html = this.responseText;
    var season = 0;
    var episode = 0;

    var parser = new htmlparser.Parser({
      onopentag: function(name, attribs) {
        if (name === "li" && attribs.id === "season-1") {
          season = 1;
          console.log("In season 1");
          for(var attr in attribs){
            console.log(attr);
          }
        }
        if (name === "a" && season === 1) {
          episode = 1;
          var nextPage = attribs.data;
          console.log("\""+nextPage+"\"");

          // Go to "nextPage" here
          xhttp.open("GET", "\""+nextPage+"\"", true);

        }
      },
      onattribute: function(name, value) {
        if(name === "data-url" && season === 1){
          if(value.includes("episode-")){
            episode = value.substr(8,1);
          }
          console.log(value);
          console.log("Episode is: " + episode)
        }
      },
      ontext: function(text) {

      },
      onclosetag: function(tagname) {
        if (tagname === "li" && season === 1) {
          season = 0;
          console.log("Leaving season 1");
        }
      }
    }, {
      decodeEntities: true
    });
    parser.write(html);
    parser.end();

  }
};
xhttp.open("GET", "https://friendspage.org", true);
xhttp.send();

The code above results in this output:
In season 1
id
episode-1
Episode is: 1
"https://friendspage.org/episode-1"
episode-2
Episode is: 2
"https://friendspage.org/episode-2"
episode-3
Episode is: 3
"https://friendspage.org/episode-3"
episode-4
Episode is: 4
"https://friendspage.org/episode-4"
episode-5
Episode is: 5
"https://friendspage.org/episode-5"
episode-6
Episode is: 6
"https://friendspage.org/episode-6"
episode-7
Episode is: 7
"https://friendspage.org/episode-7"
episode-8
Episode is: 8
"https://friendspage.org/episode-8"
episode-9
Episode is: 9
"https://friendspage.org/episode-9"
Leaving season 1

The code works as I want it to, except for the part where I want to go to the nextPage. I am going to use input variables from the command line to choose which page to go to, but currently, I don't know how to go to the nextPage.
// Go to "nextPage" here
xhttp.open("GET", "\""+nextPage+"\"", true);

Trying to use xhttp.send() results in an error send has already been called. I am guessing I either need to close the current request and open a new one, or simply start another instance of XMLHttpRequest.
If that is what I would need to do, which is the preferred method? And what would be the cleanest way to do it? If not, what is the solution I need to use?
Answer: Make a new xhttp object in a new variable for each new request. Don't reuse the current one.
FYI, the request-promise library is much better built for node.js than trying to emulate an archaic interface from the browser (which even it has replaced with fetch()).  The functionality built into node.js to do this is http.get(), but that has been extended in a very helpful fashion in the request library and then it's been promisified in the request-promise library which makes it even easier to use.  I would strongly suggest using the request-promise library for this task.

EDIT Jan, 2020 - request() module in maintenance mode
FYI, the request module and its derivatives like request-promise are now in maintenance mode and will not be actively developed to add new features.  You can read more about the reasoning here.  There is a list of alternatives in this table with some discussion of each one.  I have been using got() myself and it's built from the beginning to use promises and is simple to use.
Comment: Thanks, I will look into request-promise. It looks very promising! :) .... Sorry, terrible pun xD
Comment: How would I use request-promise to go to nextPage? That is how do I make a new request? It is not part of the [GitHub cheat sheet](https://github.com/request/request-promise#cheat-sheet)
Comment: @Skillzore - You just call `rp('http://someURL').then(...)` to start a new request.
Comment: Well, I am currently using [the crawl a webpage better](https://github.com/request/request-promise#crawl-a-webpage-better) example. So do I just do another `var options` thing inside the first `then(function ($) {...})`? That doesn't seem very elegant....
Comment: @Skillzore - I can't debug code I can't see and I think we've already answered the original question you asked.  If you have a new question, perhaps you should post the exact code that the question is about in a new question.  If you want to call `rp()` with the same options in several different places, you can just make a local function that you pass the URL to and it creates the options you want and then calls `rp()` returning the promise.  That's just factoring common code into a shared function.
Comment: Sorry, made a [new question](https://stackoverflow.com/questions/53073931/best-method-of-moving-to-a-new-page-with-request-promise)


Prove by induction that for $n\geq 3$, $p_1 \to p_2, p_2 \to p_3, \dots p_{n-1} \to p_n \implies p_1 \to p_n$

Question: I have proven the base case for $n=3$ by creating a truth table and verifying the implication.
Now i need help with inducing a proof for every case. Please guide me on how i should approach this problem.
Comment: For a formal proof of such a statement, you should first try to give a formal definition of "$\ldots$"
Comment: Broadly speaking, the rest of the proof has two steps.  First use the _induction hypothesis_ to show $p(1)\to p(n-1)$.  Then use the _base case $(n=3)$_ to conclude that $p(1)\to p(n)$.  The first of these steps is where you have to contend with Hagen's point.
Comment: @brianMoehring i have already proven the base case of n=3 using a truth table. do i use another truth table for the induction???
Comment: If your comment is to my second step, I said to use your base case, not prove it.  Truth tables probably are useless for the inductive step.  Do you have experience with inductive proofs?
Comment: @BrianMoehring yes i have some experience with basic inductive proofs that involve algebra but i have never done one like this. I am assuming it is like this.... p1->p2, p2->p3,p(k-1)->pk=>p1->pk. let p(k-1) = p3 since we know p1->p3  prove p1->p4.
Comment: i am completely stuck my brain cannot handle this please help
Comment: I am assuming it is just what i have said above then you say p1->p3,p(k-1)->pk so p1->pk
Comment: Someone please help?
Comment: see below for a summary of induction plus an example of how it is done. These proofs are not generally done with truth tables. They are performed using the rules of inference in tandem with the axioms, theorems and definitions present in mathematics. I would be able to give you better direction if I knew what the statement actually was that you are trying to prove.
Comment: if you're satisfied with you're answer, then please click the green check to close the post. Thanks!
Answer: The induction step is to prove that
p1 → p2, p2 → p3, ..., p(n-1) → pn ⇒ p1 → pn
implies
p1 → p2, p2 → p3, ..., p(n-1) → pn, pn → p(n+1) ⇒ p1 → p(n+1).
First assume
p1 → p2, p2 → p3, ..., p(n-1) → pn ⇒ p1 → pn.
Now assume
p1 → p2, p2 → p3, ..., p(n-1) → pn, pn → p(n+1).
Show from those assumptions that p1 → pn
and subsequently p1 → p(n+1).
Pull it together to conclude
p1 → p2, p2 → p3, ..., p(n-1) → pn, pn → p(n+1) ⇒ p1 → p(n+1)
and finally the induction step.
Forget about that truth table stuff.
It is not a major part of logic.
The rules of inference are.
Use them.
Answer: Proof by induction is typically used to prove a statement about the natural numbers, or some subset thereof. For example, we may be proving $\forall n P(n)$ where $n \in \mathbb{N}$ and $P(n)$ is the statement $\sum_{i=0}^ni=\frac{n(n+1)}{2}$. In other words, we may be proving that for every $n \ge 0$, the sum of the first $n$ natural numbers is $\frac{n(n+1)}{2}$.
Proof by induction is organized into two steps:
$(1)$ In the basis step, you demonstrate that $P(n)$ is true for the least element in the domain you're working with. In the example above, we would want to show that $P(0)$ is true. So we work out $P(0)$, or $\sum_{i=0}^0i=0=\frac{0(0+1)}{2}=0$, and confirm that it is in fact true.
$(2)$ In the inductive step, the goal is to validly deduce the following statement: $P(k) \rightarrow P(k+1)$ where $k$ is some arbitrary number from the domain you're working with. This is typically accomplished by assuming the antecedent is true and then deriving the consequent. In other words, we assume that $P(k)$ is true, and then under that assumption we attempt to show that $P(k+1)$ is true.
Following the example above, I would assume $P(k)$, or $\sum_{i=0}^ki=\frac{k(k+1)}{2}$, is a true statement, and then my goal would be to derive $P(k+1)$, which is $\sum_{i=0}^{k+1}i=\frac{(k+1)[(k+1)+1]}{2}=\frac{(k+1)(k+2)}{2}$. I would do all this as follows:
$$P(k): \sum_{i=0}^ki = \frac{k(k+1)}{2}$$
$$\sum_{i=0}^ki + (k+1)= \frac{k(k+1)}{2} + (k+1)$$
$$\sum_{i=0}^{k+1}i= \frac{k(k+1)}{2} + \frac{2(k+1)}{2}$$
$$\sum_{i=0}^{k+1}i= \frac{k(k+1)+2(k+1)}{2}$$
$$\sum_{i=0}^{k+1}i= \frac{k^2 +k+2k+2}{2}$$
$$\sum_{i=0}^{k+1}i= \frac{k^2 +3k+2}{2}$$
$$\sum_{i=0}^{k+1}i= \frac{(k+1)(k+2)}{2}$$
$$P(k+1): \sum_{i=0}^{k+1}i= \frac{(k+1)(k+2)}{2}$$
Once you have completed the basis step and the inductive step, you are finished. By induction you may conclude that $\forall n P(n)$ is true (i.e. $P(n)$ is true for all $n$ in the domain you're working with). This is all possible because the inductive step shows that if the statement $P(n)$ is true for any arbitrary number $k$ in your domain, then it is also true for the very next number, $k+1$. Since in the basis step you show $P(n)$ is true for the first number in the domain, this infers that $P(n)$ is true for every number after the first number.


CSS 3 - Scale transition snaps back in google chrome

Question: I have an issue , I have the following code I am using for increasing the scale using CSS3 transition , at the end it snaps back to its original scale after increasing.
CSS:
.big{

        transition:all 0.3s ease-in-out;
        display:inline;
}
.big:hover{

-webkit-transform:scale(1.4);
}

HTML :

Typo

Comment: This is not related to the solution, but your logo is not nice at all...
Comment: Haha! Nice that you understand arabic :3
Comment: As I see it, be nice to others and they will be nice to you :)  Sorry I do not know the answer to your question though
Comment: you mean you want to stay at scale 1.4 after mouseLeave !?
Answer: Try using inline-block instead of inline (also, it's recommended to add compatibility to the rest of the browsers as well).
CSS:
.big {
    -webkit-transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    display: inline-block;
}
.big:hover {
    -webkit-transform: scale(1.4);
    -moz-transform: scale(1.4);
    -o-transform: scale(1.4);
    transform: scale(1.4);
}

HTML:

Typo

Test it here: http://jsfiddle.net/XbUC8/


Xaml switch between TextBlock and TextBox

Question: I've noticed that TextBoxes are very slow and create performance issues when the Text is changed dynamically by code (I need to change the Text continuosly to 10-15 TextBoxes at the same time), so, as a workaround, I've created a custom control with a TextBlock and a TextBox:

The TextBlock is used in almost all time.
  The TextBox is used only when I need to edit the Text inside the control with keyboard.

My solution is to change the template and use the TextBox when the control is focused:
(Value is a string Dependency Property)

</Style>

But when I click on the control nothing happens.
I think that the problem is that the "focus state" is passed to the internal TextBox, and the control loses the "focus state".
There is a better way to create a custom "TextBox" control like this, or a way to resolve this problem?
Answer: You don't need a custom control for this, that's just adding unnecessary overhead. What you're trying to create is still a TextBox, with all the usual behavior of a TextBox (focus etc). All you need to do is change the template to a TextBlock when it's not in focus:
<Window.Resources>

    </Style>

</Window.Resources>

<StackPanel>
    <TextBox Text="Hello World" />
    <TextBox Text="Goodbye World" />
</StackPanel>

Comment: Very good Idea! Thanky you very much. I will try this
Comment: we have the same solution in our project. but the problem with this solution is the caret position when the textbox got focus. the caret should be on the mouseposition. But instead it is always on index 0.
setting the CaretIndex in the GotFocus-Event with the help of GetCharacterIndexFromPoint does not work. GetCharacterIndexFromPoint always returns "-1". Did you came up with any solutions for that? @Mark
Comment: @PandaPlayer if you want that functionality then the control has to be a TextBox at the moment you click it. Easiest solution is to change the above from a regular Trigger to a MultiTrigger with conditions `IsMouseOver=false` and `IsFocused=false`. If you want it to still look like a TextBlock when then mouse is over it then you can add another MultiTrigger for `IsMouseOver=true` and `IsFocused=false`, and in that trigger set BorderThickness to 0. It will need a few other minor tweaks to get it 100% perfect (eg removing the internal margin) but that will get you pretty close to what you need.


Multiply 1D list to 2D list but only the same index

Question: I have 2 list like this
d = [[1,2,3],[4,5,6],[7,8,9]]
c = [1,2,3]
so i want to multiply only one each element of c to only one list inside d. Like this:
y1 = c[0] x d[0] = [1x1, 1x2, 1x3]
y2 = c[1] x d[1] = [2x4, 2x5, 2x6]
y3 = c[2] x d[2] = [3x7, 3x8, 3x9]
And then append it to a new 2D list [[y1],[y2],[y3]].
Expected process: [ [1x1, 1x2, 1x3], [2x4, 2x5, 2x6], [3x7, 3x8, 3x9] ]
Anyone knows how to do it? thank you
Answer: You can achieve this using a list comprehension, if you want a pure Python solution:
d = [[1,2,3],[4,5,6],[7,8,9]]
c = [1,2,3]

print([[d[row][col] * c[row] for col in range(len(d[0])] for row in range(len(d))])

This can also be more concisely achieved using numpy:
import numpy as np

d = np.array([[1,2,3],[4,5,6],[7,8,9]])
c = np.array([1,2,3])

print(d * c[:, np.newaxis])


Let $E=C([-1,1])$ and $f,g \in E$ such that $f(x) = x^2-1$ and $g(x)= 1-x^2$. Determine if $B(f,2) \cap B(g,2) = \emptyset?$

Question:
Let $E=C([-1,1])$ the set of continuous functions with the sup norm and $f,g \in E$ such that $f(x) = x^2-1$ and $g(x)= 1-x^2$. Determine if $B(f,2) \cap B(g,2) = \emptyset?$

With the sup norm I have that \begin{align*}
d(f,g) &= \|f-g\|_{\infty}\\
&= \sup_{x\in [-1,1]}|f(x)-g(x)|  = \sup_{x\in [-1,1]}|x^2-1-(1-x^2)| \\
&= \sup_{x\in [-1,1]}|2x^2-2|=2
\end{align*}
So this would seem that the intersection is empty, but I'm not entirely sure this concludes it?
Answer: I don't think your result implies that the open balls do not intersect. Try to visualize it, if you take an open ball with the center $g$ then they will intersect obviously, as $g$ lies in the boundary of $B(f,2)$
In fact, $h(x)=x^2$ belongs to both of these open balls


How to add Custom Columns in SmartTable?

Question: I am displaying the data in a smartTable. Now I would like to add one custom icon column. Is this possible ? So for example I have a SmartTable and a JSON model as shown below and I would like to display the JSON Model value in First Column as Text.
<mvc:View
    xmlns="sap.m"
    xmlns:mvc="sap.ui.core.mvc"
    controllerName="sap.ui.demo.smartControls.SmartTable"
    xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
    xmlns:smartTable="sap.ui.comp.smarttable">
    <smartFilterBar:SmartFilterBar
    id="smartFilterBar"
    entityType="Product">
    <smartFilterBar:controlConfiguration>
    <smartFilterBar:ControlConfiguration
    key="Category" visibleInAdvancedArea="true"
    preventInitialDataFetchInValueHelpDialog="false">
    </smartFilterBar:ControlConfiguration>
    </smartFilterBar:controlConfiguration>
    </smartFilterBar:SmartFilterBar>
    <smartTable:SmartTable
    id="smartTable_ResponsiveTable"
    smartFilterId="smartFilterBar"
    tableType="ResponsiveTable"
    editable="false"
    entitySet="Products"
    useVariantManagement="false"
    useTablePersonalisation="false"
    header="Products"
    showRowCount="true"
    useExportToExcel="false"
    enableAutoBinding="true">
    </smartTable:SmartTable>
    </mvc:View>

and in onInit() method of controller I have the json model.
var oData = { "Text": "StackOverFlow"};
var oModel = sap.ui.model.json.JSONModel(oData);
sap.ui.getCore().setModel(oModel);

Regards,
Mayank
Answer: There is an example here:
SAP Developer Guide - Smart table
I did this in an application recently, with an oData service, should be similar with data from JSON Model. Here is what mine looks like:

 <smartTable:SmartTable
  id="gSmartTable"
  initialise="onSmartTable"
  beforeRebindTable="onBeforeRebindTable"
  showOverlay="onShowOverlay"
  entitySet="Employees"
  smartFilterId="gSmartFilterBar"
  tableType="ResponsiveTable"
  useExportToExcel="false"
  useVariantManagement="false"
  useTablePersonalisation="true"
  persistencyKey="gSmartTable_Explored"
  header="Workers"
  showRowCount="true"
  enableAutoBinding="true"
  demandPopin="true">

   <columns>
   <Column width="100px" hAlign="Left">
     <customData>

      <core:CustomData key="p13nData"
       value='\{"columnKey": "Pernr", "maxLength": "5","columnIndex":"0", "leadingProperty": "Pernr"}' />
     </customData>
      <Text text="{i18n>tableColumnEmployeeID}" />
    </Column>
    <Column width="100px" hAlign="Left">
     <customData>

      <core:CustomData key="p13nData"
       value='\{"columnKey": "ZQ_STAT", "maxLength": "5","columnIndex":"4", "leadingProperty": "ZQ_STAT"}' />
     </customData>
      <Text text="{i18n>tableColumnStatus}" />
    </Column>
   </columns>
   <items>

    <ColumnListItem type="Navigation" press="onPress">
     <cells>

     <Text text="{
     path: 'Pernr',
     formatter: '.formatter.stripZeros'
     }" />
     </cells>
     <cells>

      <core:Icon
      src="{
       path: 'ZQ_STAT',
       formatter: '.formatter.iconVis'
       }"
      color="{
       path: 'ZQ_STAT',
       formatter: '.formatter.iconColour'
       }"/>
     </cells>
    </ColumnListItem>
   </items>

 </smartTable:SmartTable>

I was able to add two custom fields, with formatters on the data. If you want the custom column to appear first, set the 'columnIndex' property appropriately.
Hope that helps!


how to use Jhipster-jdl without modify the configration i update before?

Question: when i create an Entity ,I modify the code in the Entity file .and then I add some fields in the jdl file and import . How can I keep the changes and add the fields in the Entity rather than override or not override.
Comment: Work in a branch using git  and merge, consider JHipster generator as a member of dev team. Get some inspiration about the upgrade generator explanations http://www.jhipster.tech/upgrading-an-application/
Comment: thanks a lot ,but I mean I use import-jdl to create an entity ,and I modify the entity class directly. then I add some fields in the jdl file and import,it will make my changes when I modify the entity class directly restore
Comment: My comment still applies
Comment: Is it? Let me think it over ,thank you very much.
Answer: You should use version control likes git and then generate. After that you can merge, revert, etc. For more information visit here


C++ How to read txt file and retrieve numerical values, apart from string (and vice versa)

Question: I have been teaching myself C++, and searching for how to do this. Let me give an example to clarify my intention.
Here is a txt file, and the content is following.
Matt   18  180.0   88.5
Angela 20  155.5   42.2

Each row has information about a person's name, age, height and weight.
What I've been trying to do is to get those 4 types of information separately and store them in different variables, based on the information type.
vector<string> name; //"Matt" or "Angela" are stored here.
vector<int> age; //18 or 20
vector<double> height; //The same logic goes for this vector and the next one
vector<double> weight;

At least I've found that information inside txt files can be stored in string variables by using ifstreamObject.open(filename.c_str()) and getline(ifstreamObject, string). However, by using this method, I'd get only string values which correspond to each row. In other words, I cannot distinguish string values from numeric values.
Chances are that there isn't any other way to get information from txt files. Nonetheless, just in case, I'd like to ask some advice here on how to get information in such a way, before I give up.
Any advice would be appreciated.
Answer: What you can do is to use the stream directly,
std::string name;
int age;
double height, weight;

while(ifstreamObject >> name >> age >> height >> weight)
{
    // process name, age, height and weight
}

The downside is that the stream insertion operator will read until the first whitespace. So, if you want to read a whole line as a string, then use getline, process the string accordingly, "map" back the string read by getline into a istringstream,
std::istringstream is(str); // constructs an istringstream from the string str

then use is similarly to how you'd use a stream.
Comment: Thank you so much. Can I ask one more question? The `>>` operator apparently separates each string block (In the example above, each string block can be "Matt" , "18", "180.0" and so on), based on whether there is a space or not. I also think that I need to put a variable's name between `>>`, in order to detect each string block. Am I correct? Googling `c++ ifstream >> operator` shows results which are related `c++ istream >> operator`, not `ifstream`.
Comment: @YMD yes, that's correct. And the extraction operator is inherited from `istream` (which is a base class of `ifstream`).
Answer: If you know that there is a certain Character between each entry (like a tab) you could use String.find_first_of and substrings to divide the string into pieces and parse them into the fields you have.
Check http://www.cplusplus.com/reference/string/string/ for more info
Answer: Hi you can use stl::string methods to manipulate row string to extract those 4 types of information separately.
use std::string::find_first_of to find each start of white space and use std::string::find_first_not_of to find each non white space characters. use std::string::substr to extract sub string from row string. Also use atoi to convert string value to int.
for example,
//rowSrting holds the data of one line in file
std::size_t nameEnd = rowString.find_first_of(" ");
string name = rowString.substr(0, nameEnd-1);

std::size_t ageFirst = rowString.find_first_not_of(" ", nameEnd);
std::size_t ageEnd = rowString.find_first_of(" ", ageFirst );
int age = atoi(rowString.substr(ageFirst, ageEnd-1));


How to prevent GNOME Screensaver's "random" option from including Images directory?

Question: I love GNOME Screensaver application and all the themes that can use be used with it -the defaults and additionals from the repositories. So I would like to prefer the "Random" theme selection.
The problem: there's a choice as Images Directory among themes. When I opt for Random, screensaver shows the content of my Images directory as well. No need to give details, but this is not suitable for more than one reason. Shortly, that directory is very private for me and screensaver, by nature, is to be wieved by everybody when we lock the screen and leave the computer.
Once upon a time there were a number of discussions on the issue, but the developers' approach was something like this: "This is not a bug, this is a feature". Technically it may not be considered as a bug, but still it is a personal security issue for me.
A workaround may be not to use the default Images directory for images -or putting just a few screensaver-safe image in it- and to use another directory for the personal images, instead. I don't like this way because desktop integration of GNOME & Ubuntu makes that directory -which comes as default- functional for some image related task.
So the question: How can I choose Random option for the GNOME Screensaver and yet not include the Image directory to the line?
Comment: BTW, you should always store those *more than one reason* images in a semi-hidden directory (like ~/nrop/ or ~/.nrop/) so anyone you casually let use your computer won't stumble across them.
Comment: I think I have a `.hidden` stored away somewhere...
Comment: @Roger Pate & @fluteflute I'll take your advice(s) into consideration, seriously.
Answer: There are "Wishlist" bug reports about this on Launchpad and the GNOME Bugzilla. I wouldn't get your hopes up that this will be implemented in the graphical interface anytime soon though.
But it turns out your problem is solvable with a little effort! (This looks like a lot of steps but actually it's not hard.)

Choose the Random option in System->Preferences->Screensaver
Open the gconf editor (Alt+F2 and enter gconf-editor)
Navigate to apps/gnome-screensaver
Right click on the themes 'key' and click "Edit Key..."
Click on screensavers-personal-slideshow and press Remove
Answer: The Random screensaver simple shuffles through all the other available screensavers.
So the way to fix this is to disable the Pictures folder screensaver.
From the GnomeScreensaver FAQ:

How can I remove some themes from the list of themes shown in the preferences?
Eventually this feature will be added to the preferences dialog itself. But for now the not so elegant solution is to run the following from a command-line:

PATH="${PATH}:`pkg-config --variable privlibexecdir gnome-screensaver`:/usr/libexec/xscreensaver" \
gmenu-simple-editor gnome-screensavers.menu

Simply uncheck the Pictures folder screensaver.


Incomplete type for std::vector

Question: The GCC compiler complains (see below) when I try the following. class Face needs to be incomplete because it contains pointer to class Element which similarly contains pointer to class Face. In other words, there is a circular dependency among classes. How can I fix it?
error: invalid application of 'sizeof' to incomplete type 'Face'
class Face; // needs to be incomplete

class Element
{
    std::vector < std::unique_ptr <Face> > face;
};

class Face
{
    std::vector < std::unique_ptr <Element> > elm;
};

Comment: You might want to read this: http://home.roadrunner.com/~hinnant/incomplete.html
Comment: What is the error that you're getting? I compiled your code on my mac and I didn't get any error.
Comment: @stefan : look at the circular dependency between the types. This reason could have been highlighted in the question though.
Comment: You can use incomplete types with shared and raw pointers.
Comment: What error did you get with what version of gcc and on what code? I can't reproduce...
Comment: @MarcGlisse: I got the error mentioned in the post with gcc version 4.8.2
Answer: One way to fix this is to declare the destructors and constructors of Element and Face but not define them in the header.
Then you need to define them in cpp files.
(More technical details can be found in the answers to my question there: Is std::unique_ptr<T> required to know the full definition of T?)
The source of the problem is that the destructor of unique_ptr needs to call delete (by default) therefore it needs to know the definition of the type (to have it's size). But if the destructor of Element and Face is generated automatically, then it will be inlined by default: the code using Element and Face instances will be forced to know the size of both types so that their destructors can call unique_ptr destructor which can call delete with the type associated to the pointer.
The solution I gave will make sure the construction and destruction of the unique_ptr are defiend in a separate cpp. They will not be inlined but they are still callable by the code using Element and Face. The destructor code of the unique_ptrs will be in the cpp where the destructors of Element and Face are defined, so in these cpp the definition of both will be needed.
To take your example:
//header
class Face; // needs to be incomplete

class Element
{
public:
    Element(); // don't define it here
    ~Element(); // don't define it here
private:
    std::vector < std::unique_ptr <Face> > face;
};

class Face
{
public:
    Face(); // don't define it here
    ~Face(); // don't define it here
private:
    std::vector < std::unique_ptr <Element> > elm;
};

// cpp
#include "header"
// if you want the default impl (C++11)
Element::Element() = default;
Element::~Element() = default;

Face::Face() = default;
Face::~Face() = default;

In case they are in different header/cpp pair, it's still the same solution. However you have to do more forward declare and the cpp files defining the construction/destruction have to include all the necessary headers:
//element.h
class Face; // needs to be incomplete

class Element
{
public:
    Element(); // don't define it here
    ~Element(); // don't define it here
private:
    std::vector < std::unique_ptr <Face> > face;
};

////////////////////////////////////////////////////////////
// face.h
class Element; // needs to be incomplete

class Face
{
public:
    Face(); // don't define it here
    ~Face(); // don't define it here
private:
    std::vector < std::unique_ptr <Element> > elm;
};

////////////////////////////////////////////////////////////
// element.cpp
#include "element.h"
#include "face.h" // necessary to allow the unique_ptr destructor to call delete

// if you want the default impl (C++11)
Element::Element() = default;
Element::~Element() = default;

////////////////////////////////////////////////////////////
// face.cpp
#include "element.h" // necessary to allow the unique_ptr destructor to call delete
#include "face.h"

// if you want the default impl (C++11)
Face::Face() = default;
Face::~Face() = default;

Comment: "But if the destructor of Element and Face is generated automatically, then it will be inlined by default: t"
Yes, indeed. But why is it a problem that they are inlined?
Comment: What if `Face` and `Element` have their own header and cpp files?
Comment: @Shibli Same answer, but then you just have to forward-declare Element for Face and Face for Element. I'll add an example.

Incomplete type for std::vector


Dependency problems with wkhtmltopdf when trying to install latest version

Question: I'm trying to install the latest version of wkhtmltopdf on an ubuntu server 12.04. apt-get install wkhtmltopdf only installs version 0.9.9 and I need the latest version, 0.12.2.1. I was having trouble so I posted a question here, but that didn't work, and seemed to cause more problems as I was trying things I don't understand.
I found a way to install the latest version. That is, download the latest version and install it like this dpkg -i wkhtmltox-0.12.2.1_linux-precise-i386.deb
Although when I try do that now, I get this
Selecting previously unselected package wkhtmltox:i386.
(Reading database ... 178460 files and directories currently installed.)
Unpacking wkhtmltox:i386 (from .../wkhtmltox-0.12.2.1_linux-precise-i386.deb) ...
dpkg: dependency problems prevent configuration of wkhtmltox:i386:
wkhtmltox:i386 depends on xfonts-base.
wkhtmltox:i386 depends on xfonts-75dpi.
wkhtmltox:i386 depends on libstdc++6.
dpkg: error processing wkhtmltox:i386 (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db ...
Errors were encountered while processing:
wkhtmltox:i386

And when I try and do sudo dpkg -a --configure it gives me this
dpkg: dependency problems prevent configuration of wkhtmltox:i386:
 wkhtmltox:i386 depends on xfonts-base.
 wkhtmltox:i386 depends on xfonts-75dpi.
 wkhtmltox:i386 depends on libstdc++6.
dpkg: error processing wkhtmltox:i386 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 wkhtmltox:i386

How can I fix these dependency problems?
Comment: try to do like here http://askubuntu.com/questions/603672/unable-to-install-opencv-on-12-04/603678#603678 except installing opencv
Comment: Yeah, I saw this. I'm a little nervous to 'sudo apt-get dist-upgrade' as I don't want it to affect any of the sites running on the server. I've tried up to that point though.
Comment: well if you need that package to be installed you need to proceed with `dist-upgrade` as it requires certain libs or you install those packages manually then.
Comment: Nevermind the previous comment. Naïvety on my part in not understanding the command fully. Will try it now.
Comment: I did the `dist-upgrade` and still getting the same problems. When I do the apt-get -f install it says it needs to remove this package wkhtmltox:i386 and then fails with this:

`Removing wkhtmltox:i386 ...

dpkg: warning: while removing wkhtmltox:i386, directory
'/usr/local/share' not empty so not removed.

dpkg: warning: while removing wkhtmltox:i386, directory '/usr/local/bin' not empty so not removed.

dpkg: warning: while removing wkhtmltox:i386, directory '/usr/local/lib' not empty so not removed.`
Comment: did you try manually to remove it `sudo apt-get remove --purge wkhtmltox:i386`
Comment: It gives the same problem. It won't remove it because '/usr/local/share', '/usr/local/bin' and '/usr/local/lib' are not empty.  I don't know why it's giving these problems. Those folders seem important so I don't know why it wants to delete them anyways.
Comment: read this thread http://unix.stackexchange.com/questions/164321/after-creating-a-deb-dpkgwarning-while-removing-directory-usr-local-bin-not you have to understand more clearly. One thing might also happen when you installed packages as a root also so might need to login as root to un-do.
Answer: on Ubuntu 14.04 and Ubuntu 20.04.4 LTS
(correct architecture 32 bit)
$ dpkg -i wkhtmltox-0.12.2.1_linux-trusty-i386.deb
dpkg: dependency problems prevent configuration of wkhtmltox:
wkhtmltox depends on xfonts-base; however:
  Package xfonts-base is not installed.
wkhtmltox depends on xfonts-75dpi; however:
 Package xfonts-75dpi is not installed.

Ubuntu 20.04.4 LTS:
 sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb
 Selecting previously unselected package wkhtmltox.
 (Reading database ... 230695 files and directories currently
installed.)
 Preparing to unpack wkhtmltox_0.12.6-1.focal_amd64.deb ...
 Unpacking wkhtmltox (1:0.12.6-1.focal) ...
 dpkg: dependency problems prevent configuration of wkhtmltox:
 wkhtmltox depends on xfonts-75dpi; however:
 Package xfonts-75dpi is not installed.

dpkg: error processing package wkhtmltox (--install):
dependency problems - leaving configured
Processing triggers for man-db (2.9.1-1) ...

Now just issue the following command:
apt-get -f install

Comment: Worked on Ubuntu Server 18.04
Comment: As sudo, downloaded .deb from downloads page, then ran `apt-get -f install`. It installed all dependencies. Worked like a charm.
Answer: FWIW, I ran into this same problem and it turned out to be an issue with the version of wkhtmltopdf I was trying to install. I have an Ubuntu 12.04.5 64-bit system and was trying to install a 32-bit version of the package. Looks like you have the 32-bit version there as well; should it be amd64 instead of i386? All package downloads here: http://wkhtmltopdf.org/downloads.html.
Hope this helps.
Comment: Yeah I finally managed to sort it out. And this was exactly the problem. Thanks for posting.


Can pushkit Voip notification be use for an other purpose

Question: I'd like to know if i can use pushkit voip notification, even if my application is not a voip application.(by it, i mean eventually publish it in the app store) I'm not trying to make any voip call, I'd just like to use it's functionnality to wake my application up even if the user has quit it, and process information from the background. I'm sorry if i'm unclear, english isn't my first language(i'll try and make it clearer if needed). Thanks in advance for your help.
Comment: Check it, I think you got a solution: https://stackoverflow.com/questions/48581495/ios-silent-push-should-update-application-badge-count/48581601#48581601
Answer: No, you should not. Even if you do that, high chances (I would say 99.9%) that Apple will reject your app during App Review.
Pushkit is meant only for Voip Apps & Apple as far as I know is very strict while reviewing apps.
Comment: Your welcome. But let me tell you, as per my knowledge, this may not be possible. Once the user has force quit the app, notification can not be processed by app without user interaction. (except Pushkit).


Which weapons have splash damage in Torchlight 2?

Question: As an Engineer I like using two-handed weapons because of the Heavy Lifting passive skill that gives bonus attack speed and stun chance. However, I'm not sure if the Greathammer I'm currently using causes splash damage, so I'm wondering if I should try another two-handed.
Which weapon types in Torchlight 2 cause splash damage (in particular, two-handed weapons), and how large is the splash arc and splash damage dealt by each weapon type?
Comment: In terms of basic attacks, all melee weapons, with the exception of claw-class, splash to multiple targets. This includes staves.

Projectile Weapons (all ranged weapons including wands) never splash.
Comment: @RavenDreamer So I can keep using my Greathammer :) but do you know if the damage and arc varies for weapons that splash?
Comment: @SadlyNot It does. I can't remember where I read the differences between the weapon types, but if I do I'll answer.
Comment: Don't shotguns splash?
Answer: I looked up all the weapon types in Torchlight 2.  Here is the complete table.
<code>| Weapon      | Hands | Range | Arc        | Splash Damage |

|:------------|:-----:|:------|:-----------|:-------------:|

| Polearm     | 2     | 3m    |120 degrees | 50%           |

| Greatmace   | 2     | 2m    |120 degrees | 50%           |

| Greatsword  | 2     | 2m    |120 degrees | 50%           |

| Greataxe    | 2     | 2m    |120 degrees | 50%           |

| Greathammer | 2     | 2m    |120 degrees | 50%           |

| Staff       | 2     | 2m    |100 degrees | 50%           |

| Mace        | 1     | 1.8m  |60 degrees  | 25%           |

| Sword       | 1     | 1.8m  |60 degrees  | 25%           |

| Axe         | 1     | 1.8m  |60 degrees  | 25%           |

| Claw        | 1     | 1.7m  |0 degrees   | 0%            |

| Bow         | 2     | 10.2m |0 degrees   | 0%            |

| Crossbow    | 2     | 13.2m |0 degrees   | 0%            |

| Cannon      | 2     | 6m    |55 degrees  | 50%           |

| Shotgun     | 2     | 5m    |30 degrees  | 30%           |

| Pistol      | 1     | 7.2m  |0 degrees   | 0%            |

| Wand        | 1     | 7.2m  |0 degrees   | 0%            |
</code>
Comment: Welcome to Arqade, nice answer.
Answer: You can check the splash arc radius, distance, and % of full damage that splash attacks do for your current weapon by looking at the Arcane Statistics panel.


Can you pass an external function to a Vue component as a prop?

Question: I have a legacy codebase mostly built in PHP. I'm researching how to turn commonly used parts of the code into re-usable Vue components that can be plugged in as needed.
In one case, I have an onclick event in the html which will need to be individually passed to a child component. onclick="func()"
I want to be able to pass that func to the component from the markup, without defining this one-time use function as a property method either on the component or its parents.
I can't find anything in the Vue docs or elsewhere on how to do that. Every attempt I make gives an error:

Property or method "hi" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

Is there a way to pass externally-defined functions in the global scope to a Vue instance?
Vue tabs:
Vue.config.devtools = true;

Vue.component('tabs', {
  template: `

            {{tab.name}}

        <slot></slot>

  `,
  data(){
    return{
      tabs: []
    };
  },
  created(){
    this.tabs = this.$children;
  },
  methods:{
    selectTab(selectedTab){
      this.tabs.forEach(tab => {
        tab.isActive = (tab.name == selectedTab.name);
      });
    },
    otherHi() {
      alert('other hi');
    }
  }
});

Vue.component('tab', {
  template: `

      <slot></slot>

  `,
  props: {
    name: {required: true},
    selected: {default: false},
    callHandler: Function,
    clickHandler: {
      type: Function,
      default: function() { console.log('default click handler') }
    }
  },
  data(){
    return{
      isActive: false
    }
  },
  methods: {
    callHandler() {
      console.log('call handler called');
      this.clickHandler();
    }
  },
  computed:{
    href(){
      return '#' + this.name.toLowerCase().replace(/ /g, '-');
    }
  },
  mounted(){
    this.isActive = this.selected;
  }
});

new Vue({
  el: '.app',
  methods: {
    vueHi() { alert('hi from vue'); }
  }
});

function hi() {
  alert('hi!');
}

Markup:

    <tabs>
      <tab name="Tab 1" :selected="true" v-bind:call-handler="hi">

Tab content

      </tab>
      <tab name="Tab 2">

Different content for Tab 2

      </tab>
    </tabs>

Comment: I've never seen a good example of needing a functional prop. Could you use an event instead, ie your component emits an event and the parent handles that?
Comment: That seems to be the primary suggestion from the docs, and it makes the problem worse. Now instead of having the component that can handle its own single-use click event, I have every instance of its parent component having a function that's never used by the component itself, and only once in the whole code base used by a child element. That still seems like the wrong way to structure this.

Fundamentally, I don't need to pass a functional prop, I need to allow a component to reference an externally-defined function either without using the method object, or by using it as a proxy.
Answer: You could define your methods like this in your component :
...
methods: {
   hi
}
...

But you will have to define it in every component where you need this function. Maybe you can use a mixin that define the methods you want to access from yours components, and use this mixins in these components ? https://v2.vuejs.org/v2/guide/mixins.html
Anoter solution ( depending on what you try to achieve ) is to add your method to the Vue prototype like explained here :
https://v2.vuejs.org/v2/cookbook/adding-instance-properties.html
Vue.prototype.$reverseText = function(string) {
  return string.split('')
    .reverse()
    .join('')
}

With this method defined in the Vue prototype, you can use the reverseText method like this in all of your components template :
...

 {{ $reverseText('hello') }}

...

Or from yours script with this :
methods: {
  sayReverseHello() {
    this.$reverseText('hello')
  }
}

Comment: Thanks for your response. I don't think this helps for the reason you mentioned - I am trying to avoid having a single-use event function defined on every component.
The way I envision this, the component should only define the methods and properties that will be used by every instance, but should be able to accept outside functions for usage with specific instances.
Comment: So maybe the solution that involve adding the method you need in the prototype is the one that suits the most to your needs ?
Unfortanely for you, there is no others way to use an external javascript function directly in your template without wrapping it like mentionned above.


Cordova Android Status Bar Color

Question: What are the ways of changing android status bar color dynamically in runtime and statically in source code ?
I'm using Cordova + Framework7
Answer: Use Cordova plugin statusbar.
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-statusbar/

Cordova Android Status Bar Color


Contractor cut joist hangers to make them fit

Question: (edited with additional info re. header)
We are removing a couple of load bearing walls as part of renos in our home. The engineer specified a W8x21steel beam to replace the load bearing wall. The floor joists are 2x10.
It appears the contractor put the bolts into the "header" (not sure if that is the right term) in the wrong place (not enough space between bolt and joist). He then cut some of the joist hangers to make them fit. This has been done in at least 4 out of the 10 hangers that he has installed.
Also, he used 2 1/2" layers of plywood plus a 2x8 as a header in the flange of the steel beam (see picture below)
Questions:

Has the integrity of the hanger been compromised by him cutting out part of the material?
The hangers he used are Simpson Strong Tie LUS210Z. Are these the correct hangers to use in this application since the beam is shorter than the joist by 2" and the lowest nail barely goes into the wooden
The contractor has used N10dhdg Simpson nails (.148" x 1 1/2"). Are these the right nails to use? The Simpson website specifies that common 10d nails (.148" x 3") are used with this hanger.
Is the use of plywood + 2x8 as the header acceptable or should this be replaced with a single 3x10 cut to size?  Should we use 2 1/2"  nails into the header?

Per the simpson website
https://www.strongtie.com/facemounthangersssl_solidsawnlumberconnector/lus-hus-hhus-hgus_productgroup_wcc/p/lus.hus.hhus.hgus
"With 3x carrying members, use 0.162" x 2 1/2" nails into the header and 0.162" x 3 1/2" nails into the joist with no load reduction.
With 2x carrying members, use 0.148" x 1 1/2" nails into the header and 0.148" x 3" nails into the joist, reduce the load to 0.64 of the table value."
Is this ok and if not any suggestions on how it can be corrected?
Thanks!
Added view of header inserted into i-beam

Comment: Agreed on only use 1-1/2" for straight nailing, however diagonal nails are spec'd at 3" I believe.  A 1-1/2" diagonal nail will barely protrude from the 2x12.
Comment: The right move would've been to countersink the nuts and cut off the bolts flush with the ledger. Fortunately it's easy to replace the hangers.
Comment: @isherwood That's one way. A much better way would be to drill proper clearance holes in the hangers for the threads, so the nut tightens directly down on the bracket.
Comment: Considering the specs on the nail size. The floor joist's size of 2x12 is what is known as nominal unless they used a "true" 2x12 which I highly doubt. The actual thickness is closer to 1 1/2 inches so driving a 3 inch nail into 1.5 inches of wood isn't going to help anything. The board which is perpendicular to the floor joist looks to also be 1.5 inches thick so if you drive a 3 inch nail then it will hit the steel and be unable to go further. I cannot speak for the integrity of the notched hangers but that bottom nail appears to be driven into air unless it is angled upwards.
Comment: @Mike Waters  better talk to the building inspector first.  If you were an engineer and people wanted carte blanche to cut and modify joist hangers, who knows what they might do.  Perhaps resulting in floors falling.  Which is why building codes do not allow modifications to joist hangers, at least not without an inspector's permission.
Comment: The more I look at it, the less I like the butt joint in the 2x8 (first pic).  Did the engineer allow it?  Have you spoken with him/her yet?  You need to.
Comment: Lots of upvotes for a suggestion to drill holes in a hanger. I'm a bit baffled by that, and I disagree. No modification is safe without manufacturer approval.
Comment: [Nominal vs Actual](https://www.archtoolbox.com/materials-systems/wood-plastic-composites/dimensional-lumber-sizes-nominal-vs-actual.html). I would imagine that an inspector would say to [drive additional nails](https://i.stack.imgur.com/Aq5p1.jpg) and call it a day but I'm not an inspector nor an engineer.
Comment: Just to follow up on my comment. Yes, 3 inch nails should be used for the diagonal nails.
Comment: So, your contractor seems to have cut some corners - and not just in the hangers. ( ... sorry, couldn't resist the pun.)
Answer: No, it's not acceptable to cut the joist hangers.
In order to determine if they are acceptable anyway, there are several issues to review: 1) hangers are notched, 2) incomplete nailing, 3) wrong nails, 4) wrong install of fasteners (angled install in lieu of perpendicular to joist installation).
1) Notching the hangers voids the allowable stresses published by the manufacturer for each hanger. However, if the hanger is not stressed to its maximum allowed, the engineer can review and determine if it meets the "intent".
2) 3) and 4) Published allowable stress values are determined by installing the hanger in the proper manner, as per the manufacturer's installation instructions. When the fasteners are not correct, missing or improperly installed, then the designer will need to make a determination that they meet the required design loads.
If you have a Building Permit, I'm sure the Building Official will want the designer to provide "certification" that the installation is acceptable. If it's not acceptable, it will need to be re-done.
So, if the correct wood ledger was used and it's impossible to comply with the drawings, the engineer will need to redesign...and pay to have it done correctly. You can see that the engineer will do everything possible to accept the lack of nailing fully into the ledger/beam...but will probably want the hanger replaced (at the contractor's expense).
It's important to you to get this corrected or have the engineer provide the certification, because if there's a problem in the future, they'll both point the finger at each other and you'll be in court forever.
Comment: @MonkeyZeus  the diagonal nails need to be 3".  1-1/2" will barely protrude from the end of the 2x12.
Comment: I am inclined to agree on wanting more than a 2X to anchor into.   However on the diagonal nails (is this a misunderstanding - diagonal should be sideways NOT angled up) I refer you to the manufacturer's (Simpson Stong-Tie) website:  https://www.strongtie.com/resources/product-installers-guide/lus-installation.
Comment: How do you propose driving 3 inch nails into 1.5 inches of wood with steel behind it?
Comment: @MonkeyZeus Simpson makes "short" nails, but they also allow "double shear" nailing. Here's a chart showing their nails available:   https://www.strongtie.com/products/connectors/wood-construction-connectors/technical-notes/fastener-types-and-sizes  The contractor could have used the short nails into the wood member fastened to the steel beam and 3" nails fastening the joist to the hanger.
Comment: I wouldn't want any diagonal nailing when it's in the same direction as the forces on the nail. That's a disaster waiting for the nail to walk out. I would also think a joist like this would need to be attached to a double thick header or a 4x, which would accommodate the 3" nail, and what I think the hanger manu. expects. I would also think the hanger is supposed to be attached to the same or wider width board as the joist. With the header being smaller dimension, this seems like a totally botched install.
Comment: @Technophile Yes, the diagonal nails should be 3 inch.
Answer: Cutting a hanger is never a good idea and should never be accepted. It's shoddy workmanship by the contractor and there were numerous solutions that could have avoided this (starting with properly measuring the bolt locations for the web blocking). However, the main issue is that these hangers are not designed for this application. They are meant to hang joists from solid sawn wood beams, typically 2 or 3 2x members in a laminated configuration. These can also go into a ledger designed for them, but web infill blocking. Is not typically designed for this for a number of reasons. Simpson makes top flange mount hangers that should have been specified instead (whether by the engineer or the contractor) and either welded or pinned to the steel since that is the actual structural member. Sounds like your contractor should be to blame for most of this in my eyes, although the engineer certainly could have done better as well.
Source: licensed architect
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to contribute here.
Answer: You never cut hangers unless they  are made for cutting.   Call in a inspector who will advise you or the engineer who done the design but don't under any circumstances let this go without it being checked. As further down the line could cost you a lot of money.
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to contribute here.
Answer: I'm familiar with that double shear hanger. Nails should be 10d 3" for the cross nailing and 10d 3" or 10d 1-1/2" depending on single or double 2 x material rim joist/header. However it's the wrong hanger for the application. It might have been ok if the rim/beam/header was constructed differently. And never modify a framing hanger other than bending those meant for it. The through bolts should have been laid out to avoid conflict with the joists.
Comment: How are they the wrong hanger? You don't make that clear.
Comment: @Technophile, you seem to have misunderstood my question. I'm asking Rick to clarify and substantiate his statement for the sake of a better answer. I don't need a lesson in construction, having been involved since childhood and as a professional for many years. Also, neither of you linked to any supporting documentation, which is how things are commonly done on the internet. "Have a look at a website" doesn't get us very far into a conversation.
Comment: @isherwood please have a look at the Simpson Stong-Tie website. Framing connectors have specific approved applications, based on mechanical engineering analyses and testing. Framing construction is regulated via building codes, permits and inspections because people can die (or at least sue) when houses fall down. Construction can look simple, and there are many who will happily wade in with a hammer, saw and little skill, knowledge or understanding.
Comment: Thanks Rick and everyone for all the responses. Rick, can you please explain which hanger would be more suitable? Is the issue with the current header that it is only 2x8 with 2 layers of 1/2" plywood? Any suggestion on what can be done to rectify? For the bolts should the existing bolts be moved to a different location or should the existing joists be sistered?
Answer: It appears to be horribly wrong. The hangers should not be cut but this is the least of your worries. For starters, the steel I-beam is shorter than the joist it's intended to support. The bolts connecting the wood header to the i-beam are undersized. The wood headed bolted to the I-beam is shorter than the joist it is intended to carry.
There are a few ways to correct this:

You can use Simpson's top mount joist hanger and use the I-beam to support the joists. This would require gaining access to the top of the I-beam by removing the subfloor (and any finished floor) above.
Depending on the condition of the wood header inserted in to the I-beam you may be able to add another header to the one you have. The new header should be the same size as the joist, and must be laminated and bolted to the I-beam with no less than 3/4" diameter bolts spaced 2' apart in a top and bottom pattern to prevent splitting. Keep in mind that the bolts are carrying the load of the joists and must be strong enough for this. After this is done, install the face mount Simpson hangers. Use Simpson #10 x 3" screws where you can drive through both the original header and the secondary header. Otherwise, use Simpson's #10 x 1½ screws.
If you're able to get to a lumber yard, you may be able to get a 3" x 12" wood joist and use this in place of the header that's affixed to the I-beam. You would have to notch a section of the 3 x 12 joist so that it can fit into the I-beam while still keeping the 12" width on the outside of the I-beam. The 3 x 12 must be bolted the same way as in option 2 above and the perpendicular joists can be face mounted with the same screw detail as in option 2.

There's one or two other options but these three should be the least complicated to achieve.
Hope this helps.
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to contribute here.
Comment: Thx for all your responses. Our engineer has asked the contractor to move the bolt locations so that they don't interfere with the hangers. For the hangers he wants to use LRU28 instead. We also checked with Simpson and they confirmed that LRU28 can be used in our case but recommend that we use SD10x1½" screws into the face flanges and SD10x2½" screws through the double shear joist fasteners.

Question:
A few joists are not sitting flush with the beam and have as much as a 1/2" gap at the top and 1/4" gap at the bottom between end of joist and steel beam. Any concerns with this spacing?
Comment: @user105375 You might want to make this a new question.
Comment: Thanks I have created a new question.


Hyperparameter tuning with multiprocessing pool

Question: I have the function for tuning hyperparameters for the model
def modelHPTuning(X_train, y_train, hyperparams):
    classifier = ExtraTreesClassifier()
    grid = GSCV(classifier, hyperparams)
    grid_result = grid.fit(X_train, y_train)
    best_hyperparameters = grid_result.best_params_
    return best_hyperparameters

best_hyperparameters = modelHPTuning(X_train, y_train, XRT_Hyperparams)

For multiprocessing, I tried
pool = Pool(4)
best_hyperparameters = pool.starmap(modelHPTuning, X_train, y_train, XRT_Hyperparams)
pool.close()

getting error
TypeError: starmap() takes from 3 to 4 positional arguments but 5 were given

I tried
zip(X_train, y_train, XRT_Hyperparams)

getting
AttributeError: 'str' object has no attribute 'keys'

How to fix the arguments, GSCV function is just creating a grid space for GridSearchCV
Comment: It would be helpful (mostly to you, ultimately) if we knew what types `X_train`, `y_train` and `XRT_Hyperparams` were,  what type of parameters `modelHPTuning` was expecting and *where* you were getting the exception.
Comment: X_train, y_train are ndarray of shape (1050.18) and (1050.), XRT_Hyperparams is a dictionary of parameters {'n_estimators': [100,200,300,400],'max_depth': [2,3,4,5]}, starmap exception is from args of pool.starmap
Answer: You didn't really answer what type of parameters modelHPTuning was expecting. Its arguments X_train, y_train, hyperparams cannot be the same type as the actual values being used in starmap :X_train, y_train, XRT_Hyperparams.
The arguments to starmap is a function and a single iterable. If that function takes, for example, two arguments (we'll call them x and y), then that single iterable will typically be a list or tuple containing one or more lists or tuples each contains two elements for the two arguments  that the function takes. For example:
from multiprocessing.pool import Pool

def f(x, y):
    print(x, y)

if __name__ == '__main__':
    x = [9, 10]
    y = [90, 100]
    with Pool(2) as pool:
        pool.starmap(f, [[9, 90], [90, 100]])

Prints:
9 90
90 100

In other words, you must be passing to starmap a function and multiples of the type(s) of value(s) that the function is expecting.
If you have the x and y values to be passed to function f in individual iterables, then you would use builtin function zip to create the single iterable required by starmap:
from multiprocessing.pool import Pool

def f(x, y):
    print(x, y)

if __name__ == '__main__':
    x = [9, 10]
    y = [90, 100]
    with Pool(2) as pool:
        pool.starmap(f, zip(x, y))

Prints:
9 90
90 100

If your function f has one or more arguments for which you need to always pass the same value (in the following example argument caption), the easiest way to do that is to use function functools.partial:
from multiprocessing.pool import Pool
from functools import partial

def f(x, y, caption):
    print(caption, x, y)

if __name__ == '__main__':
    x = [9, 10]
    y = [90, 100]
    with Pool(2) as pool:
        pool.starmap(partial(f, caption='The values are:'), zip(x, y))

Prints:
The values are: 9 90
The values are: 90 100

The other way to accomplish this if you are using zip to build your parameter list for starmap is to use itertools.repeat, but this can be far more costly:
from multiprocessing.pool import Pool
from itertools import repeat

def f(x, y, caption):
    print(caption, x, y)

if __name__ == '__main__':
    x = [9, 10]
    y = [90, 100]
    with Pool(2) as pool:
        pool.starmap(f, zip(x, y, repeat('The values are:')))

Prints:
The values are: 9 90
The values are: 90 100

With the above examples, you should now be able to figure out what you need to be using as values for starmap and arguments to modelHPTuning.


Packing and Unpacking Structs of GTiff files

Question: I am working with an NDVI script that I did not write and I am trying to get it to run.  The problem it's having is the old Type Error: Can't convert bytes object to str implicitly.  I had never seen the struct package until yesterday, and after quite a bit of research I understand the concept generally, but not exactly specifically.
I am dealing with tiff files and trying to create an NDVI image.  Here is the code sample.  If anyone could help me understand this a bit more and help me solve the problem I would greatly appreciate it!
## The function which loops through the input image and
## calculates the output NDVI value to be outputted.
def calcNDVI(self, filePath, outFilePath):

    # Open the inputted dataset
    dataset = gdal.Open(filePath, gdal.GA_ReadOnly)

    # Check the dataset successfully opened
    if dataset is None:
        print("The dataset could not be opened")
        sys.exit(-1)

    # Create the output dataset
    outDataset = self.createOutputImage(outFilePath, dataset)
    # Check the datasets successfully created
    if outDataset is None:
        print("Could not create output image")
        sys.exit(-1)

    # Get hold of the RED and NIR image bands from the image
    # Note that the image bands are hard coded to handle
    # landsat 8 TIFFs that produce separate images per band
    # which are mosaiced together where
    # Red = band 1 and NIR = band 2
    red_band = dataset.GetRasterBand(1)
    nir_band = dataset.GetRasterBand(2)

    # Retrieve the number of lines within the image
    numLines = red_band.YSize

    # Loop through each line in turn:
    for line in range(numLines):
        # Define variable for output line
        outputLine = ''

        # Read in data for the current line from the
        # image band representing the red wavelength
        red_scanline = red_band.ReadRaster(0, line, red_band.XSize, 1, \
                red_band.XSize, 1, gdal.GDT_Float32)
        # Unpack the line of data to be read as floating point data
        red_tuple = struct.unpack('f' * red_band.XSize, red_scanline)

        # Read in data for the current line from the
        # image band representing the NIR wavelength
        nir_scanline = nir_band.ReadRaster(0, line, nir_band.XSize, 1, \
                nir_band.XSize, 1, gdal.GDT_Float32)
        # Unpack the line of data to be read as floating point data
        nir_tuple = struct.unpack('f' * nir_band.XSize, nir_scanline)

        # Loop through the columns within the image
        for i in range(len(red_tuple)):
            # Calculate the NDVI for the current pixel
            ndvi_lower = (nir_tuple[i] + red_tuple[i])
            ndvi_upper = (nir_tuple[i] - red_tuple[i])
            ndvi = 0
            # Be careful of zero divide
            if ndvi_lower == 0:
                ndvi = 0
            else:
                ndvi = ndvi_upper/ndvi_lower

            # Add the current pixel to the output line
            outputLine = outputLine + struct.pack('f', ndvi)

            # Write the completed line to the output image
            outDataset.GetRasterBand(1).WriteRaster(0, line, red_band.XSize, 1, \
            outputLine, buf_xsize=red_band.XSize, buf_ysize=1, buf_type = gdal.GDT_Float32)

            # Delete the output line following write
            del outputLine

And the output when ran:
outputLine = outputLine + struct.pack('f', ndvi)

TypeError: Can't convert 'bytes' object to str implicitly

Again, any help is greatly appreciated!  Also, there are several questions on this site and elsewhere about this particular struct error, but nothing that deals with images specifically.
Thanks!
Answer: Ok I figured out the answer if anyone has a similar question and this stays up!  The output line that was causing the error:
outputLine = outputLine + struct.pack('f', ndvi)

Can be fixed with a very simple solution:
outputLine = outputLine + str(struct.pack('f', ndvi))

Python cannot convert bytes object implicitly, but you can do it explicitly.


How clean up linseed oil stains after spill on stone patio?

Question: A contractor spilled linseed oil on my stone patio, staining a large area. I tried cleaning the stone with simple dish soap & water, and it had absolutely no effect. I fear that the oil has been absorbed. Any other suggestions for a cleaning method, one that won't discolor the stone during cleaning?
The stained surfaces are bluestone, brick, and some random rocks.
Thank you for any suggestions.
Comment: Why don't people have contractors clean up messes made. They're paying for a quality job, and that includes not messing up other stuff?
Comment: 1. Use an excess of turpentine/mineral spirits to dissolve the linseed oil then sop it up. 2. Steam clean.
Comment: Related: https://diy.stackexchange.com/q/83299/21138
Comment: Linseed is a drying oil, so this comes *way* too late, but limonene, orange oil, is mighty good at lifting unwanted oil spills. Put a generous amount on the the spill, equal volume or so, scrub the Dickens out of it, and hose off. Likely even after an hour, far less a day, some of the linseed has oxidized/polymerized, and is *not* coming out.
Comment: Note that orange oil is a pretty general less-toxic alternative to turpentine.
Comment: (not NON toxic, mind you)
Answer: If the area isn't unreasonably large a poultice of talc and mineral spirits should work. You could purchase a commercial poultice preparation if you don't care to play Kitchen Chemist, but it may take some shopping to find a large tub rather than the small jars marketed for countertop maintenance.
For areas too large for that but too small to have steam cleaned your best bet is probably a commercial degreasing product (or copious amounts of mineral spirits) and your garden hose. Soaking the area first should help by saturating the stone so the solvents won't be able to carry more contaminates into the stone.
Answer: Caustic soda.
Make a thin paste with water.
This stuff will eat flesh, be careful.
Clean up with lots of water, then club soda or white vinegar to neutralise any residue.
If your stone has any moss it will die so there will be a visible change, you may need to bleach your whole patio afterwards.