When do resource-generating skills work on destructible objects?

Question: I've noticed that when attacking an object (e.g. a barrel) with a fury-generating skill as a Barbarian, I generate fury as if I would have attacked a monster. Attacking a barrel with a spirit-generating skill, however, does not generate spirit.
My question is, when do resource-generation skills actually generate resources when attacking an object?

Does it only depend on the class?
Does it depend on the specific skills used?
Does it matter if the object is a red-highlighted one (e.g. a barrel) or a non-highlighted one (e.g. a tombstone act 1 graveyard)?
Answer: It depends on the class:

Barbarians generate fury whenever they successfully hit an enemy or destroyable object with a fury generator.
Monks generate spirit whenever they successfully hit an enemy (but not destroyable object) with a spirit generator.
Demon Hunters regenerate hatred merely by using a hatred generating skill, whether it hits or not.

The other two classes don't have "generator" skills and rely on passive generation.
Comment: @NickT It generates hitting anything destructible that hasn't already been destroyed. Even candles.
Comment: Wait, so just shooting into a wall as a DH generates hatred?
Comment: @Oak Yep. Hatred comes back rather fast overall, and the generators don't generate a huge amount.
Comment: Does Fury only generate when hitting certain destructable objects (barrels/urns but not tables/chairs)?
Answer: According to Blizzard (under "Combat"):
Due to degenerative nature of the Barbarian's Fury, it should be generated by attacking environment objects, but since Monk's Spirit is not degenerative, it should not be generated by attacking environment objects.


Python - cgi field storage error

Question: I have this in my python script
form = cgi.FieldStorage()
print form
print form.getvalue("param")

the 2nd line prints FieldStorage(None, None, 'param=abcd') and the 3rd line causes an error
    File "/var/www/cgi-bin/use_save.py", line 24, in <module>
    print form.getvalue("param")
  File "/usr/lib64/python2.7/cgi.py", line 548, in getvalue
    if key in self:
  File "/usr/lib64/python2.7/cgi.py", line 594, in __contains__
    raise TypeError, "not indexable"
    TypeError: not indexable

What is causing this error the value being passed just a string?
Answer: Try changing the enctype of your form to either multipart/form-data or application/x-www-form-urlencoded.
More information here: http://www.futurequest.net/forums/showthread.php?t=14245
http://www.w3schools.com/tags/att_form_enctype.asp

Python - cgi field storage error


How to use "at" command in shell script?

Question: I would like to use audio-recorder for recording. It should start recording at a certain time and stop after hours.
Comment: So what's the problem? You use it exactly like in command-line, see `man at`. Please [edit] and clarify: What did you try? What behaviour did you experience? What's wrong?
Comment: An example would create a job that starts your recorder then one that switches it off some hours later and also removes that previous at job.
Answer: I suppose you're talking about this software, however it does provide only very limited command-line options. If you want to record audio from command-line or in a script you better stick to command-line programs – I'm essentially using this approach here. For this to work you might need to install some packages, run sudo apt install pulseaudio-utils lame to be sure.
#!/bin/bash
sink="alsa_output.pci-0000_00_1b.0.analog-stereo"
echo 'f=$(date +%F_%R)_rec.mp3;timeout "'$2'" parec -d "'$sink'".monitor|lame -r -V0 - $f'|
at "$1"

You need to adjust the value of sink to your system, pacmd list-sinks|grep name: shows it enclosed in <> (don't copy those!). After that make the script executable with chmod +x SCRIPTNAME and run it as e.g. /path/to/SCRIPTNAME 10pm 30m to record for 30 minutes starting at 10pm. The recording will be saved in the directory where you run the script as e.g. 2017-12-17_10:00_rec.mp3 for a recording that started at this date and time. If you want to change that, replace $(date +%F_%R)_rec.mp3 in the script.
Example run
$ ./test.sh 10:00 10m
warning: commands will be executed using /bin/sh
job 1 at Sun Dec 17 10:00:00 2017
$ atq
1      Sun Dec 17 10:00:00 2017 a dessert
$ atrm 1
$ atq
$

As you can see, you can use atq to display and atrm to remove a pending job.
Time and duration format
As for the time format see man at, especially:

At (…) accepts times of the form
         HH:MM to run a job at a specific time of day.  (If that time is already past, the next day is  assumed.)   You
         may  also  specify  midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for
         running in the morning or the evening.  You can also say what day the job will be run, by giving a date in the
         form month-name day with an optional year, or giving a date of the form MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY
         or [CC]YY-MM-DD.  The specification of a date must follow the specification of the time of day.  You can  also
         give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can
         tell at to run the job today by suffixing the time with today and to run the job  tomorrow  by  suffixing  the
         time with tomorrow.

As for the duration format see man timeout, especially:

DURATION is a floating point number with an optional suffix: 's' for seconds (the default), 'm'  for  minutes,
         'h' for hours or 'd' for days.


How to hide a button with Javascript

Question: I have a button as follows:
ADD

Once I click the button, it adds a row to a #dataList1. Then I want it to be hidden. And I did following in Javascript;

It adds the row, but after it, it does not hide the button. Where did I do wrong?
Comment: I've removed the `` from the beginning of your title. Don't put tags in the title. (Do you see anyone else putting tags in the title?)
Comment: add `$('.btnA').css('display', 'none');`
Comment: I'm curious why $('#AddRow').on('click', function(){
$('#AddRow').hide();
});  is not working??
Comment: Also, if you're using jQuery (and you clearly are), include the `jquery` tag on the question.
Comment: try $('#AddRow').style.disply="none"
Comment: Also note that if you call AddRow more than once, you're creating an invalid DOM: You cannot have multiple elements with the same `id` value (see `id="grpNum"` and `id="grpExp"` in the rows being added).
Answer: Add id to input
HTML
    ADD

And hide button after appending in AddRow function.
JS
function AddRow(){
var tr = '
';
tr += '	';
tr += '<input type="text" id="grpNm" name="grpNm" value="" style="width:96%"/>	';
tr += '<input type="text" id="grpExp" name="grpExp" value="" style="width:96%"/>	';
tr += '
';
    $('#dataList1').append(tr);

    $("#AddRow").hide();
}

fiddle
Comment: You are also adding the $('#AddRow').hide() inside AddRow() function. In that case, you don't need to add 'id' explicitly when you can refer button using its class.
Comment: Yes, "And hide button after appending in AddRow function.". I've edited my fiddle to be more clear.
Comment: My question is why you need to give id when that button can be referred by its class?
Answer: Because there is no control with the id AddRow. You have to either give id or use class sector $('.btnA').hide();

Answer: You can hide the button in AddRow() function itself:
function AddRow(){
  var tr = '
';
  tr += '	';
  tr += '<input type="text" id="grpNm" name="grpNm" value=""  style="width:96%"/>	';
  tr += '<input type="text" id="grpExp" name="grpExp" value=""   style="width:96%"/>	';
  tr += '
';
  $('#dataList1').append(tr);
  $('.btnA').hide();
};

DEMO
Answer: Three Steps Problems:
1) Add this code inside AddRow() function:
$('#AddRow').hide();

