Rental equipment selection for digging 52" deck footings?

Question: I need to put in about 20 concrete footings for several deck-related projects. The footing base should be 12-18" (but see note below). Frost depth in my area requires footings to be 52" below grade (local building official has stated this).
Soil is clay with rocks, mostly 4-5" across (softballs). Based on past septic excavation, this seems to be pretty consistent.
I'm weighing how to best dig holes that deep. Local equipment rental options are:
Towable post-hole digger (up to 16" auger + extensions):

Mini skid-steer (Dingo) with auger attachment (up to 16" auger + extensions):

Mini-backhoe which claims 6' digging depth:

In theory / "on paper" all of these could do the task. But it is hard to assess which will be the most effective at digging holes. By effective I mean:

Will work well in the soil
Dig a reasonably neat hole to requirements
Not take excessive time or labor

The rental cost for all is roughly the same or at least not a enough to be a primary concern.
I have some experience with small 3-point equipment on tractors and feel confident to safely learn & use these machines.
It is an option to do a larger # of smaller footings (meaning, smaller footprint & less load-bearing) if that makes any difference here. Though all things considered I'd think fewer, larger footings would be less overall work.
Comment: +1 for the dingo,  20 holes is a chore. let the hydraulics of the dingo do the lifting. And Dingo was its name-o!
Comment: So, the soil is the same all the way down to depth? Any large rocks? That info will make a difference.
Comment: @SolarMike thanks, I have added an update. It seems to be consistent based on past work. We've seen very few large rocks but smaller ones are numerous.
Comment: Have you considered using helical piles instead of digging?
Comment: @Matthew yes and I am actually awaiting a quote for that. The anecdotal costs I've read about seem reasonable. Getting contractors to actually quote for things around here however is quite hard sometimes.
Comment: Access to the work area is a big consideration when choosing between those machines you listed.  Bigger machine is more expensive but generally faster, but some areas can't be reached with something like the backhoe mounted option.
Comment: @JPhi1618 that's a good point; a few holes will be within 1-2 feet of the house. Most are out in the open.
Answer: Having dug footings before by hand (2-man auger, clamshell digger and shovel) I would definitely suggest the Dingo for this project. I did 5 with the auger and 2 with clamshell (because it was near utility lines) but 20 footings is a lot and you should keep this simple and quick, letting the machine do most of the work.
Note- clamshell post-hole digger example:

A clamshell is not better than 2-man auger, it's a lot more work but you have to hand dig near utility lines. The 2-man auger has 4 handles and the motor in the middle, one man operates from one side and the other stabilizes as it digs. It's fast but it's a lot of exertion, especially for as many footings as you're talking about.
Comment: Thanks for clarifying, I understand now. The auger I'm considering is like a trailer, much bigger than a 2-man auger. But I don't know how it would compare to the Dingo. I agree a clamshell would be a huge PITA! :)  (now that I know the term for it!)


How to modify a variable using async method before it use in widget build?

Question: I have a variable named userName,which depends on databse query,so async is a must.
My older code can be concluded liks this
class IndexScreen extends StatefulWidget {
  @override
  _IndexScreenState createState() => _IndexScreenState();
}

//use database query function
Future<void> initUser() async{
  UserTable().getUserInfo(curUserEmail).then((value)=>null);
}

//show page
class _IndexScreenState extends State<IndexScreen> {
  @override
  Widget build(BuildContext context) {
    initUser().then((value){
    final theme = Theme.of(context);
    return WillPopScope(
      onWillPop: () =>router.navigateTo(context, '/welcome'),
      child: SafeArea(
        child: Scaffold(
//The static global variable is used in Body in other files
            body: Body()
        ),
      ),
    );
  });
}
}

It warns that miss return,I dont knwo how to amend my code.
Thanks!!
Comment: why shouldn't you use FutureBuilder? It will be helpful to load the screen like you want after completed the future.
Answer: You can achive this by using the FutureBuilder widget. Please refer the code below.
class IndexScreen extends StatefulWidget {
  @override
  _IndexScreenState createState() => _IndexScreenState();
}

//use database query function
Future<Map> initUser() async {
  final data =
      await UserTable().getUserInfo(curUserEmail);
  return data;
}

//show page
class _IndexScreenState extends State<IndexScreen> {
  @override
  Widget build(BuildContext context) {
    return FutureBuilder(
      future: initUser(),
      builder: (BuildContext context, AsyncSnapshot snapshot) {
        if (snapshot.hasData) {
          final theme = Theme.of(context);
          return WillPopScope(
            onWillPop: () => router.navigateTo(context, '/welcome'),
            child: SafeArea(
              child: Scaffold(
                body: Body(),
              ),
            ),
          );
        } else {
          // Returns empty container untill the data is loaded
          Container();
        }
      },
    );
  }
}

Comment: Should it be "else{ return Container();}"?  I run this code but it shows black screen which I think is Container(),but the initUser() function has finished,it didn't change.I doubt it's for my gteUserInfo() method retrun nothing,it just assign values to static variables
Comment: I have updated the code snippets. Can you please check with the current code snippet and revert back?
Comment: I watch `snapshot.connectionState` to fix my special bug,thanks!!


Is following sets form a basis for $V^*$?

Question: Let V be the real vector space of all polynomials, in a single
 variable and with real coefficients, of degree at most $3$.

Let $V^*$  be its dual space.
Let $x_1 = 1, x_2 = 2, x_3 = 3, x_4 = 4.$

Is following sets of functionals $\{f_i |1 \leq i \leq 4\}$
 form a basis for $V^*$?

For all $p \in V , f_i(p) =
 p(x_i)$ for $1 \leq i \leq 3$ and $f_4(p)=\int_{1}^{2} p'(x)dx$ |Yes/NO

My attempt : i think Yes
i take  $p(x)=a_0+a_1x+a_2x^2 + a_3x^3 $  and  $p '(x) = a_1 + 2a_2x + 3a_3x^2$ Then by integration:
$$f_4(p)=\int_a^bp'(x)dx=a_1x+\frac{2a_2 x^2}{2}+\frac{3a_3x^3}{3} \ \ ]_a^b=  a_1(b-a) + a_2( b-a)^2 +a_3(b-a)^3$$ where $a=1 , b=2$
Now $f_1(p) = p(x_1)=a_0+a_1x_1+a_2x_1^2 + a_3x_1^3$
$f_2(p) = p(x_2)=a_0+a_1x_2+a_2x_2^2 + a_3x_2^3$
$f_3(p) = p(x_3)=a_0+a_1x_3+a_2x_3^2 + a_3x_3^3$
Now  for basis it must be linearly independent
so $f = c_1 f_1 + c_2f_2 + c_3 f_3 + c_4f_4=0 $ here $c_1=c_2=c_3=c_4 = 0$
so It will form a basis for $V^*$
Is is its True ?
Comment: Why do you think the integral of $f_4$ evaluates to $p(b-a)$ instead of $p(b)-p(a)$?
Comment: Really? Suppose $p(x)=x^2$. You think $(2-1)^2=2^2-1^2$?
Comment: @almagest  because $p(b-a) =  p(b) - p(a)$
Comment: okss @almagest i missed that logics
Comment: So how does that affect the rest of your answer?
Answer: So we have $f_1(p)=p(1), f_2(p)=p(2), f_3(p)=p(3)$ and $f_4(p)=p(2)-p(1)$, and we need to check if they are linearly independent. But it looks like $f_4=f_2-f_1$.
So it's no.
Comment: Close.  For instance,  you could write $f_1-f_2+0\cdot f_3+f_4=0$.  That's a _nontrivial_ linear combination.   Right?
Comment: ya  @Chris custer thanks u


How to fix SublimeText 3 Python build error?

Question: I use a Mac and haven't used Sublime Text and Python in a few months, and have come back to it for a project. But, I get an error when I try to build documents I've definitely built before, and even the simplest test document (ex. print("Hello World!")). It must be because of some Mac update, but I am not on Big Sur, I'm still on Catalina. I can't update to Big Sur to fix my problem because of my work I need certain programs that are not compatible with Big Sur yet.
I get the following error:
<code>/Users/maxzhou/.bash_profile: line 1: export: `v6.1.1/bin': not a valid identifier
bash: /Library/Frameworks/Python.framework/Versions/2.7/bin/python: Bad CPU type in executable
[Finished in 0.0s with exit code 126]
[shell_cmd: python -u "/Users/maxzhou/Documents/Test file.py"]
[dir: /Users/maxzhou/Documents]
[path: /Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Applications/Racket:/Applications/Racket v6.1.1/bin]
</code>
I vaguely remember encountering this error when setting up Sublime Text for the first time, but now don't remember how to fix this.
Comment: What's the first line of your `.bash_profile` look like? If you open a terminal and run python, does it start there or display the same error?
Answer: Sorry, I met a similar error as well and my Macbook is also Catalina...
When I restart my Mac and try to run Python codes on Sublime Text 3 using "Python" system built by Sublime at the first time, everything is ok, but if I quit Sublime and then open it and run python codes then I will get some errors... e.g. if I "import bs4" then I will get an error "there is no module called bs4" but I do install this module by pip install (as well as pip3 because I install two kinds of Python in my Mac, one is Anaconda while another is Python 3.8)...
I don't know what happens but I think this might be kind of bug on Mac or Sublime maybe...


What happens to GraphServiceClient when access token expires?

Question: This is the code. I get an access token and with that access token I create a client. What happens if access token expires? Do I need to create another client?. Create only one client? or each time I need users for example, I should call GetGraphServiceClient()? that will resolve the fact that the token is expired because calls for a new one. If not how can I verify if the token is expired?
public async Task<GraphServiceClient> GetGraphServiceClient()
{
    var token = await GetAccessToken();

    var client = new GraphServiceClient(new DelegateAuthenticationProvider(
        (requestMessage) =>
        {
            requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
            return Task.FromResult(0);
        }));

    return client;
}

    private async Task<string> GetAccessToken()
    {
        var app = ConfidentialClientApplicationBuilder.Create(_connectionData.ClientId)
       .WithAuthority(AzureCloudInstance.AzurePublic, _connectionData.TenantId)
       .WithClientSecret(_connectionData.ClientSecret)
       .Build();

        AuthenticationResult result = null;
        try
        {
            result = await app.AcquireTokenForClient(scopes)
            .ExecuteAsync();
        }
        catch (MsalServiceException ex)
        {
            // Case when ex.Message contains: invalid scope
        }

        return result?.AccessToken;
    }

Comment: @romil-kumar-jain Could you provide more code? How do you get access token?
Comment: You can assume that you have the latest refresh Token and access token all the time. so no need to go into logic how we are getting this.
That's a long code.
Comment: There's a very similar problem here

https://stackoverflow.com/questions/44007753/using-graphserviceclient-to-get-refresh-tokens-when-authenticating-using-userpas
Answer: It depends on if you are authenticating according to the Graph SDK or the Graph REST API. If you are authenticating against the SDK, as one of the commenters already mentioned, the SDK will take care of that for you as long as you set it up properly. If you are using the REST API, then you will have to take care of it yourself.
SDK Authentication:
GraphSDK.cs
public class GraphSDK
{
    public static GraphServiceClient Initialize(IConfiguration config)
    {
        return new GraphServiceClient
            (
                new ClientSecretCredential
                (
                    config.GetValue<string>("TenantID"),
                    config.GetValue<string>("ClientID"), Environment.GetEnvironmentVariable("CLIENT_SECRET"),
                    new TokenCredentialOptions { AuthorityHost = AzureAuthorityHosts.AzurePublicCloud }
                ),
                new[] { "https://graph.microsoft.com/.default" }
            );
    }
}

Startup.cs
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddScoped(svc => GraphSDK.Initialize(Configuration));
        ...
    }
}


JavaScript web app can't find element to insert text

Question: When entering the numbers into the textbox to get the stories it works just fine until I type in number "4" and hit the "Get Story" button and try to go back to number 3. That's when I get this message in the console window on line 35:
"Generated text element not found."
HTML:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Story Fetcher</title>
    <link rel="stylesheet" href="styles.css">

Stories

                <input type="text" id="story-number" placeholder="Enter story number">
                <button id="get">Get Story</button>
                <button id="getRandom">Random Story</button>

                <button id="clear">Clear</button>

CSS:
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            margin: 0;
            padding: 0;
        }

        header {
            background-color: #ff6600;
            color: #fff;
            padding: 20px;
            text-align: center;
        }

        h1 {
            font-size: 28px;
            margin: 0;
        }

        main {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 80vh;
        }

        #content-wrapper {
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 20px;
            max-width: 100%;
            text-align: center;
            margin: 20px;
            overflow-x: hidden;
        }

        #story-number {
            padding: 10px 16px;
            font-size: 14px;
            border: 1px solid #ccc;
            border-radius: 4px;
            width: 200px;
            height: 30px;
            margin-bottom: 10px;
        }

        #get-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        #get, #getRandom, #clear {
            background-color: #ff6600;
            color: #fff;
            border: none;
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            border-radius: 4px;
            transition: background-color 0.3s ease;
            margin-bottom: 10px;
        }

        #story-container {
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 20px;
            max-width: 100%;
            text-align: center;
            display: none;
        }

        #generated-text {
            font-size: 18px;
            line-height: 1.5;
            margin-bottom: 20px;
            color: #333;
            text-align: center;
        }

        #generated-text span {
            font-weight: bold;
            color: #000;
            font-size: 20px;
        }

        #clear {
            display: block;
            margin: 0 auto;
        }

        @media (min-width: 601px) {
            #content-wrapper {
                max-width: 600px;
                max-height: 40vh;
            }
        }

        @media (max-width: 600px) {
            #get, #clear {
                font-size: 10px !important;
                padding: 20px 20px !important;
            }
        }

Javascript:
document.addEventListener('DOMContentLoaded', function () {
    var totalStories = 3;
    var currentStory = null;

    function clearStoryContainer() {
        var storyContainer = document.getElementById('story-container');
        if (storyContainer) {
            storyContainer.style.display = 'none';
            var generatedTextElement = document.getElementById('generated-text');
            if (generatedTextElement) {
                generatedTextElement.innerHTML = '';
            }
            var contentWrapper = document.getElementById('content-wrapper');
            if (contentWrapper) {
                contentWrapper.style.marginTop = '0';
            }
            currentStory = null;
        }
    }

    function fetchStory(storyNumber) {
        clearStoryContainer();
        var xhr = new XMLHttpRequest();
        xhr.open('GET', 'fetch.php?story=' + storyNumber, true);
        xhr.onload = function () {
            if (xhr.status === 200) {
                var storyContainer = document.getElementById('story-container');
                if (storyContainer) {
                    storyContainer.style.display = 'block';
                    var generatedText = xhr.responseText;
                    var generatedTextElement = document.getElementById('generated-text');
                    if (generatedTextElement) {
                        generatedTextElement.innerHTML = parseAndStyleTitles(generatedText);
                    } else {
                        console.log('Generated text element not found.');
                    }
                    var contentWrapper = document.getElementById('content-wrapper');
                    if (contentWrapper) {
                        contentWrapper.style.marginTop = '60px';
                    } else {
                        console.log('Content wrapper element not found.');
                    }
                    currentStory = storyNumber;
                } else {
                    console.log('Story container element not found.');
                }
            } else {
                console.log('Error fetching story. Status code: ' + xhr.status);
                clearStoryContainer();
                displayErrorMessage('Error fetching story.');
            }
        };
        xhr.onerror = function () {
            console.log('Network error while fetching story.');
            clearStoryContainer();
            displayErrorMessage('Network error while fetching story.');
        };
        xhr.send();
    }

    function displayErrorMessage(errorMessage) {
        var storyContainer = document.getElementById('story-container');
        storyContainer.style.display = 'block';
        storyContainer.innerHTML = errorMessage;
        document.getElementById('content-wrapper').style.marginTop = '60px';
        currentStory = null;
    }

    function parseAndStyleTitles(text) {
        return text.replace(/\[\[(.*?)\]\]/g, function (match, title) {
            return '' + title + '';
        });
    }

    document.getElementById('get').addEventListener('click', function () {
        var storyNumber = parseInt(document.getElementById('story-number').value);

        if (!isNaN(storyNumber) && storyNumber >= 1 && storyNumber <= totalStories) {
            fetchStory(storyNumber);
        } else {
            displayErrorMessage('Please enter a valid number between 1 and ' + totalStories + '.');
        }
    });

    document.getElementById('getRandom').addEventListener('click', function () {
        var randomStoryNumber = Math.floor(Math.random() * totalStories) + 1;
        fetchStory(randomStoryNumber);
    });

    document.getElementById('clear').addEventListener('click', function () {
        clearStoryContainer();
    });
});

PHP:
<?php
// Read the requested story number from the URL parameter
$storyNumber = $_GET['story'];

// Check if the story number is valid (e.g., within the range of available stories)
$totalStories = 3; // Update this to match the actual total number of stories

if ($storyNumber >= 1 && $storyNumber <= $totalStories) {
    // Read the content of stories.txt
    $storiesFile = file_get_contents('stories.txt');

    // Split the content into stories based on a unique delimiter (e.g., "###")
    $stories = explode("###", $storiesFile);

    // Get the requested story
    $requestedStory = trim($stories[$storyNumber - 1]); // Adjust the array index

    // Replace newline characters with
 tags for line breaks
    $formattedStory = nl2br($requestedStory);

    // Return the formatted story as a response
    echo $formattedStory;
} else {
    // Return an error message if the story number is invalid
    echo 'Error: Invalid story number.';
}
?>

stories.txt
1. [[IDAHO: The Bear Lake Monster]]

    In the depths of Bear Lake, a legend born from Joseph C. Rich's pen lurks—a tale of the enigmatic "Bear Lake Monster." This 20th-century legend, chronicled by Rich, tells of an elusive creature with sightings of a colossal, malevolent "water devil." Its elongated neck, capable of striking from the water's edge, added to its mystique.

    Through generations, tales of the Bear Lake Monster echoed in the region, whispered around campfires and passed down. The lake's murky depths became a realm of fear and fascination, where the line between reality and legend blurred.

    Recent events added a twist—a 25-foot-long decomposed carcass found on the lake's shores. Some claim it to be the creature of centuries-old sightings, sparking intrigue and mystery.
    The legend of the Bear Lake Monster, rooted in both the written word and local memory, continues to cast its eerie shadow over the tranquil waters of the lake, serving as a reminder of the enduring allure of the unknown and the power of myth in the human experience.

###
2. [[DELAWARE: The Addy-Sea Inn]]

    Nestled on Bethany Beach's serene shores, the Addy-Sea Inn, dating back to 1902, exudes timeless elegance and history. Yet, beneath its historic exterior lies a tapestry of paranormal encounters and unexplained phenomena.

    Three specific rooms within the inn are rumored to house restless spirits. In Room 1, guests have reported the antique porcelain tub shaking mysteriously during baths, as though stirred by unseen hands. Room 6 resonates with ethereal organ music despite the absence of instruments, creating an enchanting yet enigmatic atmosphere.

    Room 11, however, emerges as the epicenter of these ghostly tales, rumored to be haunted by the spirit of Paul Dulaney, the inn's former handyman. His spectral presence occasionally materializes near the bed, blurring the boundaries between the living and the departed.

    As guests step into the historic Addy-Sea Inn, they anticipate encounters with the spectral. Within its hallowed halls, the living and the otherworldly intersect, offering a unique opportunity to commune with the spirits of yesteryear and engage in the timeless dance between the seen and the unseen.

###

3. [[Inn of the Goblin]]

    Nestled on Bethany Beach's serene shores, the Addy-Sea Inn, dating back to 1902, exudes timeless elegance and history. Yet, beneath its historic exterior lies a tapestry of paranormal encounters and unexplained phenomena.

    Three specific rooms within the inn are rumored to house restless spirits. In Room 1, guests have reported the antique porcelain tub shaking mysteriously during baths, as though stirred by unseen hands. Room 6 resonates with ethereal organ music despite the absence of instruments, creating an enchanting yet enigmatic atmosphere.

    Room 11, however, emerges as the epicenter of these ghostly tales, rumored to be haunted by the spirit of Paul Dulaney, the inn's former handyman. His spectral presence occasionally materializes near the bed, blurring the boundaries between the living and the departed.

    As guests step into the historic Addy-Sea Inn, they anticipate encounters with the spectral. Within its hallowed halls, the living and the otherworldly intersect, offering a unique opportunity to commune with the spirits of yesteryear and engage in the timeless dance between the seen and the unseen.

Why is this occurring? Do I need to change anything?
Comment: Is this a JS problem, a PHP problem, an HTML problem, or a CSS problem?
Answer: In displayErrorMessage function, you use innerHTML for story-container. When the error message load, the div with id="generated-text" will be replaced, so when you try to show one story again, there is no div with id="generated-text" to show the story.
You just need to show error message in generated-text or use another div.
function displayErrorMessage(errorMessage) {
        var storyContainer = document.getElementById('story-container');
        storyContainer.style.display = 'block';
        var generatedTextElement = document.getElementById('generated-text');
        generatedTextElement.innerHTML = errorMessage;
        document.getElementById('content-wrapper').style.marginTop = '60px';
        currentStory = null;
    }

story.txt
1. [[IDAHO: The Bear Lake Monster]]
...............................

###2. [[DELAWARE: The Addy-Sea Inn]]
..................................

###3. [[Inn of the Goblin]]
...................................

Comment: You don't need to delete this question, it will remain for future users that may have the same problem.
Comment: What would be a good way to change this?
Comment: I think I managed to fix it. But now there's the next issue, the first story generates just fine, but then the next story generates a bit further down leaving quite a bit of space on the top.
Comment: I edit my answer, replace the displayErrorMessage function that i send with yours, and the problem will be fixed.
Comment: Yes, that helped! But now there's the next issue, the first story generates just fine, but then the next story generates a bit further down leaving quite a bit of space on the top. And then the third goes even further down.
Comment: Because in your story.txt file, you are using 1 newline for story 2 and 2 newline for story 3, for fixing the problem you have to remove newlines from stories.
Comment: What do you mean by "removing newlines" ?
Comment: I edit my answer, saw the story.txt part. You have to edit your stories like this to remove extra lines.
Comment: Thing is, I need the blank lines to make it as paragraphs.
Comment: Just remove newline after ### and before number. Also, it would be nice if select my answer as final answer.
Comment: I'm quite new to Stack Overflow, so don't really know how to do that.

Also, when I press any of the buttons now, there seem to be some kind of a blinking effect going on for a second or so, any idea what causes this?
Comment: You did it and the answer is selected, thanks. Also, did my last comment fix your problem ?
Comment: Not really, but I found a fix in the PHP. But the blinking issue still exist where it blinks for a second whenever I press any of the buttons to generate a story.
Comment: For fix that, you can learn and use jQuery and callback function to control each move in browser.
Comment: It would take me quite long to learn jQuery and callback functions, so if you could help me with this I would be very, very thankful!
Comment: Sure, but you need to open a new question and describe what you want.
Comment: This issue has been resolved, but can't delete this question.
Comment: Somehow I've been banned from creating new questions, and I'm not sure how to resolve that :/
Comment: That's because you're asking too many questions ! Generally you have to dig in and after a couple of days if you are not success, then try to send new question.
Comment: Hanif, I think question bans are applied if a poster asks too many **downvoted** questions. Thus, the number of questions doesn't matter - if some of them were upvoted then the author would be permitted to ask more. [See this FAQ](https://meta.stackoverflow.com/questions/255583/what-can-i-do-when-getting-we-are-no-longer-accepting-questions-answers-from-th) on Meta. cc @PatrikQvarnström.


why 2 different strings have the same address in C?

Question: Code and example csv file below.
The Program I write is a csv reader. In the while loop I acquire the line of the file as a string and then with sscanf I extract the data that I store in local variables.
I have 2 strings that I store in char* name and char* surname but they happen to have the same address :
Printing description of name:
(char *) name = 0x000000010004da78 "Bob"
Printing description of surname:
(char *) surname = 0x000000010004da78 "Bob

I don't understand why since they have different variable names.
I hoped to have an answer with that question but it wasn't my problem : Temporary C strings have same address
I renamed the variables and re-build the .exe (using Xcode) but the problem remains. Any idea why that problem happens ?
Thanks
Code
void readFileTest(FILE* *pFile, TTest* *pRootTest)
//Reads the content of the file, line by line
{
    int count=0;
    char string[MAX_SIZE];
    TTest *pTestCurrent=NULL, *pPrevious=NULL;

    //Reads first line (wich is the label line)
    fgets(string, MAX_SIZE, *pFile);
    printf("Column labelling : %s\n", string);

    //allocating pointer
    pTestCurrent=malloc(sizeof(TTest));
    pTestCurrent->ID=0;
    pTestCurrent->name="";
    pTestCurrent->surname="";
    pTestCurrent->mean=0.0;
    pTestCurrent->pNext=NULL;
    pTestCurrent->pPrevious=NULL;

    (*pRootTest)=pTestCurrent;
    pPrevious=pTestCurrent;

    //Extracts data of each line and stores it in a node
    while(fgets(string, MAX_SIZE, *pFile)) //reads line by line until the EOF
    {
         int identification=0;
         char* name;
         char* surname;
         float mean=0.0;

         //Counts iterations (lines) in the file
         count+=1;
         printf("Iteration n°%d\n", count);

         //Extracts data of the line in variables
         sscanf(string, "%d,%[^,],%[^,],%f", &identification, name, surname, &mean);

        //Assign data in variables to node in pTestCurrent
         pTestCurrent->ID=identification;
         pTestCurrent->name=name;
         pTestCurrent->surname=surname;
         pTestCurrent->mean=mean;

         //Displays data in node
         printf("Line content (stored in pTestCurrent) :\nID : %d\nNAME : %s\nSURNAME : %s\nMEAN : %f\n\n", pTestCurrent->ID, pTestCurrent->name, pTestCurrent->surname, pTestCurrent->mean);

         if(pTestCurrent==NULL)
         {
             printf("ERROR : pointer pTestCurrent is NULL, the programm will exit now\n");
             EXIT_FAILURE;
    }

         //Refresh pointer
         pTestCurrent->pNext=malloc(sizeof(TTest));
         pTestCurrent=pTestCurrent->pNext;
         pTestCurrent->pPrevious=pPrevious;
         pTestCurrent->pNext=NULL;
         pPrevious=pTestCurrent;
         }
};

Example file :
ID,NAME,SURNAME,MEAN
1,Smith,Bob,4.32
2,Mason,Jack,9.21
3,Gabe,John,2.67

Answer: The problem here is, inside the while loop, you're using uninitialized pointer. Those pointers are not guaranteed to point anywhere valid, and you're trying to access the memory location pointer by them. This causes undefined behavior
Solution: before you pass them as the argument to sscanf(), you need to make sure they point to some valid memory which can be accessed by your process.
Comment: It is even worse as there is no memory allocated but accessed. It is just poor knowledge of the the basics of the C language.
Comment: Initializing them won't help if he continues to "copy" strings this way.
Answer: You make two mistakes:

you do not have valid memory when you sscanf
you do not copy the values scanned.

The first:
    sscanf(string, "%d,%[^,],%[^,],%f", &identification, name, surname, &mean);

here name and surname are only pointers to char, but they do not point to memory of your program (they are uninitalized and can point anywhere. It would have been likely you got a segmentation fault). In stead, do:
    char name[64], surname[64];  // or any proper size for the names

You now have valid memory for your sscanf.
Second, when you copy the data scanned to your structure, you must have allocated memory in your structure for the data. With only pTestCurrent->name=name; you place the pointer to name in the name field of your structure, but you do not copy the data. Consequently, upon your next sscanf you will just overwrite the data. In stead, do:
    pTestCurrent->name= malloc(strlen(name)+1);
    strcpy(pTestCurrent->name, name);


Is there a way to save username and password for print authentication?

Question: I saw this this question and followed its answer, but the problem persists for me. Once I send a document to print, this dialog box (in figure) opens up and shows "Held for authentication". Then I right-click and enter my username and password and then the pdf is sent to the network printer.
Is there a way to store my username and password? The 'Remember password' option does not work. I do not want to remove authentication (can't see how the network printer will identify me if I am not authenticated, as the network is based on Windows), I just want to save my username and password into some appropriate file so that I do not have to key in every time.
Comment: Does "Remember password" not work? Do you search a program to save passwords?
Comment: No, it doesn't, unfortunately. Instead of a program for doing pwds (I do not know about them), I thought I could save in some text file from which this program collects its data.
Comment: Is the username/password to your local machine or to the printer itself?
Comment: @David: It is the network printer and I have to log in with my network username and password.
Comment: can you change your local password to be the same as the network one
Comment: @jet: the passwords are the same, but that's irrelevant as the Network runs on Windows...
Answer: that's a bug, look at bugs.launchpad
on another page they write:

If I don't type anything, the window's form says that I will send my username only (and a blank password) but wireshark shows that it is instead sending the correct username and password (which I entered into the printers folder, but which is hidden).

maybe it works for you
Answer: This might work. Although you are not sharing a printer on your computer the fact that you install Samba and connect to a share on your network means you might get authentication via Samba. I haven't tried it personally but its worth a shot.
https://help.ubuntu.com/12.04/serverguide/samba-printserver.html


Burying multiple circuits in one trench

Question: I'm in the process of running a circuit from the panel in my garage to an equipment area for a koi pond I built.  Because of some rock at about 16 inches depth in part of the run, I'm taking advantage of the code allowance for 12" depth for the circuit which will be 20A and GFCI protected.  In addition, I'm running it in nonmetallic conduit. There will be a receptacle at the equipment location but I'll also use this opportunity to add one at a nearby patio.
I've dug the trench and installed the conduit, no wires pulled yet.  Currently I have an outdoor extension cord providing service to the pond and patio.  While traveling, a contractor came by to do some work and plugged in on the patio.  They ended up tripping the breaker and couldn't reset it (locked garage) so they left.  One of my neighbors later noticed that the pond equipment (life support for the koi, really) was off.  He called and we got it started.  But this got me thinking that it would be pretty easy to have something in the other outlet trip my pond off.
So, I've decided I probably need to forego the patio receptacle.  But I was curious.  The way 300.5 is written is says max 20A overcurrent protection and GFCI.  I've interpreted this as the total of all wires in the trench/conduit.  But, is it possible to run 2 circuits in that conduit if each is less than 20A?  I'm guessing not, but I don't really understand the full interpretation of that.
Thanks
Answer: I am not a code expert, but my understanding of reading 300.5 is that multiple circuits would be permitted, provided:

Each circuit <= 20A and GFCI protected
Conduit fill requirements are met (not a big deal for small circuits)
Conduit multiple circuit derate requirements are met

The last can be an issue. As I understand it from many previous posts on DIY SE, generally speaking 2 circuits are not a problem due to the way wire current ratings are defined but once you have 3 there can be problems and 4 or more is pretty much guaranteed to require large wires than usual.
Assuming all that to be the case, you should be able to run 2 15A and/or 20A circuits in one conduit. Based on this fill table even 1/2" PVC 80 can handle 5 wires = 2 x hot/neutral + 1 x ground.
You may want to consider metal conduit. With the right type of metal conduit, you can go to 6" depth instead of 12".
As far as GFCI, install it inside the building. That can be a GFCI/receptacle or GFCI only or GFCI/breaker. The GFCI electronics will last far longer (and likely fewer nuisance trips) if installed inside (temperature controlled, no rain) than outside. Every receptacle outside must be GFCI protected, no ifs, ands or buts. Another answer noted the issue of exceptions. Those exceptions are for things like fire alarms and, in some jurisdictions, refrigerators. You don't want to risk a ground-fault problem in an outside water feature - the risk to a human (instant injury or death) is far greater than the risk to your koi, as much as you may love them, if their equipment is temporarily off.
If you do get frequent nuisance trips, try to figure out where/how to better protect the equipment. But at least putting the convenience receptacles on a separate circuit will avoid a nuisance trip on that circuit from affecting the koi pond equipment.
Comment: "Every circuit outside must be GFCI protected, no ifs, ands or buts" That's not quite right. Outdoor *receptacles* must be GFCI protected. There is not a general requirement to protect the wiring with an upstream GFCI - GFCI at the receptacle is valid (if arguably a bad idea due to putting electronics outdoors). However, the OP *must* implement upstream GFCI coverage in order to be allowed to cover their buried conduit with only 12" of cover instead of the usual 24".
Comment: As long as the circuits are <=20A, four is not a problem.  With 4 circuits in a pipe, #14 wire derates to 17.5A and #12 wire derates to 21A.  Assuming it is not UF cable, but UF cable has no business in sanely sized conduit.
Comment: @nobody You are correct. For example, hardwired lighting fixtures do not require GFCI.
Comment: That's really interesting.  My reading of 300.5 was that the circuit itself required GFCI protection, but then I missed all the rest of this too.  I have 1" conduit in the trench now so I should be fine on the fill factor.  I just ran this size conduit because my experience was it was easier to pull through and not really harder to run.
Comment: Actually you are probably correct with 300.5 for a shallower trench. I'm referring to general outside gfci
Answer: Since this is a life safety device for the koi, it should not be on a shared circuit and should not be on GFCI.  How the heck do you do that to a water feature?
Low voltage.  You knock it down to 24 volts for transmission to the koi pond. 24 volts is not dangerous and can be around water installations.
I understand that 24 volt aerators are readily available; some are even designed to be fed off solar. (an interesting option coupled with battery; after all what do the poor dears do during a power outage?)
If you can only get a 120V aerator, then you bump it back up from 24V to 120V as close as possible to the pump, and locally derive that 120V, meaning you need a ground spike right there.  But make a real effort for everything out at the pond to be 24V.
Note that low voltage is MUCH more sensitive to voltage drop, so be careful about wire sizing. If cost becomes prohibitive, bump up to #6 or even #2 aluminum. The cheapest way to splice aluminum to copper (in a low-voltage regime) is with bare lug-style terminals (look at a service panel accessory ground bar for an example of those, in fact you can get one and cut it up!) You can get them with plastic molded cases around them (Polaris, ILSCO Mac Block, Alumiconn) but that considerably more than doubles the price, and you can just wrap them a whole bunch of layers of electrical tape.
Comment: 120V is pretty common with ponds.  I have another in a different location that's been fed from a GFCI for about 10 years and never had a nuisance trip happen.  It feed three devices at a pond (in my filter builds), a pump an air pump and a UV light.  None of these is in the pond (like a submersible pump), they are all about 10-20 feet from the pond, depending on the install.
Answer: There is nothing wrong with running multiple line voltage circuits in the same conduit. You can't run low voltage in the same conduit.  You didn't mention the size of the conduit, so you'll have to learn about fill capacities. Having 2 circuits individually protected by GFCIs would minimize the chances of the "life support" for your pond failing.  But being realistic, outdoor circuits often have nuisance trips on GFCIs.   I'm not sure, but believe it's code legal on critical circuits to swap out a GFCI  breaker with a normal breaker if you are getting nuisance trips.  I'm not sure if a Koi pond would count as a critical circuit.
Comment: I don't think any GFCI event in a *pond* should be regarded as a nuisance one.  If there ARE nuisance trips, (and there aren't .. but if there are) you should eliminate the source of them so that you can provide and have confidence in GF protection in a situation that badly requires it.  In other words ... if water is getting where it shouldn't ... that's not a nuisance trip!  If there is some pump motor functioning normally but somehow triggering the GFCI ... throw it out, and get one that doesn't.
Comment: ...continuing nuisance trips are a problem because they can result in food spoilage:  If a GFCI trips on a freezer or fridge and there's nobody around (think vacation) you could end up with a ruined freezer full of food. I KNOW I KNOW what you're going to say:  "It's better than getting electrocuted and dead". If the fridge, freezer were properly grounded, there would be virtually no chance of injury.  Let's be a bit more realistic about this subject.  I'll get snipped on this for sure, but come on, let's not let the perfect become the enemy of the good.
Comment: I agree that I wouldn't regard it as nuisance.  In fact, when people tell me they are getting a nuisance trip on ANY GFCI my first response is "I know it's a nuisance to you but are you sure there's not a problem?"  Many years ago I had trips on a hearing device used to keep a hole in ice in the winter.  Electrician said "I see nuisance trips like this all the time."  I put it on the bench and, yup, there was a current leak.  Thanks.
Comment: Nuisance trips are real, folks.  I had a Treager smoker and it would frequently  nuisance trip the GFCI outlet.  I plugged it into another GFCI outlet and it still tripped it.   So I ran an extension cord to a non-GFCI outlet and it worked fine. To test, I used one of those old 2 prong to 3 prong adapters (not a good product BTW!) and tested using a digital multi meter between the smoker and a good known ground.   Got nothing, zero zip nada. Tried several times and nothing. Of course I removed the adapter so at least the smoker would be properly grounded.   ....Just saying....don't dis on me.
Comment: I'm not dogmatic about it, though I try to keep with the code.  In my case the receptacles are outdoors so they really should be GFCI and I really should figure out what's tripping them if they trip.  As I see it, GFCI is monitoring the difference in current on the hot and neutral and within a time/magnitude it will trip.  If you have a device with a large LC circuit that might distort this, it's probably not good for GFCI.  None of the devices I have should have an issue.  The rare case where I had a trip it was a heater and it was a real fault.
Comment: It is all a balance of risk/benefit. The risk with an outdoor pond is arguably higher than the risk in a kitchen (though comparable to a bath). In a kitchen most people don't say "refrigerator has an issue, let's get rid of all the GFCI" - it is (hopefully) more like "refrigerator has an issue, let's put it on a separate circuit or on a protected circuit but before the GFCI". Outside with water the equation is very, very different.
Comment: I do agree that anything that involves water and electricity  should be well grounded and GFCI protected.   I mean: Water and electricity...what could go wrong?!"  (sarcasm intended).  I just didn't know whether a pond pump feeding live fish would be considered a critical circuit, which is WHY I said I didn't know.      If it had a serious short/ground fault w/o GFCI protection, guess what's for dinner!?  (More sarcasm intended)!  Don't yell at me for this, it's just a joke. Take care and NEC on!

Burying multiple circuits in one trench


Powershell sql provider databases collection missing system databases

Question: When connecting to the powershell sql provider on 2008R2 the Databases collection does not seem to include the system databases.
Any ideas how to include master, msdb, etc. in the returned list ?
Using SMO does it, I was just curious how to do it with the provider.
E.g
push-location "SQLSERVER:\SQL\$env:COMPUTERNAME\DEFAULT\Databases"
Get-ChildItem | Select-Object Name
Pop-Location

Returns:
Name
----
DBA

Answer: this way:
push-location "SQLSERVER:\SQL\$env:COMPUTERNAME\DEFAULT\Databases"
Get-ChildItem -force | Select-Object Name
Pop-Location


Partitioning failed

Question: I was installing Ubuntu with Wubi off a USB stick, and the demo launched fine and everything so I decided to install Ubuntu for dual boot. So while installing I guess that partition failed cause it was stuck on creating et4.
I closed down Ubuntu and started up Windows and when I looked at my hard drive space it went from ~168 GB down to ~86 GB. So I am guessing it did partition but Ubuntu must have not installed correctly.
When I boot my PC It goes straight to Windows, and if I go to the boot menu it also shows Ubuntu If I have my USB plugged in. Is there anyway to correct this so I can get my HDD space back? I gave about 92 GB for Ubuntu on the partition.
Comment: I also went to my disk management and it won't let me expand my main partition.
Comment: Wait. Did you use Wubi or did you use standard partitions?
Comment: I just used Wubi. Wubi said nothing about partitioning your drive before I installed it.
Answer: Since you used Wubi to install Ubuntu, you can use Windows' Add/Remove Programs tool to uninstall Ubuntu.
Also, I believe that Wubi uses file instead of partitions. So, you should be able to find the partition file somewhere. I guess you could search for large files or something. I'm no Windows expert and have never personally used Wubi, so I can't be more specific.

Partitioning failed


Add simple option to an InstallShield Express project?

Question: I've got a very simple, straightforward Install Shield Express project that installs our client software.
Currently, I only show a minimal set of dialogs during the installation process (Welcome, License Agreement, Destination Folder, Done).
My goal is to allow the user a way to select an option. When the option is selected, we will create 1 additional Shortcut on the desktop (that shortcut will have an additional option added to the Target section - a parameter to pass in to the .exe file).
What's the best approach to let the user to set this option/flag?
I considered enabling the "Setup Type" Dialog, and overriding the default options and creating 2 different Setups - "Normal" and "Normal with Extra Shortcut". That seems a bit sloppy to me, and a lot of work for 1 true / false option.
Answer: Your install flow seems to be the following if I read correctly:
click to install >> welcome >> license >> destination folder >> installing... >> done!
If this is the case, and the shortcut needs to be picked before installing since it's a paramater passed to the .exe file then I'd say let users select that as a checkbox in the destination folder box. It follows to put it there logically because then they can see both locations at once.

Now all this is given the limitation that the checkbox can't be placed at the very end when installation is complete, because that is where most applications ask whether the user wants to create a shortcut or not.


Does Locust Swarm stack?

Question:
Possible Duplicate:
Do damage over time effects stack?

I'm playing Diablo 3 as a Witch Doctor and go for Aoe-Dmg at the moment. Therefore I use Locust Swarm a lot. Because there seems no debuff/dot-icon on the enemies I wonder if Locust Swarm will stack? So basically there are several situations where it's important if the skill stacks:

I hit a mob twice with LS
I hit a mob with LS, this mob infects another mob and then I hit the new infected mob manually with LS
I play with another WD in a group (different skillrunes) and we attack a group of enemies with LS

It seems like it won't stack (haven't tried the group-WD-thing), but I'm not quiet sure.
Does anyone have any experience with this spell?
Answer: Your own Locust Swarm won't stack, in the same way that a Wizard cannot stack their Blizzard ability. In your first instance where you hit the same mob multiple times, all you will do is refresh your stack, overwriting the old one with the full duration of the debuff from the new one, but without stacking the daamge.
In your second instance, you hit a mob with LS, LS spreads, you then hit the mob it spread to manually with LS. In this instance the second mob will have their LS debuff refreshed.
In the third instance, multiple of the same class can stack their abilities together but the stacking of some effects is limited. In the case of Locust Swarm, it can be applied once by each Witch Doctor in the group to each mob, following the same rules as above.
Edit: more information on the stacking of Damage over Time in Diablo 3 is available half way down this post:

"Damage over time effects do not stack in Diablo 3. Everytime you use the same dot on the same target you do only reset the timer to the maximum duration. This does prevent extreme damage numbers from long time dots. The dot effects are balanced to make good damage over a longer time allowing you different actions in the mean time. They have the best damage to cast time ratio."
Answer: You can stack Locust Swarm on enemies if your int changes between stacks.  Locust Swarm, Soul Harvest, Locust Swarm will let you double it up; a gear switch might too, but that would be really really annoying.
Comment: How do you know it is actually stacking and not just replacing the old one with the new one?  Can you see both ticking at the same time?
Comment: I took off most of my int gear and my weapon, to reduce my DPS.  Then I eyeballed the damage done by the end of the DOT effect.  it didn't seem just to have refreshed.
Comment: Hmm, sounds kind of inconclusive, given that we have an official statement that they always replace and never stack.
Comment: And perhaps if it did, it was a bug? (ie: not intended... swapping gear mid fight isn't probably recommended, and while soul harvest is very useful, it should only increase damage not change the affect)

Does Locust Swarm stack?


PHP website logs me out, what could it be?

Question: I have a PHP application. It is load balanced across 2 servers. The problem is I keep getting logged out of the session I am in (after a long period of time) and I am not sure why. I have not been with this code for very long and am not sure where to start.
It's a Zend Framework application.
Any ideas?
Comment: Sessions are only stored in the server temporarily while cookies can be saved for a long period of time. Using sessions will cause you to log out. You should try using cookies instead.
http://php.net/manual/en/function.setcookie.php
Comment: I was going to say gremlins, but I like the aftershave reason better.
Comment: I do use cookies but the user has a session once the cookie is authenticated, it doesn't check the cookie every time. I use zend auth stuff.
Comment: I would use CKone - Get the chicks hot. Cookies behind the ear does not hit the note.
Answer: Might be how your sessions are managed.
Check the session manager:
<code>var_dump(Zend_Session::getOptions());
</code>
If you get the below:
<code> ["save_handler"]=> string(5) "files" ["save_path"]=> string(13) "/var/lib/php5"
</code>
Try a session and check that the file is created on one of the web servers but not the other. The options say that it is stored in a file.
If it is then the problem is the session manager. Change the session manager to use the db or memcached (if possible). It needs to be something which could manage users on both server.
Comment: Hi yes I get files. So the session manager is using files. Ok will look into using mencache or something else as the manager. Thanks


Location Service using Cordova

Question: I want to check the location and store the required data in the internal storage of the mobile. To stop this task, use has to tap stop button in the main ui. As this task started, no matter the state of the app, that task should do its work.
I can implement this using native android command. But I want to implement this using cordova and I can't figure out a way to do this..
If this task cannot be done using cordova, can I do it using native android and inject to the cordova app..??
Please help..
Answer: You can do this using the ng-cordova geolocation watcher, it watches geolocation properties such as lat, lon, and speed.
first intall ng-cordova and inject it
bower install ngCordova

angular.module('myApp', ['ngCordova'])

then install the geolocation plugin
cordova plugin add org.apache.cordova.geolocation

then you want to create a watcher, make sure to fire it after a device ready event or it will cause problems
This is what device ready function looks like
document.addEventListener("deviceready", function () {
  $cordovaPlugin.someFunction().then(success, error);
}, false);

here is the watcher controller:
module.controller('GeoCtrl', function($cordovaGeolocation) {

  var watchOptions = {
    frequency : 1000,
    timeout : 3000,
    enableHighAccuracy: false // may cause errors if true
  };

  var watch = $cordovaGeolocation.watchPosition(watchOptions);
  watch.then(
    null,
    function(err) {
      // error
    },
    function(position) {
      var lat  = position.coords.latitude
      var long = position.coords.longitude
  });

  watch.clearWatch();
  // OR
  $cordovaGeolocation.clearWatch(watch)
    .then(function(result) {
      // success
      }, function (error) {
      // error
    });
});

As you watch their geolocation info you can push it into a local database like http://pouchdb.com/ or couch db or a server database. If you want to use this in any state of the app you can make it into a service,
here is an example in a app i built
service.watchSpeed = function () {
        console.log('watcher');
        ionic.Platform.ready(function () {
            var watchOptions = {
                frequency: 15 * 60 * 1000,
                timeout: 1 * 60 * 1000,
                enableHighAccuracy: true // may cause errors if true
            };

            service.watch = $cordovaGeolocation.watchPosition(watchOptions);
            service.watch.then(
                null,
                function (err) {
                    service.watchSpeed();
                },
                function (position) {
                    if (service.maxspeed.ToUseApp !== 0) {
                        var lat = position.coords.latitude;
                        var long = position.coords.longitude;
                        var speed = position.coords.speed;
                        service.speed = speed;
                        if (speed > service.maxspeed.ToUseApp) {
                            $state.go('overspeed');
                        }
                        if ($ionicHistory.currentStateName() === 'overspeed' && speed < service.maxspeed.ToUseApp) {
                            $ionicHistory.goBack();
                        }
                    } else {
                        console.log('speed watcher has been killed, why master??');
                    }
                });
        });
    };

then in my home controller i call the watcher
ionic.Platform.ready(function () {
                ffService.getMaxSpeed();
            });

Comment: Is there a way to check whether this service has started already..?
Comment: Yeah see where is put my console log (watcher)  that tells you when the geowatcher has started.
Comment: I have this kind of a problem. User start this service and close the app without stopping the service. After that user open the app again and try to start service again. Then I have to inform the user that this service is already stated.. How can I do such a thing..?
I'm very new to cordova, please help..
Comment: Just bind a factory variable like service.started in the geowatcher. Then on whatever page you are showing check to see if service.started is true or false.
Comment: I am about to head to class but I can add a example if this later if you would like

Location Service using Cordova


If a value comes through an if/then statement remove element from array - Javascript

Question: I am looping through elements in an array. If a value is not within a specific range I want to remove the element (that the value is associated with).
Here's what i have so far (see code below) - I am using the pop method to remove the element as it comes through but the last element in the array always gets removed and NOT the element/value within the if/then statement. I've tried the splice method as well but I can't get that to work. Any idea on how to do this?

    var h = [
     ["29","Verbena St", "500", "2", "2,702"],
     ["36", "Quitman St", "400", "2", "1,700"],
     ["32", "Alan Dr", "500", "2", "2,408"],
     ["34", "Newton St", "300", "2", "1,954"],
     ["30", "Soth Pl", "400", "2", "1,509"]
    ];

    var hs = [
      ["Verbena St"],
     ["Quitman St"],
        ["Alan Dr"],
      ["Newton St"],
      ["Soth Pl"]
    ];

function Location (){

    for (var r = 0; r <= h.length; r++){
        var p = h[r][0];
     var address = h[r][1]; // Get address
        if (p >= 21 && p <= 33 && address == hs[r]){
            console.log(address);
        }
        else {
            console.log(address + " - OVER 33");
            h.pop(address);
            console.log(address + " - REMOVED");
        }
   }
};

Location();
Comment: please add the wanted result as well.
Comment: because _the pop() method removes the last element from an array_
Comment: [Related or duplicate](https://stackoverflow.com/questions/9882284/looping-through-array-and-removing-items-without-breaking-for-loop)
Answer: It's not good practice to remove elements from an array while iterating through it, instead, you can filter it using filter(), like this :

var h = [
  ["29","Verbena St", "500", "2", "2,702"],
  ["36", "Quitman St", "400", "2", "1,700"],
  ["32", "Alan Dr", "500", "2", "2,408"],
  ["34", "Newton St", "300", "2", "1,954"],
  ["30", "Soth Pl", "400", "2", "1,509"]
];

var hs = [
  ["Verbena St"],
  ["Quitman St"],
  ["Alan Dr"],
  ["Newton St"],
  ["Soth Pl"]
];

function Location (){
  h = h.filter(function(r, i){ // r = value, i = index
    var p=r[0];
    var address = r[1]; // Get address
    return p >= 21 && p <= 33 && address == hs[i];
  });
};

Location();
console.log(h);

Or, in case you want to display messages, you can use another array and only push the elements you want to it (better use a forEach) :

var h = [
  ["29","Verbena St", "500", "2", "2,702"],
  ["36", "Quitman St", "400", "2", "1,700"],
  ["32", "Alan Dr", "500", "2", "2,408"],
  ["34", "Newton St", "300", "2", "1,954"],
  ["30", "Soth Pl", "400", "2", "1,509"]
];

var hs = [
  ["Verbena St"],
  ["Quitman St"],
  ["Alan Dr"],
  ["Newton St"],
  ["Soth Pl"]
];

function Location (){
  var g = [];
  h.forEach(function(r, i){ // r = value, i = index
    var p = r[0];
    var address = r[1]; // Get address
    if (p >= 21 && p <= 33 && address == hs[i]){
     console.log(address);
      g.push(r); // push it
    }
    else{
      console.log(address + " - OVER 33 - REMOVED"); // do nothing
    }
  });
  h = g;
}

Location();
console.log(h);
Comment: Yes the filter method is what I was looking for!
Answer: For removing elements of an array, you could loop from the end and splice if necessary, because the next smaller index is not affected.

function updateLocation() {
    var address, p, r = h.length;
    while (r--) {
        p = h[r][0];
        address = h[r][1]; // Get address
        if (p >= 21 && p <= 33 && address == hs[r]) {
            console.log(address);
        } else {
            console.log(address + " - OVER 33");
            h.splice(r, 1);
            console.log(address + " - REMOVED");
        }
    }
}

var h = [["29", "Verbena St", "500", "2", "2,702"], ["36", "Quitman St", "400", "2", "1,700"], ["32", "Alan Dr", "500", "2", "2,408"], ["34", "Newton St", "300", "2", "1,954"], ["30", "Soth Pl", "400", "2", "1,509"]],
    hs = [["Verbena St"], ["Quitman St"], ["Alan Dr"], ["Newton St"], ["Soth Pl"]];

updateLocation();
console.log(h);


wordpress: remove year and month in url using .htaccess

Question: I want to Remove year and month in url
https://www.newkannada.com/2016/10/mukunda-murari-kannada-songs-download.html
To
https://www.newkannada.com/mukunda-murari-kannada-songs-download.html
this is my code
BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)/?$ $1.html [L,R=301]
RewriteRule . /index.php [L]
</IfModule>

END WordPress
Answer: To change URL format, you need go to dashboard and go to Settings -> Permalinks. And in Common Settings section, select Custom structure. Next, input /%postname%.html into this field.
Comment: i had tried this, still https://www.newkannada.com/2016/10/mukunda-murari-kannada-songs-download.html showing 404 error


Procedure expects parameter which was not supplied in SQL

Question: I'm getting this error when accessing a stored procedure in SQL Server:

Procedure or function 'resetdata' expects parameter '@FirstName', which was not supplied.

This is my table:
CREATE TABLE dbo.Client
(
    ClientID int IDENTITY(1,1) PRIMARY KEY NOT NULL,
    FirstName VARCHAR(50) NOT NULL,
    LastName VARCHAR(50) NOT NULL,
    StreetAddress VARCHAR(50) NULL,
    Suburb VARCHAR(15)NULL,
    C_State VARCHAR(3) NULL, --CHECK (C_State IN ('QLD', 'NSW', 'VIC', 'TAS', 'SA', 'WA', 'NT', 'ACT')),
    PostCode SMALLINT NOT NULL,
    PhoneNumber VARCHAR(11) NULL,
);
GO

ALTER TABLE Client
ADD CONSTRAINT state_ CHECK (C_State IN ('QLD', 'NSW', 'VIC', 'TAS', 'SA', 'WA', 'NT', 'ACT')),
    CONSTRAINT check_post_code CHECK ([PostCode] LIKE '[0-9][0-9][0-9][0-9]' or [PostCode] LIKE '[0-9][0-9][0-9]');
GO

This is my stored procedure:
CREATE PROCEDURE [dbo].[resetdata]
    @FirstName varchar(50),
    @LastName varchar(50),
    @PostCode smallint
AS
BEGIN
    INSERT INTO A1.dbo.Client (FirstName, LastName, PostCode)
    VALUES(@FirstName, @LastName, @PostCode)
END;
GO

EXEC dbo.resetdata;
INSERT INTO Client(FirstName, LastName, PostCode)
VALUES ('F', 'L', 12345);

Comment: I'm curious as to the purpose of the procedure "dbo.resetdata". It does not reset anything; it just adds a new row. After calling the procedure, you insert a row manually, which suggests you were expecting it to do something else. Perhaps you could elaborate on what you are trying to accomplish.
Answer: Error message means exactly what it says: your SP is expecting three arguments as declared.
This is your SP header definition:
create procedure [dbo].[resetdata]
    @FirstName varchar(50),
    @LastName varchar(50),
    @PostCode smallint

Three arguments. None of them has default.
This is how you're attempting to execute it:
EXEC dbo.resetdata;

No arguments provided. This causes the error from your question. Pass arguments to avoid error message.
Couple of things:

if you will try to apply script of your SP to test database or another copy of your database, you will have to modify your first line with USE A1. I'd suggest to remove this line. Choose DB once you connect, then just run all scripts on current database
Insert INTO A1.dbo.Client - same note about different databases and one more - if you already defined database with USE A1 at the beginning of the script, why are you referring same DB explicitly? If your SP and table are supposed to be in same DB - don't specify DB.
Answer: There are a couple of issues here:

The EXEC procedure is not passing the parameters required.
There is a constraint on the Postcode that will fail with 12345.

The correct code to run your stored procedure would be:
   EXEC [dbo].[resetdata]
        @FirstName = 'F',
        @LastName = 'L',
        @PostCode = 123

Answer: Try this:
USE A1;
GO
create procedure [dbo].[resetdata]
@FirstName varchar(50),
@LastName varchar(50),
@PostCode smallint
AS
BEGIN
Insert INTO A1.dbo.Client (FirstName,LastName,PostCode)
VALUES(@FirstName,@LastName,@PostCode)
END;
GO

EXEC dbo.resetdata @FirstName='F', @LastName='L', @PostCode=12345
--INSERT INTO Client(FirstName,LastName,PostCode) VALUES ('F','L',12345); No need to this Insert

Note: In sample data, you are going to insert 12345 to PostCode column, So it seems that 5 digit numbers are valid, but you have check constraint that shows PostCode should be 3 or 4 digit length. If 5 digit is valid so pay attention to the PostCode column's data type as it's maximum value is 32767. So if you want to insert a record with PostCode greater than this value you will get an error. May be it would be better to define it as INT and control it's value via a Check Constraint and also change the current check constraint definition on this column.


Seam Hello World won't work through Eclipse

Question: I'm trying to follow any tutorial there is on the Internet to create a Seam "hello world" app.
I've installed Seam 2.2.Final, and deployed some of its tutorials using ant on my JBoss 5.1 server. They work.
Now, I'd like to run any of these (or even an empty project) from Eclipse, and this can't be done.
So, what I'm doing in Eclipse is this:
File -> New -> Seam Web Project
In the Seam Facet configuration, I create a connection profile for my mysql database, using mysql driver I downloaded: mysql-connector-java-5.1.10-bin.jar
When I test the connection, the ping returns success.
Next I finish the project Wizard and restart my JBoss 5.1 server.
It returns 3 exceptions:
<code>        17:51:35,334 ERROR [[/SeamPr2]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
        com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.seam.jsf.SeamApplicationFactory
            at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:213)
            at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196)
            at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:60)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
            at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
            at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
            at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
            at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
            at $Proxy38.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
            at org.jboss.Main.boot(Main.java:221)
            at org.jboss.Main$1.run(Main.java:556)
            at java.lang.Thread.run(Thread.java:680)
        Caused by: java.lang.InstantiationException: org.jboss.seam.jsf.SeamApplicationFactory
            at java.lang.Class.newInstance0(Class.java:340)
            at java.lang.Class.newInstance(Class.java:308)
            at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:537)
            at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405)
            at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135)
            at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717)
            at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239)
            at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:186)
            at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:131)
            at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:203)
            ... 71 more
</code>
Here's the second one:
<code>        17:51:40,811 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/SeamPr2 state=Create mode=Manual requiredState=Installed
        org.jboss.deployers.spi.DeploymentException: URL file:/Users/nataliazon/devel/jboss-5.1.0.GA/server/default/tmp/5c4o13-6fo297-h37fm7za-1-h37fmra7-v/SeamPr2.war/ deployment failed
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:331)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
            at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
            at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
            at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
            at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
            at $Proxy38.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
            at org.jboss.Main.boot(Main.java:221)
            at org.jboss.Main$1.run(Main.java:556)
            at java.lang.Thread.run(Thread.java:680)
</code>
And the third one:
<code>        17:51:40,830 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/Users/nataliazon/devel/jboss-5.1.0.GA/server/default/deploy/SeamPr2.war/ state=PreReal mode=Manual requiredState=Real
        org.jboss.deployers.spi.DeploymentException: URL file:/Users/nataliazon/devel/jboss-5.1.0.GA/server/default/tmp/5c4o13-6fo297-h37fm7za-1-h37fmra7-v/SeamPr2.war/ deployment failed
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:331)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
            at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
            at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
            at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
            at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
            at $Proxy38.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
            at org.jboss.Main.boot(Main.java:221)
            at org.jboss.Main$1.run(Main.java:556)
            at java.lang.Thread.run(Thread.java:680)
</code>
Please, help me. I have no idea where the errors come from, since ant deployment on the same JBoss5.1 and Seam 2.2 works fine, and I follow the tutorials step by step.
Answer: I've never had good luck creating a Seam project through Eclipse.  It's simpler to use seam-gen to create your project in your eclipse workspace, open Eclipse and create a new project(not a seam project, just a plain project) using the same name as the project you just made in seam-gen.  The project can then be built and configured through eclipse.
Word of advice about using 2.2 and JBoss 5 - you might want to consider Seam 3 or at least the Beta Seam 2.3 with JBoss 7 if you plan on staying with Seam.  Except for a few people(Marek Novotny put together 2.3) Seam 2 is no longer being maintained.  Seam 3 doesn't work with JBoss 5 and Seam 2 requires major contortions to work with JBoss 7.   The transition has been handled poorly and doesn't look like that will improve with The Seam 3 - Apache Delta Spike move.
Comment: Thanks for your advice! I have been struggling with Eclipse for 2 days now, and even though some problems have vanished (though for reasons unknown to me), more and more new problems are appearing. It's like a matryoshka doll of endless exceptions. What a painful experience.
I finally gave up and decided to do it through seam-gen, and it works so far.


$(\sum_{i=1}^n\omega_i)^t$: A Generalization on Term Cardinality of Multinomials

Question: I'm asked to compute the number of terms in the expansion of the expression below:
$$(w+x+y+z)^{10}$$
What is meant by "terms"? How can this be generalized so that we can find something like this:
$$(\sum_{i=1}^n\omega_i)^t$$
Comment: I get $286$... Is that right?
Comment: Describe how you get 286 (-:
Comment: I get $286$ also.
Comment: I get $1716$. Is that right?
Comment: https://en.wikipedia.org/wiki/Multinomial_theorem To be honest, I got $286$ by copying the "copyable plaintext" from what Wolfram found the expansion to be, then used the find-replace feature in Word to replace $+$'s with $*$'s and it said "Word has completed its search of the document and has made $285$ replacements," so that means there are $286$ as the pattern goes $()+(): 1\implies 2$, $()+()+(): 2\implies 3$, and so on...
Comment: I used the Multinomial Theorem to get the latter answer though...
Comment: Haha, that is clever, but that should only be used as a tool to verify your answers.  See @AndréNicolas's answer for reference to Stars and Bars method. As he noted, that is exactly what you need (-:
Answer: If you expand this expression, you get a sum of products of variables. the summands are the terms.
Comment: Yes, but I mean in the final expansion when I "simplify" the resulting expression, then am I to count then or when it's all strewn about?
Comment: You sum the terms until you can't sum them anymore. Take $$(a+b)^{2}$$ as an example. You end up with 4 terms when you start expanding, but after you add the like terms, you end up with 3.
Comment: I got $286$, but what's the method?
Comment: I get $1716$ now is that good then?
Answer: Presumably they mean that for example $(x+y)^2$ has three terms, and $(x+y)^3$ has $4$. We multiply out blindly, and then gather expressions involving the same power of $w$, $x$, $y$. and $z$ together.
Note that a term has shape $Cw^ax^by^cz^d$, where $a, b.c.d$ are non-negative integers whose sum is $10$, and $C$ is a multinomial coefficient. So we want to find the number of solutions of $a+b+c+d=10$ in non-negative integers.
To find how many choices there are for $(a.b.c.d)$ is a standard combinatorial problem, solved by the method sometimes called Stars and Bars. The Wikipedia article on this is pretty good.
We are not writing down the explicit formula in the hope you will go to the article.
Problems involving Stars and Bars have also been repeatedly discussed on MSE.
The solution for $4$ and $10$ generalized readily to $n$ and $t$.
Answer: By terms they mean all combinations of
$$
w^ix^jy^kz^t \qquad (i,j,k,t\in\mathbb{Z})
$$
That exist when you foil out the complete polynomial. An easy way to get a pattern going would be to check out what happens when the exponent is $1,2,3$ (instead of $10$). From there, see if you can get a general expression based upon the number of variables ($4$) and the exponent ($10$).


why we can't initiaize data member in a member function using list initializer?

Question: why assignment is working, but initialization not working ?
please explain what is happening in these 3 cases in code.
#include <iostream>

class Fun {
public:
    void set_data_variable()
    {
        y {2};      // case 1 : this doesn't work
        // y = 2;   // case 2 : this does work
        // y = {2}; // case 3:  this also work

        std::cout << y << "\n";
    }
private:
     int y = 6;
};

int main()
{
    Fun f;
    while (1) {
        f.set_data_variable();
    }

}

Comment: You can't initialize something that already exists.
Answer: For intrinsic type (And also user defined classes) this syntax:
y {2};

Is only valid during object construction. The object y has already been constructed. It happened in the compiler generated function Fun() (The default constructor of the Fun class).
y = 2; and y = {2}; work because they are assignment operations.
Comment: what does POD means ?
Comment: @user_xyz https://stackoverflow.com/questions/146452/what-are-pod-types-in-c


How do I renforce a cardboard antenna for outside use?

Question: I bought Mohu Releaf cardboard antenna. It works much better outside than inside. Mohu explicitly advises against outdoor use of its indoor models, yet I wrapped it in a plastic bag and hung it out of window.  It looks a bit shabby so I am looking for ways to improve both the look and protection against elements.
I tried placing antenna between window glasses yet it gets less channels than outside. I have a big outside antenna, again it gets less channels.

Dimensions: 9″ x 11.5″
Effect of elements on Leaf antennas
http://mohu.freshdesk.com/support/solutions/articles/4000026474-can-i-use-my-leaf-curve-antenna-outside-or-in-an-attic-
Releaf model
https://releaf.gomohu.com/#specs
Update. I used it in a plastic bag to reduce deterioration yet eventually bought Winegard Elite on a sale, now have a few channels more. May be will use the leaf  with bedroom television.
Comment: Cardboard is not a material known for its weather resistance... Have you considered just getting one designed to be used outdoors?  It would likely be cheaper than properly weatherproofing your currently very weather susceptible one.
Comment: I have one but it is big, bulky and gets less channels. My plan B is to wait until this one deteriorates than if I still into tv switch back to big metal one or buy a new one. Also a friend promised to return me an antenna once pandemic is over. I hear outside antenna Winegard 7550 catches more channels  than cardboard Releaf, yet it costs nearly $200
Comment: Fair enough, though I feel like there must be options available somewhere between small, cheap, cardboard and large, expensive, metal -- a small, cheap, plastic one would probably work well for you.  You can either wait until your cardboard one wears out, or sell it while it's still working to someone who can use it indoors, and buy one rated for outdoor use.
Answer: At the risk that it might alter the properties of the cardboard in some way that might matter at radio-frequencies, I'd slather it in epoxy resin for waterproofing and follow up with a coat or two of spar varnish for UV protection.
Comment: Make sense yet not sure I would go for that considering the different epoxy resins have varying effects on radio waves. That it is one should use an appropriate epoxy
Comment: Potential metallic components or pigments are probably greater risk than epoxy itself https://www.reddit.com/r/rfelectronics/comments/a7wbkh/is_opaque_epoxy_transparent_to_rf_at_433_or_900mhz/
Answer: I'd agree strongly with the suggestion to get an outdoor rated antenna, however, if you really want to attempt to use your cardboard antenna out in the weather, I'd suggest plastic lamination.
I'm not sure how big the antenna is, but they make lamination machines for 8.5 x 11" paper and they're cheap enough for home purchase. If you need something bigger, a local print shop may be able to do it for you or at least direct you to where it could be done in your town.
Comment: you yon can  seal laminating pouches with a iron like used for pressing clothes, dealing with the "puck" where the cable connects would be tricky though. maybe do the epoxy thing there instead,  lay paper or foil over the pouch to keep the hot-melt laminating glue off the iron.
Comment: antenna is 9 x  11.5 yet it contains a metal cylinder that connects cable to the cardboard body. Would it jam the lamination machine?
Comment: the cable connection wouldn't make it through the laminator my wife has, but it might be possible with a professional/commercial machine. Frankly, [Ecnerwal's suggestion](https://diy.stackexchange.com/a/197827/34147) sounds better than lamination.
Comment: Thanks I check with local staples outlet or whatever available - your idea sounds simpler and I am not exactly handyman