Level hardwood floor that was covered by baseboard

Question: I recently removed my baseboard to be able to put the free standing wardrobe close to the wall.
I noticed that the approximately 1 inch of floor where the baseboard was sitting on is a little higher than the rest of the room - don't know why. Maybe it was an old floor?
I need to level the floor, or even remove it, so the wardrobe sits straight on the floor.

What would you recommend? Using a rotary tool with a sanding drum would do it?
This "uncovered" floor is maybe 1/6 inch higher than the rest of the room.
A little less than 1 inch wide (baseboard depth) and 60 inches long.
Ideally I should not remove it, because there will be a gap.
Thanks!
Comment: From the picture it's hard to tell.  Is it an additional layer of material on top of the wood or does it look like the floors were refinished at some point and they just couldn't sand that close to the wall (so it's thicker and all one piece)?
Comment: I'm having trouble identifying the issue from the description and picture. Maybe an arrow or two showing exactly what you're talking about would help.
Comment: @JPhi1618 I included a new picture, hope it helps!
Comment: @FreeMan I included a new picture, hope it helps!
Comment: I think the new picture helps. If I understand, that piece pointed to by all the red arrows sticks out beyond the plaster, such that if you put a square on the floor and push it toward the wall, it will hit that piece _before_ the blade of the square touches the plaster. If that's the case, I'd agree with [isherwood's answer](https://diy.stackexchange.com/a/160857/34147) - cut out a small section of that piece of wood.
Comment: When you remove that piece, there _will_ be a bit of a gap (though you could chisel _down_ to remove only the portion that sticks out beyond the wall), however, it will be inconsequential since it will be hidden by the wardrobe. When you remove that, you'll reinstall the baseboard which will also hide the gap. It's what I've heard framing carpenters call "trim to fit". i.e. once the trim is in place, everything "fits".
Answer:
Make a cut using whatever small saw you have on hand--keyhole, reciprocating, oscillating--at each side of the opening just down to floor level.
Use a chisel or other sharp tool to split the grain at floor level, shaving off a thin strip.

<code>_________ ___________________ ____________ <-- top of protruding board
_________|___________________|____________ <-- floor level
               ^-- chisel here
         ^-- vertical cuts --^
</code>
Alternatively, install some plastic feet on the front of your wardrobe and forget about it.
Comment: Could you explain a little better this cut? Cut horizontally ou vertically? Thank you!
Comment: "Down to floor level" implies vertically. "At floor level" would've meant horizontally. :)
Comment: based on the new pictures, I think the cutting method is the right approach. I don't think the feet will work, OP seems to want the front to be flush with the floor (here's hoping the floor is perfectly level...)
Comment: Flush with =/= tight to. https://www.carpentry-tips-and-tricks.com/Carpentry-Terms.html#F
Answer: I don't think that's "old floor", I think that because you removed the wallboard, you are into the interior stud wall structure and that is the top surface of the bottom plate of your wall. I like the idea of just putting some little feet or pads on your wardrobe to raise it up over that lip.
Comment: But then there will be a gap accumulating dust underneath the wardrobe. If I fix this little higher floor, then it will be sitting on the floor correctly.
Comment: The bottom plate is the larger board with the cut mark on it.


Keyboard-shortcut key-press-detection sensitivity settings

Question: last week I switched from Ubuntu 10.10 to 12.04 and after setting up my keyboard shortcuts, e.g., Ctrl+Alt+E for my favorite editor and Ctrl+Alt+X for the terminal, I noticed that the behavior when pressing the appropriate keys changed somehow.
I know this is very subjective and I am not 100% percent sure if I am suddenly just too lazy when using my keyboard, but here is what I noticed:
To run your shortcuts, you usually press the modifiers first and in addition press the alphanum key. Now, if I hold the modifiers down very consciously and press the alphanum key afterwards everything works fine. However, I noticed that I may often release the modifiers a bit too early. In Ubuntu 10.10 (metacity/compiz) my keyboard shortcuts would still execute and my tools would pop up. This does not work anymore in 12.04. Nevertheless, I still believe the old behavior to be more intuitive and would like to have it back.
I a nutshell: Is there a parameter to control the shortcut-key-press detection behavior?
I already searched the ubuntu keyboard options and searched for "keyboard" in gconf-editor but could not find any hints so far.
Answer: Yes there is in the compiz settings. To install it:
<code>sudo apt-get install compizconfig-settings-manager
</code>
Compiz is a compositing manager, which means that it enhances the overall user interaction by adding fancy effects to your windows, from drop shadows to awesome desktop effects like the Desktop Cube or the Expo view.
Compiz can also be a window manager, which means that it is the software between you and your desktop apps. It enables you to move or resize windows, to switch workspaces, to switch windows easily (using Alt-Tab or so), and so on.
You can install Compiz Setting Manager on Ubuntu 12.04 Precise Pangolin/Ubuntu 11.10 Oneiric Ocelot/Ubuntu 11.04 Natty Narwhal/Linux Mint.
There is the respective setting you will be able to edit the shortcut keys.
Comment: I already have it, but thx for the hint. I thought the compiz settings would not work for unity2D (using 2D because it is more compatible with my fullscreen wine games). I could delete my shortcuts in the ubuntu settings and move them to the compiz settings. Very good! The compiz detection works much more intuitive, now I can again use my lazy shortcuts. Answer accepted!


Block process from using port

Question: For some reason, Foxit Reader likes to listen on port 23119. I don't know why it does this.
I want to block a specific process (Foxit Reader) from using a specific port (23119), becacuse it interferes with other programs that use this port (and actually do something useful).
How can I do it?
Comment: Maybe one day https://github.com/evilsocket/opensnitch would work, but there does not seem to be any release yet
Comment: How are you determining it's using the port? Just tried it an in my case it doesn't listen on the network, just some unix sockets that are probably for internal use of QT and should not interfer with something else.
Comment: @SebastianStark Cool! It's not packaged, but it provides instructions for building it from source. The [main site](https://www.opensnitch.io/) links to that GitHub page for downloading. Do you recommend against using it? If not, do you want to post an answer about it?
Comment: I have never tried it, so it does not feel right to recommend it. I do not even know it can prevent a process from _listening_ on a port.
Comment: @user535733 Unfortunately, FoxitReader has the nicest interface for PDF annotation on Linux. Okular is also good, but it requires a lot of KDE libraries that I do not wish to install.
Comment: @SebastianStark `netstat`
Answer: Here are four ways. Pick one you like best.

IPTables (the Linux Firewall) can intercept inbound packets, so the listener never receives them. IPTables is part of the Linux kernel, included with every install of Ubuntu. Several simpler frontends to IPTables (ufw, gufw) are in the Ubuntu repositories. This is the easiest method for most users...however your case is unusual (port conflict), so it may not work for you.
An AppArmor rule could prevent port use by an individual program...if/when this functionality is finally implemented (See LP:796588). However, the act of prevention might crash the program.
The application itself may offer a setting. You may need to approach the upstream developers and ask nicely for this. They might say yes, or not - they might have the listener there for a very good, innocent reason.
When using open source software, you can edit the source and recompile. Of course, this requires many requisite skills, and is recommended for fairly advanced users only.

Since your case is a port conflict (two applications trying to use the same port), one possible solution is to start the application you want bound to the port first. After the port is bound, then you are free to start Foxit Reader.
Comment: As far as I know AppArmor can confine network traffic only at socket level, not port level. So you could block it from using TCP, but not a specific port.
Comment: If you block the port with IPTables, it will also not be possible to use it with another program, as OP wants.
Comment: @SebastianStark edited the answer to address your great input.
Comment: Yes I believe that @Sebastian Stark is correct  on using apparmor for port blocking.  However, one could write a rule to block network access from foxit altogether.

Block process from using port


How to get specific element string from element in XML?

Question: I have this XML file and I want to fill my list with only article id and item_description value.

<?xml version="1.0" encoding="utf-8"?>
<articles>

    <item_description>Mobitel Smasung</item_description>
    <single_price>Kom</single_price>
    <unit_of_measure>1250</unit_of_measure>

    <item_description>Mobitel DA</item_description>
    <single_price>WD</single_price>
    <unit_of_measure>232</unit_of_measure>

</articles>

This is what I got so far:

        public void LoadAllArticles()
        {
            XDocument xdoc = XDocument.Load(defaultDataPath + @"\saved_articles.xml");

            foreach (var article in xdoc.XPathSelectElements("articles/article"))
            {
                articles = article.Descendants()
                               .Select(element => element.Value)
                               .ToList();

            }
        }

How to load only id + " " + item_description to the list?
Answer: Since you want the id attribute from the parent article, move the call to Descendants() into the Select() lamdba to perform the string concatenation (skip the foreach loop):
    articles = xdoc.XPathSelectElements("articles/article")
                   .Select(art => art.Attribute("id").Value + " " + art.Descendants().FirstOrDefault(node => node.Name == "item_description", "<no description>"))
                   .ToList();

Comment: That way I get "XElement does not contain a definition for Select"
Comment: @SebastianMarjanović Sorry, I left out an important detail, you need to use `Select()` on the whole collection of article elements, answer updated
Comment: Thank you very much, will give it a go! Am new to handling xml files
Comment: Output is i1 Mobitel Šmasung, is there any other way to remove the tags or should I just string.Replace();
Comment: @SebastianMarjanović `.Value` at the end should give you just the inner text :)


How to create/update a many-to-many relation where order/index matters?

Question: Let's say that you're creating a music app. You have a table of playlists and a table of songs. How would you model that relationship of song order in a playlist in a SQL environment?
Requirements:

Each playlist can have multiple songs
Song order in the playlist matters
Each song has its own rich information (artist, album, etc.)