2) Remove This event:
$('#AddRow').on('click', function(){
3) Add id AddRow in
ADD

How to hide a button with Javascript


Firestore in Cloud Functions - Create a missing index through an error message

Question: When using Firestore in Cloud Functions, how to use the Create a missing index through an error message feature?
Basically, after I use a new Firestore query in my Cloud Function, where should I expect to find the "error message [that] includes a direct link to create the missing index"?
Update: add sample code based on a comment suggestion
Assume the query below wasn't used before. After I deploy the function to Cloud Functions and use it, where can I find the automatically-created link for creating the missing index?
<code>import * as admin from 'firebase-admin';
import * as functions from 'firebase-functions';

admin.initializeApp(functions.config().firebase);

const db = admin.firestore();

export const posts = functions.https.onCall(async (
    data: { uid: string },
    context
  ) => {
  // ...

  const querySnapshot = await postsRef
    .where('uid', '==', data.uid)
    .orderBy('timestamp', 'desc')
    .get();

  // ...
});
</code>
Comment: Could you post some code so that we can help you
Comment: @DarrowHartman I'm not sure if sample code is relevant here but added it. Thank you for your suggestion.
Answer: When you perform the query, the resulting promise will become rejected. Your code will need to catch that error from the rejected promise, then log the error object.  The url will be in the log message. (I'm assuming you're using node here, but the same error handling will apply to any language using its conventions for capturing and logging errors.)
Comment: (1) Note: I'm using Cloud Functions, but yeah, principle should be the same. (2) In my case, no such error happened, the query ran successfully. Perhaps my query already has an index? ... Don't think so, but will re-check, try with another query, and get back to you hopefully.
Comment: Update: yes, you're right. Indeed an error was logged. For future readers: you can find these logs in Firebase Console => Hosting => "Logs" tab.


How to check if an individual datatable row is empty or not?

Question: So in this dataset I want to check for the number of boys and number of girls and the total . The dataset returns Table[1] which has two rows, number of girls and number of boys .The row[0][1] returns the number of girls and the  row[1][1] returns the number of males

but whenever the Table1 returns single row .ie count of either boys or girls , an IndexOutOfRangeException is thrown There is no row at position 1 at the first if itself.
Is my way of checking for empty datarow correct?
And here is the code snippet
 if (dsStudent != null && dsStudent.Tables.Count > 0 && dsStudent.Tables[0].Rows.Count > 0)
        {
            if (!(dsStudent.Tables[1].Rows[0]==null) && !(dsStudent.Tables[1].Rows[1]==null)) //both are present
            {
                lblbNumOfGirls.Text = dsStudent.Tables[1].Rows[0][1].ToString().Trim();
                lblNumOfBoys.Text = dsStudent.Tables[1].Rows[1][1].ToString().Trim();
            }
            else if ((dsStudent.Tables[1].Rows[0][1].Equals(string.Empty))) //if girls are 0
            {
                lblbNumOfGirls.Text="0";
                lblNumOfBoys.Text = dsStudent.Tables[1].Rows[1][1].ToString().Trim();
            }

            else //if boys are 0
            {
                 lblNumOfBoys.Text="0";
                 lblbNumOfGirls.Text = dsStudent.Tables[1].Rows[0][1].ToString().Trim();
            }

            lblNumStudents.Text = (int.Parse(lblNumOfBoys.Text) + int.Parse(lblbNumOfGirls.Text)).ToString(); //total number of students
         }

Answer: If Table1 returns only 1 row, the index of that 1 row is "0". That;s why you are getting Index out of bound issue.
If you are only running the code when there are two rows or more (one row for male and one row for female and other), your check should be dsStudent.Tables[0].Rows.Count > 1
Because your check was dsStudent.Tables[0].Rows.Count > 0, your code will enter the if-statement when there is only 1 row, but throw a exception when you are trying to access the second row dsStudent.Tables[1].Rows[1][1].ToString().Trim()
Remember, count and index is different in coding.
Row 1: index = 0
Row 2: index = 1
Row 3: index = 2
...

-- EDIT--
Okay, I see. So the problem is that you are reading Table1, but did not varify it first.
This is the line where it's throwing exception:
if (!(dsStudent.Tables[1].Rows[0]==null) && !(dsStudent.Tables[1].Rows[1]==null))

You are reading Rows[0] and Rows[1], but it is possible that the row doesn't exist.
For example, if your table only contains 1 row, the second part of the condition dsStudent.Tables[1].Rows[1] will throw exception because Rows[1] doesn't exist.
To check if your table contains at least two rows, the easiest way is to do this:
if (dsStudent.Tables[1].Rows.Count >= 2)
{
}

My suggestion is to check for boys and girls within inside the if-statement.
And also, if the value is null, you can not compare it with String.Empty
NULL does not equal to String.Empty
if (dsStudent.Tables[1].Rows.Count >= 2)
{
    if (DBNull.Value.Equals(dsStudent.Tables[1].Rows[0][1])) //girls = 0
    {
    }
    if (DBNull.Value.Equals(dsStudent.Tables[1].Rows[1][1])) //boys = 0
    {
    }
}

Comment: I am getting two rows when both girls and boys are present.Only when either one of them is present I get single row
Comment: @saurabh64 please see my updated answer, I'm guessing that you are confused with count and index.
Comment: Table[0] is a separate table and Table[1] is separate .Everything related to Table[0] is working fine


error 'TempSLLNODE' : use of class template requires template argument list

Question: #ifndef TEMPLATE_LINKED_LIST
#define TEMPLATE_LINKED_LIST

template <class T>
class TempSLLNODE
{
public:
    T info;
    TempSLLNODE *next;
    TempSLLNODE( T value, TempSLLNODE *ptr = NULL)
    {
        info = value;
        next = ptr;
    }
};

template <class T>
class TempSLL
{
public:
    TempSLL()
    {
        head = tail = 0;
    }
    ~TempSLL();
    T isEmpty()
    {
        return head == 0;
    }
    void addToHead(T);
    void addToTail(T);
    T deleteFromHead();   // delete the head and return its info;
    T deleteFromTail();   // delete the tail and return its info;
    void deleteNode(T);
    bool isInList(T) const;
private:
    TempSLLNODE *head, *tail;
};

#endif

Comment: You are not going to comment on your code **at all** ??
Comment: as @Nabla said, you should explain your problem with real words, because we are human after all. If you don't we'll not be able to help you and you post will be deleted...
Answer: TempSLLNODE is template, you need to use it with type:
update:
TempSLLNODE *head, *tail;

to:
TempSLLNODE<T> *head, *tail;
//         ^^^

Answer: You could at least mention the line of the error.
For future reference, the error is here:
private:
    TempSLLNODE *head, *tail;

You need to know that when you instantiate a variable from a class template, you should mention the template type. In fact, for each template type you use to instantiate a variable, the compiler compiles and generates code of the class for you, and before doing so, compiler does not generate any code for the class template.
So I guess what you meant here is:
private:
    TempSLLNODE<T> *head, *tail;

Comment: C++ does not have generics. It has class templates.
Comment: You're calling it a "template class" now. It is a _class template_, as I said.


Border casuses overflow

Question: I have built a header and I defined the width to 33.33%. This works fine as long as I don't have a border. As soon as I add the border it my right element will be displayed on the next line. Is there an attribute that collaborates with borders?
Comment: kindly post your code
Comment: [This](http://stackoverflow.com/questions/8721001/putting-a-border-around-floating-elements) will help I guess.
Answer: Given the standard CSS Box Model (content-box), your element's overall horizontal width will be:
border-left + padding-left + width + padding-right + border-right
As you can see, the width only refers to the width of the content - it doesn't include the padding or the borders.
Consequently, if your element is 33.33% wide  and then you apply:
border: 2px solid rgb(0,0,0);

your element is no longer 33.33% wide.
Now it's 2px + 33.33% + 2px wide.

Solution #1 using calc():
You can continue referring to the standard CSS Box Model (content-box) but to compensate for the 2px width border on each side, you can declare the element's width as:
width: calc(33.33% - 4px);

Solution #2 using box-sizing:
You can tell the browser not to refer to the standard CSS Box Model (content-box) and to use the alternative CSS Box Model (border-box) instead:
box-sizing: border-box;

When the browser refers to the border-box model, the width does include the content and the padding and the borders.
Comment: Why give the worse method first?
Comment: Because it accommodates the CSS Box Model which became the standard (ie. content-box). The contest over which Box Model should be the standard goes back to the Browser Wars of the mid-2000s. Border-Box was Internet Explorer's preferred implementation. There's (of course) nothing wrong with referring to the border-box model, but it's definitely also worth knowing how to approach this situation while continuing to refer to the content-box model.
Answer: You can use
box-sizing: border-box;

see https://developer.mozilla.org/en/docs/Web/CSS/box-sizing

The width and height properties include the content, the padding and border, but not the margin. This is the box model used by Internet Explorer when the document is in Quirks mode. Note that padding and border will be inside of the box e.g.  .box {width: 350px; border: 10px solid black;} leads to a box rendered in the browser of width: 350px. The content box can't be negative and is floored to 0, making it impossible to use border-box to make the element disappear.
      Here the dimension is calculated as, width = border + padding + width of the content, and height = border + padding + height of the content.
Comment: @Quentin thanks I was trying to fix the blockquote but having trouble with it

Border casuses overflow


Need help joining table

Question: I have a function that exports a table to CSV and in the query I set which fields will export.
Here is the query:
SELECT lname, fname, email, address1, address2, city,
state, zip, venue_id, dtelephone, etelephone, tshirt FROM volunteers_2009

The field venue_id is the the id of the venue which is referred to in another table (venues)
So volunteers_2009.venue_id = venues.id
When I open the CSV file it displays the venue_id which I understand, but I need help modifying the query to put in the name of the venue (venues.venue_name) within the CSV file.
Any help is appreciated.
Answer: SELECT a.lname, a.fname,a. email, a.address1,a. address2, a.city,
    a.state, a.zip, a.venue_id, a.dtelephone, a.etelephone, a.tshirt,
    COALESCE(b.venue_name,'') AS VenueName
FROM volunteers_2009 a
LEFT JOIN venues b ON b.id=a.venue_id

Comment: @Joel, this has performance implications since you're doing a table lookup and function call for every record. The two pass approach (union all) only does a table lookup for the non-NULL venue IDs and not even that for the NULL ones (and no function calls).
Comment: Although performance probably won't matter so much since you're using MySQL anyway :-).
Comment: Actually, I'll clarify that last statement - I didn't mean MySQL was a toy DB (it is, compared to DB2/z, but that's another issue), just that it's used mostly in places where you don't pay for CPU usage (unlike mainframe DB2).
Answer: Standard SQL query for this is (assuming you want both ID and name for the venue):
SELECT a.lname as lname, a.fname as fname, a.email as email,
    a.address1 as address1, a.address2 as address2, a.city as city,
    a.state as state, a.zip as zip, a.venue_id as venue_id,
    b.venue_name as venue_name, a.dtelephone as dtelephone,
    a.etelephone as etelephone, a.tshirt as tshirt
FROM volunteers_2009 a, venues b
WHERE a.venue_id = b.id
AND a.venue_id IS NOT NULL
UNION ALL
SELECT a.lname as lname, a.fname as fname, a.email as email,
    a.address1 as address1, a.address2 as address2, a.city as city,
    a.state as state, a.zip as zip, a.venue_id as venue_id,
    '' as venue_name, a.dtelephone as dtelephone,
    a.etelephone as etelephone, a.tshirt as tshirt
FROM volunteers_2009 a
WHERE a.venue_id IS NULL

Comment: Works well, except it does not export the records that do not have a venue_id in that field.
Comment: Are you saying they could be NULL in volunteers_2009; or are you saying they can be set to a value that doesn't exist in venues?
Comment: Avoid the FROM A,B syntax.  Use FROM A INNER JOIN B instead.
Comment: It is marked as NULL if there are no venue_id's stored within that field.
Comment: @Brad: Use outer join, thats totally requirement specific
Comment: @Joel, why do you prefer inner join? There's no performance difference in any DB I use.
Comment: It's not the performance.  It's the clarity and portability, especially as you start to work with more than just 2 or 3 tables in the same query.
Comment: Ah, I see. I'm guessing it's because we come from different backgrounds. Mainframers have hordes of DBAs to sort out these issues and performance is always rated above readability (so those same DBAs keep their jobs). :-)
Answer: SELECT lname, fname, email, address1, address2, city,
state, zip, b.venue_name, dtelephone, etelephone, tshirt FROM
volunteers_2009 a, venues b
where a.venue_id = b. venue_id

use proper alias in case both tables have any columns with the same name.
--- EDIT to have all the rows from venues use outer join as
SELECT lname, fname, email, address1, address2, city,
state, zip, b.venue_name, dtelephone, etelephone, tshirt FROM
volunteers_2009 a(+), venues b
where a.venue_id = b. venue_id

Need help joining table


Remove requirement for a click event from existing javascript

Question: I have a modal popup that used to have a submit button.
As the content of the form is now pre filled, I want to remove the submit and have the form auto submitted.
The section of javascript that deals with this is below
afterShow: function () {
            $(document).on('submit', '#back-in-stock-popup-wrapper form[name="back_in_stock"]', function () {
                $.post('ajax/back_in_stock_subscribe_pop_up.php', $('#back-in-stock-popup-wrapper form[name="back_in_stock"]').serialize(), function (data) {
                    $('#contact_messages').html(data);
                    if ($('.messageStackSuccess').length) {
                        $('.back-in-stock-popup-wrapper-button-row').hide();
                        $('.back-in-stock-popup-content-wrapper').hide();
                    }
                });
                return false;
            });
        }

Instead of it waiting for a submit event, I want it to follow the code.
I'm hopeless with javascript and I thought I could just change it to
$(document)('#back-in-stock-popup-wrapper form[name="back_in_stock"]', function () {

but that didn't work.
How do I tell javascript to just proceed without waiting for the submit from the button click?
Comment: Let me see if I can wrap my head around this terrible user experience you are suggesting. You're going to open a modal with a form in it, populate the form, and then auto submit it right in front of the users eyes. What's the point of that
Comment: I have no clue what you expect that line of code to do.
Comment: this doesn't sound like you're trying to learn, it sounds like you're trying to avoid hiring a developer. you've basically answered every one of your own questions and avoided crediting anyone who has tried to help you. we're not a free code writing service.
Comment: @Iwrestledabearonce.Where have I answered every one of my own questions?
Comment: @gforce301 No, you assume too much. The form was to subscribe to notifications when a product comes back into stock. Given that the site only allows purchasing by registered and approved users, the name and email is already known, so pre populates the fields. Instead of presenting a user with a prefilled form and asking them to click submit, the popup will just advise that the request has been sent. They have to click a button to ask to be advised in the first place, so why make them click again to send something they didn't have to fill in. Actually makes the user experience better!
Comment: @StevePrice "I'm hopeless with javascript". You have no idea what you are talking about do you? That `afterShow` method is only going to happen once the modal is displayed on the screen. "I have a modal popup that used to have a submit button. As the content of the form is now pre filled, I want to remove the submit and have the form auto submitted." It will be a completely jarring, ugly and ridiculous user experience. Or it will be a pointless one. A modal open on the screen with a form displayed in it with nothing for the user to do and they're wondering why they are looking at it at all.
Answer: Just remove the outer call like so:
afterShow: function () {
                $.post('ajax/back_in_stock_subscribe_pop_up.php', $('#back-in-stock-popup-wrapper form[name="back_in_stock"]').serialize(), function (data) {
                    $('#contact_messages').html(data);
                    if ($('.messageStackSuccess').length) {
                        $('.back-in-stock-popup-wrapper-button-row').hide();
                        $('.back-in-stock-popup-content-wrapper').hide();
                    }
                });
                return false;
        }

Comment: I don't know if this will be an issue in this situation, but in certain cases and depending on how you're populating the data into the fields, if you have to wait _at all_ for your data to be filled you may want to set an interval in order to check that the data is actually filled, otherwise you could end up with half-stuffed/empty form information.
Comment: @zfrisch A much better way than relying on timing functions would be using a callback or promise to ensure that this function only runs once the data-fill function runs. However I guessed that here, the data is already being filled in another function - but without more info, this is all just guesswork :)
Comment: Agreed! Personally I've had to use a timing function instead of Promises a handful of times but admittedly that was before they became so well supported. It's one of those things that kind of sticks with you as a possibility.
Comment: @General_Twyckenham Indeed, the form has already been filled, and validated.
Comment: @zfrisch We've all been there - urgh, just thinking about some of the code I've had to write in the past makes me sick lol
Comment: @StevePrice Cool - so try my suggestion out, feel free to accept/upvote if it helped, or update if you still have issues
Comment: @General_Twyckenham It doesn't give a success message, so it doesn't appear to be doing what's expected. I'll have to do some debugging on it.


How to make a shell-like program which allows SSH password input?

Question: On OSX Terminal, I can connect to a server with SSH because terminal offers password input session.
$ ssh firstname.lastname@example.com
email@example.com's password:

I wanted to make my own terminal implementation, so I

created pseudo terminal.
fork
redirected pty slave into stdin on child process.
exec bash.

And then, pushes string ssh firstname.lastname@example.com into pty master on parent process.
But by program showed me this.
$ ssh firstname.lastname@example.com
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).

instead of password session.
What's my problem, and how can I fix it?
P.S. I know I can use expect utility. This is just a trial to implement my own pseudo shell application.
Update for later reference
The key to solution was using of forkpty() function instead of posix_openpt() function. Former one handles all hard annoying works, and gives me bi-directional master file number. I can read from and write to the file number. And the created pty device works perfectly. SSH login session works well. In contrast latter one still needs a lot of works which I never can figure out how.
I had to care about forkpty last two parameters. I thought them was output, but actually it was input. That was the source of all the problems, and after setting them to all NULL, it's working well now.
Comment: possible duplicate of [How to switch terminal to new child process of process launched with NSTask?](http://stackoverflow.com/questions/7545133/how-to-switch-terminal-to-new-child-process-of-process-launched-with-nstask)
Answer: There is already a program which does what you want: sshpass
http://sshpass.sourceforge.net/
Since it is open source, you can examine its source to find out how it works.
Answer: I finally wrote pty device: https://github.com/eonil/PseudoTeletypewriter.Swift
My old Q/A describes some more: How to switch terminal to new child process of process launched with NSTask?


stem puller for shower

Question: I've an old shower in my house that was leaking when I moved in 8 years ago. I removed the faucet and, for 7 years now, I've not been able to remove the stem. (yes, that's a long time, but kids got in the way :) ).
I just purchased a Moen stem puller (not sure of the make\model of the stem), but it was unable to thread in so I could pull the stem out.
Ideas?
Thank you
Comment: 7 years is about 6-3/4 years past the "time to rip the wall open and replace that thing" date, IMHO. i.e. longneck's option 2.
Answer: Two options:

Find a screw that does fit the thread. You have the screw that holds the handle on, right? Take that screw to the hardware store and buy one that is threaded the same and 3-4 inches long. You can then drill a hole in a 2x4 for the screw (you'll probably need a washer) and use that 2x4 to pull the stem out.
Forget about changing the cartridge. Just open the back side of the wall and replace the whole assembly. If you have copper pipes, Shark-bite connectors make this a super easy fix nowadays.

stem puller for shower


Are disk file operations faster if executed in parallel?

Question: Consider there are N files to be completely written to disk (i.e. flushed from all file buffers). For each file we write a small (relative to HDD seek time) amount of data, e.g. 64KB, with WriteFile, and then call FlushFileBuffers on that file to ensure that the data for the file is completely flushed to hard drive.
If we write&flush files one-by-one sequentially, then I expect that approximately it takes time N*seekTime + N*writeTime, where seekTime is the time to position hard drive head to the proper sector (which may take up to the time of full disk rotation), and writeTime is the time it takes the disk to write sequentially 64KB of data. With such one-by-one approach we give the OS no room for optimization because we define the sequence in which the files must be flushed.
With some support from the OS a performance improvement could be achieved by rearranging the order of file write&flushes so that taking into account the disk rotation (i.e. the current position of the head on disk) file operations are rearranged so to start from those for which almost no rotation is needed (i.e. the nearest to the current position of disk head) and ending with those for whom almost full rotation of the disk is needed.
The question is: does operating system (Windows in particular) provide such optimization? In the other words, can performance be improved by running file write&flush operations in parallel in N threads, one thread per file? Or will it cause extra re-positioning operations decreasing the performance (as a kind of context-switches for hard drive)?
Comment: Optimization is done on radial head motion. The OS has no clue on the axial position.
Answer: You should first ask yourself, and explain here, why you need to flush. What you want to achieve is not necessarily what actually happens.
If you actually want to optimize an application in such a way that a certain access pattern on a physical device results, then you make your solution very hardware dependent. What appears like an optimization on your test cases may achieve the opposite effect in another scenario. For example, what about file fragmentation? What about raid disks? What about network file systems? What about SSD drives? What about concurrent accesses to the same disk by other processes running on the same machine?
The key to making disk accesses fast is buffering. Don't defeat it if you don't absolutely need to defeat it.
Comment: I'm aware of the complications. That is one of the reasons why I am asking the question at Stackoverflow, instead of just benchmarking both options and choosing whichever is faster on my machine and in my test cases. I am asking the question in order to understand the problem fundamentally, so to make it possible to predict (to some extent) how the chosen solution will work in the cases not covered by my performance test cases. The key question is whether (and how well) the OS (Windows in particular) optimizes HDD write+flush requests coming in parallel for different files.
Comment: I need to flush for the purpose of durability: to ensure that data is actually written to disk before taking next steps. These N files I can flush in any order and even in parallel. What matters is to come to a point where the data of every file is physically written to disk. Let's limit the scope to rotating disks (no SSDs), ignore file fragmentation (assume the user defragments the disk for performance regularly), no network file systems, ignore disk accesses of the other processes. RAID is interesting. And let's not take approach "don't optimize anything because it's pointless".
Comment: I'm not trying to discourage optimization when it is found to be necessary. I merely wanted to ensure you realize that what you want will likely lead to a brittle solution that may stop yielding the benefit you want at any time, and for any number of reasons. If you are conscious of this, fine.
Answer: You need to benchmark, since it is operating system, file system and hardware specific. On my Linux system, many file operations are going thru the page cache, so if two programs (or the same program run twice) are accessing a file near the same time, the latest access might not involve any physical disk I/O. Linux and POSIX have even some system calls to help the page cache (posix_fadvise(2), madvise(2), readahead(2)...)
I don't know Windows, but heard and believes in the rumor which says that it is less efficient than Linux on such caching.
Hardware limitations are often a very significant bottleneck. Replacing your disk with an SSD might be worth the cost.
AFAIK, old BSD & SunOS & Linux disk drivers did the optimization you are suggesting (reorganizing I/O operations to lower seek & rotation delays). Today, it does not really matter (the disk controller itself will map "logical" sectors to "physical" ones).
Answer: I believe Windows does no IO scheduling whatsoever, in fact it even breaks large IOs into 256KB pieces. Linux has IO scheduling built-in.
That said some drivers and disks do some reordering. Usually, the IO/sec rate increases to a point at higher queue depth. Crystal Disk benchmark has a QD32 mode.
SSDs certainly do that which is easy to see from benchmarks with high queue depth. SSDs also have hardware parallelism. They get faster when you increase the queue depth for random reads.
What I found on my desktop disk on Windows is that sequential small write-through IOs happen at a much faster rate than the disk seek rate. Either the controller is write-caching or the disk geometry is really amenable to sequential writes even if non-cached.


Adding payload in packet

Question: Can I insert image or document (in MBs) as a data in packet using scapy?
This is what I did to send data.
<code>data = "University of texas at San Antonio"
a = IP(dst="184.108.40.206")/TCP()/data
send(a)
</code>
Comment: What are you really trying to do with this?  Build your own file streamer in python?  If so, there are much easier ways to do that than `scapy`
Answer: Yes, you can send raw data like this.  In this example, data will be ASCII encoded.
<code>>>> data = 'University of Texas at San Antonio'
>>> a = IP(dst='220.127.116.11') / TCP() / Raw(load=data)
>>> send(a)
</code>
Comment: That works, but does it do what is intended ? don't you need to send at least two packets for the TCP handshake to work ? wouldn't this payload be simply discarded by the recipient ?
Comment: @b0fh You are correct, sending a single TCP packet with data is not the same as establishing a TCP connection via the three-way hand shake and then transmitting data that would be accepted by a real TCP stack.  This answer was simply about adding data after a TCP header.

Adding payload in packet


iOS 9 - App Transport Security wont load XML files

Question: I am upgrading my app to iOS9. To Support ATS i had shifted all my urls to https.
But ATS is throwing below error on XML files. The JSON files located at the same location have no problem.
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
JSON URL: https://www.example.com/content/123.xml
XML URL: https://www.example.com/content/123.json
Please suggest what might be the issue ?
Thanks in advanced.
Answer: Run the following commands in Terminal :
curl -v 'https://www.example.com/content/123.xml'
curl -v 'https://www.example.com/content/123.json'

It is highly probable that your server doesn't support SSL and redirects your url towards a standard http download.
If this is the case there will be a Location header that indicates the new url.
Comment: When i tried curl i got the response - ***

301 Moved Permanently

Moved Permanently
The document has moved here.
**** but the url i am using is HTTPS protected. do you think this is an issue from my server side ?
Comment: Can you show me the entire output of curl, including http headers ? What is the value of the Location header ? Is it a http or https link ?
Answer: Add it to your app info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Answer: In your App's plist add:
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>


How to see what clients of lan doing on the internet

Question: I have Ubuntu 16.04 server with routing, firewall, dhcp, dns caching. Is it possible to see what clients doing on internet, most importantly what sites are they visiting? It can be done by proxy (which I have - Squid and its analyzer Lightsquid), but is it possible to do it without proxy? To have some overview or survey over what people do on my network? I mean in the sence of lightsquid, some kind of "database" or long term overview, where I can actually view their activity on internet.
Answer: You can't see actually communication data (i.e. what your users are posting on facebook), however using Wireshark you can see incoming and outcoming http & https requests, and you could tell what website they are looking at.
Happy spying!
- The Exp3rt
(https://www.wireshark.org/)
Comment: Wireshark will run indefinitely, as far as I'm aware. How is what you want different to what Wireshark can give?
Comment: Hi, I know about wireshark, but I acutally mean some kind of long term overview. I edited my original post, to make it more clear.
Comment: Is it possible to implement wireshark on text based server? Lightsquid works the way that it takes log files from squid in some set interval, and makes simple overview (accesible by putting your server ip in browsers address line) what ip  went on what www page when, how many times etc. Is it possible to do this in wireshark? I always thought that its only for "on the fly" use...
Comment: Is that a way how to watch your network? How the network administrators do it? I don't want to be blind :-)


Is it possible to use dual monitors with World of Warcraft?

Question: As the title says, is it possible to use dual monitors with World of Warcraft?
I don't have a set-up currently but I can see the advantages of using one monitor for WoW and one for a browser open to Wowhead (questing, dungeon runs) or email/RSS/whatever (farming).  Is this even possible?
Answer: If you are running a reasonably recent version of windows, the answers is Yes. I run Warcraft in full screen windowed mode and have wowhead open in a browser on my second monitor, along with my vent client.
Answer: If you can run two monitors you can use wow in windowed mode and not need to 'alt-tab' or otherwise minimize the warcraft windows.
http://www.google.com/images?q=warcraft+windowed+mode
You can obviously do this without two monitors and have quick access to firefox (or itunes, etrade, etc). There is a performance hit with windowed mode, but it does have dynamic fps (frames per second) to degrade game play video quality to compensate.
Issue with this is that if you are using two video cards, some video cards introduce some issues when you drag windows between video cards or span windows between two different video cards. This isn't an issue with Windows7 any longer.
You also likely want to adjust the setting 'play sound in background' as when you wow window doesn't have focus it won't play sound. So when your surfing wowhead (or stackexchange) you won't notice chats, yourself being attacked, ready checks, etc otherwise.
Answer: The "Full screen (Windowed)" display mode (in the WoW display options) is just what you want. It runs the game in windowed mode, but stretches the window to fill the entire screen and hides the title bar/borders/etc. You can switch to another application (say, a web browser on another monitor) and WoW will remain visible.
In contrast, if the game is running in "true" full-screen, switching applications will cause the game to disappear since it is no longer the active window. This is how full-screen apps usually work.
You take a very minor performance hit (a few frames per second at most) running in this display mode instead of true full-screen, but it's not noticeable and completely worth it.
Answer: My second monitor is my iPad ..
this doesn't really solve the problem you describe, especially since the input methods are so different -> remove fingers from mouse/keyboard, touch the screen etc.
Comment: or a cheap netbook/laptop would acompish the same thing. get a KVM (hardware or software) and can use the same KB and Mouse.
Comment: I've got a four year old laptop that I use currently but in the last week it's started blue screening with memory errors.  A new monitor is a cheaper option, but it would be a good excuse to get an iPad...
Comment: @Xantex: I agree (+1 to comment) .. especially considering things like 'SYNERGY' (see http://synergy-foss.org/)
Answer: Be careful when running other programs on the other monitor. Videos may rob frames, especially YouTube or other flash-based sites when flash has "Hardware Acceleration" enabled. Windowed mode in itself will take frames away from you, so to get the best performance (e.g. during a raid), switch back to full screen mode.


Android debugging via Bluetooth

Question: I was using earlier adb to debug Android applications over wifi, usb - it was great.
Right now I am wondering if it is possible to connect phone with adb via bluetooth.
I did a quick research but didn't find anything - have you tried it already ?
Answer: It is not supported by the current adb software, however you could probably make it possible if you have a rooted device (or possibly even if not - see below) either by modifying adb or by using bluetooth to tunnel a channel it does support, such as tcp.
You would need to obtain the source for the adb program - the same source is used to build both the PC and the device versions.  First step is to just build it with unmodified functionality, which may take a fair amount of build system modification unless you do so as a part of a complete android source build (the way it was intended to be done)
Then you would modify it to add a bluetooth channel as an option and install it on the device (why you need root) and in your path on the PC.  You'd think you could run it from an alternate location on the PC, and you likely can as long as you use it from the command line, but if your fire up DDMS it may kill off the running adb server and launch a new one using the default in the path, so ultimately you'll have to put your modified version there.
IF you can already get your device to accept adb connections over tcp (possible with root, perhaps possible in some cases without) there is another option, which is to not modify ADB (or at least not modify the device side) and instead come up with something running on the device which accepts bluetooth connections and forwards the traffic via local loopback to the tcp port on which the stock adb is operating.  This would save the trouble of having to rebuild adb.
If you have some kind of tethering or similar network-over-bluetooth solution, you might even be able to leverage that to carry adb-over-tcp-over-bluetooth without writing any code.
Finally note that it is not 100% essential that the adb daemon run as a more privileged userid or be installed in place of the official one - you can run an adb daemon as an ordinary application and do many of the expected things with it.  However, whichever adb daemon is running first will grab the unix domain java debug socket, and so only that adb daemon will be able to provide the full java debug services.  More primitive things like logcat, shell, running process list, push/pull, etc will at least partially work without this, provided that your adb daemon doesn't quit (modification may be required) when it is unable to claim the debug socket.  If you can kill the official adb daemon and exploit a race condition, you may be able to get an unofficial one started before it restarts - you would probably need to have a script or program to do this and run it with setsid from the official adb shell, meaning you'd need to connect via USB first.  At that point, you'd also be able to start your unofficial adb daemon running as the same userid as the official one.
You may want to spend some time estimating or testing if the performance (speed) will be satisfactory before investing in a lot of time setting this up for real.
Answer: I know this is a bit old but I seem to have found a post that does this. All credit goes to the author of fomori.org for finding this and making the information available. Today it helped me, maybe tomorrow I'll help you by making it easier to find.
Source
Comment: As long as the source is external to SO you should copy the portions relevant to the answer. Your source link is now broken (at least for me), and your answer rendered useless. You're still encouraged to link your sources and give credit of course, but it's far more useful to not depend on third parties to never change their links or remove content.
Comment: that site seems to be offline (checked 3 minutes ago)

Android debugging via Bluetooth


Nether warts x villagers?

Question: Is it possible to get nether warts from a certain villager? I have already searched through all the fortresses and could find a single wart.
Answer: Unfortunately, it is impossible to get nether warts from villagers. They are only found in Nether Fortresses.
However, if you find another fortress and you find a bit, you can make a nether wart farm using soul sand and nether wart if you want more.
Answer: No. In Java and Bedrock editions Nether fortresses are the only source.
On the other hand, I doubt you searched them -all-. There are millions of them. Either you've been unlucky and found a fortress without any Nether Wart chambers and chests with it as loot, or you failed to notice it. Sometimes finding it is quite a journey - but once you find some you can farm it on soulsand in the overworld.

Nether warts x villagers?


Python JSON formatting question for class project

Question: I'm working on a project for a Intro to programming logic class for school where we are reading in information from a .txt file, reformatitng it to JSON format and then writing that JSON format to a new .txt file while also printing the JSON formatted data to the screen.
I'm having an issue where my JSON key value pairs are putting quotes on data types that do not need quotes, such as integers and booleans.
def main():
    runtimeManager = RuntimeManager()
    jsonResult = runtimeManager.run()
    outputFileName=runtimeManager.outputFilename
    print(jsonResult)
    print("\nOutput written to " +outputFileName+ ".")

class RuntimeManager:

    def run(self):
        ## Gather required member variables
        self.getUserInputFileName()
        self.getUserOutputFileName()

        ##Grabbing user file and extracting the CSV
        with open(self.inputFilename) as inputFile:
            jsonResult = CsvToJson(inputFile.readlines()).transformCsvToJson()
            with open(self.outputFilename, "w") as outputFile:
                outputFile.write(jsonResult)
            return jsonResult

    def getUserInputFileName(self):
        ## Prompt User for
        self.inputFilename = input("Enter the filename:  ").strip()

    def getUserOutputFileName(self):
        self.outputFilename = input("Enter the OUTPUT filename:  ").strip()

class CsvToJson():

    def __init__(self, csv):
        self.csv = csv
        self.headers = csv[0].strip()
        self.data = csv[1:]

    def transformCsvToJson(self):
        jsonResult = "{"
        for i in range(0, len(self.data)):
            if (i != 0):
                jsonResult = jsonResult + "\n,"
            jsonResult = jsonResult + "\"" + str(i+1) + "\":" + self.createJsonObject(self.headers, self.data[i])
        return jsonResult + "\n}"

    def createJsonObject(self, headers, csvRow):
        csvKeyArray = headers.split(",")
        csvValueArray = csvRow.strip().split(",")
        jsonObject = "{"
        for i in range(0, len(csvKeyArray)):
            jsonField = ""
            if (i != 0):
                jsonField = ","
            jsonField = jsonField + "\"" + str(csvKeyArray[i]) + "\":" + self.getValueDataType(csvValueArray[i])
            jsonObject = jsonObject + jsonField
        return jsonObject + "}"

    def getValueDataType(self, value):
        if (type(value) == int):
            value = str(value)
        elif (type(value) == str):
            value = "\"" + value + "\""
        elif (type(value) == bool):
            if (value):
                value = "true"
            else:
                value = "false"
        elif (type(value) == null):
            value = "null"
        else:
            value = "ERROR"

        return value

if (__name__ == "__main__"):
    main()

I've put my program in here with line numbers. The stipulations of my assignment dictate that we are not permitted to use the JSON module built into python.
the issue I'm having is my JSON formatting looks like this:
{"1":{"Last Name":"Minion","First Name":"Bob","Preferred Name":"Bob","Preferred Pronoun":"he/him","SF ID #":"2211-4456","Program Code":"3504","Phone":"910-432-8765","Email":"email@example.com"}

and it should look like this:
{"1":{"Last Name":"Minion","First Name":"Bob","Preferred Name":"Bob","Preferred Pronoun":"he/him","SF ID #":"2211-4456","Program Code":3504,"Phone":"910-432-8765","Email":"firstname.lastname@example.com"}

with the quotes not being on the code in the Program Code:3504 key value pair, and I can't figure out why the quotes are being placed on it.
example input file content looks like this:
Last Name,First Name,Preferred Name,Preferred Pronoun,SF ID #,Program Code,Phone,Email
Minion,Bob,Bob,he/him,2211-4456,3504,910-432-8765,firstname.lastname@example.com
Nichols,James,James,,1234-5678,3651,352-395-5220,firstname.lastname@example.com
Person,Punny,,,9999-1111,3840,352-123-4567,firstname.lastname@example.com
Person,Punny2,,,9999-1112,3841,352-123-6792,email@example.com
Person,Punny3,,,9999-1113,3842,352-123-3420,firstname.lastname@example.com
Smart,Maxwell,Max,,9922-4029,3650,310-2910,firstname.lastname@example.com
Tree,Groot,Groot,,1122-3344,3624,361-1234-5678,firstname.lastname@example.com

Comment: Please remove the line numbers and just give us the program itself.
Comment: And to answer your question, you are assuming the data you read are integers, but they're not. When you split a string it returns a list of strings. That's what your `csvValueArray` is. You have to write your own logic to convert certain strings in that list to integers or other types.
Comment: Line Numbers Removed
Comment: Can you please [edit] your question and put there sample content of the input file?
Comment: example input file added
Comment: Something can be said about the input data for sure? For example, can we say that only integers, floating-point numbers, strings and empty values can occur in the input data? Or maybe we can say that the set of columns is fixed, they are always named exactly as shown in the example and always contain only data of a specific type?
Answer: All values from a split CSV line are type str which is why you get quotes around everything.  You could write a coerce function that tests if the string can be converted to int:
    def coerce(value):
        try:
            return int(value)
        except ValueError:
            return value

    def getValueDataType(self, value):
        value = self.coerce(value)
        if (type(value) == int):
            value = str(value)
        ...

I'll leave it as an exercise to coerce bool and null.
Answer: Here is an example, where s is the JSON string.
There is no character escaping, in this one.
j = ''
h = next(it := iter(s.splitlines())).split(',')
for r in it:
    a = ''
    for k, v in zip(h, (c := r.split(','))):
        if not v: v = 'null'
        elif not (v in ['true', 'false', 'null'] or v.isnumeric()):
            v = f'"{v}"'
        if a: a += ','
        a += f'"{k}": {v}'
    if j: j += ',\n'
    j += '{' + a + '}'
j = f'[{j}]'

Output
[{"Last Name": "Minion","First Name": "Bob","Preferred Name": "Bob","Preferred Pronoun": "he/him","SF ID #": "2211-4456","Program Code": 3504,"Phone": "910-432-8765","Email": "email@example.com"},
{"Last Name": "Nichols","First Name": "James","Preferred Name": "James","Preferred Pronoun": null,"SF ID #": "1234-5678","Program Code": 3651,"Phone": "352-395-5220","Email": "firstname.lastname@example.com"},
{"Last Name": "Person","First Name": "Punny","Preferred Name": null,"Preferred Pronoun": null,"SF ID #": "9999-1111","Program Code": 3840,"Phone": "352-123-4567","Email": "firstname.lastname@example.com"},
{"Last Name": "Person","First Name": "Punny2","Preferred Name": null,"Preferred Pronoun": null,"SF ID #": "9999-1112","Program Code": 3841,"Phone": "352-123-6792","Email": "firstname.lastname@example.com"},
{"Last Name": "Person","First Name": "Punny3","Preferred Name": null,"Preferred Pronoun": null,"SF ID #": "9999-1113","Program Code": 3842,"Phone": "352-123-3420","Email": "email@example.com"},
{"Last Name": "Smart","First Name": "Maxwell","Preferred Name": "Max","Preferred Pronoun": null,"SF ID #": "9922-4029","Program Code": 3650,"Phone": "310-2910","Email": "email@example.com"},
{"Last Name": "Tree","First Name": "Groot","Preferred Name": "Groot","Preferred Pronoun": null,"SF ID #": "1122-3344","Program Code": 3624,"Phone": "361-1234-5678","Email": "firstname.lastname@example.com"}]

If you wanted to include character escaping, here is a re-factor.
There is an RFC which defines the values.
RFC 8259 – The JavaScript Object Notation (JSON) Data Interchange Format – Section 7. Strings.
import unicodedata
j = ''
h = next(it := iter(s.splitlines())).split(',')
for r in it:
    a = ''
    for k, v in zip(h, (c := r.split(','))):
        if not v: v = 'null'
        elif not (v in ['true', 'false', 'null'] or v.isnumeric()):
            v = unicodedata.normalize('NFC', v)
            v = str(v.encode('unicode_escape'), 'utf-8')
            if '"' in v: v = v.replace('"', r'\"')
            v = f'"{v}"'
        if a: a += ','
        a += f'"{k}": {v}'
    if j: j += ',\n'
    j += '{' + a + '}'
j = f'[{j}]'

And, if you want to indent the lines, here is another re-factor.
import unicodedata
j = ''
h = next(it := iter(s.splitlines())).split(',')
for r in it:
    a = ''
    for k, v in zip(h, (c := r.split(','))):
        if not v: v = 'null'
        elif not (v in ['true', 'false', 'null'] or v.isnumeric()):
            v = unicodedata.normalize('NFC', v)
            v = str(v.encode('unicode_escape'), 'utf-8')
            if '"' in v: v = v.replace('"', r'\"')
            v = f'"{v}"'
        if a: a += f',\n{(" " * 8)}'
        a += f'"{k}": {v}'
    if j: j += ',\n'
    j += (' ' * 4) + '{\n' + f'{(" " * 8)}{a}\n{(" " * 4)}' + '}'
j = f'[\n{j}\n]'

Output
[
    {
        "Last Name": "Minion",
        "First Name": "Bob",
        "Preferred Name": "Bob",
        "Preferred Pronoun": "he/him",
        "SF ID #": "2211-4456",
        "Program Code": 3504,
        "Phone": "910-432-8765",
        "Email": "firstname.lastname@example.com"
    },
    {
        "Last Name": "Nichols",
        "First Name": "James",
        "Preferred Name": "James",
        "Preferred Pronoun": null,
        "SF ID #": "1234-5678",
        "Program Code": 3651,
        "Phone": "352-395-5220",
        "Email": "email@example.com"
    },
    {
        "Last Name": "Person",
        "First Name": "Punny",
        "Preferred Name": null,
        "Preferred Pronoun": null,
        "SF ID #": "9999-1111",
        "Program Code": 3840,
        "Phone": "352-123-4567",
        "Email": "firstname.lastname@example.com"
    },
    {
        "Last Name": "Person",
        "First Name": "Punny2",
        "Preferred Name": null,
        "Preferred Pronoun": null,
        "SF ID #": "9999-1112",
        "Program Code": 3841,
        "Phone": "352-123-6792",
        "Email": "firstname.lastname@example.com"
    },
    {
        "Last Name": "Person",
        "First Name": "Punny3",
        "Preferred Name": null,
        "Preferred Pronoun": null,
        "SF ID #": "9999-1113",
        "Program Code": 3842,
        "Phone": "352-123-3420",
        "Email": "firstname.lastname@example.com"
    },
    {
        "Last Name": "Smart",
        "First Name": "Maxwell",
        "Preferred Name": "Max",
        "Preferred Pronoun": null,
        "SF ID #": "9922-4029",
        "Program Code": 3650,
        "Phone": "310-2910",
        "Email": "email@example.com"
    },
    {
        "Last Name": "Tree",
        "First Name": "Groot",
        "Preferred Name": "Groot",
        "Preferred Pronoun": null,
        "SF ID #": "1122-3344",
        "Program Code": 3624,
        "Phone": "361-1234-5678",
        "Email": "firstname.lastname@example.com"
    }
]


How to directly connect 2 Ubuntu PCs via wi-fi?

Question: I want to create a direct link between 2 PCs via Wi-Fi without using a router to avoid a bottleneck.
What should i do? Both PCs uses Ubuntu 12.04 amd64.
Answer: You may want to look into setting up an adhoc network. That way the computers can talk directly.
To be honest though, I doubt you'll get much speed increase if any, because the limiting factor is more likely to be wifi transmission speed 802.11g.
Comment: thanks, i will try, the drivers for my ethernet makes Ubuntu freezing, i can't use the ethernet card.
Answer: Edit: sorry I thought you said without wifi. so Adhoc is what you're looking for.
But if you want the fastest, connect 2 PCs to a router with Ethernet.
Comment: i know, but i can't use the ethernet port.


How can I practice aiming faster as Sniper?

Question: I have noticed that when I play sniper if my shots miss, it's usually because I fail to actually get it to the right spot in time.
I also can't seem to get a good shot if I go too fast.
I also seem to shoot slowly in the flash game shoot which I have been using to see how my aimbooster practice is going.
Here is an example of the fast shooting
Answer: There are countless tutorials on YouTube covering this subject, but the only one that really stuck out to me was nst's tutorial.

Prediction
 - Shoot an enemy when they are unlikely to change direction. This will allow you line up for a headshot.
 - Enemies' movements are somewhat easier to predict if they jump. Shoot where you think the enemy will land rather than where the enemy is.
 - Not all classes die from one hit, if you landed a successful headshot try finishing them off with a noscope.
 - Check for enemy snipers, most will be at commonly known spots so make sure to check those before you push.
 - Parachuting soldiers are an easy kill since they are hindered by their lack of mobility.
 - In a Sniper v Sniper. A common tactic to use is "Doublezooming". Doublezooming is used after a player has missed their shot, they will instantly zoom in/out to bait the enemy player into thinking they are going to take a shot. When the enemy sniper zooms in they will not be able to move around as much and therefore makes it an easier target to kill.
Make The Best Of What You Got
 - In a scenario where you are likely to die, it always good to try and get a pick. Remember medics take priority over any other class.
Play Around Corners
 - Hold angles where you think the enemies are likely to come. This will allow you to fully power up your shot before an enemy comes.
 - Aim at the wall when you are scoped in. So the sniper dot will not be visible to enemies and you will catch them by surprise.
Don't Be Afraid To Take A Fight
 - The sniper rifle is powerful at close ranges. Don't be afraid to take a chance at a shot.
Sensitivity
 - While it's up to your personal preference. A good sensitivity for sniper is a low one.
 - High perfect mouse control speed is recommended. Meaning no matter how fast you move your mouse it will always move the same distance in-game.
The video in your question doesn't necessarily represent the true nature of the game as you will zoom out after each shot hence why I summarised it. You gotta learn how to walk before you can run.
Comment: Hi Mano!  Can you give a small example from the video as well?  It would greatly improve your answer!
Comment: Oh, yes perhaps I could improve it. I will try to the best of my ability, but not right now. Thanks for the feedback.
Answer: I really recommend you try this site specifically Fast ShootingI use it on a constant basis and I have improved dramatically because of it. It provides a great resource with a cornucopia of minigames that each target a specific area of skill
Comment: This constitutes a link only answer, and will become invalid as soon as the site goes down. Please summarize the relevant info from the link to ensure your answer remains valid.


What tools or technique to use for cutting hinge and dead bolt recesses?

Question: I have to hang several new six panel interior doors. Since these are not pre-hung they don't have the recesses cut away for hinges or the bolt or the door handle. I have the jig to use to cut out the hole for the handle. However, I don't know where to begin to cut away the recesses for the hinges. I suppose I could just use a chisel but that seems slow and likely to result in rough corners and uneven depth. I thought about using a routing tool as well.
What is the correct, professional way of prepping the door to be hung on an existing frame?
Answer: You'll find good resources on the web that have already been written/video'd with a search term like "How to Mortise Hinges on Interior Door".
If I wasn't using a purpose-built jig for this task, I'd use a router freehand to get most of the hinge mortise cut, and finish the edges with a sharp chisel.
It's not clear if the existing jambs are already mortised for hinges, but if they are, I'd make a story stick** to mark your door.
Pay attention to how plumb/square the jamb is, as that'll affect where the door will sit within. (Just as an example, if the head of the jamb is sloped, you'll either accept an uneven reveal across the top, or custom cut the top of the door to fit the opening. Either of these will affect where the hinges go.)
When you've cut your mortises, be prepared to play around with the fit... sometimes strategically loosening a few screws to get the hinge leaf to sit right will be all it takes to get a door to fit well.
I'm not going to lie to you: doing new doors in old construction isn't easy. Take your time. Do the least visible one first and learn from it.
** story stick (story pole) -- a stick (1x1 or 1x2 works well) around 78" for most interior door applications but ymmv. Simply hold it up to the top of the door jamb on the hinge side, mark about 1/8" for the reveal, then continue down the stick and mark where the existing hinges start and stop. ((This is where you need to know if the top of your door jamb is level! If it isn't, you should probably cut the door first, then lay out your hinges.)) Carry the stick over to your door; set it aligned to the 1/8" mark and the top of the door, and transfer the marks for your hinge locations. If you're lucky, all your doors are the same, and you'll only have to use one set of marks.
Comment: _I'd make a story stick_ I don't know what this is. Sounds fun though.
Comment: I'm replacing doors that were hollow slabs and had been painted over by the previous homeowner.  I can use the existing doors to make a pattern for the new ones.  I'm mostly worried about cutting out the recesses - or mortising I guess - since using a chisel takes too long and/or requires skill I don't possess.
Comment: Added info about story stick for the benefit of anyone in the future. If your existing doors fit well, they're probably a good template for subsequent doors. (Note where they've been nipped/tucked when you're using them as a template.) If you haven't purchased your replacement doors yet, you should know that a lot of door shops (the real ones -- not the evil orange box) will do the work of mortising/cutting new doors based on existing ones for not-a-lot-of-money. If the existing doors didn't fit very well, then it's a little harder to get a good result from the door shop.


Batch to open folder, resize and position it

Question: I want to open 2 folders, resize and position it SIDE by SIDE...
I already open it.
echo off
%system%\explorer.exe "[Path1]"
%system%\explorer.exe "[Path2]"
Comment: `cmd`/`batch` has no functionality to interact with GUI programs. You need another language for that.
Comment: Short answer you can't do this with a batch or cmd
Answer: This isn't possible, I'm afraid. Do you want to do a comparison? If so, you should use a proper tool like Beyond Compare or Araxis Merge.


How do I retrieve tickets for a specific month?

Question: I would like to retrieve data on tickets for the month of July. I used the incremental export to set the "start_time" to July 1st but I am also receiving tickets for August as well.
I noticed that Zendesk has "end_time" but I don't know how or if it is possible to use both start time and end time together to limit my data only to July. I'm using Python to do this.
Link
Answer: I am also working on zendesk api in python but I want to tell you that there is "start_time" in ticket api here you can see that link.
Yeah there is "start_time" in Zendesk Talk api in Incremental Export, and here it is working absolutely fine.


Why does the crypt() function not have a memory leak?

Question: From crypt(3) - Linux man page:
char *crypt(const char *key, const char *salt);

Return Value:
A pointer to the encrypted password is returned. On error, NULL is returned.
Since the return value is unknown unless key and salt is given, this should be dynamically allocated memory, but valgrind doesn't agree.
Answer: From the man page:

The return value points to static data
  whose content is overwritten by each call.

So this means it's not dynamically allocated - it's a single static allocation (just like a global variable).
Answer: From the page you linked:

The returned value points to the encrypted password, a series of 13 printable ASCII characters (the first two characters represent the salt itself). The return value points to static data whose content is overwritten by each call.


Is it possible to set Hebrew value in html select tag?

Question: This html select looks good on jsfiddle:
<select>
  <option value="אלף">אלף</option>
  <option value="בית">בית</option>
  <option value="גימל">גימל</option>
</select>

Is it guarenteed to work on all desktop browsers?
Comment: Why would it *not* work? What kinds of things are you worried about? Fonts? Writing direction? Passing data to server?
Comment: Shouldn't it be `` ?
Comment: Is there a "foreign-languages" tag or something like that? I couldn't find one..
Comment: @JukkaK.Korpela - The title says "value", so fonts obviously aren't the problem. As to the other options - I really can't guess what can go wrong.. If I had to I'd say "passing data to the server", but wouldn't want to limit the question to only that.
Comment: @OrenA perhaps you're worried how your values would appear since I think they are [Right-To-Left Hebrew text](http://stackoverflow.com/tags/right-to-left/info) ?
Comment: @Reyno - all of the above :)
Comment: @OrenA, how does this differ from "is `value="foo"`guaranteed to work?" Or from ditto about `value="æ"`. All non-Ascii characters imply that you need to consider character encodings (normally, use UTF-8), but this is in no way limited to `select` and Hebrew. Writing direction affects only the way characters are displayed, so they appear (to client-side scripts and to server-side processing) in the same logical order as in HTML source, e.g. the first character in the string "אלף" is "א".
Answer: According to the spec : http://www.w3.org/TR/html401/interact/forms.html#edef-OPTION

CDATA is a sequence of characters from the document character set and
  may include character entities.

But notice :
User agents should interpret attribute values as follows:

Replace character entities with characters,
Ignore line feeds,
Replace each carriage return or tab with a single space.

User agents may ignore leading and trailing white space in CDATA attribute values (e.g., "   myval   " may be interpreted as "myval"). Authors should not declare attribute values with leading or trailing white space.
Hence , I don't see any reason for not to be working with older browsers.
I've tested it with IE7 for you ( pure ie7)
Answer: To answer your question, I don't know if it's guaranteed to work on all Desktop browsers as there are a lot of Desktop browsers out there but there are also tools to check them for compatibility. My personal favorite is browsershots which gives numerous screenshots on what a page would look like in different browsers and different browser versions. Please note that "browsershots" might need registering a free account.
Other tools can be found by searching for browser compatibility testing tools

On another note concerning the worry about Right-To-Left texts HTML display mentioned in OP comments, you can make use of the Bi-directional Text (Bi-Di) markup and CSS.
Wikipedia:

Bi-directional text is text containing text in both text
  directionalities, both right-to-left (RTL or dextrosinistral) and
  left-to-right (LTR or sinistrodextral)

A good example of BiDi markup can be:
<select dir="rtl" lang="he">
  <option value="אלף">אלף</option>
  <option value="בית">בית</option>
  <option value="גימל">גימל</option>
</select>

Another good use of BiDi could be using CSS as following:
.hebrew {
    direction: rtl;
    unicode-bidi: bidi-override;
}

Please note that it's recommended to use Bidi markup instead of CSS where possible:

You should always use dedicated bidi markup to describe your content,
  where markup is available. Then CSS may or may not also be needed to
  describe the meaning of that markup. This depends on whether you are
  dealing with content that is handled by the user-agent as HTML or XML.
  (Note that XHTML may be served as either!)


When does a limit reach a value $< 1$?

Question: I'm working on a proof in number theory, and have encountered a proof. If I include the proof, I can show that as some numbers tends to infinity, they follow a certain rule. Unfortunately, this is not precise enough, so I have set  up an inequality. This is the limit:
$$\lim \limits_{n \to \infty} g \cdot \left(1-(1-\prod_{i=1}^n (1-\frac{1}{p_i}))\right)$$
and know that it tends to $0$. In this case, $p_i$ are the prime numbers, and $g$ is any number in-between $p_{n}+1 $ and $p_{n+1} -1$. I would like to know at which n the expression is less than $1$. In other words/symbols:
$$\lim_{n \to \infty} g \cdot \left(1-(1-\prod_{i=1}^n (1-\frac{1}{p_i}))\right) < 1.$$
I've written a short bit of code in Python and had it reviewed on Code Review. Since I've tried numbers up to 100 million and did not reach a number less than $1$, I would like to know whether there is some mathematical of  arriving at the result, or whether my limit is just wrong. Thanks!
Comment: @LinusRastegar It does. And Mertens' third theorem says how fast. You get a finite nonzero limit if $g \sim \log p_n$.
Comment: Well, Mertens proved that $$\lim_{x\to \infty} (\log x)\prod_{p \leqslant x}\biggl(1 - \frac{1}{p}\biggr) = e^{-\gamma}.$$ And $\dfrac{n}{\log p_n} \to +\infty$.
Comment: @Momo "The first $n$ prime numbers" are "the primes not exceeding the $n$-th prime number". Hence we have the product $\prod\limits_{p \leqslant p_n} \bigl(1 - \frac{1}{p}\bigr)$.
Comment: And $p_i$ is prime numbers?
Comment: @SimpleArt Yes, thanks for recommending the clarification.
Comment: Note that $1 - (1 - \prod) = \prod$. Also, by [Mertens' third theorem](https://en.wikipedia.org/wiki/Mertens'_theorems), the limit is $+\infty$, the product is asymptotically $e^{-\gamma}/\log p_n$.
Comment: @DanielFischer I understand your simplification but disagree with your limit. I think that the product converges to 0 thus the limit becomes 0.
Comment: @Daniel Fischer But his product looks like it is for "the first n prime numbers", not for "the prime numbers less than n".
Comment: @DanielFischer It was made clear to me in [this](http://math.stackexchange.com/questions/2044965/sum-of-an-infinite-series-of-fractions) post that 1 - the product converges to 1.
Comment: @LinusRastegar if you use that argument only to conclude that this limit is 0, then you might be in trouble because this is in fact a $\infty \cdot 0$ scenario, which may be anything ...
Comment: I think I'll just be posting a new question with the limit as the question and not the inequality. Thanks for doubting my work (not trying to be passive aggressive, I really appreciate it) and making me think more!
Comment: Why the $(1-(1-P))$?  Why not just $P$?
Answer: A counter proof ... I feel like stealing the answer from Daniel Fischer, but here is evidence I knew about Mertens' theorem before. To avoid any further doubts:
$$ g \cdot \left(1-\left(1-\prod_{i=1}^n \left(1-\frac{1}{p_i}\right)\right)\right) \geq (p_{n}+1)\cdot \prod_{i=1}^n \left(1-\frac{1}{p_i}\right)=$$
$$=\frac{p_{n}+1}{\ln{(p_n+1)}}\cdot \ln{(p_n+1)} \cdot \prod_{i=1}^n \left(1-\frac{1}{p_i}\right)=$$
$$=\frac{p_{n}+1}{\ln{(p_n+1)}}\cdot e^{-\gamma} \cdot \frac{\ln{(p_n+1)} \cdot \prod_{i < p_n+1} \left(1-\frac{1}{p_i}\right)}{e^{-\gamma}}>$$
$$>\frac{p_{n}+1}{\ln{(p_n+1)}}\cdot e^{-\gamma} \cdot (1-\varepsilon)$$
starting with some $n$ for some $\varepsilon$ (from the definition of limit). The latter goes to $\infty$.
Another way (to add some creativity from me) is to exploit this result:
$$\liminf_{n \rightarrow \infty} \varphi(n)\cdot \frac{\ln{\ln{n}}}{n}=e^{-\gamma}$$
where $$\prod_{i=1}^n \left(1-\frac{1}{p_i}\right)=\frac{\varphi\left(\prod_{i=1}^n p_i\right)}{\prod_{i=1}^n p_i}$$
so that
$$g \cdot \left(1-\left(1-\prod_{i=1}^n \left(1-\frac{1}{p_i}\right)\right)\right) \geq (p_{n}+1)\cdot \prod_{i=1}^n \left(1-\frac{1}{p_i}\right)=(p_{n}+1)\cdot \frac{\varphi\left(\prod_{i=1}^n p_i\right)}{\prod_{i=1}^n p_i}=$$
$$=\frac{p_{n}+1}{\ln{\ln{\left(\prod_{i=1}^n p_i\right)}}}\cdot \varphi\left(\prod_{i=1}^n p_i\right) \cdot \frac{\ln{\ln{\left(\prod_{i=1}^n p_i\right)}}}{\prod_{i=1}^n p_i}>$$
considering the definition of $\liminf$
$$>\frac{p_{n}+1}{\ln{\ln{\left(\prod_{i=1}^n p_i\right)}}} \cdot (1-\varepsilon) \cdot e^{-\gamma}=$$
(from some $n$ onwards of course)
$$=\frac{p_{n}+1}{\ln{\left(\sum_{i=1}^n \ln{p_i}\right)}} \cdot (1-\varepsilon) \cdot e^{-\gamma} > \frac{p_{n}+1}{\ln{\left(n\cdot \ln{p_n}\right)}} \cdot (1-\varepsilon) \cdot e^{-\gamma}=\frac{p_{n}+1}{\ln{n} + \ln{\ln{p_n}}} \cdot (1-\varepsilon) \cdot e^{-\gamma}$$
which again is easy to see it goes to $\infty$.

When does a limit reach a value $< 1$?


Why the asp datagrid header is rendered as TR instead of TH? How to Render the Header of grid as TH

Question: Is it possible to render the header text as TH instead of TR
<code>    <asp:DataGrid ID="DataGrid2" runat="server" AutoGenerateColumns="False"
                                CssClass="rgform" PageSize="3" Width="100%">
           <AlternatingItemStyle CssClass="rgAltRow" />
           <ItemStyle CssClass="rgRow" />
           <HeaderStyle CssClass="rgHeader" />
             <Columns>
              <asp:BoundColumn DataField="project_id" HeaderText="Project Id">
              </asp:BoundColumn>
             </Columns>
    </asp:datagrid>
</code>
Answer: Try adding this attribute: <code>" UseAccessibleHeader="True"</code> to your DataGrid.
This will replace TD with TH in your column header TR


How to heal workers?

Question: Workers are usually captured rather than damaged, but I was recently playing with a friend, and he was bombing my workers from the see.
I was then looking for the "fortify until healed" option, but couldn't find it. Can workers heal themselves ?
Answer: They don't have a Fortify option, but if you take no action with them during the turn, they will heal the same as any other unit (1 point in neutral territory, 2 points in friendly territory, 3 points in a city).
Comment: so there is no way to have them sleep while they heal, and get the focus again when they are at full health again...
Comment: Nope, that unfortunately isn't possible.

How to heal workers?


reading input from a text file and using it in a function in C

Question: How would I use input from a text file so that I could use it in a function, without saving the characters into an array? As I read from the text file a 1 will come up and I will go to "setParameters", where I would enter the rest of the parameters. Also in that function, I will use malloc.(if it does not make sense let me know so that I can clarify it, also I am new to C)
int val;
int choice;
 FILE *fpointer;
fpointer = fopen("afile.txt","r");
printf("\nError Detection/Correction");
printf("------------------------------\n");

choice = fscanf(fpointer,"%d",&val);
while(choice != 3)
{
    printf("1. Enter Parameters\n2. Enter Hamming Code\n3. Quit\n");
    switch(choice)
    {
        case 1: setParameters();
            break;

        case 2: checkError();
            break;

        case 3: printf("*** Program Terminated Normally");
            break;

        default:
            printf("Not a valid entry");
        break;

    }//end of switch statment

Comment: Can you perhaps post any code that you already have?  Is this an assignment question?
Comment: what's `run`? I think you want `switch(val)` instead of `switch(choice)`
Comment: `choice = fscanf(fpointer,"%d",&val);
while(choice != 3)` --> `choice` will only be `0,1,EOF`
Comment: So should I change the while condition to "while(!feof(fpointer))"
Comment: You will want to look at [**Why is while ( !feof (file) ) always wrong?**](http://stackoverflow.com/questions/5431941/why-is-while-feof-file-always-wrong).
Comment: `fscanf(fpointer,"%d",&val);` attempts to read text and convert that into an `int` for `val`.  Where does code then use `val`?
Comment: val is used in a function that is not posted on here
Comment: not sure what you want to ask @Blitzman.
Do  you want to use val, in other functions without storing it to an array?
Do i get it right?
Comment: yes that is exactly right
Comment: @Blitzman, Did my answer help you.?
Answer: To take input from file in C (using fscanf):
You need to initialize FILE pointer using fopen and then scan each input using fopen.
FILE *fpointer;
fpointer = fopen("afile.txt","r");
int ret;
while(ret = fscanf(fpointer," %d ",&val))
{
     if(ret == EOF)
     {
          break;
     }
     else
     {
         // use val variable here in code which is taken as input from file
     }
}

here, it is important to understand what ret variable is:

EOF, if the pointer is reached end of file.
0, if no input matched with the variable
>0, number of matched variables with the file input

To take input from file in C++ (using fstrean):
it is very easy to get input from a file. we just need to change cin to get input from file stream instead of standard input.
#include <fstream.h>

void main() {
    ifstream cin("afile.txt");
    int val;
    cin  >> val;

    // use val as variable in code.
}

this approach is very easy but only works in C++. it requires no file operations like fscanf . just changing cin will do the work :)
Comment: Observations: `while(ret = fscanf(fpointer," %d ",&val)
{
     if(ret == EOF || ret == 0)` won't compile; there's a `)` missing at minimum; and the `ret == 0` condition would never be true because the (fixed) while loop would prevent it being reached.  I'd use `while ((ret = fscanf(fpointer, "%d", &val)) == 1)` which only enters the loop if the input is successful.  Note that [trailing blanks in `scanf()` format strings are a UI disaster](https://stackoverflow.com/questions/19499060/) too, and the leading blank is superfluous (but otherwise harmless).


Laravel 5.6 Route Group

Question: My controllers which are HomeController and BlogController in Admin folder. My views like:

/admin

index.blade.php
/blog

index.blade.php

I want to call /admin0admin url to /resources/views/admin/index.blade.php.
I want to call /admin0admin/blog url to /resources/views/admin/blog/index.blade.php
Here how i call in view:

And my routes like:
Route::group(['namespace' => 'Admin', 'prefix' => 'admin0admin'], function () {
     Route::get('/', 'HomeController@index')->name('index');

     Route::group(['prefix' => 'blog'], function () {
         Route::get('/', 'BlogController@index')->name('index');
     });
});

And my BlogController index method:
return view('admin.blog.index');

I got an 404 not found error.

Route [admin0admin.blog] not defined

Laravel Version is : 5.6.*
Comment: Check out `php artisan route:list` to find out what the names and routes are in your app.
Comment: i added route list too
Comment: there is your issue! You need to name the route `admin0admin.blog`, not `index`. `prefix` does not affect names of routes, so you need to write it out.
Comment: can you write as an answer?
Answer: You need to name the route admin0admin.blog, not index. prefix does not affect names of routes, so you need to write it out.

Laravel 5.6 Route Group


Bootstrap 4.4 Navbar Collapsed Hamburger Icon Not Visible But Working Properly

Question: Bootstrap Navbar working properly in collapsed mode on smaller screen sizes, but the hamburger icon is not showing up in the navbar.
Here is my code for the navbar. Please help me out.

<link rel="stylesheet" href="https://cdn.usebootstrap.com/bootstrap/4.4.1/css/bootstrap.min.css">

PPDC

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">

    </button>

Comment: The icon appears in the demo above. Please revise it as needed to show your problem.
Comment: It has a media query, which sets display as `none` after for screens larger than 992px`
`@media (min-width: 992px)
.navbar-expand-lg .navbar-toggler {
    display: none;
}`
Comment: @isherwood didn't work for me when I expaneded the snippet. Edit: When I make the result full page
Comment: That's not what your question says. Please revise to be more clear. Also include enough markup so we can help.
Answer: I think you messing some css or js of Bootstrap cdn's so,
go with this code it's working fine.

<!doctype html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="stylesheet" href="https://firstname.lastname@example.com/dist/css/bootstrap.min.css" >

    <title>Hello, world!</title>

        Navbar
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

        </button>

              Home (current)

              Link

                Dropdown

                Action
                Another action

                Something else here

              Disabled

          <form class="form-inline my-2 my-lg-0">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
          </form>


Syncfusion HTML To PDF conversion

Question: I'm facing with an interesting problem. I use Syncfusion Essential Studio + Web Kit for converting HTML to a PDF. Sometimes it works fine, but sometimes it is completely useless.
What means completely useless? It throws UnauthorizedException, every time, when I call HtmlToPdfConverter's Convert method. But it doesn't occur every time, just appears randomly.
Here is my code:
<code>        string htmlString = "";

        try
        {   // Open the text file using a stream reader.
            using (StreamReader sr = new StreamReader("PdfTemplates\\template.html"))
            {
                // Read the stream to a string, and write the string to the console.
                htmlString = sr.ReadToEnd();
            }
        }
        catch (Exception e)
        {
            _logger.Error(e,"read the template html");
            throw e;
        }

        StringBuilder sb = new StringBuilder(htmlString);

        sb.Replace("%SOMETHING%", something);
        htmlString = sb.ToString();

        _logger.Information("htmltemplate with new data created");

        PdfDocumentBase mergedPdf;
        try
        {
            var pdfDocFromHtml = _htmlConverter.Convert(htmlString, ""); // THE Problematic line
            var pdfLoadedDocument = new PdfLoadedDocument(uploadedPdfStream);

            //template generation
            _logger.Information("pdf created from html");

             //merge the generated pdf with the uploaded document
             mergedPdf = MergePdf(pdfDocFromHtml, pdfLoadedDocument);

             _logger.Information("pdf merged");

             var resultStream = PdfDocumentToStream(mergedPdf);

            pdfDocFromHtml.Close(true);
            pdfLoadedDocument.Close(true);

                    return resultStream;
        }
        catch (Exception ex)
        {
            Type typeOfE = ex.GetType();
            _logger.Error(ex, "pdfLoadedDocument from byteArray");
            throw;
        }
</code>
I work in a team, and none of the teammates has the problem, just me. I'm on Windows 10 Pro. We're developing an ASP.NET MVC application.
Does somebody have an idea what can be the problem?
Answer: I have tried to reproduce the unauthorized exception while converting HTML string to PDF using MVC application in Windows 10 environment, but it is working fine. We have not faced similar exceptions earlier, Could you create a new incident through Syncfusion Direct-Trac support system with the below details.

Code snippet or a sample to reproduce the issue.
Input HTML file or URL.
Environment details about the Operating System and language specification.

Meanwhile, please try converting some other URL (http://www.google.com) to PDF using the same project and let me know the result.
Note: I work for Syncfusion
Comment: I tried to convert http://www.google.com, but it failed, too. I'll contact with the support, too.

Syncfusion HTML To PDF conversion


Should I keep a gable vent along with soffit and ridge venting?

Question: When we moved into our house it had a large gable vent at one end of the attic, and a turbine vent on the top of the roof. We had a new roof installed and they recommended to use soffit vents and a ridgeline vent. Soffits needed replacing anyway so we went with that.
They left the turbine vent in place and the roofer couldn't give a clear answer as to whether we should close off the gable vent. My thinking is the gable vent is not necessary now that we have the soffit and ridge line. But we left it open to see what would happen with all 4 elements in place. We have noticed our electric bill decreased. But also noticed oak pollen sucked into the attic which we never had in 8 years before. It is all throughout the attic.
We live in southeast Texas. It rarely snows here, and our house is surrounded by LOTS of oak trees. Should we cover up/close the gable vent?
Answer: You should close off the gable vent, but not due to the pollen. Also, your energy bills won't give you scientific evidence either way--there are too many other variables potentially skewing any comparison.
The reason is that a gable vent typically short-circuits the airflow path between the soffits and the ridge, leaving some of the outer attic space less well scavenged. Ideally you want a simple, straight path of convective flow from soffit to ridge covering the entire attic area.
Here's more information about the inverse question: Do I need soffit vents when I have 2 gable vents and 5 normal peak vents?


How to solve integrals where cauchy integral does not apply?

Question: Lets say I had to solve an integral over the curve with radius 2,
I have f(z) as z/(z-2), if I center z at z = 2, the residue came out to be 0.
However, my problem is if I center z at z = 2, this works but my integral would not
equal to 2piiresidue....because I believe residue theorem states that singularity points
must not be on the curve....can anyone help me out straighten out my logic?
Answer: If your singularity lies on the contour, you have to evaluate the integral as a Cauchy principal value.
The contribution from the pole that lies on the contour is half of that of a pole that lies in the interior.
Comment: Stated another way: it is a divergent improper integral (in the conventional sense), so if you think it is useful anyway, you have to invent some way to make sense of it.  The Cauchy Principal Value is one of those ways.  A good example to study: $$\int_{-1}^1\frac{dx}{x}$$


How do I cure Orb Piercer poison?

Question: I got poisoned by an Orb Piercer on the 4th Layer of the Abyss. The poison effect is purple and drains both my health and hunger. The Red, Blue, and Paralysis antidotes don't have any effect. How do I cure Orb Piercer poison?
Answer: The first thing you need to do is meet Nanachi, who you can find by:

 Killing yourself with fall damage.

(Source and tips here)
Then, you should be able to acquire the Orb Piercer Venom.
Comment: It seems the poison also gets cured if you return to the surface or give up your current run.

How do I cure Orb Piercer poison?


git branch -v always stucks the cmd

Question:
Like this screenshot shows, after I typed git branch -v and typed Enter, the cmd will always be stucked.I have tried to make another new clone, but this problem didn't disappear.
It happens to my every repository, and I have tried upgrade / reinstall my git.
Maybe there are some weird software conflicts exists
Comment: Do not post images of code, input/output data or error message. Use the select and copy-paste functionalities provided by the operating system and post the text as text in the question. Put a line that contains only `\`\`\`` before it and another one after it or indent it with 4 spaces to be rendered nicely.
Comment: Related to the suggestion of @phd, what happens if you press `q`? Or if you press `Ctrl-C`? (when you run the command without `--no-pager`)
Comment: https://stackoverflow.com/a/48370253/7976758 ? Try `git --no-pager branch -v`
Comment: Thanks a lot, it seems caused by a malware. This malware is forced to be installed at where I work. It is a network access control software, but it seems more than that.
Answer: Maybe this phenomenon is due to windows, try it under wsl/wsl2
Comment: ...Very sad, this problem can be produced in wsl too.

git branch -v always stucks the cmd


FAQ: Linguistics disciplines and sub-disciplines

Question: What are the various fields that belong to Linguistics?
Answer: Linguistics consists of various fields:
A - Anthropological Linguistics, Applied Linguistics.
B
C - Cognitive Linguistics, Comparative linguistics, Computational Linguistics.
D - Discourse Analysis.
E - Etymology, Evolutionary Linguistics.
F - Forensic Linguistics, Functional theories of grammar.
G - Generative Linguistics, Graphemics, Graphetics.
H - Historical Linguistics.
I - Internet Linguistics.
J
K
L - Language acquisition, Language assessment, Language development, Language education, Lexis, Linguistic anthropology.
M - Morphology, Morphonology.
N - Neurolinguistics.
O - Orthography.
P - Phonetics, Phonology, Pragmatics.
Q - Quantitative linguistics.
R
S - Semantics, Semiotics, Sociolinguistics, Syntax.
T - Translation studies.
U
V
W
X
Y
Z
Comment: Can I suggest `Discourse Analysis`, `Sign Languages`, and `Translation studies`? Edit: And perhaps `Applied Linguistics` too.
Comment: Of course, even if Sign Language is not "a field"... no? I'm going to add the other ones, thanks.
Comment: Thank you, but why do you think that `Sign Languages` is not a field in itself? There's a lot of research on natural sign languages and although that is not my *field*, I think it has made important contributions to linguistics in general. Am I missing something here?
Comment: @KleinePrins No maybe it's me, but Sign Language is a field in Linguistics? I mean, it's a subject, but like "Spoken languages"... I am not sure if I am explaining myself well lol :)
Comment: I get it, and I guess there can be several opinions about this. I just looked for serious and comprehensive lists of linguistic subfields and they are all different. I have no problem accepting your idea that SL is a subject since I found such variety of lists. On a side note, I think this little debate could be labelled as "philosophy of linguistics". I now want to add that to my academic interests!
Comment: @KleinePrins Yes, there isn't an actual total consensus. Again, it might just be me so if you find it somewhere listed as such, let me know.
Comment: Perhaps Psycholinguistics as well?
Comment: From Wikipedia, "[Translation studies](https://en.wikipedia.org/wiki/Translation_studies "Translation studies - Wikipedia") borrows much from the various fields of study that support translation. **These include comparative literature, computer science, history, linguistics, philology, philosophy, semiotics, and terminology.**" So I suppose translation studies is broader than linguistics?
Answer: An additional area of linguistics is Descriptive Linguistics. This is the practice of discovering the facts of a particular language (generally from a speaker). It is distinct from "anthropological linguistics", which is a sub-area of anthropology that looks at socio-cultural anthropological questions as realized in language, such as kinship systems, collection of terminology for material artifacts, and so on. Anthropological linguistics is the same thing as linguistic anthropology. It is also distinct from the subfields phonetics, phonology, syntax, semantics, pragmatics, morphology, lexicography and various other areas that you might try to fit language description in. For example, phonology is an area of grammatical theory that relates to sound systems and it attempts to devise a general theory of human language sound systems. Descriptive linguistics contributes to that study, but it has entirely different goals and methods. The product of a descriptive study of a language is (or should be) very different from the product of a theoretical study of the grammars of human languages.


Use of BLOB giving "java.lang.ClassNotFoundException: oracle.sql.BLOB" in case of SPRING-Hibernate application in case of ORACLE as a database!

Question: I am using BLOBs in my SPRING-Hibernate application its, giving "java.lang.ClassNotFoundException: oracle.sql.BLOB" in case of ORACLE as a database!
Exactly I am getting following:
Caused by:
org.springframework.dao.InvalidDataAccessApiUsageException: Couldn't initialize OracleLobHandler because Oracle driver classes are not available. Note that OracleLobHandler requires Oracle JDBC driver 9i or higher!
nested exception is java.lang.ClassNotFoundException: oracle.sql.BLOB

Comment: how did you try? How do you put them on your classpath? Where is your configuration?
Comment: I tried with all the ORACLE JDBC dirver versions [9i and 10g] almost all the releases!
If you can tell me the specific version then that will be great!
Comment: In fact I am using OSGI, so I create a bundle wrapper and put it into the classpath!
Comment: then you have classpath issues with OSGi.
Comment: But it is able to load other classes from ORACLE jdbc driver!
I mean everything else apart from BLOB stuff works properly!
Answer: You need ojdbc.jar (or similar) on your classpath (this is the Oracle JDBC driver)
Here is a list of drivers, pick the one that suits your environment.
Answer: Maybe your OSGI manifest does not export the right packages?