On the client side, this is easy, just have an array of product ids on the playlist, and get the song information from those. If the order changes, just update the array and push a new one. Computationally intensive but very easy to reason about and no chance of a doubled index entry.
In relational database world, normally for a many-to-many relationship, you'd use a junction table. Where each playlist_id corresponds to a song_id. You could add a column for index, but then when you update the order of a playlist, you have to rewrite the order of all the indexes.

id
playlist_id
song_id
index

1
1
50
1

2
1
24
2

3
1
21
3

4
2
12
1

I'm struggling to find an answer to this question.
For my specific situation, I'm currently using Supabase and their Javascript SDK which references a hosted PostgreSQL database and everything is done from a client side app with queries. I don't know how to write an SQL function that would deal with this. It all seems like it'd be very complex compared to just pushing a new array each time, even though it's the "correct" way. It doesn't look like PostgreSQL supports an array of foreign keys yet, so is there a better way?
Comment: Your q is very hard to follow: so many words, no diagrams, no schema. If it's essential to maintain an ordering, and there's no 'natural' field that tells the ordering (I can't see one amongst your words), then you need to introduce an extra column purely for the purposes of relative ordering. Its values don't matter, providing you can insert enough steps in the sequence. Please show what design you've arrived at already, then we can discuss.
Comment: BTW fields purely for sequencing steps are very common in schema designs for assembly-line manufacturing; each step needs certain components to 'bolt on' to the assembly.
Comment: @AntC made a much clearer example with diagrams that I think more people can relate to. I think I have the correct model, it's more "how do I write an SQL function to update the ordering" that I don't understand.
Answer:
In relational database world, normally for a many-to-many relationship, you'd use a junction table.

Yes, and that junction table would be 'all key' -- that is in this case its schema would be its key would be {playlist_id, song_id}.
Presumably (you don't say this) a song can appear on many playlists, and at a different sequence in each. Furthermore you can't infer index from any other table.  index is only held on this table. Also (I guess) a user might resequence their playlist by shuffling the same set of songs.
Adding index means you no longer have a junction table. But you do still have a table (one of) whose key(s) is {playlist_id, song_id}. There might be an alternative key {playlist_id, index}, or if a user inadvertently shuffles two songs to the same position on a playlist, that might be allowed, and you'll use song_id to resolve ties. (That's what I'd do, to keep it simple. In a manufacturing step, that's like saying I need 4 bolts and 2 clips here, but it doesn't matter which order you attach them.)
What you don't want or need is an additional id in this table. It does nothing but get in the way of the true key(s) and, as you say, trying to shuffle the order would give a maintenance headache. Perhaps you're not aware any table can have a composite key.


disable a menu permenantly in android

Question: I would like to be able to disable a menu item after it is chosen. That is, the menu item is available only at the first time it is set. Then onwards it should be completely disabled. How can I do this?
I tried the following:
  MenuItem mi=menu.findItem(R.id.item1));

And used this code to disable it after "firstrun"
 mi.setEnabled(false);

However, once I force stop the App and go back to it again. The menu item is enabled.
How can I prevent this and disable it permenanly?
Thanks.
Comment: Clue - sharedPreferences.  Google is your friend.
Answer: You have to persist your data somewhere. In this case, I'd suggest using Shared Preferences which is the preferred way to store simple booleans and other small data, each with a specific key. In your case, once the user has clicked on the menu item, call
// Where this is a Context such as your Activity
SharedPreferences sp = PreferenceManager.getSharedPreferences(this);
sp.edit().putBoolean("MENU_CLICK", true).apply();
// Use commit() in place of apply() if you support pre-Gingerbread devices

Then in your onPrepareOptionsMenu(), retrieve the shared preference by using
SharedPreferences sp = PreferenceManager.getSharedPreferences(this);
// default false to show on first run
final boolean haveClickedMenu = sp.getBoolean("MENU_CLICK", false);
mi.setEnabled(!haveClickedMenu);

disable a menu permenantly in android


What would happen if you married Aela and did the mission for the Dawnguard DLC where you have to turn you spouse into a vampire?

Question: I was wondering this because she is a werewolf and I'm a vampire.
Answer: From this UESP page:

This quest will not be offered if you are married to any of the following people:

Aela the Huntress

You can't turn Aela into a vampire.


Using requestAnimationFrame more functional

Question: I had to resort to the requestAnimationFrame function as the use of settimeout didn't work synchronously. (Due to slowing down or stopping on tab changes.)
However, to make requestAnimationFrame simpler to use (Taking the settimeout syntax as an example), I want to make something that I can use unlimitedly.
I currently have a code sample below.
However, as I said, I want to make it unlimited and flexible. There may be a mistake in the codes.
let start = 0;
let delay = 1;
let num = 0;
function loop(timestamp)
{
    var delay_timestamp = delay*1000;
    if(timestamp - start > delay_timestamp)
    {
        start = timestamp;
        console.log(num++);
    }
    requestAnimationFrame(loop);
}
loop();

The style I want.
I am aiming to make the requestAnimationFrame function more functional without using settimeout.
I aim to make the requestAnimationFrame function more functional. By specifying how often each function will be called. For example, this could be a function called new_loop.
new_loop(function_name_1,1000);
new_loop(function_name_2,4000);

In summary, I want to make it more functional, as in the example above. Thank you for your help.
Comment: *as the use of settimeout didn't work synchronously.* Huh? `requestAnimationFrame` isn't synchronous either
Comment: @CertainPerformance I mean the slowdown in tab switching etc.
Comment: Do you mean that the throttling of inactive tabs is the problem, because it throws off your timing?
Comment: `However, to make requestAnimationFrame simpler to use (using the Settimeout example), I want to make something that I can use unlimitedly.` you can use requetAnimationFrame as often as you'd like
Comment: @Bravo Yes I know but I want to do this in a function that I can use indefinitely.
Comment: can you show some code that demonstrates what you want, even if it seems to make no sense,  because your words aren't making sense ... you keep referring to not using settimeout, and the settimeout example ... there's absolutely no settimeout in your code, so there is no settimeout example to help understand what it is you want
Comment: @Bravo I already have nothing to do with settimeout. I aim to make the requestAnimationFrame function more functional. By specifying how often each function will be called. Did you review the code that I specified as the style I want?
Comment: Ahh, the edit make it more apparent what you want
Comment: @Bravo I hope I explained. I'm waiting for your help. I'm asking and wondering about the code structure of the function called new_loop.
Answer: If I understand, you want to use requestAnimationFrame to "power" a setTimeout-like function
I believe the following is what you want

const animationTimeout = (cb, ms, ...args) => {
    const go = start => {
        const anim = now => {
            if (start + ms <= now) {
                return cb(...args);
            }
            af = requestAnimationFrame(anim);
        }
        af = requestAnimationFrame(anim);
    }
    let af = requestAnimationFrame(go);
    return {
        cancel: () => cancelAnimationFrame(af)
    }
};
console.time('test');
animationTimeout(() => console.timeEnd('test'), 2000);

// this one will be cancelled before it triggers
const x = animationTimeout(() => console.log('you will never see this'), 2000)
setTimeout(() => x.cancel(), 1000);

and for interval

const animationInterval = (cb, ms, ...args) => {
    const go = start => {
        const anim = now => {
            if (start + ms <= now) {
                cb(...args);
                start = now;
            }
            af = requestAnimationFrame(anim);
        }
        af = requestAnimationFrame(anim);
    }
    let af = requestAnimationFrame(go);
    return {
        cancel: () => cancelAnimationFrame(af)
    }
};
const interval = animationInterval(() => console.log(new Date), 1000);
setTimeout(() => interval.cancel(), 5500);

The only thing the above does NOT have is a way to cancel the timeout/interval - but thats pretty easy to add
edit: added cancelling
Comment: How can I use the function to be called here? I have not seen an example of this. How can I run a function called write every 2 seconds with the method you wrote? That's what I meant by using unlimited. I want to run a function called read every 4 seconds using the function you made on another line?
Comment: erm ... it's just like using setTimeout .... I even have an example in the snippet ... isn't that what you wanted? a setTimeout-like funciton that uses animation frame?
Comment: In other words ... in your question, where you use `new_loop` - that would be this answers `animationInterval` if it runs every n milliseconds, OR, this answers `animationTimeout` if it runs once after n milliseconds - sorry I didn't make my function names as un-descriptive as you wanted
Comment: How can I get console.log(new Date) to call a function called write() instead. Could you add an example where a function is called instead of a console.log?
Comment: do you know how to use setTimeout/setInterval? that's how - a function IS called `() => console.log('xxx')` IS a function - do arrow functions confuse you?
Comment: ok ... so you know how in your question you have `new_loop(function_name_1,1000);` .... replace `new_loop` with `animationInterval` ... tada - done - or, copy my answers code, and instead of calling the function `animationInterval` call it `new_loop` ... tada - done - no rocket surgery required
Comment: @perfectmorn - I probably did not understand what you want - seems the code I posted has done more to confuse you than help you - maybe you should explain more about what you want (in your question)
Comment: const interval = animationInterval(() => write(), 1000); When I use it like this, will the write function be executed?
Comment: your question has no such code, so how the heck should I know @perfectmorn  ... how about you do `new_loop(function_name_1,1000);` like in your question - except use my better name `animationInterval` (or `animationTimeout` - whichever is appropriate to your requirements)
Comment: I think you didn't read the question twice. What did I say? "I aim to make the requestAnimationFrame function more functional. By specifying how often each function will be called. For example, this could be a function called new_loop." Your code seems to partially handle this. The only difference is that it runs the function name I wrote.
Comment: huh? I read the question ... looks like you want something that works like setInterval, but uses requestAnimationFrame ... that's what `animationInterval` does ... exactly - I originally thought you wanted a setTimeout replacement, since all you did was talk about setTimeout, never setInterval ... you know the difference, right? One triggers once, the other multiple times? Anyway ... I probably don't understand what you want becaue your question doesn't actually describe what you want


GFCI Breaker in Main Panel

Question: 5 Outlets in bedroom on the same breaker. None of them are GFI outlets. Outlet 1 works, Outlet 2 is a switch controlled outlet. Switch works the bottom half of outlet and it works, top half is power and it doesn't work. Other 3 outlets are dead. Any suggestions?
Comment: Check the connections in outlets 1 and two.  Look for backstabs being used. turn off breaker before doing any checking.
Comment: Can you post photos of the inside of the box for outlet number 2 please?
Comment: Does sound like a loose connection, my first choice would be a loose connection in the switch. Hot makes it to switch but not to outlet. It seems like a loose connection in a receptacle would not feed the switch.
Comment: Hello, and welcome to Home Improvement. We'll need more info before we can help you. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to participate here.
Answer: I would be looking at the switched outlet.
If your 1,2,switch are from the closest to your panel I would go to the switched outlet first as it is quite common for a failed backstab to have this problem at the last working outlet or first non working.
you know the switch is getting power and if backstabs are used switches are normally fed by a pigtail.
When the switched outlets other side is fed by a back stab that would be the most likely place, if not there the switch box would be my next check.
If you pull the outlet out and everything starts working the wires need to be moved from the backstabs to the screws. If the outlet has been damaged (melted from arcing) replace it.

GFCI Breaker in Main Panel


How to Install CA Certificate on Android devices in AWS Device Farm

Question: As per our requirements we are expected to install our CA certificates on end user devices (for Android) manually or pushed the certificates though MobileIron service for our users. After successful installation of CA Certificates only, our App Users can benefit our services.
As of now i don't see any option to install CA Certificates on Android Device which is located in AWS Device Farm before running my appium tests.
is there any way to achieve it or any one successful with that.
Answer: This is not a supported scenario for Device Farm today.
Device Farm will review the requirements for possible solutions.
Comment: Thanks Hongda Zhao.


How can I place text inside an SVG circle with React JS?

Question: I have the following code:
import React from 'react';

var SVGComponent = React.createClass({
    render: function() {
        return <svg {...this.props}>{this.props.children}</svg>;
    }
});

var Circle = React.createClass({
    render: function() {
        return <circle {...this.props}>{this.props.children}</circle>;
    }
});

var MakeCircles = React.createClass({

    render: function () {
        return(

                <SVGComponent height="110" width="500">
                    <Circle
                        cx="50" cy="55" r="45"
                        fill="none"
                        stroke="#F0CE01" strokeWidth="4" />
                </SVGComponent>

        );
    }
});
export default MakeCircles

I'm trying to get some text inside the circle but finding it absolutely difficult. Is there something/some add-on that can help me with this?
Comment: Sorry I took it out of the code because it didn't work. I've tried putting it outside of the SVGComponent tags, but it seems like I'd need to rely on positioning to get it to the right spot. I'm hoping there's a more elegant solution out there that may involve the SVGComponent or Circle classes I created.
Comment: I recommend getting rid of SVGComponent and Circle components. Using  or  instead, you'll have the same result. Unless you already know which extra properties or behaviors those components will address, I think they'll make your codebase (or sample) larger and complex, and never serve a purpose.
Comment: What do you mean exactly by "trying to get some text inside the circle" ? Where is this text in your example ?
Comment: Do you want the circle to be a set size, or adjust to the size of the text?
Answer: A circle is a layer, and so is a Text node. You have to have them as separate layers and make them look as if they belong together:
<SVGComponent height="110" width="500">
    <Circle cx="50" cy="55" r="45" fill="none" stroke="#F0CE01" strokeWidth="4" />
    <text textAnchor="middle" x="250" y="55">Circle Text</text>
</SVGComponent>

Comment: Tiny thing: `text-anchor` should be `textAnchor` in React.
Comment: this didn't work for me.. only the text renders
``
``
` Circle Text`
``


Is there a special name for a 3 foot long drill bit, and where can I buy them?

Question: I'm looking at the websites for our local hardware stores (Rona, Totem, Home Hardware, Home Depot) for a 3 foot long drill bit, but all I'm coming up with is standard bits.
The problem is that it's probably a specialized tool and might even have a special name.
I need a drill bit long enough to punch a hole from my upstairs home theatre room into my basement server room.
Is there a special name for this bit and where might I find such a tool?
Comment: You can probably go to a local electrical wholesaler and pick one up.  36, 54, and 72 inches are the norm and you can even get extensions if you need longer.
Comment: Hahaha, this reminds me of [Spinal Tap](http://www.youtube.com/watch?v=wMVMHNG68m8&feature=related) so much. (Warning: NSFW language)
Comment: Bell-Hanger bit is one standard name, if becoming somewhat out-dated.
Answer: Try searching for "auger bit".
Answer: Klein Tools has some Flex Auger Bits and Extensions.
Next time you're at the Home Depot check the Electrical section.
Comment: I find these fun to use for some reason.  Most of them have a screw at the tip of the bit to make them self-starting too.
Comment: Ideal makes a good flex bit also. We always called them installer bits.
Answer: Try "installer bit"; the flexible ones are particularly nice. I have a 54" one, which is enough to run a line for a light switch into the floor below.

There's a hole in the drill bit, which lets you use it as a fish:
Comment: What is the wire mesh on your pull rod called? I had that at one of my high school jobs, but haven't been able to find it since and don't know its proper name.
Comment: @Kellenjb as far as I can tell, it's just called a "wire mesh cable pull" or "cable grip". A search for that finds a bunch of places where you can buy different sizes with different types of attachments. The one I have came with the installer bit.
Comment: Looks like it works like a chinese finger trap


Handling Mass Sentry as a Zerg

Question: I have once again battled with a Protoss. This time the build was a lot of sentries, a handful of stalkers and some Immortals. I want Roaches, Hydras, and Lings. The map was Lost Temple. Any clash just went with him dishing out a lot of Force Fields, outranging my roaches with Stalkers and trapping my lings. The hydras can fire but with only hydras as the only "functional unit' against a ton of Force Fields, I was sure crushed.
When protoss goes like this, is there anyway to deal with it using land units only and no Ultras?
Answer: On of my favorite ways to deal with an opponents who is running a lot of Sentries is a strategy called Brinkmanship.  Briskmanship was a technique first pioneered by Otto Von Bismark as part of his Realpolitik during the period leading up to the First World War.
The goal of Brinkmanship was to push events further down the road to a "Brink" without ever actually reaching it.  The belief behind this was that as events moved towards the edge one could confer a very real advantage as people would start to make mistakes.
Such a Machiavellian strategy is directly applicable to a mercantilistic situation like Zerglings vs Sentries.   Ultimately he would like to trade his Sentry energy for Zergling deaths at a fairly high rate of return.  As a result the more Force Fields you can cause him to waste through Brinkmanship the fewer remaining resources (energy) he has to invest in Zergling deaths (or Roach/Hydra deaths).
The goal here is not to engage your opponent until he has exhausted most of his supply.  You would think that it would thus work worst against an opponent who has a high supply of energy, but actually just the opposite is true; the more energy your opponent has the more likely he is to misspend it.  An opponent with few sentries will husband his forcefields until a full engagement is taking place.  By comparison the enemy with 10+ Sentries will be more willing to throw them away to try and catch a handful of Zerglings.
Ideally you want to engage your opponent, force him to throw down a forcefield, and then retreat with minimal damage.  The reason I like to use Zerglings for this, is that many players think of Force Fields as a direct counter to Zerglings and thus are more willing to expend them against advancing Zerglings.  Additionally, Zerglings are very fast (a 6 on creep with the speed upgrade) and have the best chance of getting out alive.  They are also cheap!
The actual execution of the technique will be to: Run your Zerglings at your opponent, as if to attack, and then dash back just before actually getting to melee range.  This feint is more effective if your opponent knows that the rest of your army is close behind.  Since Zerglings are the fastest Zerg land unit, it is not uncommon to see them as the harbingers of an attacking force.  Ideally, this will convince your opponent that this is an assault and he will expend forcefields.  Once he has started running out of forcefields to spend you can begin the real assault.
Remember, don't commit too early, its always better to wait as long as possible to engage as a Zerg because of the speed at which you reinforce.
The Advanced Class
Feinting and drawing out your opponents resources is a great technique, but a better player will start to realize this, so you're going to need a little extra gusto to punch through.  There have been a number of innovative strategies to provide that extra "umph;" tunneling Roaches, Doom Drops, Counters at their Main, etc; but one of the easiest consists of splitting your force in half and flanking them.  By attacking from multiple sides you're able to achieve much higher surface area and a much larger Arc.  The result is that they need many more force fields and much higher micro to deal with the situation.  Usually, even a good player won't notice he's fighting a battle on two fronts until one of them has collapsed.
Comment: is tzenes the 'Jon Skeet' of Gaming? [I mean seriously? Brinksmanship in Starcraft?!]
Comment: @GaiusSensei man this is the first inside joke i've seen involving two so websites
Answer: There are some ways to deal with mass sentries. You can use roaches and infestors which can move while burrowed to move under the force fields.
Glings can be pretty effective too if you separate them from the rest of your army, you have to micro them to trap sentries with their own force fields.
The best way to deal with force fields is to improve your micro and to upgrade burrow to avoid being trapped.
Answer: Meta game has changed and many patches introduced as well.  Brinksmanship as the the accepted answer has described doesn't really work.  An average platinum player these days will see this as baiting and not care to use force fields until the zergling force is fully committed.  Also, mutalisks do quite well against stalkers these days.  Number for number, mutas can definitely take on stalkers despite their increased cost.  Orrrr, you will be forcing your opponent to spend 150 / photon cannon as a static defense deterrent to mutalisks killing probes.  Basically, mutas are immune to force field, do well against stalkers despite being "anti-air" and destroy other units like zealots and colossi which can't attack them. just gotta pick off the stalkers or other ground units 1 by 1 via vigilant micro when you see their army making a move.  Stalkers are clumsy.

Handling Mass Sentry as a Zerg


Logical expression that "Someone takes a class and talks to others in the class."

Question: I would like to represent the statement

"There is a student registered to AI class who talks to other students that are registered to AI class."

to first order logic. I have come up with this but I am not sure if it is the correct solution:

$\exists x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \wedge \text{Talk}(x,y)$

I think it means there are two students that take AI and they talk. Should I change my answer to this:

$\exists x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \Rightarrow \text{Talk}(x,y)$

I changed the last "and" operator to make it sound like: "If there are two students that take AI, they are talking."
Which do you think is better? What seems like to be the difference? How would you represent the statement in FOL?
Thank you for your answers.
Answer: The first one is correct.
The second one says that there are two people such that if they are both students and take AI, then they talk. This is automatically satisfied by any two people (well, depending on what you're quantifying over, perhaps they don't even need to be people) who are not both students who take AI, whether or not they talk, so it says practically nothing.
Answer: Your change from:

$\exists x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \wedge \text{Talk}(x,y)$

to

$\exists x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \Rightarrow \text{Talk}(x,y)$

does not give you the right answer, but I think you were right to be concerned about the first answer, and in fact with the second one you were going in the right direction of what I think is the correct answer.
To explain this, go back to the original English statement:

"There is a student registered to AI class who talks to other students that are registered to AI class."

English (and all natural language) is notoriously ambiguous, but I think this is better interpreted as:

"There is a student registered to AI class who talks to all other students that are registered to AI class."

than as:

"There is a student registered to AI class who talks to some other student that are registered to AI class."

for the simple reason that the original statements uses 'students' and 'are', rather than 'student' and 'is'.
Your first logic expression

$\exists x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \wedge \text{Talk}(x,y)$

of course captures the

"There is a student registered to AI class who talks to some other student that are registered to AI class."

but in order to capture

"There is a student registered to AI class who talks to all other students that are registered to AI class."

you will need to use a universal.  Indeed, it is here that I think you were on the right track to try and paraphrase this as:

"If there are two students that take AI, they are talking."

although that is actually not quite right either, for now you are effectively saying that any pair of students that are both taking AI will be talking, i.e. that would translate as:

$\forall x,y: \text{Student}(x) \wedge \text{Student}(y) \wedge \text{TakesAI}(x) \wedge \text{TakesAI}(y) \to \text{Talk}(x,y)$

and that is too strong of a statement: all you know is that is some student taking AI who is talking to all other students taking AI, and so you need to do something in between:

"There is some student in AI class such that for any other student: If that other students is taking AI, then they are talking."

And that translates to:

$\exists x (\text{Student}(x) \wedge \text{TakesAI}(x) \wedge \forall y ((\text{Student}(y) \wedge \text{TakesAI}(y)) \to \text{Talk}(x,y)))$
Comment: I would actually interpret *"talks to some"* and not of *"talks to all"*. But as you say, it's ambiguous.
Comment: What to do if the source sentence is specific about "talks to some"?  That is not this problem, but could be another.  Why does a source, i.e. English, sentence, need to be changed so much to be translated?  The original sentence here does not say some or all.  So any logic sentence that says the the first student talks to at least two other student should be correct.  Does that imply there is more than one correct translation.
Comment: @GeoGraphy Note that you are actually giving another interpretation yet:  That the students is talking to at least *two* or more other students.  And yes, when in English we use 'some', we *often* mean two or more.  But in logic, the existential is used to express 'one or more'.  So yes, this all points to the inherent ambiguity in English .. or at least that English usage is 'conventional' ... but that those conventions can be sloppy and can change over time. So when you ask 'what is the correct translation', you really need to know what the author of the sentence meant.
Comment: @Bram28, Thanks.  You have reminded me of a conversations long ago about whether meaning came from the author or the reader.


What is the difference between a rivet setter and rivet header?

Question: What is the difference between a rivet setter and rivet header? What sort of rivets are they used for? Do they require the use of an anvil?
Answer: The setter seats the rivet into the workpiece. The header rounds the rivet shank over to lock the workpiece in place.
Whether an anvil is required probably depends on the particular project.


Creating a pointer directly from a typedef struct definition

Question: I  want to check what the following code means.  I think I am creating a pointer to a list of pointers to adjlistnode structures but I'm not sure.
Here is the code:
typedef struct adjlistnode {int node; int cost; struct adjlistnode *next;}
    **AdjMatrix;

I'm confused as to what **AdjMatrix actually is. Like I said above, I think it is a pointer to a list of pointers to adjlistnode structures but I'm not sure. Am I right in my assumption?
Comment: See [Is it a good idea to typedef pointers?](https://stackoverflow.com/questions/750178/) — TL;DR, the answer is generally "No", but function pointers can be an exception.  I'd not seen a typedef using pointer to pointer; it is mainly confusing and probably not very useful.  You'll do better reference `struct adjlistnode`, or making your own sane typedef: `type struct adjlistnode AdjListNode;` (choose your own capitalization scheme).
Comment: @JonathanLeffler - Personally I prefer aliasing the function type itself and declaring pointers to functions with the asterisk in plain sight. It also has a nice consistent feeling to it.
Answer:
I think it is a pointer to a list of pointers to adjlistnode structures

No, it isn't.
AdjMatrix becomes a type representing a pointer to pointer to struct adjlistnode
As an example it can be used like:
AdjMatrix p = NULL; // p is now a pointer to pointer to struct adjlistnode

The code seems to be for building a linked list and AdjMatrix seems to be a short hand for referring to a pointer to the head pointer. It could be used like:
void addNode(AdjMatrix pHead, int node, int cost)
{
    struct adjlistnode *tmp = malloc(sizeof *tmp);
    tmp->node = node;
    tmp->cost = cost;
    tmp->next = *pHead;
    *pHead = tmp;
}

void deleteNode(AdjMatrix pHead)
{
    if (*pHead)
    {
        struct adjlistnode *tmp = *pHead;
        *pHead = tmp->next;
        free(tmp);
    }
}

int main(void) {
    struct adjlistnode *head = NULL;

    // Add nodes
    addNode(&head, 1, 2);
    addNode(&head, 3, 4);
    addNode(&head, 5, 6);

    // ... use the list

    // Delete nodes
    while(head) deleteNode(&head);

    return 0;
}

Notice that typedef of pointers is often considered bad practice. Instead it would be better to do:
typedef struct adjlistnode {int node; int cost; struct adjlistnode *next;} AdjMatrix;

and use it like:
void addNode(AdjMatrix **pHead, int node, int cost)

to make it clear the pHead is a pointer to pointer to AdjMatrix
Comment: Thanks for the advice! This code was actually given to me as a starting point for an assignment and AdjMatrix is supposed to be an array of linked lists. I think it's clear for me now thank you!
Answer: The rules around a typedef can be simplified to the following generalization: if you have any valid variable declaration in C (without a storage class such as extern, static or register, etc.), then strapping a typedef at the front turns the variable name into a new type name, based on the type of the variable.
So here, without the typedef:
struct adjlistnode {int node; int cost; struct adjlistnode *next;}
    **AdjMatrix;

AdjMatrix is variable of type pointer to pointer to struct adjlistnode.
But in your post, because of the typedef, AdjMatrix is a name for the type pointer to pointer to struct adjlistnode.
Comment: It is obsolescent, but `long unsigned typedef long ull;` is a valid typedef — but the 'storage class' (or `typedef`) _should_ be first, and GCC will warn about it if pushed hard enough.
Comment: Thanks for answering so quickly! This makes more sense now!
Answer: From typedef [emphasis added]:

typedef is a reserved keyword in the C and C++ programming languages. It is used to create an alias name for another data type. 1 As such, it is often used to simplify the syntax of declaring complex data structures consisting of struct and union types, but is just as common in providing specific descriptive type names for integer data types of varying lengths.

The AdjMatrix is an alternative name of struct adjlistnode ** type, which is a pointer to pointer to struct adjlistnode.
You can use it to declare variables like this:
AdjMatrix pp_st_adjlistnode;

which means pp_st_adjlistnode is a pointer to pointer to struct adjlistnode.


Safe unicode string / name

Question: Assuming I have a form element that should allow pretty much any reasonable string that names something (IE like the title of this question).
How do I validate that the string is reasonable, and not something weird or unsafe? (Assuming here that something like Unicode emoticons☺ are reasonable)
Checking for all the escape chars like newlines, form feeds etc, is of course a given. Things like length is harder though, since an English descriptive name is very hard with just 1 char, but trivial in Chinese.
There are ~31 Unicode classes, which ones are safe?
What would a complete regex or similar check look like in Javascript or C#?
Comment: Well as long as you use parameterized queries for your sql commands, any input will be safe against sql injection. At that point you just need to specify in your database that the column you are storing data in is unicode. When you display any of the content you will want to ensure that you use HTML Encoding procedures, which are available in javascript as well as the majority of serverside scripting languages.
Comment: Just for context, what is it that you are trying to make it safe for? Is it safety for insertion into a database, or for XSS, or unvalidated user input?
Comment: All of the above.
Comment: `[A-Z]` is only option that is somewhat safe for all possible and plausible places to send such data. Even lowercase letters may break code using incorrect UTF-7 encoding... Definitely digits can be mistakenly treated as numbers with bad code... {end of trolling} - you need to define what you trying to achieve much better than "safe" for question to be answerable.
Comment: @AlexeiLevenkov an input like the title of this question
Answer:
How do I validate that the string is reasonable, and not something weird or unsafe?

It's not clear what you mean by 'unsafe'. As @gmiley said, you can't protect against injection issues like XSS by filtering input; this is an output escaping issue.
As for 'reasonable' a good starting place would be:

As you mentioned, disallowing control characters: U+0000–U+001F and U+007F–U+009F, minus newline and maybe tab if you want to allow those.
Especially for web applications, disallowing characters that are 'unsuitable for use in markup' according to the unicode-xml note. This prevents layout tricks like the Right-to-Left-Override.
Unicode normalisation (String.Normalize in C#), for example Normal Form C to standardise the code points for combining accents, or Normal Form KC to also flatten oddities like fullwidth text, which you might or might not want to do depending on audience.
If you don't like Zͪa̻͍l̀g̐ͦ͢oͬ̓ṯ̺ͮěͧ̚͞x͕̀̇ṱ̢͖̩̮̆̃ͤ you might like to consider limiting consecutive combiners.

Safe unicode string / name


Number of items in skeleton loader

Question: I have a list of users. When the list is first loaded a skeleton list is presented, so that the user will experience a (perceived) performance boost:
https://github.com/ksux/ks-design-guide/issues/38

What would be a good number of items in the skeleton, if some customers may have 5 users, and some may have 2,000?
Comment: I would say that showing a skeleton for something that is unknown is confusing (why show e.g. 6 items when a second later there are 3, or 30?). I think another approach altogether would be more appropriate here. Or talk to the devs, maybe they can provide the number of items in advance?
Comment: @NirSmadar note that facebook is doing this with an infinite list/scroll--which would be a bit different than a finite list of users.
Comment: On the back end, couldn't you efficiently index each customer's user count? So that you *do* know the number of users very quickly/up front, and then you do the longer query/load to actually load the users and metadata?
Comment: @JosefEngelfrost facebook are doing exactly that..
Comment: @J.Dimeo assume there's no solution through code here..
Comment: Be weary of what you think is a gain. Personally when Facebook is taking its time to load and shows me the skeleton list it reminds me that it is slow and that I am staring at nothing. I'd argue that a small spinner for new stuff above a rendered list of stuff it already had loaded for my timeline would be better... Letting me see actual content.
Answer: Assumption: You are talking about a results list that does not live on a separate page (full page experience) and I am assuming this is some sort of search or auto complete type of a feature.
What I learned:
In the studies I've done, a magic number for a list is between 5 and 9. If you display less than 5 users don't mind seeing more and after 9 information quickly becomes overwhelming.
Your example:
Short Answer:
Best practice is to display a spinner (animated image) and/or a label "loading results" or something similar to notify a user that the process is still preparing results.
Long Answer:
Showing a skeleton is ONLY going to be helpful if you know you would have to display 100 results and you display 100 skeleton items. If the number of skeleton / placeholder items does not match the number of items in the result - it will raise more questions from the user stand point.

Why did I see 10 and all of a sudden that changes to 3, where did the other 7 go?
If I saw 3 placeholder items and now I see a 100, where did these extra items come from? Did i make a mistake in my search query?

Also, as a side note, if a user is searching for something and they find 2000 results, they most likely wont go through all 2000, unless they ned to do a mass action of some sort. Paginating that list or breaking results into smaller groups is recommended to keep the load times shorter and page weight smaller.
Comment: "...magic number for a list is between 5 and 9." Aha! It's [Miller's "7±2" theory](https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two)!
Answer: I would recommend in this case displaying the users as they become available, with a label like "Loading more users..." appearing below the last user that disappears when the last user is loaded. MS Outlook does this when searching email- it presents a blank screen with the text "Searching..." and then as emails are found, they begin to populate downward.
(Unless that's not possible either- it's all or nothing- you don't know the first user's data until you've loaded all users' data)

Number of items in skeleton loader


NServicebus time-sensitive auction implementation

Question: We are using NServicebus to design a system that has to solve an auction scenario: we want to send out a message to a set of companies that can bid on an item. After we've received all the bids we want to send the item to the highest bidder.
We initially thought this kind of scenario was perfectly suited for NServicebus: Pub/sub for sending out a message (e.g. BidOnItem or ItemAvailable), message handlers that subscribe to that message for each interested company and a saga for storing the different bids we receive and we're done.
In a normal auction we could set a timeout at say 5 minutes and then decide who gets the item based on the highest price we've received. We don't have that luxury. The problem that we've run in to is that our specific scenario has a tricky, non-negotiable business requirement: the auction is very time-sensitive. Seconds matter. What we'd like to do is decide who gets the item as soon as all companies have responded. Usually this will happen in a matter of seconds. We want to decide the second all subscribers have responded. Obviously we'll also still implement a timeout but that will be the exception rather than the rule. If we want to determine if everyone has replied we'd need something like a list  of all the handlers at all the endpoints that are subscribed to the BidOnItem message. It appears the NServicebus API doesn't provide this information.
There are some future requirements we have to implement as well centered around data enrichment and approval/rejection decisions that would benefit greatly from knowing whether all handlers on a pub/sub channel have responded. I know this reeks of request/reply which is something NServicebus discourages because of the coupling it causes but this requirement feels like something that's fundamental for a lot of processes that is very hard to implement outside of the core bus infrastructure. In that sense it feels a lot like Saga.ReplyToOriginator which NServicebus does provide.
What would be the "NServicebus Way" to solve this problem?
Answer: Pub/Sub is usually not the way to go in these auction scenarios. What if your saga would do reguest/response with your bidders?
S: OnAuctionCreated  (carries the list of bidders, or you could fetch them somewhere)
foreach bidder in event.Bidders
  -bus.Send(RequestBidFrom(bidder))
SetTimeout(X)
S: OnBidResponse
  bids.Add(response.Bidder,response.Bid)
if(bids.Count()== Data.TotalBidders)
    CompleteAuction();
S:OnTimeout
  CompleteAuction()
Comment: One of the key principles of pub/sub is that the publisher should have no knowledge of its subscribers. It could be 0 or millions the publisher shouldn't care.  That is the reason that pub/sub is no good here given your requirement: "If we want to determine if everyone has replied". This requirement means that you have to know who is supposed to answer == reg/response. Does this help?
Comment: It depends on how different the requests are. I would probably use the same message and have a "integration" endpoint take care of mapping between the different bidders. That integration endpoint can then decide to use different messages for better scaling, monitoring etc  That integration endpoint could also be the one that keeps the list of active bidders. Remember that in messaging one request can result in multiple responses
Comment: That looks like one of the "workarounds" we considered. The RequestBidFrom method in your example would return an instance of RequestBidFromCompanyX, RequestBidFromCompanyY, etc. and handlers to match those classes (optionally distributed over several endpoints) correct?
Comment: Thanks Andreas. I see where you're going. It feels like we would be building something that pub/sub could give us for free. What we'd like to hear is why pub/sub is not the way to go here: is it because of limitations in the current NServicebus API or is it because it is inherently not a good pattern and if so, why?


Kazam webcam is black / not working

Question: kazam 1.5.3
ubuntu 16.04.2 LTS xenial
screen recording works fine, but adding the webcam just adds a black square in the top right corner, which I can move with alt + click & drag
If I do a webcam ONLY recording (no screen), and then hit "finish recording", it just stops recording and there's no prompting to save the file.
Any ideas?
Comment: I am getting the same issue
Answer: About Webcam:
I had the same issue that it was showing a black square in the top right corner. But then I played with some of the settings in File -> Preferences -> Webcam settings as shown here.
Now, if you'll try recording from webcam then it might work fine.
Saving the file:
As shown here under File -> Preferences -> Webcam, you have an option to Save files automatically which you can turn on.
Comment: I don't see a way to save preferences. Did you change via  config file or gui itself?

Kazam webcam is black / not working


jQuery popover with drag and drop facility

Question: I am trying to implement jquery popover with drag and drop facility. but not able to complete.
any suggestion ? or is there any library available for that
Answer: jQuery UI is probably what you're looking for. See http://jqueryui.com/dialog/
For a basic dialog box you would do something like the following:
HTML:

Content

JS:
$(function() {
    $("#dialog").dialog();
});

Remember to include reference to the library as well.
By default the dialog box has drag and drop functionality. However, there are lots of settings you can change to get it exactly how you want.


How can I get a bolt with no head out of my wall?

Question: I tried to screw this bolt into a stud to secure a 2x4. The hex head snapped off, and now the bolt is stuck. I managed to slide off the 2x4, but I have no idea how to extract the bolt. IIRC it's a 6" long, 1/4" wide bolt with about 5 inches in the wall.
Looking around on the internet, it seems like I can't get it out without arc welding a new nut onto the bolt. I don't have the equipment or experience to pull that off. Are there any alternative methods that would be more within reach for a novice like myself?
Comment: Once you've acquired a pipe wrench of appropriate size and backed this thing out - because that'll work a treat - you need to drill a bigger pilot hole, or buy better bolts. I've rounded off some cheese-grade wood screws running them down with an impact gun, but snapping the head on a lag screw is a manufacturer defect.
Comment: Seems like it is too long anyway - which is why it broke. Consider that you only need  2 to 3 diameters of length to produce a usually sufficient grip.
Comment: @GOATNine, I've had plenty of bolts and lag screws break like that, and they were a single piece, not post-manufacture head additions. Heads tend to break off in the same pattern as the threads, since that's how the weakness is inherent to the head. If it was a cut, I'd expect the end to be flat, which this isn't.
Comment: Why do you need to remove it?  did the bolt turn at all or did the head just shear off? is this a mild steel or high tensile screw - what tool did you use that caused the thread damage in the photo?
Comment: Might just be my eyes, but the end of that looks like the head was attached post-manufacture, and poorly at that. That's not a shear pattern, that's a cut pattern.
Comment: @SolarMike agreed - this bolt was not suitable for this task.  OP needed a thicker bolt, and perhaps to size the hole better.  Or perhaps OP was driving the lag bolt straight into the timber without any pre-drilling, so the resistance went up as the depth increased.
Comment: @Criggie I drilled pilot holes in the wall and the 2x4 separately. I think the problem was that the hole I made in the 2x4 didn't line up with the hole in the wall. The 2x4 wasn't secured very tightly to the wall when I was screwing in the bolt.
Answer: This is a job for vise grips. What I would do is file the bolt flat on two sides. Don't take off so much that you significantly compromise its strength - just flatten the threads. These flat sides will enable you to grip it with a pair of large vise grips. That should provide sufficient leverage to remove the bolt. Take it a bit at a time.
Comment: @Jasen the vise grips provide a longer lever arm, you apply a small amount of force to it and let the moment do the work for you (torque in action!). Too much force will destroy the shaft, but the grip point on the shaft is likely stronger than the joining of the head to the shaft was.
Comment: A perfect excuse to get a nice pair of locking pliers (Vice-Grips or a major brand of equivalent) to your toolbox. Maybe a set of different sizes. And maybe a new toolbox. And maybe other tools to put in the new toolbox... more seriously, this likely happened because the OP didn't pre-drill. Lag bolts of this size need to have a hole slightly smaller than their shafts pre-drilled the full depth. So add drill and set of bits to that new toolbox, too.
Comment: @Jasen it has always worked for me as long as enough of the shaft is exposed, including 1/4" lag bolts in an oak beam that I sheared with a socket wrench. I don't even bother with the filing to make flat sides. Inserting the bolt causes more shear stress than removing it, which is why you can remove it without it shearing again.
Comment: if the screw is so tight that the head snapped off this is unlikely to work.
Comment: You could add heat if it just won't budge with the grips, but it has to be a committed approach. Enough heat to affect the fit in the wood will be more than enough heat to remove the temper in the steel, so it's got to get to the point where you can twist it out dead soft - halfway would worse than no heat applied.
Comment: Fun fact: in the UK, we call these mole wrenches :shrug:
Comment: @HoneyDo PLEASE STOP{ rejecting the edit. I AM NOT deleting the pictre. read the edit summary. I am adding  a text description. Look at the edit IN LINE or side by side!!!
Comment: @G Warner - My edit summary in line or side by side didn't show that. Even so - what's the benefit?, But all okay - did change 'vice' grips to 'vise' grips on your edit.
Answer: Say you try one of the other proposed approaches in the other answers and the screw is just stubborn and more of the shaft keeps snapping off...
Consider that you might not need to remove the screw at all. In a worst case, you can almost always snap off the screw close to the base of the wall (maybe a little grinding with a rotary tool like a Dremel to fully bury the head) and patch over it with some drywall joint compound like you would do for a screw hole anyway.
Comment: Another recommendation for the Dremel.  Much better than just bending it and hoping it snaps where you want.  It never will, and bending the screw around is going to make more of a mess of the drywall.
Comment: @StayOnTarget, the OP says there's already 5" of bolt in the wall, so it's not likely going to pound into the wall, unless you really hit it. That's some really aggressive thread, not like your standard nail. And a 5" nail is going to be tough to pound in at 1/4" diameter. You'll likely break the stud if you do get it to move, which is bad.
Comment: @computercarguy You just weren't using the correct wrench for pounding in those screws
Comment: Good suggestion. It'll probably snap down close to the face of the framing. Grab it with a pliers and work it up and down a few times. It'll pop right off.
Comment: If it breaks off near the wall surface you could most likely just pound it in with a hammer until the tip of the metal is below the surface of the wall. Since you have to apply mud anyway some small damage to the wall at that point is inconsequential as well.
Comment: @computercarguy You just gotta play it by ear. For example, if it's in a very solid stud and the bolt is relatively soft and close to flush, you might have luck with lighter taps (and a potential actual reason to use a ball peen hammer, lol) just deforming the bolt to something acceptably-coverable with mud.
Comment: @JasonC, take another look at the pic. There's about an inch out of the wall, and those aren't exactly soft bolts. This isn't a grade 8 or anything, but it's still steel. And you can use "lighter taps" for a decade and still not move it. Wood is compressive, so it'll simply deform a tiny bit and snap back, unless there's enough force to make the lag screw move. I've tried hammering in regular screws, for a broken head, and they just don't move unless you haul off and bash them, and this has far more aggressive threads. You'd be better off cutting it if you just want to mud it over.
Comment: And those times when I tried to hammer in a screw, I usually ended up bending the thing and snapping it off, but not because I intended to.
Comment: @computercarguy Well yeah there's an inch sticking out now but the context here is after snapping / cutting it off. Also the underlying assumption is that if you're actually there, trying to get the bolt out, then you can decide what works and what doesn't as you go... this isn't the kind of situation that you have to lock in a perfect plan ahead of time for.
Comment: @JasonC, I'm simply trying to say that these suggestions aren't going to work, and attempting to save the OP some time and annoyance. I've learned a lot from just doing things and making mistakes, but I've also learned from looking at other people's failures. I'm trying to be an example of "learn from other people's failures", so the OP doesn't make the same mistakes. If there was even the slightest chance this would work, I wouldn't me so adamant about what I say.
Answer: I would just clamp my drill's chuck on that puppy and spin it out.
Comment: Might work if the OP has a keyed chuck.  I've never used a keyless chuck that would grip tight enough.  If you were going to file 3 flats at 120°for a keyless chuck it would be easier to file 2 parallel flats for a spanner
Comment: I've done it many times. Takes a good grip. My particular drill's chuck ratchets tighter in first gear. I wouldn't expect a 1/4" screw to be a problem.
Comment: If you have an impact drill, that might work better than a conventional drill, though often those have a quick release hex socket rather than a 120° chuck.  There are chuck attachments you can get for them though.  Main benefit is they prioritize torque over speed, which is what you need to get something unstuck like this.
Comment: This can work better, if you file three flats onto the thread so the chuck has somewhere to close into, and then turn against the thread.
Comment: (Also if it's *really* causing problems and you've got a way to grind flats on the bolt [or it's soft enough for sandpaper], put 3 small flats on the sides, like a triangle, and any chuck will eat it for breakfast.)
Comment: @ChrisH, I've done this with keyless chucks as well as keyed. The keyed version can get you a better grip, but the keyless works just fine in most situations, too.
Comment: @ChrisH My drill's keyless chuck generally doesn't have a problem with it (the milwaukee chucks and some others have a ratcheting mechanism that kicks in for that final grip) but you can also help it out if you wrap the bolt in a small piece of sandpaper or something similar (rough side against bolt). Or if the bolt is soft enough compared to the chuck just keep tightening and spinning and tightening and spinning until it either finds its happy place or breaks something, lol.
Comment: This worked for me. I have a drill with a keyless chuck.
Answer: Another possible strategy; if you can get 2 nuts onto the threaded bar and turn them against each other they will practically lock into each other, this should allow you then to use a regular spanner, shifter or vice grips to loosen and remove the bolt. Make sure your only turning the first nut and not the second or the effect is lost. If you have it a little thread lock on the nuts might help too.
Comment: There are no nuts for those threads. This is clearly a lag bolt. The questioner says "nut" but that was actually the head of the bolt (I assume some translation problem)
Comment: @Ecnrewal if you want to be picky you need to say "lag screw" as a bolt is by definition formed of a male (screw) and female (nut).
Comment: @einpoklum bigger nuts, cross the threads.  You might never get them off the screw, if that matters.
Comment: @einpoklum Are you talking about the two nut trick in general?  In general, intuitively, it seems that the 'pushing' nut would rotate the 'holding' nut but it locks.
Comment: @JimmyJames: [Got it](https://www.youtube.com/watch?v=Pvs_EFR-f4E).
Comment: @einpoklum That's a decent example but for machine threads, you shouldn't need to tighten them together like that.  I was trying this out with wood screw threads and it did seem more necessary.  Take a carriage bolt and two screws and play around a bit, it's pretty entertaining, IMO, to watch my intuition fail so dramatically.
Comment: Fair enough, i didn't know that you don't get nuts for that thread type. Thanks.
Comment: @Ecnerwal spoken like somone who has never tried to use two nuts to remove a lag screw. I do encourage you to give it a try, for educational purposes
Comment: @JimmyJames: So, you're saying this can work? But - how will you fit the nuts onto the bolt, when nuts target screws with closer fluting?
Comment: @JimmyJames: Finding it a bit difficult to wrap my head around this two-nut trick. I would try it myself, but luckily I've never had OP's problem. Guess I'll take your word for it.
Comment: @einpoklum The mechanism behind it is, when you put the two nuts on, then tighten one *against* the other (unscrew first one + screw second one), the nuts' threads push outwards (from the border between the two nuts) against the bolts' threads, and the friction locks them in place -- effectively it's like tightening them both against a flat surface. You'll see this used elsewhere too like using a second nut to keep a first nut from vibrating loose. It'll work as long as the friction against the threads can overcome the torque applied to the nuts (sometimes it can't, usually it can).
Answer: Some of the other answers are worth trying but IMO a 1/4" lag bolt embedded 5 inches in wood, presumably without a pilot hole, and tightened to the point the head broke off is not coming out with any reasonable effort.  I'd saw it off and work around it .... 2 minutes of relatively little effort.
Answer: Use a plumber wrench. In general more force and better fit jaws for the task than vise grips:
]1
Edit upon comment by jay613: Since it's 5" wood. Drill a hole next to the screw, file the screw and then use the wrench. Or save the money by not buying the wrench and go for the answer by jay613 (saw or drill several holes).
I also found out that it may be easier to find the original design of the plumber wrench by searching on Swedish wrench.
Edit 2: Minimum damage to the wall may be to drill a hole along the screw and use the wrench. Welding a nut may weaken the screw and it will break again.
Comment: Well don't delete your answer I just +1'd it for tool porn.  :)
Comment: I'd say about equal 33% odds with this tool (which is very nice FWIW) of removing the bolt, shearing off more of the bolt, or getting bruised knuckles while the bolt laughs at you.
Comment: I realise that I did not comprehend when OP wrote 5". I imagined a wall stud of perhaps 2".
Answer: TL;DR: Other options (described below) include:

(1) Chuck bolt directly into drill.
(2) Cut slot in bolt and use screw driver.
(3) Cut flats on bolt and use socket driver.
(4) Use two nuts to provide gripping surface.
(5) Destructive brute force with a hammer.
(5b) Destructive brute force with a crowbar.
(6) Cut the bolt flush to the wall.
(7) Keep the bolt and use it for something else.

I second the vice grip solutions (definitely simple with a good success rate, and my preferred approach) -- as well as the welding technique you mentioned (not generally accessible though), but here's a few other "tricks" I've used in similar situations that can sometimes be easier than the vice grips, especially if you have a socket wrench, power drill, or impact driver to help you out, or if you don't have vice grips.
(Btw: You're not going to find nuts to fit perfectly on this bolt, but, I've mentioned nut-based techniques anyways as a general technique for other similar situations.)

Trick #1 - Chuck bolt in drill
If all you have is a drill (or an impact driver with a collet chuck):
Just chuck the bolt directly into your drill. Tighten the chuck down real good and try to unscrew it.
It can be hard on the chuck, especially if you've got the bolt in there slightly off-axis, but, with a decent tool you can generally get away with this every once in a while with no harm done. It can be your dark little secret.
If the threads cause problems here and you've got a way to grind or sand them off, you could take them down a bit first. If you cut three small flats like a triangle, it'll make any chuck very happy. If your drill's chuck is harder than this bolt (which it probably is), it'll probably wear them down a bit, too. If grip is still an issue, or you need to protect the chuck, wrap some sandpaper or something similar around the bolt first (rough side towards bolt) and chuck over that.

Trick #2 - Cut slot in bolt
Tools needed:

Something to cut a slot in the end of the bolt with, for example:

A hack saw.
A Dremel with a cutting wheel (my preferred tool for this).
An angle grinder with a thin cut wheel.

Something to unscrew flat slots with:

A screwdriver with a nice wide handle for leverage.
A drill with a flat screw driver bit.
An impact driver with a flat screw driver bit (my preferred tool).

The idea here is to simply cut a slot in the end of the bolt to turn it into something you can unscrew with a screw driving tool:

Use your cutting tool of choice to cut a horizontal slot through the center of the end; wide enough to get whatever screw driver into it. Now you've turned the bolt into a big screw, and you can use your screw driver to remove it.
Pro-tip: If the metal of the bolt is too weak and you find that the areas next to your slot are bending outwards; find a nut that fits the bolt and screw it on after cutting the slot. This will reinforce the metal and you should have no problems (unless you break your screwdriver bit, of course).

Trick #3 - Cut flats on bolt
This is like trick #2 but for if you have a wrench instead, and you have a way to grind metal flat (you might not have the tools to cut a slot). It's also useful if the bolt (or your screw driver bit) is to small / weak for #2. For this, tools needed:

Something to grind a flat on one or two sides of the bolt with, for example:

A Dremel with a grinding wheel.
An angle grinder with a grinding wheel (my preferred tool for this).
A flat file.
A solid flat object (e.g. scrap of wood) with some low grid sand paper on it.

Something to unscrew a flatted bolt with:

A socket wrench (my preferred tool for this).
A screwdriver with a socket driver bit and a nice wide handle for leverage.
A drill with a socket driver bit.
An impact driver with a socket driver bit.
A crescent wrench, or some kind of adjustable wrench (not necessarily vice grips).

The idea here is to grind flats in the sides of the bolt (red highlight) so you can grab it with one of your socket tools or wrench, then unscrew it with that:

Trick #4 - Use two nuts
This one only sometimes works but can be handy if your set of tools is limited. Tools required:

Two standard hex nuts that fit on the bolt. They don't necessarily need to be hex nuts, just two things with flat sides and threads; like maybe a hex nut and a wing nut or a t-nut, etc.
Something with leverage to grab and twist the two nuts with (ouch...). Wrenches, etc.

What you do here is:

Screw both nuts onto the end of the bolt.
Now try your hardest to unscrew the first one while screwing the second one (or holding it steady). What you want to do here is basically tighten the two nuts against each other as hard as you can.
Now, you can use first nut to unscrew the bolt. With a little bit of luck, and physics on your side, this can work provided that the friction the two nuts are exerting on the bolt threads is stronger than the torque required to remove the bolt.

TODO: better pic

Trick #5 - Brute force hammer
This one generally ends up being destructive but is sometimes your only option. Essentially, just brute force it out then patch up the hole. You'll need:

A hammer or other blunt object.
Materials to patch up the hole with.

This is basically what you're imagining. Just whack the bolt until it either rips itself out of the wall, or loosens enough that you can pull it out.
A slide hammer (sort of like a reverse hammer) with a nut on the bolt to pull against could help here, too, although that's a relatively uncommon tool.
Success with this is limited but can work if the wall is soft or brittle, and if you don't care about the hole.
Note that depending on the size of the bolt and the properties of the bolt and wall, you have a risk of doing a fair amount of damage here, so you have to weigh the possible outcomes here first.
As an alternative form of the above, if you can't / don't want to rip the bolt out, but the wall is weak enough to give and there's hollow space behind the wall, sometimes it's easiest just to bang on the end of the bolt with a hammer and pound it into the wall, letting it fall into the space behind the wall, where it can spend the rest of its life thinking about philosophy or the cosmos or something. At least until some random contractor finds it 30 years from now.

Trick #5b - Brute force prybar
Another form of that, if you have a nut, is to put the nut on the bolt almost to the wall, then attempt to use a crowbar or similar object between the nut and the wall to rip the bolt out with leverage.
There are other options to gain leverage here, too. If you don't have a nut, for example, you could try leveraging against the threads themselves using the V groove of a crowbar or the back of a hammer, etc. Anything you can think of to get a bite.
The difficulty with this one though is it's ideal if you can exert a force straight out along the bolt. If you come at it from the side (which is sometimes the only option, though) it can be harder to pry it out or easier to damage the wall.

Trick #6 - Just cut it off
The true IDGAF technique. You'll need:

Something that can cut a bolt, such as:

Hack saw
Angle grinder
Dremel

This one is simple: Cut the bolt off flush with the wall. That's it.
You'll be left with part of a bolt in the wall, but at least you won't have a big hole to fill.
It's not ideal but sometimes it's just all you need.
Trick #7 - Keep and repurpose it
Not sure if this even worth mentioning but; if the bolt isn't in the way, you could always just hang your coat or a painting or something on it. :D

Anyways, hopefully those help. I use the vice grip method frequently, but I've also used all of the above at one point or another.
PS: Like I said, I just wanted to add some alternatives; but re: the vice grips, if you don't own a set already, IMHO it's worth going out and buying some just for this bolt. It's a very useful tool to own in general.
Comment: todo: better pics, and also, shorten this up, and i don't know why i called them "tricks", they're not like... life hacks. change to "method" or something less obnoxious.
Comment: also i realize i got so excited to answer this that i repeated some of the other answers here so, go upvote those. they're all good.
Comment: #4b weld a single nut onto the end of the bolt.  Not really needed here, but in cases where you're dealing with a short stub there might not be enough space to fit a pair of nuts on.
Comment: does welding a bar on really get you anything over welding a nut and using a long wrench/ratchet with cheater bar?  I think you'd still be limited in weld area by the size of the bolt; and afterwards you'd want to cut the rest of the bar off for future use vs the nut being disposable.
Comment: @DanIsFiddlingByFirelight Yup! Or if you've got some steel bar laying around you can weld that on too and use it for leverage to unscrew by hand, if the bolt is strong enough to take it. Only thing to really watch out for there is fire hazard or spatter if you're arc welding with flux (a wet towel is good quick protection if you've got something nearby that you don't want spatter on). I didn't put it in the list cause the OP briefly mentioned it but you're right it's a good addition; I'll take care of it later when I take real pics.
Comment: @DanIsFiddlingByFirelight In theory, no. In practice, you might not have a nut, or you might have a scrap of steel closer to you than your wrench (I kid you not but at this very moment where I'm sitting I see four 1"x1/8" steel bars and zero nuts and wrenches -- but I'm a slob, lol). It's not an advantage, it just uses a different set of available things.
Comment: (If I had *all* of the things in front of me though, yeah I'd use a nut and a wrench.) (Although I guess one small thing the bar does get you is you could stick it on in the middle of the bar and two-hand it, like a tire iron. ♂ Whatever works! :D )
Comment: @JasonC To Done :) added image descriptions for screen reading software.  I'll leave new pics up to you for now :) Great post!
Answer: Use two nuts (if the thread is damaged so that you can't put any nut on, saw off a small part of the end), fasten them against each other, then use your spanner on one to turn the bolt.
This is so standard a practice that it's routinely used to fasten or remove studs that don't have a bolt head to start with. :-)
Comment: There are no nuts for those threads. This is clearly a lag bolt. The questioner says "nut" but that was actually the head of the bolt (I assume some translation problem)
Comment: Vise Grips are definitely something to have in the toolbox. With a pair of vice grips, a medium-sized screwdriver, some duct tape and a hammer you can fix 88% of the things in your house....
Comment: @Gábor Vise grips are one of those tools that are worth going out for. Unlike power tools, they aren't going to break easily or be (relatively) expensive. Most definitely worth buying and keeping - you never know when you'll need them again.
Comment: @Ecnerwal You don't need a nut designed for the threads.  You just need to be able to get two on there, even if they are a little loose.  It will still work.  The threads are mangled at the end, though might not be doable here.
Comment: The big question is, *which* two nuts to use... hmm... I'm thinking, perhaps, *deez* ones? ...
Comment: @manassehkatz-Moving 2 Codidact - Agreed. But if the OP can remove the stud with other means, he can go out with even more satisfaction to hunt for a vise grip. Whatever. We have quite a few good suggestions collected here and the two-nut solution is a common one of those, either in this case or for somebody else coming here later. :-)
Comment: Might be. I still wonder if an appropriately sized nut can be threaded on it. In this case, it doesn't have to be fitting or perfect, just that the two can be fastened against each other. It still sounds more within the reach of an unexperienced DIY-er than going out for vise grips. :-)
Answer: One option is to use a hacksaw or a rotary tool with a cutting wheel to carve a groove into the end of the bolt, effectively turning it into a flathead screw.  You can then use a regular screwdriver to back it out.  If the end of the bolt is boogered up too badly, it might help to file it smooth first.
You have 5 inches of screw firmly anchored into a stud so you might need more leverage than a standard screwdriver.  A ratcheting socket wrench (or a breaker bar) with a flathead bit would give you significantly more leverage.
Answer: this bolt is made of weak metal. you have to be very careful. use a small diameter metal pipe. carefully bend the bolt towards the wall. Slide the pipe over the bolt and rotate counterclockwise. when bending the bolt, heat it if there is a tool for this. this will reduce the chance of the bolt breaking.
Comment: Wouldn't this break the bolt rather than bend it?
Comment: That's a good way to either snap the bolt or burn the wall.
Comment: I didn't offer to make a fire. There are other ways to make a bolt :)
Comment: this event is likely. the head of the bolt is torn off. metal is soft but torsional deformations and bending deformations are different influences and different resistance characteristics. the author of the question should decide whether the method is suitable for this task or not
Answer: A small (10 inch) pipe wrench should make quick work of this situation. It's designed to literally grab onto smooth round steel tubes.
Answer: Channel-Lock Or Vice-Grip Groove-Lock pliers will take care of this.
Comment: This is exactly what the [currently most up voted answer](https://diy.stackexchange.com/a/221169/34147) says. Care to [edit] some more detail into this?
Answer: First try the vise grip and it might unscrew it. If not, cut it off near the surface and then use a good drill bit designed to drill metal and slightly larger in diameter to the bolt  and drill it down to slightly below surface so your spackle patch repair is seamless.


Stairwell paint is pulling away from the moulding, do you just caulk and paint or should I do something else?

Question: I've included a picture to help show the issue, but it's occuring in 2-3 spots up one side of the stairwell and looks pretty gnarly in person.

Do I just caulk over the gap and then repaint? Should I cut the paint where it's still attached first? Should I scrape? This is a little less straight forward than most of the paint touch-ups I've done before.
Comment: You have a more glaringly obvious example of this - https://diy.stackexchange.com/questions/276021/is-this-crack-a-sign-of-foundation-problems - The solutions are the same; patch it & see if/how long it takes to do it again, or invest in subsidence detectors. The staircase itself looks a bit of a quick retrofit, all the treads are top-mounted rather than being properly inserted into the stringer from underneath. It also suffers from that kind of loose attention to detail my dad would call "it fits where it touches" which hints it may be more the staircase moving than the wall.
Answer: If the stairway and wall are actually moving away from one another you should definitely do something else.  Figure out why.  Fix that.
If the staircase was built with a gap there and it was just filled poorly, you should just fill it better.  Search this site for questions on filling large gaps, and use appropriate materials and technique.
It does look like there's movement.  The caulk isn't sinking or flaking, it's being pulled apart, and there are gaps between the treads and stringer.
Answer: It looks like an older home and going to the basement probably moisture can cause the studs to twist if not fastened correctly or bracing under a load wall is missing causing bowing.Keep in mind stareways are infamous for cracking and for being out of square by as much as 3 inch per 16foot.ods are studs are placed on a setback.
Comment: Over 10 years in residential home construction  and only my opinion


data-ng-show and array elements

Question: I am seeing syntax error on the console console for the following block of code but it works the way I wanted. What is that Im missing?

 -1">
    You chose {{selectedAppName}}.

    Please choose an  {{selectedAppName}} Type.

    Please check console for the error

http://plnkr.co/edit/c6rLz77Rm11mynuA2qZg?p=preview

Answer: selectedAppType in ['A1','A2','A3','A4'].indexOf(selectedAppType) > -1

This doesn't make much sense. You're kind of trying to do the same check twice. I can't remember what the order of operations is, but this would be either trying to check if selectedAppType is in a certain integer (result of indexOf), or if selectedAppType is in the boolean (result of the > -1 comparison).
Change it to either
selectedAppType in ['A1','A2','A3','A4']

or
['A1','A2','A3','A4'].indexOf(selectedAppType) > -1

data-ng-show and array elements


Why is program not accurately computing integer SUM?

Question: I'm new to Assembly Programming (x86), and cannot figure out where I am going wrong in my program. After I redisplay the value that was moved into the array, I then want to display the current 'SUM'. I thought that by using the 'ebx' register, since it is used nowhere else in the program except in Loop2, that the value would not be overwritten and thus each 'add' statement would add the new array position value to my 'SUM'.
Can anyone spot what I'm doing wrong?

<code>INCLUDE Irvine32.inc
COUNT = 3

.data
inputMsg BYTE "Input an integer: ", 0
outputMsg BYTE "Redisplaying the integers: ", 0dh, 0ah, 0
sumMsg BYTE " Sum is now: ", 0
strArray SDWORD COUNT DUP(?)

.code
main PROC
    ; Read Integers from User
    mov ebx, 0
    mov ecx, COUNT
    mov edx, OFFSET inputMsg
    mov esi, OFFSET strArray

L1: call WriteString            ; Display Prompt
    call ReadInt                ; Read input from user
    mov [esi], eax              ; Store value into array
    add esi, TYPE strArray      ; Move to next array position
    loop L1

    call Crlf

    ; Redisplay the integers
    mov edx, OFFSET outputMsg   ; Display 'outputMsg'
    call WriteString
    mov ecx, COUNT
    mov esi, OFFSET strArray

L2: mov ebx, 0                  ; Initialize ebx to 0
    mov eax, [esi]              ; Get integer from array
    call WriteInt               ; Display integer
    mov edx, OFFSET sumMsg      ; Display value of 'sumMsg'
    call WriteString
    ; mov eax, ebx
    add ebx, [esi]

    mov eax, ebx   ; <---- MOVED from above add ebx, [esi]

    call WriteInt
    call Crlf
    add esi, TYPE strArray      ; Move to next array position
    loop L2

    exit
main ENDP

END main
</code>
Answer: Probably you have to "mov eax, ebx" before calling the last WriteInt.
Comment: I've edited my code as you and ooga suggested. Output now reads as the array value followed by `"Sum is now: +0"` with my modified code. Any further ideas?
Answer: You need to move ebx to eax before you call WriteInt. Initializing ebx to 0 before the summation loop would be a good idea too.
Comment: I tried to do as you suggested (if I understood correctly). Now all lines read as the output form the array, followed by `"Sum is now: +0"`. I've edited my code above to reflect the changes. Any more ideas?
Comment: You've put `mov eax, ebx` in the wrong place. Put it just before `call WriteInt`
Comment: I moved `mov eax, ebx` under `add ebx, [esi]` and above `call WriteInt`. now output is:
`+1 Sum is now: +1
+2 Sum is now: +2
+3 Sum is now: +3`
What am I still missing?
Comment: `mov ebx, 0` should be before `L2`, otherwise you're resetting your sum to 0 every iteration.


Adding insulation to basement that already has vapor barrier

Question: I have leftover insulation from doing my basement, little bits and pieces.
In between the joists on my basement ceiling it is insulated with vapour barrier already from when the house was built.
Will condensation form if I put all the extra pieces against the vapour barrier on the inside of the wall but do not put a second vapour barrier? Or will it be fine and help my house stay better insulated? Or is it a complete waste of time.
It just seems like such a shame for all these smaller pieces to go to waste.
Comment: A picture would help, showing where you intend to add insulation.
Comment: If the basement if finished and conditioned space, then the vapor barrier in the ceiling is serving no purpose. (I'm not a fan of vapor barriers even on walls of basements, but that's another issue...)
Answer: Insulation is always installed as such:
Warm side | Vapor/ Moisture barrier | Insulation | Cold side
You ONLY want a moisture barrier between the warm side and the insulation, because warm air holds onto more moisture than cold air, and when warm air meets cold (air, wall, whatever), the air has to let go of that moisture as it cools, forming condensation.  The moisture barrier prevents that moist air from getting into the insulation where cold and warm meet.
If you put insulation on the wrong side of your barrier, the moisture will form in the insulation, and as Shirlock said, if you create TWO layers of barrier, you create a potential moisture trap.
Answer: Do not sandwich your vapor barrier between layers of insulation, and do not add a second vapor barrier creating a multilayer thing. This will only trap moisture.  Not exactly sure where you intended to use the leftover insulation.
Comment: Some good information on vapor barriers: http://www.buildingscience.com/documents/digests/bsd-106-understanding-vapor-barriers
Answer: Rule of thumb in Canada is that insulation can be placed inside the vapour barrier, on the warm side, but it must be 1/3rd or less of the R/RSI value of the cold side insulation. So to extend Evil Greebo's example:
Warm side | Insulation | Vapor/ Moisture barrier | Insulation Insulation | Cold side
Answer: Little pieces of insulation are fairly useless because there are so many joints for air to move through.
If your existing vapor barrier is plastic sheeting, I would not place insulation in front of it (warm side of the room).  Moisture will migrate through the insulation and likely condense against the existing vapor barrier, thus trapping water in the wall.
If your existing moisture barrier is the kraft paper face on the original insulation, then probably no harm will result, since the paper-faced insulation allows mositure to migrate more quickly.
Note:  All mositure barriers are permeable, even concrete.  It is just a matter of how quickly the moisture can move through the barrier.
Comment: Concrete is not a moisture barrier.  Concrete is anything but.  A moisture barrier, like 6 mil plastic, is most definitely not permeable (if it's installed properly).  I do agree that paper faced insulation isn't a good moisture barrier (it's more like 'mold candy' IMO)