text:
Q: Would it be possible to make a Gun type nuclear bomb using Isotopically pure Plutonium-239 I know that it's normally not possible to make a gun type nucelar bomb using plutonium due to high rates of spontaneous fission.
But that's primarily due to the plutonium 240.
If you instead used ONLY plutonium 239, would it then be possible to make a Gun type nuclear bomb.

A: A good source is B. Cameron Reed's paper on "Predetonation probability of a fission-bomb core in the American Journal of Physics. To quote from the text:

For a 6.2 kg core
of pure Pu-239, an assembly time of 200 $\mu$s yields a nopredetonation
probability of 99.2% (S=0).

where the parameter S is the number of scattering events for neutrons. S=0 is the worst case for predetonation probability.


text:
Q: Counter returns unexpected value This my cpp code and I am confused because cnt returns x = 0 !
#include <iostream>
using namespace std;
int i;
int cnt () {
  for (i = 0; i<15; i++) {
    return i;
  }
}
int main () {
  int x;
  x = cnt();
  cout << x << endl;
}```

A: The return function stops every other instruction in the function from being executed and returns the chosen value to the function which called it. Your loop is executed just once.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android Two different AsyncTask and that have different putParcelableArrayList then how to Intent together 1. here my Order of execution
SplashActivity : two AsyncTask (each have different result and I want to Intent to next Activity when each AsyncTask Parsing and putParcelableArrayList completed.
MainActivity : getParrcelableArrayList from SplashActivity
In addition
-already implemented parcelable in the model class.
-The values in the array are well stored.
2. my Answer
how to Intent and startActivity when each AsyncTask complated putParcelableArrayList
please, need your help!!
if you don't unberstand, write comment please!

A: There are two possible ways to achieve this,
one way, you can call second AsyncTask in onPostExecute of first one, and then call the intent from onPostExecute of second.
Another way is you can call some common method which will set two boolean global parameters, on completion of first AsyncTask make one boolean true on same way for another and once both values are true you can call intent from that method.


text:
Q: Compress ranges of ranges of numbers in bash I have a csv file named "ranges.csv", which contains:
start_range,stop_range
9702220000,9702220999
9702222000,9702222999
9702223000,9702223999
9750000000,9750000999
9750001000,9750001999
9750002000,9750002999

I am trying to combine the ranges where the stop_range=start_range-1 and output the result in another csv file named "ranges2.csv". So the output will be:
9702220000,9702220999
9702222000,9702223999
9750000000,9750002999

Moreover, I need to know how many ranges contains a compress range (example: for the new range 9750000000,9750002999 I need to know that before the compression there were 3 ranges). This information will help me to create a new csv file named "ranges3.csv" which should contain only the range with the most ranges inside it (the most comprehensive area):
    9750000000,9750002999

I was thinking about something like this:
if (stop_range = start_range-1)
  new_stop_range = start_range-1

But I am not very smart and I am new to bash scripting.
I know how to output the results in another file but the function for what I need gives me headaches.

A: Assuming your ranges are sorted, then this code gives you the merged ranges only:
awk 'BEGIN{FS=OFS=","}
     (FNR>1) && ($1!=e+1){print b,e; b=e="" }
     ($1==e+1){ e=$2; next }
     { b=$1; e=$2 }
     END { print b,e }' file

Below you get the same but with the range count:
awk 'BEGIN{FS=OFS=","}
     (FNR>1) && ($1!=e+1){print b,e,c; b=e=c="" }
     ($1==e+1){ e=$2; c++; next }
     { b=$1; e=$2; c=1 }
     END { print b,e,c }' file

If you want the largest one, you can sort on the third column. I don't want to make a rule to give the range with the most counts, as there might be multiple.
If you really only want all the ranges with the maximum merge:
awk 'BEGIN{FS=OFS=","}
     (FNR>1) && ($1!=e+1){
        a[c] = a[c] (a[c]?ORS:"") b OFS e
        m=(c>m?c:m)
        b=e=c=""
     }
     ($1==e+1){ e=$2; c++; next }
     { b=$1; e=$2; c=1 }
     END { a[c] = a[c] (a[c]?ORS:"") b OFS e
           m=(c>m?c:m)
           print a[m]
     }' file

A: I think this does the trick:
#!/bin/bash

awk '
  BEGIN { FS = OFS = ","}
  NR == 2 {
    start = $1; stop = $2; i = 1
  }
  NR > 2 {
    if ($1 == (stop + 1)) {
      i++;
      stop = $2
    } else {
      if (++i > max) {
        maxr = start "," stop;
        max = i
      }
      start = $1
      i = 0
    }
    stop = $2
  }
  END {
    if (++i > max) {
      maxr =  start "," stop;
    }
    print maxr
  }
' ranges.csv


text:
Q: How to check that username password is correct using curl command? I want to be able to write a curl command where in i pass options like username password in the curl itself and it should connect to the server. Is there a way where we can find if the user is able to connect to that mentioned server? That means it should throw some error while I run the curl, if the credentials are incorrect. I was trying the below :-
curl --silent -k --digest -u "admin:admin" "https://theservername.com:8010"

But this return nothing.

A: According to man curl the reason you're getting no response is --silent, as expected:
Silent or quiet mode. Don't show progress meter  or  error  mes‐
          sages.   Makes  Curl mute. It will still output the data you ask
          for, potentially even to the terminal/stdout unless you redirect
          it.

If you don't want the progress meter, the likely reason you chose to add --silent, but you want to see the error messages then you must use -S additionally.


text:
Q: Different version of pumping lemma and how to prove it I have a question to solve but I am not even getting a direction to start or how to narrow down this problem. Please provide in your inputs.
Consider the following version of pumping lemma.
For any regular language $\mathcal L$, there is some $m≥1$ so that for every $y\in E^*$, if $|y|=m$, then there exist $u,x,v\in  E^*$ so that:

*

*$y=uxv$

*$x \ne\epsilon$

*for all $z\in E^*$, $yz$ belongs to $\mathcal L$ if and only if $ux^ivz$ belongs to $\mathcal L$ for $i ≥0$

I need to prove that the pumping lemma holds. And language satisying i is regular

A: This is very similar to the standard statement of the pumping lemma. Since you said you don't know how to begin, I suggest that you start by carefully review ing the proof of the standard pumping lemma that you will find in your textbook.
Then compare this statement to the standard pumping lemma to see exactly ehat the differences are, and see if you can make a small change to the standard proof to get the theorem that you need to prove here.
If you didn't understand the proof in your book, get a different book.  The book by Michael Sipser is pretty good.

(Appending my comment.)
In the ordinary pumping lemma, the $uxv$ string gets the automaton into an accepting state. Here, it might not. It only gets the automaton into a state, say $S$, from which some additional input $z$ might get it to an accepting state. But if $uxv$ gets it to $S$, and $x$ goes around a loop, then $ux^iv$ will go around the loop $i$ times and get the automaton to $S$ also. And since $uxv$ gets the automaton to $S$, and $ux^iv$ gets it to $S$ also, then $ux^ivz$ must get it to the same state as $uxvz$. So if the automaton accepts $uxvz$, for some $z$, it must accept  $ux^ivz$ also, and vice versa.

A: You can indeed use the Myhill-Nerode theorem to show that a language that satisfies this pumping lemma is regular. For $u,v\in E^*$ write $u\sim_{\mathcal{L}} v$ iff for every $w\in E^*$, $uw\in\mathcal{L}$ iff $uw\in\mathcal{L}$. This is an equivalence relation on $E^*$, and the Myhill-Nerode theorem says that $\mathcal{L}$ is regular iff there are only finitely many $\sim_{\mathcal{L}}$-equivalence classes.
Suppose that $\mathcal{L}$ is not regular, so that there are infinitely many $\sim_{\mathcal{L}}$-classes, but $\mathcal{L}$ does satisfy this pumping lemma, with pumping number $m$. There are only finitely many words in $E^*$ of length less than $m$, so there is a $\sim_{\mathcal{L}}$-class $C$ such that every word in $C$ has length at least $m$. Let $w\in C$ have the shortest length of any word in $C$, and let $w=uv$, where $|u|=m$. Now apply this pumping lemma to $u$ to get a contradiction.

A: pumping lemma provides you with a 'p' such that if $a \in L$, $\exists u,x,v$ such that a = uxv ,$|ux|\leqslant p$ and $ux^{i}v$ belong to $L \forall i.$
choose m to be that p.
then for all y, z such that |y|= m
 if $yz \in L$, then yz = uxvz (since $|ux| \leqslant m$ by pumping lemma)


text:
Q: MySQL Inner Join 2 tables SELECT *
FROM tableA a
INNER JOIN tableB b
ON  a.someColumn = b.otherColumn
INNER JOIN tableC c
ON b.anotherColumn = c.nextColumn

What if tableA and tableB has the same name in fields? How can I use:
<?
$name = mysql_fetch...
echo $name['a.title'] . ' ' . $name['b.title'];
?>

So I could get title from tableA and title from tableB. Because now, if use just $name['title'] it returns tableA's title. And the above code unfortunately gives just an empty string.

A: Instead of doing select *, you can put an alias on the columns as well.
SELECT a.title AS 'a_title', b.title AS 'b_title'
-- ...

Then your PHP would be something like:
$name['a_title']

A: Use an alias
SELECT  a.title AS TitleA,
        b.title AS TitleB,
        ...

FROM     ...
Then reference the alias:
$name['TitleA']

A: Stop using SELECT *!
Explicitly list your columns, which will then allow you to alias them as needed.
SELECT a.title AS TableATitle, b.title AS TableBTitle, ...

A: Instead of using SELECT *, you will have to call out the fields by name.  When you do this, you can assign an alias to be used for each.
SELECT a.title AS aTitle, b.title AS bTitle, etc...

A: SELECT *, a.title as atitle, b.title as btitle
FROM tableA a
INNER JOIN tableB b
ON  a.someColumn = b.otherColumn
INNER JOIN tableC c
ON b.anotherColumn = c.nextColumn


text:
Q: Angular Routing: Just to change some variables? I want to use routing in my Angular app, but I don't want to utilize any secondary controllers or templates. Is there a way I can use routes as a simple trigger to change variables (which in turn display different UI elements)?

A: If you are using ui-router, you can use $stateParams or if you are using ng-router you can use $routeParams. However, you still need to attach these values to the scope somewhere in order to bind them to the DOM.
Ex.
Define your route with a parameter
.state('home', {
    url:/home/{param1},
    controller: SomeCtrl
}

http://example.com/home/ex1
In your controller, you can then inject $stateParams and access that parameter:
$scope.urlParam = $stateParams.param1;

Then you can bind urlParam to the DOM:
<div>{{urlParam}}</div>

The above example is with ui-router, if you are using ng-router, its very similar but you may want to take a look at the docs for syntax, etc.


text:
Q: using the verb "blame"
I am not to be blamed
Many accidents were blamed on the snow
be to blame
If a ship sinks, the captain is to blame
The increase in crime is a sad reflection on our society
The increase in crime is, sadly, to be blamed on our society

I am wondering about how is the function of applying the verb blame, that is, I cannot differentiate when to use it as an intransitive, or passive verb.
Furthermore, I am wonder if the bold parts might mean the same thing or not.

A: As a learner I always had the problem with this kind of sentences, but never got the proper answer.
Let's consider the following two sentences -

The film is expected to be released on coming Friday.
The film is expected to release on coming Friday.

I have seen both sentences, but my logic said that the passive form is only possible as the film can't release itself. It has to be someone who will release the film.
But I was wrong. Both of the sentences are possible and correct. Of course the film can't release itself, but it needs someone to release the film. But to understand these two sentences we need to think of them from a different point of view.
In both the sentences the subject of the infinitive clause is not explicitly mentioned. We imagine the superordinate subject to be the subject of the infinite clause. But that is not always the case; if we imagine the subject of the infinitive clause, we can even think of an indefinite subject also. So here lies the secret.

The film is expected to be released on coming Friday.

Here the implied subject of the infinitive clause is a superordinate subject. So we can re-write the sentence as the following, explicitly mentioning the superordinate subject as the subject of the infinitive clause -

The film is expected for it (the film) to be released on coming Friday.

Now consider the other sentence -

The film is expected to release on coming Friday.

Here the implied subject of the infinitive clause is not the superordinate subject, rather the implied subject of the infinitive clause is an indefinite subject. So we can re-write the sentence as the following, explicitly mentioning the indefinite subject as the subject of the infinitive clause -

The film is expected for others to release on coming Friday.

Now coming to your sentences with blame.

The captain is to be blamed.
The captain is to blame.

Both of the sentences are correct. In the first sentence the implied subject of the infinitive clause is the superordinate subject (he), and in the second sentence the implied subject of the infinitive clause is the indefinite subject (other). Now re-writing both the sentences explicitly mentioning the subject of the infinitive clause -

The captain is for the captain to be blamed.
The captain is for others to blame.

Let's explain this aspect of grammar in details.

The structure noun + infinitive can express the idea of obligation.Active and passive infinitives are both possible.

I have got letters to write.
The carpets to be cleaned are in the garage.

If the subject of the clause is the person who has to do the action, active infinitives are used.

I have got work to do (NOT I have got work to be done)

If the subject of the clause is the person or the thing that the action is done to, passive infinitives are normally used after be.

These sheets are to be washed. (NOT These sheets are to wash)
The form is to be filled in with blue ink. (NOT This form is to fill in with blue ink)
The cleaning is to be finished by midday (NOT *...is to finish...)

Active infinitives are possible in a structure with for (explicitly mentioning the subject of the infinitive clause using for)

This form is for you to fill in.

In other cases, active and passive infinitives are often both possible with the same meaning. (similar to your example sentences in your question)

There is a lot of work to do/to be done [when the implied subject of the infinitive clause is work, only to be done is correct. When the implied subject of the infinitive clause is e.g. others, to do is only possible.]
There are six letters to post/to be posted.
Give me the names of the people to contact/to be contacted.
The people to interview/to be interviewed are in the next room.

Consider the following sentence  -

She write quickly enough to finish the paper on time.

The infinitive clause - to finish the paper on time - doesn't have a explicit subject, though it's understandable. We can re-write this sentence with a clear subject of the infinitive clause.

She write quickly enough for her to finish the paper on time.

So the subject of the infinitive clause can be omitted or retained if t substitute for the superordinate subject. When there is no subject in the infinitive clause, it's identified with superordinate subject or with an indefinite subject.
There are cases when ambiguity arises as to which subject is implied. Whether the superordinate subject or an indefinite subject is implied is not clear.

She is to young to date.[...for her to date others? or ...for others to date her...?]

When the subject of the superordinate clause is agentive, it may be redundantly repeated.

The knife is sharp enough for it (the knife) to carve the turkey.

Sometimes this optional redundancy is retained for emphasis purpose.

What is an Indefinite Subject?
Consider the following sentence -

We me you leaving the room.

If we hear this sentence, we keep guessing who is leaving the room - you? we? or you and us both?

We met you (when you? we? were) leaving the room.

With infinitive clause, a corresponding finite clause also enables one to identify an understood subject.

I asked to go ~ I asked if I could go.
I asked him to go ~ I asked if he would go.

When no referential link with the nominal can be discovered in the linguistic context, an indefinite subject may be inferred, or else the 'I' of the speaker:

The prospects are not very good, to be candid [...if I am to be candid']

In the above example the subject - I - is inferred, and so it's indefinite subject.
What is a Superordinate Subject?
The subject of a superordinate clause is called a superordinate subject.
A Superordinate clause in grammatical analysis is a term for a clause that contains another clause.

It was raining when I left home.

The clause - It was raining - contains another clause - when I left home. So the clause - It was raining - is the superordinate clause of the subordinate - when I left home.
The subject of the superordinate clause is it, and so it is called superordinate subject.
Agentive role -

Margaret is mowing the grass.

In this sentence Margaret is the subject, mowing is the verb and grass is the direct object of the verb.
The most typical semantic role of a subject in a clause that has a direct object is that of the Agentive participant: that is, the animate being instigating or causing the happening denoted by the verb.

A: The word blame is used to reflect responsibility for something.
To answer your question about the bolded sentences: "The increase in crime is a sad reflection on our society," holds a nuance that suggests the crime is increasing because society is lacking in morals. There is no implied 'call to action' in that sentence.
In the second case: The increase in crime is, sadly, to be blamed on our society, the sentence uses the word blame which implies a sense of responsibility. Society is responsible for the crime, and it then follows that society is responsible to do something about the crime. This sentence creates a feeling of requiring action.
The word blame is always used transitively like the word "hit". You have to blame someone/something. Blame is used passively in writing, such as the examples that you mentioned. In modern American English, it is rarely used passively ("be to blame") in speech. It would be used with be ~ing instead:

"What happened?"
"They're blaming the captain because the ship sank."
"Oh! I thought they were blaming the ship company instead."

It is also possible to use blame actively, but it's quite rare. In fact, I can only think of it being used in a very direct way. ie. "I blame you/him/her." To which it would (typically) be unnatural to reply, "Why do you blame me/him/her?" You would have to respond, "Why are you blaming me/him/her?"

A: I will only try to answer your last question: No, the two bolded sentences are not equivalent. To say that something "is a sad reflection on" means only that a society in which such crimes happen is not to be admired. It does not say that the society itself was the cause of those crimes. The two sentences aim the same direction, but one goes much further in actually accusing society of causing increased crime.

A: To begin with, we must remember that the word "blame",  apart from being a noun, is only a transitive verb.  I don't think it's necessary to explain as to how to form the active and passive voice with this transitive verb as I feel the OP has a good knowledge of Engish.
I am sure his confusion is only because he thinks that "blame" is also an intransitive verb.
As a matter of fact, "be to blame" is an idiom, in which the word "blame" has been used as a noun.  You use this idiom when you say that someone/something is responsible for something bad or is at fault, for example, which driver was to blame for the accident. Hence, "be to blame" is more idiomatic than "to be blamed".
Please look up the word the idiom "be to blame" in The Free Dictionary, which uses blame in the idiom as a noun.http://www.thefreedictionary.com/blame
As for two sentences about society, they convey the sense in different words.


text:
Q: Space on bottom of page if loaded on mobile I am trying to get rid of the white space on the very bottom of every page when you load it on a mobile device. I can't find where that space is defined or where to remove it or reduce it. Is it even possible or is there nothing I can do?
Also I would also like to know if there's any issue with my scripts maybe? Everything seems to work fine, but still wanted to ask.

*** {
  box-sizing: border-box;
}

/*@font-face {
  font-family: zcool;
  src: url(https://fonts.googleapis.com/css?family=ZCOOL+QingKe+HuangYou);
}*/

html,
body {
  height: 100%;
  /*  defines the whole view area */
  width: 100%;
  /*  defines the whole view area */
  font-family: 'ZCOOL QingKe HuangYou', cursive;
  /*  defines the font for the whole webpage */
}

a {
  text-decoration: none;
  /*  removes hyperlink decoration/line */
}

body {
  padding: 0;
  /*  removes padding  */
  margin: 0;
  /*  removes margin */
  border: 0;
  /*  removes border */
  background-attachment: fixed;
  /*  fixes the background image  */
  background-size: 100% auto;
  /*  defines the size of the background image  */
  background-image: url("img/bg2.png");
  /*  defines the source of the background-image  */
  background-repeat: no-repeat;
  /*  keeps background image from repeating itself  */
  background-size: 100% 100%;
  /*  defines the size of the background image  */
  text-align: justify;
  /*  justifies all the text everywhere  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  body {
    padding: 0;
    /*  removes padding  */
    margin: 0;
    /*  removes margin */
    border: 0;
    /*  removes border */
    background-attachment: fixed;
    /*  fixes the background image  */
    background-size: 100% auto;
    /*  defines the size of the background image  */
    background-image: url("img/bgm.png");
    background-repeat: no-repeat;
    /*  keeps background image from repeating itself  */
    background-size: 100% 100%;
    /*  defines the size of the background image  */
    text-align: justify;
    /*  justifies all the text everywhere  */
  }
}

** .section h1,
h2 {
  text-align: center;
  /*  centers headings inside of div  */
  /*  parent  */
}

h1 {
  /*desktop*/
  /*  centers headings inside of div  */
  /*  child  */
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

h2 {
  /*desktop*/
  /*  centers headings inside of div  */
  /*  child  */
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  text-decoration: underline;
}

code {
  /*desktop*/
  font-size: 20px;
  /*  font-size of code  */
}

kbd {
  /*desktop*/
  font-family: "Times New Roman", Times, serif;
  /*  defines font  */
  font-size: 20px;
  /*  defines font size  */
}

@media (max-width: 768px) {
  /*mobile*/
  code {
    font-size: 10px;
    /*  defines font size  */
  }
}

@media (max-width: 768px) {
  /*mobile*/
  kbd {
    font-family: "Times New Roman", Times, serif;
    /*  defines font  */
    font-size: 10px;
    /*  defines font size  */
  }
}

ul#horizontal-list {
  list-style: none;
  /*  removes bullet from list  */
}

ul#horizontal-list li {
  display: inline;
  /*  ???  */
}

ul {
  margin: 0;
  /*  removes space  */
  padding: 0;
  /*  removes space  */
  overflow: hidden;
  /* ??? */
}

li {
  float: center;
  /*  centers the list element  */
}

li a {
  display: block;
  color: white;
  /*  color op hyperlink  */
  text-align: center;
  /*  centers text  */
  padding: 16px;
  /*  adds spacing around. good for buttons  */
  text-decoration: none;
  /*  removes any hyperlink decoration  */
}

li a:hover {
  background-color: red;
  /*  turns the background red when hovering over it with mouse  */
}

.navbar {
  position: fixed;
  /*  fixes the nav bar  */
  top: 0;
  /*  position where it is fixed  */
  /*height: 50px;*/
  width: 100%;
  /*  defines width, 100% will always go edge to edge on screens  */
  background-color: black;
  /*  background color  */
  color: white;
  /*  text color */
  text-align: center;
  /*  centers text  */
  left: 0;
  /*  ??? */
  right: 0;
  /*  ???  */
  z-index: 1;
  /*  ???  */
}

.navbar ul {
  display: flex;
  /*  ???  */
  align-items: center;
  /*  centers all the elements/items  */
  justify-content: center;
  /*  ???  */
  list-style-type: none;
  /*  removes decoration  */
  margin-top: 0px;
  /*  removes spacing on top  */
}

.header {
  background-image: url(img/j.svg);
  /*  background image/graphic  */
  background-repeat: no-repeat;
  /*  keeps image from repeating  */
  background-size: 100% 78%;
  /*  sizes the image  */
  height: 100%;
  /*  positions the image  */
  width: 100%;
  /*  positions the image  */
  margin-top: 8%;
  /*  will add margin on top  */
  margin-bottom: -8%;
  /*  will add margin on bottom  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  .header {
    background-image: url(img/j.svg);
    /*  source of background image  */
    background-repeat: no-repeat;
    /*  keeps image from repeating  */
    background-size: 100% 78%;
    /*  sizes the image  */
    /*height: 100%;  positions the image  */
    width: 100%;
    /*  positions the image  */
    margin-top: 19%;
    /*  will add margin on top  */
    margin-bottom: -8%;
    /*  will add margin on bottom  */
  }
}

.body {
  /*  defines body container/section (background)  */
  /*  PARENT  */
  width: 90%;
  /*  defines width  */
  margin: auto;
  /*  centers  */
  padding: 0;
  /*  removes padding  */
  border: 0;
  /*  removes padding  */
  color: black;
  /*  text color  */
  padding-left: 5%;
  /*  spacing from screen to container/section  */
  padding-right: 5%;
  /*  spacing from screen to container/section  */
  overflow: hidden;
  /*  keeps text from going over container/section  */
  height: auto;
  /*  small text -> small body, big text -> big body  */
}

.johnswork {
  /*  defines background image  */
  background-image: url(img/johnswork.svg);
  /*  source of background image  */
  background-repeat: no-repeat;
  /*  keeps image from repeating  */
  height: 20%;
  /*  sizes the image  */
  width: 100%;
  /*  sizes the image  */
  margin-bottom: 5%;
  /*  spacing between image and text  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  .johnswork {
    /*  defines background image  */
    background-image: url(img/johnswork.svg);
    /*  source of background image  */
    background-repeat: no-repeat;
    /*  keeps image from repeating  */
    height: 20%;
    /*  sizes the image  */
    width: 100%;
    /*  sizes the image  */
    margin-bottom: 5%;
    /*  spacing between image and text  */
  }
}

.content {
  /*  defines section/container with actual material  */
  /*  CHILD  */
  margin: auto;
  /*  centers section/container  */
  height: 100%;
  /*  defines height of section/container  */
  width: 90%;
  /*  defines height of section/container  */
  background-color: white;
  /*  background color of section/container  */
  color: black;
  /*  text color  */
  border-right: double;
  /*  adds double border on the right  */
  border-left: double;
  /*  adds double border on the left  */
  box-shadow: 0px -7px 15px 1px rgb(58, 62, 64);
  /*  defines shadow around section/container  */
  text-align: justify;
  /*  jsutifies text in container/section */
  font-size: 30px;
  /*  defines font size  */
  font-family: 'ZCOOL QingKe HuangYou', cursive;
  /*  defines font  */
  margin-top: 2%;
  /*  spacing between top of section/container and text/material  */
  padding-top: 5%;
  /*  boxes content inside body  */
  padding-bottom: 10%;
  /*  boxes content inside body  */
  padding-left: 5%;
  /*  boxes content inside body  */
  padding-right: 5%;
  /*  boxes content inside body  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  .content {
    margin: auto;
    /*  centers section/container  */
    height: 100%;
    /*  defines height of section/container  */
    width: 90%;
    /*  defines height of section/container  */
    background-color: white;
    /*  background color of section/container  */
    color: black;
    /*  text color  */
    border-right: double;
    /*  adds double border on the right  */
    border-left: double;
    /*  adds double border on the left  */
    box-shadow: 0px -7px 15px 1px rgb(58, 62, 64);
    /*  defines shadow around section/container  */
    text-align: justify;
    /*  jsutifies text in container/section */
    font-size: 15px;
    /*  defines font size  */
    font-family: 'ZCOOL QingKe HuangYou', cursive;
    /*  defines font  */
    margin-top: 2%;
    /*  spacing between top of section/container and text/material  */
    padding-top: 5%;
    /*  boxes content inside body  */
    padding-bottom: 10%;
    /*  boxes content inside body  */
    padding-left: 5%;
    /*  boxes content inside body  */
    padding-right: 5%;
    /*  boxes content inside body  */
  }
}

.social {
  margin: auto;
  /*  centers section/container  */
  /*  CHILD  */
  display: flex;
  /*  ???  */
  justify-content: center;
  /*  center aligns content  */
  align-items: center;
  /*  center aligns content  */
}

.social a img {
  /*  ONLY FOR CONTACT.HTML */
  height: 150px;
  /*  height of image inside a link/href  */
  width: 150px;
  /*  height of image inside a link/href  */
  color: black;
  /*  text color of image  */
  border: none;
  text-decoration: none;
  /*  removes any decoration from image links  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  .social a img {
    /*  ONLY FOR CONTACT.HTML */
    height: 50px;
    /*  height of image inside a link/href  */
    width: 50px;
    /*  height of image inside a link/href  */
    color: black;
    /*  text color of image  */
    border: none;
    /*  removes border  */
    text-decoration: none;
    /*  removes any decoration from image links  */
  }
}

a img {
  /*  EVERY IMG IN A LINK */
  height: 150px;
  /*  height of image inside a link/href  */
  width: 150px;
  /*  height of image inside a link/href  */
  color: black;
  /*  text color of image  */
  border: 1px solid black;
  /*  defines border  */
  border-radius: 8px;
  /*  rounds borders  */
  text-decoration: none;
  /*  removes any decoration from image links  */
}

@media (max-width: 768px) {
  /* when screen size is < 768px apply the following styles */
  /*mobile*/
  a img {
    /*  EVERY IMG IN A LINK */
    height: 50px;
    /*  height of image inside a link/href  */
    width: 50px;
    /*  height of image inside a link/href  */
    color: black;
    /*  text color of image  */
    border: 1px solid black;
    /*  defines border  */
    border-radius: 8px;
    /*  rounds borders  */
    text-decoration: none;
    /*  removes any decoration from image links  */
  }
}

.floatl {
  /*desktop*/
  float: left;
  /*aligns element/object;*/
  margin-right: 15px;
  /*spacing between right side of element/object and text*/
}

.floatr {
  /*desktop*/
  float: right;
  /*aligns element/object;*/
  margin-left: 15px;
  /*spacing between left side of element/object and text*/
}

.floatc {
  /*desktop*/
  display: block;
  /* centers image */
  margin-left: auto;
  /* centers image */
  margin-right: auto;
  /* centers image */
}

@media (max-width: 768px) {
  /*mobile*/
  .floatl {
    float: left;
    /*aligns element/object;*/
    margin-right: 15px;
    /*spacing between right side of element/object and text*/
  }
}

@media (max-width: 768px) {
  /*mobile*/
  .floatr {
    float: right;
    /*aligns element/object;*/
    margin-left: 15px;
    /*spacing between left side of element/object and text*/
  }
}

@media (max-width: 768px) {
  /*mobile*/
  .floatc {
    display: block;
    /* centers image */
    margin-left: auto;
    /* centers image */
    margin-right: auto;
    /* centers image */
  }
}

.footer {
  /* defines footer */
  height: 50px;
  /* defines height of footer */
  width: 72%;
  /* defines width of footer to match content/body section/container */
  background-color: black;
  /* background color of the footer */
  color: white;
  /* footer text color */
  vertical-align: middle;
  /* centers between top and bottom */
  margin: auto auto 50px;
  /* centers between left and right */
}

#copyright {
  display: table;
  /*displays as table inside section/container*/
  font-family: 'ZCOOL QingKe HuangYou', cursive;
  /* defines font */
}

#cpy {
  display: table-cell;
  /* displays as cell inside the table */
  vertical-align: middle;
  /* alignment of the cell */
  font-family: 'ZCOOL QingKe HuangYou', cursive;
  /* defines font */
}
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" href="stylesheet.css" />

  <link href="https://fonts.googleapis.com/css?family=ZCOOL+QingKe+HuangYou" rel="stylesheet">

  <link rel="apple-touch-icon" sizes="57x57" href="img/favicons/apple-icon-57x57.png">
  <link rel="apple-touch-icon" sizes="60x60" href="img/favicons/apple-icon-60x60.png">
  <link rel="apple-touch-icon" sizes="72x72" href="img/favicons/apple-icon-72x72.png">
  <link rel="apple-touch-icon" sizes="76x76" href="img/favicons/apple-icon-76x76.png">
  <link rel="apple-touch-icon" sizes="114x114" href="img/favicons/apple-icon-114x114.png">
  <link rel="apple-touch-icon" sizes="120x120" href="img/favicons/apple-icon-120x120.png">
  <link rel="apple-touch-icon" sizes="144x144" href="img/favicons/apple-icon-144x144.png">
  <link rel="apple-touch-icon" sizes="152x152" href="img/favicons/apple-icon-152x152.png">
  <link rel="apple-touch-icon" sizes="180x180" href="img/favicons/apple-icon-180x180.png">
  <link rel="icon" type="image/png" sizes="192x192" href="img/favicons/android-icon-192x192.png">
  <link rel="icon" type="image/png" sizes="32x32" href="img/favicons/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="96x96" href="img/favicons/favicon-96x96.png">
  <link rel="icon" type="image/png" sizes="16x16" href="img/favicons/favicon-16x16.png">
  <link rel="manifest" href="img/favicons/manifest.json">
  <meta name="msapplication-TileColor" content="#ffffff">
  <meta name="msapplication-TileImage" content="img/favicons/ms-icon-144x144.png">
  <meta name="theme-color" content="#ffffff">

  <meta name="description" content="My Personal Portfolio">
  <title>John's Work | WELCOME</title>

HOME

ABOUT

CONTACT

 Article l

How to bypass LanSchool on School Computers

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac ipsum non diam faucibus dignissim. Praesent a dolor tincidunt, rutrum diam ut, convallis orci. Maecenas eleifend, sapien id blandit rutrum, enim augue cursus magna, vitae varius orci nulla
          eu arcu. Cras ultrices condimentum libero nec vulputate. Praesent id ante dignissim, congue elit id, iaculis eros. Aliquam lacus quam, facilisis et pulvinar quis, hendrerit varius erat. Duis feugiat imperdiet lobortis. Ut et faucibus dui. Integer
          quis bibendum tortor, at mattis dolor. Sed id lacus nec nisi iaculis blandit. Duis nec ligula orci. Quisque tincidunt, orci id tincidunt consequat, eros erat dictum urna, vel ultricies sem nisl eu nunc. Nulla facilisi. Suspendisse at malesuada
          magna, in suscipit purus.

    Fusce facilisis pharetra dui, ut cursus orci maximus non. Cras nec magna ac odio ornare ornare. Proin id commodo eros. Phasellus dui est, malesuada non mi sit amet, fringilla rhoncus ante. Phasellus non elit id est cursus malesuada. Maecenas accumsan erat in urna pulvinar, sit amet egestas felis facilisis. Nullam tincidunt porta nulla, a consectetur sapien venenatis in. Phasellus elementum est sit amet sem accumsan tincidunt. In semper vulputate risus, sed sollicitudin libero consectetur eget. Curabitur pulvinar eleifend augue. Sed facilisis ligula sed arcu vulputate tempus.

    Fusce facilisis pharetra dui, ut cursus orci maximus non. Cras nec magna ac odio ornare ornare. Proin id commodo eros. Phasellus dui est, malesuada non mi sit amet, fringilla rhoncus ante. Phasellus non elit id est cursus malesuada. Maecenas accumsan erat in urna pulvinar, sit amet egestas felis facilisis. Nullam tincidunt porta nulla, a consectetur sapien venenatis in. Phasellus elementum est sit amet sem accumsan tincidunt. In semper vulputate risus, sed sollicitudin libero consectetur eget. Curabitur pulvinar eleifend augue. Sed facilisis ligula sed arcu vulputate tempus.

© DA COSTA JOAO (2019)

A: .footer had margin: auto auto 50px; this was causing the problem. changed to margin: 0 auto; margin: auto auto 50px; hope this helps you. thanks

* {
  box-sizing: border-box;
}

/*@font-face {
  font-family: zcool;
  src: url(https://fonts.googleapis.com/css?family=ZCOOL+QingKe+HuangYou);
}*/

html,
body {
  height: 100%; /*  defines the whole view area */
  width: 100%; /*  defines the whole view area */
  font-family: 'ZCOOL QingKe HuangYou', cursive; /*  defines the font for the whole webpage */
}

a {
 text-decoration: none; /*  removes hyperlink decoration/line */
}

body {
 padding: 0; /*  removes padding  */
 margin: 0; /*  removes margin */
 border: 0; /*  removes border */
 background-attachment: fixed; /*  fixes the background image  */
 background-size: 100% auto; /*  defines the size of the background image  */
 background-image: url("img/bg2.png"); /*  defines the source of the background-image  */
 background-repeat: no-repeat; /*  keeps background image from repeating itself  */
 background-size: 100% 100%; /*  defines the size of the background image  */
 text-align: justify; /*  justifies all the text everywhere  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
  body {
    padding: 0; /*  removes padding  */
 margin: 0; /*  removes margin */
 border: 0; /*  removes border */
 background-attachment: fixed; /*  fixes the background image  */
 background-size: 100% auto; /*  defines the size of the background image  */
 background-image: url("img/bgm.png");
 background-repeat: no-repeat; /*  keeps background image from repeating itself  */
 background-size: 100% 100%; /*  defines the size of the background image  */
 text-align: justify; /*  justifies all the text everywhere  */
  }
}

.section h1, h2 {
 text-align: center; /*  centers headings inside of div  */ /*  parent  */
}

h1 { /*desktop*/ /*  centers headings inside of div  */ /*  child  */
 text-align: center;
 margin-left: auto;
    margin-right: auto;

}

h2 {/*desktop*/ /*  centers headings inside of div  */ /*  child  */
 text-align: center;
 margin-left: auto;
    margin-right: auto;
 text-decoration: underline;
}

code {/*desktop*/
 font-size: 20px; /*  font-size of code  */
}

kbd {/*desktop*/
 font-family: "Times New Roman", Times, serif; /*  defines font  */
 font-size: 20px; /*  defines font size  */
}

@media (max-width: 768px) { /*mobile*/
 code {
 font-size: 10px; /*  defines font size  */
 }
}

@media (max-width: 768px) { /*mobile*/
 kbd {
 font-family: "Times New Roman", Times, serif; /*  defines font  */
 font-size: 10px; /*  defines font size  */
 }
}

ul#horizontal-list {
  list-style: none; /*  removes bullet from list  */
}

ul#horizontal-list li {
  display: inline; /*  ???  */
}

ul {
  margin: 0; /*  removes space  */
  padding: 0; /*  removes space  */
  overflow: hidden; /* ??? */
}

li {
  float: center; /*  centers the list element  */
}

li a {
  display: block;
  color: white; /*  color op hyperlink  */
  text-align: center;  /*  centers text  */
  padding: 16px; /*  adds spacing around. good for buttons  */
  text-decoration: none; /*  removes any hyperlink decoration  */
}

li a:hover {
  background-color: red; /*  turns the background red when hovering over it with mouse  */
}

.navbar {
 position: fixed; /*  fixes the nav bar  */
 top: 0; /*  position where it is fixed  */
 /*height: 50px;*/
 width: 100%; /*  defines width, 100% will always go edge to edge on screens  */
 background-color: black; /*  background color  */
 color: white; /*  text color */
 text-align: center; /*  centers text  */
 left: 0; /*  ??? */
 right: 0; /*  ???  */
 z-index: 1; /*  ???  */

}

.navbar ul {
  display: flex; /*  ???  */
  align-items: center; /*  centers all the elements/items  */
  justify-content: center; /*  ???  */
  list-style-type: none; /*  removes decoration  */
  margin-top: 0px; /*  removes spacing on top  */
}

.header {
 background-image: url(img/j.svg); /*  background image/graphic  */
    background-repeat: no-repeat; /*  keeps image from repeating  */
    background-size: 100% 78%;  /*  sizes the image  */
    height: 100%; /*  positions the image  */
    width: 100%; /*  positions the image  */
    margin-top: 8%;  /*  will add margin on top  */
    margin-bottom: -8%; /*  will add margin on bottom  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
  .header {
    background-image: url(img/j.svg); /*  source of background image  */
    background-repeat: no-repeat; /*  keeps image from repeating  */
    background-size: 100% 78%; /*  sizes the image  */
    /*height: 100%;  positions the image  */
    width: 100%; /*  positions the image  */
    margin-top: 19%; /*  will add margin on top  */
    margin-bottom: -8%; /*  will add margin on bottom  */
  }
}

.body {  /*  defines body container/section (background)  */ /*  PARENT  */

 width: 90%; /*  defines width  */
 margin: auto; /*  centers  */
 padding: 0; /*  removes padding  */
 border: 0; /*  removes padding  */
 color: black; /*  text color  */
 padding-left: 5%; /*  spacing from screen to container/section  */
 padding-right: 5%; /*  spacing from screen to container/section  */
 overflow: hidden; /*  keeps text from going over container/section  */
 height: auto; /*  small text -> small body, big text -> big body  */
}

.johnswork { /*  defines background image  */
 background-image: url(img/johnswork.svg);  /*  source of background image  */
    background-repeat: no-repeat;  /*  keeps image from repeating  */
    height: 20%; /*  sizes the image  */
    width: 100%; /*  sizes the image  */
    margin-bottom: 5%; /*  spacing between image and text  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
.johnswork {/*  defines background image  */
 background-image: url(img/johnswork.svg); /*  source of background image  */
    background-repeat: no-repeat; /*  keeps image from repeating  */
    height: 20%; /*  sizes the image  */
    width: 100%; /*  sizes the image  */
    margin-bottom: 5%; /*  spacing between image and text  */
 }
}

.content { /*  defines section/container with actual material  */ /*  CHILD  */
 margin: auto; /*  centers section/container  */
 height: 100%; /*  defines height of section/container  */
 width: 90%; /*  defines height of section/container  */
 background-color: white; /*  background color of section/container  */
 color: black; /*  text color  */
 border-right: double; /*  adds double border on the right  */
 border-left: double; /*  adds double border on the left  */
 box-shadow: 0px -7px 15px 1px rgb(58, 62, 64); /*  defines shadow around section/container  */
 text-align: justify; /*  jsutifies text in container/section */
 font-size: 30px; /*  defines font size  */
 font-family: 'ZCOOL QingKe HuangYou', cursive; /*  defines font  */
 margin-top: 2%; /*  spacing between top of section/container and text/material  */
 padding-top: 5%; /*  boxes content inside body  */
 padding-bottom: 10%; /*  boxes content inside body  */
 padding-left: 5%; /*  boxes content inside body  */
 padding-right: 5%; /*  boxes content inside body  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
  .content {
 margin: auto; /*  centers section/container  */
 height: 100%; /*  defines height of section/container  */
 width: 90%; /*  defines height of section/container  */
 background-color: white; /*  background color of section/container  */
 color: black; /*  text color  */
 border-right: double; /*  adds double border on the right  */
 border-left: double; /*  adds double border on the left  */
 box-shadow: 0px -7px 15px 1px rgb(58, 62, 64); /*  defines shadow around section/container  */
 text-align: justify; /*  jsutifies text in container/section */
 font-size: 15px; /*  defines font size  */
 font-family: 'ZCOOL QingKe HuangYou', cursive; /*  defines font  */
 margin-top: 2%; /*  spacing between top of section/container and text/material  */
 padding-top: 5%; /*  boxes content inside body  */
 padding-bottom: 10%; /*  boxes content inside body  */
 padding-left: 5%; /*  boxes content inside body  */
 padding-right: 5%; /*  boxes content inside body  */
  }
}

.social {
 margin: auto; /*  centers section/container  */ /*  CHILD  */
 display: flex; /*  ???  */
 justify-content: center; /*  center aligns content  */
 align-items: center; /*  center aligns content  */
}

.social a img { /*  ONLY FOR CONTACT.HTML */
 height: 150px; /*  height of image inside a link/href  */
 width: 150px; /*  height of image inside a link/href  */
 color: black; /*  text color of image  */
 border: none;
 text-decoration:none; /*  removes any decoration from image links  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
 .social a img { /*  ONLY FOR CONTACT.HTML */
 height: 50px; /*  height of image inside a link/href  */
 width: 50px; /*  height of image inside a link/href  */
 color: black; /*  text color of image  */
 border: none; /*  removes border  */
 text-decoration:none; /*  removes any decoration from image links  */
 }
}

a img { /*  EVERY IMG IN A LINK */
 height: 150px; /*  height of image inside a link/href  */
 width: 150px; /*  height of image inside a link/href  */
 color: black; /*  text color of image  */
 border: 1px solid black; /*  defines border  */
 border-radius: 8px; /*  rounds borders  */
 text-decoration:none; /*  removes any decoration from image links  */
}

@media (max-width: 768px) {  /* when screen size is < 768px apply the following styles */ /*mobile*/
a img { /*  EVERY IMG IN A LINK */
 height: 50px; /*  height of image inside a link/href  */
 width: 50px; /*  height of image inside a link/href  */
 color: black; /*  text color of image  */
 border: 1px solid black; /*  defines border  */
 border-radius: 8px; /*  rounds borders  */
 text-decoration:none; /*  removes any decoration from image links  */
 }
}

.floatl { /*desktop*/
  float: left; /*aligns element/object;*/
  margin-right: 15px; /*spacing between right side of element/object and text*/

}

.floatr { /*desktop*/
  float: right; /*aligns element/object;*/
  margin-left: 15px; /*spacing between left side of element/object and text*/

}

.floatc { /*desktop*/
  display: block; /* centers image */
  margin-left: auto; /* centers image */
  margin-right: auto; /* centers image */

}

@media (max-width: 768px) { /*mobile*/
 .floatl {
  float: left; /*aligns element/object;*/
  margin-right: 15px; /*spacing between right side of element/object and text*/

  }
}

@media (max-width: 768px) { /*mobile*/
 .floatr {
  float: right; /*aligns element/object;*/
  margin-left: 15px; /*spacing between left side of element/object and text*/

  }
}

@media (max-width: 768px) { /*mobile*/
 .floatc {
  display: block; /* centers image */
  margin-left: auto; /* centers image */
  margin-right: auto; /* centers image */

  }
}

.footer { /* defines footer */
  height: 50px; /* defines height of footer */
  width: 72%; /* defines width of footer to match content/body section/container */
  background-color: black; /* background color of the footer */
  color: white; /* footer text color */
  vertical-align: middle; /* centers between top and bottom */
 /* margin: auto auto 50px;  centers between left and right */
  margin: 0 auto;
}

#copyright {
 display: table; /*displays as table inside section/container*/
 font-family: 'ZCOOL QingKe HuangYou', cursive; /* defines font */
}

#cpy{
    display: table-cell; /* displays as cell inside the table */
    vertical-align: middle; /* alignment of the cell */
 font-family: 'ZCOOL QingKe HuangYou', cursive; /* defines font */
}
<!DOCTYPE html>

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" type="text/css" href="stylesheet.css"/>

 <link href="https://fonts.googleapis.com/css?family=ZCOOL+QingKe+HuangYou" rel="stylesheet">

 <link rel="apple-touch-icon" sizes="57x57" href="img/favicons/apple-icon-57x57.png">
 <link rel="apple-touch-icon" sizes="60x60" href="img/favicons/apple-icon-60x60.png">
 <link rel="apple-touch-icon" sizes="72x72" href="img/favicons/apple-icon-72x72.png">
 <link rel="apple-touch-icon" sizes="76x76" href="img/favicons/apple-icon-76x76.png">
 <link rel="apple-touch-icon" sizes="114x114" href="img/favicons/apple-icon-114x114.png">
 <link rel="apple-touch-icon" sizes="120x120" href="img/favicons/apple-icon-120x120.png">
 <link rel="apple-touch-icon" sizes="144x144" href="img/favicons/apple-icon-144x144.png">
 <link rel="apple-touch-icon" sizes="152x152" href="img/favicons/apple-icon-152x152.png">
 <link rel="apple-touch-icon" sizes="180x180" href="img/favicons/apple-icon-180x180.png">
 <link rel="icon" type="image/png" sizes="192x192"  href="img/favicons/android-icon-192x192.png">
 <link rel="icon" type="image/png" sizes="32x32" href="img/favicons/favicon-32x32.png">
 <link rel="icon" type="image/png" sizes="96x96" href="img/favicons/favicon-96x96.png">
 <link rel="icon" type="image/png" sizes="16x16" href="img/favicons/favicon-16x16.png">
 <link rel="manifest" href="img/favicons/manifest.json">
 <meta name="msapplication-TileColor" content="#ffffff">
 <meta name="msapplication-TileImage" content="img/favicons/ms-icon-144x144.png">
 <meta name="theme-color" content="#ffffff">

 <meta name="description" content="My Personal Portfolio">
 <title>John's Work | WELCOME</title>

HOME

ABOUT

CONTACT

 Article l

How to bypass LanSchool on School Computers

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac ipsum non diam faucibus dignissim. Praesent a dolor tincidunt, rutrum diam ut, convallis orci. Maecenas eleifend, sapien id blandit rutrum, enim augue cursus magna, vitae varius orci nulla eu arcu. Cras ultrices condimentum libero nec vulputate. Praesent id ante dignissim, congue elit id, iaculis eros. Aliquam lacus quam, facilisis et pulvinar quis, hendrerit varius erat. Duis feugiat imperdiet lobortis. Ut et faucibus dui. Integer quis bibendum tortor, at mattis dolor. Sed id lacus nec nisi iaculis blandit. Duis nec ligula orci. Quisque tincidunt, orci id tincidunt consequat, eros erat dictum urna, vel ultricies sem nisl eu nunc. Nulla facilisi. Suspendisse at malesuada magna, in suscipit purus.

    Fusce facilisis pharetra dui, ut cursus orci maximus non. Cras nec magna ac odio ornare ornare. Proin id commodo eros. Phasellus dui est, malesuada non mi sit amet, fringilla rhoncus ante. Phasellus non elit id est cursus malesuada. Maecenas accumsan erat in urna pulvinar, sit amet egestas felis facilisis. Nullam tincidunt porta nulla, a consectetur sapien venenatis in. Phasellus elementum est sit amet sem accumsan tincidunt. In semper vulputate risus, sed sollicitudin libero consectetur eget. Curabitur pulvinar eleifend augue. Sed facilisis ligula sed arcu vulputate tempus.

    Fusce facilisis pharetra dui, ut cursus orci maximus non. Cras nec magna ac odio ornare ornare. Proin id commodo eros. Phasellus dui est, malesuada non mi sit amet, fringilla rhoncus ante. Phasellus non elit id est cursus malesuada. Maecenas accumsan erat in urna pulvinar, sit amet egestas felis facilisis. Nullam tincidunt porta nulla, a consectetur sapien venenatis in. Phasellus elementum est sit amet sem accumsan tincidunt. In semper vulputate risus, sed sollicitudin libero consectetur eget. Curabitur pulvinar eleifend augue. Sed facilisis ligula sed arcu vulputate tempus.

© DA COSTA JOAO (2019)


text:
Q: Twistedmatrix, rotate log on a weekly basis and customizing name of the log what should be the better way to use Python twistedmatrix log file, and customize it so that it can be :
- rotating on a weekly basis (sunday)
- with a custom naming convention (replace the current date _underscore glued that can be seen in the DailyLogFile with something like myfile.yyyymmdd.log or so)
shoud it be by writing my own/subclassing in the same way as class DailyLogFile(BaseLogFile): ?
i have seen that some consider logrotate from linux command, but i wanted to go with a python twistedmatrix solution. (but maybe are there some trouble that i dot have guessed ?)
best regards

A: You can definitely do this with Twisted's logging system.  You're on the right track by looking at DailyLogFile.
However, consider that the best solution might involve idiomatically integrating with the target deployment platform.  If the convention on the platform is for applications to manage their own log files, then I'd say you're on the right track.
If, instead, the convention is for applications to run under a manager like launchd, then you may want to consider that approach instead.  If all deployed software follows the same local conventions, then the system admin has an easier time managing everything correctly.


text:
Q: str_replace , / not working I need to find \ in a string.
Example
$replacevalue = "%20";
$area = "test\abc.htm";
$valuetoreplace = "\";
$area = str_replace($valuetoreplace,$replacevalue, $area );

But it seems like the page goes into a loop or somthing if i do the same with /  there are no problem please help

A: You need to double your \s as it is an escape character for strings... So:
% php
<?php
$area = str_replace("\\","",'test\abc.htm');
echo $area."\n";
?>

Yields... testabc.htm

A: try this:
$replacevalue           =   "%20";
$area               =   "test\abc.htm";

$valuetoreplace     =   "\\";
$area               =   str_replace($valuetoreplace,$replacevalue, $area );

or another solution is in this post

A: valuetoreplace should be "\\".

A: Well "\" this character is an escape character so compiler refers to it as an escape not as a "\", just add another one so it will escape itself "\" and your code will work

A: Change the line:
$valuetoreplace     =   "\";

to
$valuetoreplace     =   "\\";

Read more about escaping characters.

A: '\' is a special character add a double \\ to escape it


text:
Q: Subtract two values I'd like to subtract two values, one in the current record, then the next in the next record...they are time clock entries and I want to calculate the amount of time an employee spend on his/her break, so I'll have to subtract the time the employee clocked out, and the time the employee clocked back in.  This will be done for several records, then at the end of it all I also want to have total of all the breaks taken.
So how can I do this?  I'm doing this in Django BTW.
UPDATE
The records look a bit like this:
employee_id, rec_date, start_time, end_time
18, 2010-08-23, 09:58:00, 14:13:00
18, 2010-08-23, 14:39:00, 18:47:00
19, 2010-08-23, 14:15:00, 18:31:00
21, 2010-08-23, 12:05:00, 14:52:00
21, 2010-08-23, 15:23:00, 18:49:00
21, 2010-08-31, 08:00:00, 12:00:00
21, 2010-08-31, 12:45:00, 19:00:00

A: You'll have to iterate over the clock actions and do the calculation manually. Something of this sort:
breaks = 0
break_start = None
clock_actions = user.clock_actions.filter(date=desired_day).order_by('date')
for action in clock_actions:
    if action.type == 'CLOCK IN':
        break_start = action.time
    elif break_start is not None:
        breaks = breaks + action.time - break_start
        break_start = None

You may have to adjust the subtraction to work with timedelta objects, depending on your choice of field for time.


text:
Q: Vagrant Push configure src directory on guest machine config.push.define "ftp" do |push|

        # Login Credentials
        push.host = "104.131.46.134"
        push.username = "root"
        push.password = "password"

        # FTP vs SFTP
        push.secure = "true"

        # Where to copy the files on the server
        push.destination = "/var/www/html"

        # Where are App is
        push.dir = "public"
    end

I have above code above. I understand   push.destination = "/var/www/html"   points to actually directory on the remote server. How do you specify source directory on guest machine? My Wordpress Theme is hosted on /usr/usrname/public_html/wp_content.
Should I put
push.dir = "/usr/usrname/public_html/wp_content"

and it would work?

A: Yes, per doc

dir - The base directory containing the files to upload. By default this is the same directory as the Vagrantfile, but you can specify this if you have a src folder or bin folder or some other folder you want to upload.

so if the host files that you want to push are on /usr/usrname/public_html/wp_content you will have
push.dir = "/usr/usrname/public_html/wp_content"


text:
Q: How to get current URL requesting for network connection? How can i get current URL requesting for network connection?
e.g. YouTube current running video URL, downloading a file URL from any app .

A: You can't.  For good reason-  it would be a huge security hole if an app could send every URL back to a central server.  It would basically be made to order for malware.


text:
Q: What size for a dictionary is too big for an app? I am writing a Windows Phone app (in c#), and it has a lot of data in it.
I would like to store this data in a dictionary (or less ideally an array), but there will be about 10 000 dictionary values (spread out across 3-4 dictionaries). Do you think these dictionaries would be too big, and take up too much memory?
The dictionaries will be Dictionary<int, customClass>
It would obviously be better to use an array, but do you think it is ok to use a dictionary?

A: It all depends on the number of actual objects you are storing... and the size of those objects. The dictionaries themselves will be only 32 (or 64) bits x 10,000 x 2 (key and value) plus a small overhead - ie small... because the dictionaries only store a pointer to your object.

A: The number of items in a collection like dictionary/array/list doesn't matter very much, 10w integers cost less than 1M(about 100,000 * 4bytes). So the memory cost mainly depends on what stores in your CustomClass. If the class contains a few primitive properties only, it won't cost very much memory either. You shouldn't worry about the memory cost very much, unless you do something like loading a file's data into on property of the class.


text:
Q: Edit request data before validation
Request data:

    [
        "invoice_data" => [
            ...
            "discount" => null,
        ],
        "product_credit" => [
            ...
            "discount" => null,
        ]
    ];

What I am trying to do

I am trying to create an if statement to check if the
$request -> invoice_data['discount'] == null then set it to 0 ALSO
$request -> product_credit['discount'] == null then set it to 0
Before the validation process because the validation will fail.

What I have tried:

I have found a method in Laravel called prepareForValidation() and it use $this -> merge([...]) which is what I am looking for but problem is that I cannot access the discount in invoice_data and product_credit.

A: Cleaner way to set a default value of attributes than editing in request payload:
Model {
   protected $attributes = [
      'inovice_data' => 0,
      'discount' => 0,
      'product_credit' => 0
   ];
}

In this way, if no values are provided, or undefined value or null, Eloquent will set these attributes to defined default values while populating in db.

A: <?php

$data =
[
        "invoice_data" => [
            "discount" => null,
        ],
        "product_credit" => [
            "discount" => null,
        ]
    ];

$keyWhitelist = [
    'invoice_data',
    'product_credit'
];

foreach ($data as $key => $entry) {

    if(!in_array($key, $keyWhitelist)) {
        continue;
    }

    if(key_exists('discount',$entry)) {
        if ($entry['discount'] === null) {
            $data[$key]['discount'] = 0;
        }
    }
}

var_export($data);

gives result:
array (
  'invoice_data' =>
  array (
    'discount' => 0,
  ),
  'product_credit' =>
  array (
    'discount' => 0,
  ),
)


text:
Q: Compromise between id and key referencing I have the following tables for keeping a product with its attributes:
Attributes
id name
1  color
2  material

Attribute values
id attribute_id value
  1     1       black
  2     2       plastic

Products
id  name     attributes
 1  Laptop   {1:"1",2:"2"}

Attribute in the Products table is referenced by id (1). But it could also be referenced by attribute name:
{"color":"black"}

Though it breaks data integrity it allows to upload products with attributes which are not in a DB yet. Those could be added later, and then products could be filtered by them.
I ask for an advice on how to use the benefits of both approaches? I want to reference the existing attributes by ids or names, and reference all others by names in the Products table.


text:
Q: VBScript editor for MAC Is there any VBScript editor that I can run on mac? Or is VBscript something specifically for PCs?

A: TextWrangler (free) can be used to edit VBScript.  It does give basic syntax highlighting, strings, keywords etc, but it is not aware of App-specific object models such as the Excel Object Model, which I'm guessing is the reason you want to edit VBScript on a Mac.
Textastic ($7.99 on the AppStore as of today) has even better syntax highlighting than TextWrangler. It is syntax highlighting for ASP.NET VbScript, and that mode also works pretty well for VBA.
The built-in Visual Basic Editor in Office 2016 (for Mac) is probably the worst thing ever: no intellisense, no search/replace, no indenting and syntax highlighting is way less complete than TextWrangler or Textastic.

A: As far as I know VBScript is just for PCs (Windows Scripting Host) and IE.

A: On my Mac, I use TextWrangler for creating VBScripts. It doesn't support VBScript implicitly (highlighting of all keywords), but it has nice indenting, search replace etc. functions. A good all round text editor, also for code.
Of course you can not run the code on OSX, VBScript is for Windows environments only.


text:
Q: How to change multiple subscription products strings in woocommerce subscriptions? I have multiple subscription products in my website with monthly, yearly and weekly.
I am running this code which is working fine (changing "month to 30 days ") but only works for the products with "Monthly" how can I apply it to change the the string for weekly and yearly also?
Thank you
function wc_subscriptions_custom_price_string( $pricestring ) {
    $newprice = str_replace( 'month', '30 days', $pricestring );
    return $newprice;
}
add_filter( 'woocommerce_subscriptions_product_price_string', 'wc_subscriptions_custom_price_string' );
add_filter( 'woocommerce_subscription_price_string', 'wc_subscriptions_custom_price_string' );

A: You can choose to replace all strings you need given that you know, what it says right now.
I can't find the documentation, but given that the $pricestring takes on values biweekly, weekly, yearly, I would follow the pattern, and try:
function wc_subscriptions_custom_price_string( $pricestring ) {
    $newprice = str_replace( 'biweekly', '14 days', $pricestring );
    $newprice = str_replace( 'weekly', '7 days', $pricestring );
    $newprice = str_replace( 'yearly', '365 days', $pricestring );
    return $newprice;
}

Basically, it takes the $pricestring and replaces whatever the text (the first parameter) found inside, and replaces it with whatever text (the second parameter), saving it again and returning the modified $newprice.
Notice the order of biweekly and weekly if you want to avoid accidentally rewriting weekly in biweekly.

A: Just do similar replaces, you can even embed them, like:
function wc_subscriptions_custom_price_string( $pricestring ) {
    $newprice = str_replace(
        'month',
        '30 days',
        str_replace(
            'year',
            '365 days',
            str_replace(
                'week',
                '7 days',
                $pricestring
            )
        )
    );
    return $newprice;
}
add_filter( 'woocommerce_subscriptions_product_price_string', 'wc_subscriptions_custom_price_string' );
add_filter( 'woocommerce_subscription_price_string', 'wc_subscriptions_custom_price_string' );


text:
Q: Rally - Error - hydrateModel is not a function? Question : I am new to Rally APP development, trying to build a simple application with a Release dropdown , when selected populates the grid.
However when I select the value, I am getting the following error          Based upon this error
1. What does this mean ? - Uncaught TypeError: this.store.hydrateModel is not a function at constructor.initComponent" , and how to resolve this ?
====================================================================
App.js?_dc=0.59785698231437:43 Data:  [constructor]
    08:43:48.080 sdk-debug.js:185210 Uncaught TypeError: this.store.hydrateModel is not a function
        at constructor.initComponent (sdk-debug.js:185210)
        at constructor (sdk-debug.js:30211)
        at constructor.callParent (sdk-debug.js:4469)
        at constructor [as _componentConstructor] (sdk-debug.js:34291)
        at constructor.callParent (sdk-debug.js:4469)
        at constructor (sdk-debug.js:144823)
        at constructor.callParent (sdk-debug.js:4469)
        at constructor (sdk-debug.js:185132)
        at new constructor (sdk-debug.js:5100)
        at eval (eval at getInstantiator (sdk-debug.js:5720), <anonymous>:3:8)
            initComponent @ sdk-debug.js:185210
            constructor @ sdk-debug.js:30211
             callParent @ sdk-debug.js:4469
            constructor @ sdk-debug.js:34291
            callParent @ sdk-debug.js:4469
    constructor @ sdk-debug.js:144823
    callParent @ sdk-debug.js:4469
    constructor @ sdk-debug.js:185132
    constructor @ sdk-debug.js:5100
    (anonymous) @ VM20:3
    instantiate @ sdk-debug.js:5692
    (anonymous) @ sdk-debug.js:2303
    _loadData @ App.js?_dc=0.59785698231437:45
    fire @ sdk-debug.js:10046
    continueFireEvent @ sdk-debug.js:11447
    fireEventArgs @ sdk-debug.js:11425
    prototype.fireEventArgs @ sdk-debug.js:42297
    object.(anonymous function) @ sdk-debug.js:195692
    fireEvent @ sdk-debug.js:11411
    onListSelectionChange @ sdk-debug.js:149617
    object.(anonymous function) @ sdk-debug.js:195692
    fire @ sdk-debug.js:10046
    continueFireEvent @ sdk-debug.js:11447
    fireEventArgs @ sdk-debug.js:11425
    fireEvent @ sdk-debug.js:11411
    maybeFireSelectionChange @ sdk-debug.js:95171
    doSingleSelect @ sdk-debug.js:95145
    doSelect @ sdk-debug.js:94983
    selectWithEvent @ sdk-debug.js:94717
    onItemClick @ sdk-debug.js:95543
    fire @ sdk-debug.js:10046
    continueFireEvent @ sdk-debug.js:11447
    fireEventArgs @ sdk-debug.js:11425
    prototype.fireEventArgs @ sdk-debug.js:42297
    fireEvent @ sdk-debug.js:11411
    processUIEvent @ sdk-debug.js:96924
    handleEvent @ sdk-debug.js:96850
    (anonymous) @ VM60:7
    wrap @ sdk-debug.js:10800
==========================================================================

Code Below
enter code here

  Ext.define('CustomApp', {
            extend: 'Rally.app.App',
            componentCls: 'app',
            //specify the layout over here
            defaults: { margin:10 },
           // layout: 'border',

            items: [
                     { xtype:'container', itemId:'drop-downContainer',layout:'hbox' },
                     { xtype:'container', itemId:'gridContainer',layout:'hbox' }
                   ],

            //var userStories: undefined;

            launch: function() {
         enter code here       console.log('Entering the launch function');
                this._loadUserStores();
            },

            _loadUserStores: function()
                {   console.log("Entering the Load User Stories...");
                    var releaseComboBox = Ext.create('Rally.ui.combobox.ReleaseComboBox',{
                                            itemId: 'releaseDropDown',
                                            listeners: {
                                                    load: function(data,records,success){
                                                            console.log("Load is complete");

                                                        },
                                                    select: this._loadData,
                                                    scope: this
                                                            }

                                              });

                   this.down('#drop-downContainer').add(releaseComboBox);

                   },

            _loadData: function(myStore,data,success)
             {   console.log("Entering the onLoad Data...");
                 console.log("Store --",myStore);
                 console.log("Data: ",data);

                  var datagrid= Ext.create('Rally.ui.grid.Grid',{
                                       store:  myStore,
                                       columnCfgs: ['Name', 'ReleaseStartDate"', 'ReleaseDate', 'ObjectID', 'State', 'PlannedVelocity']
                                        });

                   console.log("DataGrid is complete...");
                  //this.down('#gridContainer').add(datagrid);

                 }

        });

A: The problem you're running into is myStore is not a store- it's the release combo box.
I'd check out the easy button for scoping apps to timeboxes: https://help.rallydev.com/apps/2.1/doc/#!/guide/timebox_filtering
And here's another example showing how to load/update a grid based on a combobox filter:
https://help.rallydev.com/apps/2.1/doc/#!/example/filterable-grid


text:
Q: Rails - Elasticsearch + rspec error I always end up with the following error, when i try to search imported records through rspec.
NoMethodError: undefined method `model_name' for [PROXY] Object:Elasticsearch::Model::Proxy::ClassMethodsProxy
method_missing, from proxy.rb
After some investigation, i found out that i can search through the records normally in development and test environment. But when i debug through one of the request specs (which invokes one of my actions involving elasticsearch methods) it doesn't go through and bamm, the same error.


text:
Q: Update current user's primary blog after creating a blog in wordpress multisite I wanted to update the current user's primary blog to the blog created after blog signup on wp-signup.php form. So that the current user's primary blog is set to the blog he had created.
I tried this but its not working,
add_action('wpmu_new_blog','update_primary_blog',10);

function update_primary_blog() {
global $wpdb;
update_user_meta( get_current_user_id(), 'primary_blog', $wpdb->insert_id );
}

Is there another way to do it?

A: try this:
<?php
add_action('wpmu_new_blog','update_primary_blog',10, 1);
function update_primary_blog($blog_id) {
    update_user_meta( get_current_user_id(), 'primary_blog', $blog_id);
}

more info (and arguments) on the hook:
http://adambrown.info/p/wp_hooks/hook/wpmu_new_blog?version=3.3&file=wp-includes/ms-functions.php


text:
Q: Create a loop for calculating values from a dataframe in R? Let's say I make a dummy dataframe with 6 columns with 10 observations:
X <- data.frame(a=1:10, b=11:20, c=21:30, d=31:40, e=41:50, f=51:60)

I need to create a loop that evaluates 3 columns at a time, adding the summed second and third columns and dividing this by the sum of the first column:
 (sum(b)+sum(c))/sum(a) ... (sum(e)+sum(f))/sum(d) ...

I then need to construct a final dataframe from these values. For example using the dummy dataframe above, it would look like:
        value
1.     7.454545
2.     2.84507

I imagine I need to use the next function to iterate within the loop, but I'm fairly lost! Thank you for any help.

A: You can split your data frame into groups of 3 by creating a vector with rep where each element repeats 3 times. Then with this list of sub data frames, (s)apply the function of summing the second and third columns, adding them, and dividing by the sum of the first column.
out_vec <-
  sapply(
    split.default(X, rep(1:ncol(X), each = 3, length.out = ncol(X)))
    , function(x) (sum(x[2]) + sum(x[3]))/sum(x[1]))

data.frame(value = out_vec)
#      value
# 1 7.454545
# 2 2.845070

You could also sum all the columns up front before the sapply with colSums, which will be more efficient.
out_vec <-
  sapply(
    split(colSums(X), rep(1:ncol(X), each = 3, length.out = ncol(X)))
    , function(x) (x[2] + x[3])/x[1])

data.frame(value = out_vec, row.names = NULL)
#      value
# 1 7.454545
# 2 2.845070

A: You could use tapply:
tapply(colSums(X), gl(ncol(X)/3, 3), function(x)sum(x[-1])/x[1])
       1        2
7.454545 2.845070

A: Here is an option with tidyverse
library(dplyr) # 1.0.0
library(tidyr)
X %>%
     summarise(across(.fn = sum)) %>%
     pivot_longer(everything()) %>%
     group_by(grp = as.integer(gl(n(), 3, n()))) %>%
     summarise(value = sum(lead(value)/first(value), na.rm = TRUE)) %>%
     select(value)
# A tibble: 2 x 1
#  value
#  <dbl>
#1  7.45
#2  2.85


text:
Q: A fairly straightforward balls-and-urns problem I am interested in the following question, which is stated in the abstract of [1]:

An urn contains $r$ different balls. Balls are drawn with replacement until any $k$ balls have
  been obtained at least $m$ times each. How many draws are necessary?

The cited paper solves this problem using Poissonization for various special cases (e.g. $k=1$ or $k=r$ and so on) but I cannot find a reference for the most general case, asymptotic or otherwise.  Is there a name for this general problem, and are there any known solutions (or upper bounds) for it, assuming that $r\to\infty$?
[1] Holst, Lars. "On birthday, collectors', occupancy and other classical urn problems." International Statistical Review/Revue Internationale de Statistique (1986): 15-27.


text:
Q: Achieving tombstoning in Kafka I have a KStream with key value pairs that are grouped by key. Every key should be unique, and the only reason why it might not be is as the same key is streamed with a null as value.
In my streams application I need to filter out all the same keys if the value of on of the records is null (tombstone). How do I get started?
KStream<Key, Value> table = builder.stream(kafkaProperties.getTopicName());
// If key exists multiple times, check for null value and if found
// remove / ignore record

So when  it needs to stay, but when   the complete key with all values need to be thrown away.

A: This is quite tricky to achieve. Data is processed linearly, and thus you would need to buffer all key-value pairs in a state store, eg, using a transform(). You would insert each input key-value pair into the key-value store. If you receive a null value, you can delete it from the store.
The difficult part is, to decide/know that there won't be any null-value for a key in the future. How to determine this, depends on your overall setup, and there is no generic answer. If you can make the decision at some point that a key-value pair in the store cannot have a future tombstone, you can send it downstream and also delete it from the store.


text:
Q: MSBuild build start property Is there a property or another way in MSBuild that would hold the start time of a build?
I have explored my builds with the MSBuild structured viewer but found nothing.

A: First of all, project files (csproj) are actually MSBuild files, so we can use MSBuild variables.
The problem is when we compile the entire solution (sln), we don't have an MSBuild file to declare variables and change the default behavior of MSBuild Build target.
So in the first step, we will need to create an MSBuild file for the sln:

*

*You can change this environment variable to generate the MSBuild file from the build process:
Set MSBuildEmitSolution=1
msbuild {yourSlnFile}.sln

The root folder now should contain a file with .sln.metaproj, that you can compile the solution with him (msbuild {yourSlnFile}.sln.metaproj /t:Build)
Link

*You can create your own MSBuild file for compile the solution with him, and he will be cleaner from the first option:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="Build">
        <Message Text="$([System.DateTime]::Now.ToString(`yyyy.MMdd`))"></Message>
        <MSBuild Projects="{yourSlnFile}.sln" Properties="Configuration=$(Configuration); Platform=$(Platform)" />
    </Target>
</Project>

Link
Now, in your custom MSBuild file to build the sln, you can declare a tag in PropertyGroup, and this tag will hold the DateTime in your file:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <StartCommandTime>$([System.DateTime]::Now.ToString(`yyyy.MMdd`))</StartCommandTime>
    </PropertyGroup>
    <Target Name="Build">
        <Message Text="$(StartCommandTime)"></Message>
        <MSBuild Projects="{yourSlnFile}.sln" Properties="Configuration=$(Configuration); Platform=$(Platform)" />
        <Message Text="$(StartCommandTime)"></Message>
    </Target>
</Project>


text:
Q: RabbitMQ architecture to manage trips and coordinates I'm new to RabbitMQ, but I know that my use case fits well in this kind of architecture. What I want to achieve is the following.
Using an android application, the user will push the "start trip" button. This will call to an API which will create the trip. Then, the android application will send data periodically, gps coordinates, to the API (which will accomplish some task). When the user finishes the trip, another call to the API will be made.
Until now, the API was a simple Restful written using spring boot. Now, I want to make changes to the architecture and add RabbitMQ.
I've thought that whenever a trip is started, the API will create a Queue (queue_trip_XXX, as XXX is the trip identificator), bound to a exchange (trips_exchange) with a routing key (trip_XXX). Then, but dynamically, gps coordinates will be sent to the exchange and routed to the corresponding queue. When the user ends the trip, the queue will be removed.
So, there will be one queue for each trip and a unique exchange. Is this appropriate? Do you have any other solution that would best fit to this use case?
Another question is how can I create a consumer which listens to messages sent to a queue?
Thanks!

A:
So, there will be one queue for each trip and a unique exchange. Is this appropriate?

As I've mentioned in the comment I don't think it's a good idea due to the fact that every queue in RabbitMQ is a separate Erlang process.
Is there any reason why you would like to process messages from one trip separately from the others? Maybe one queue will be enough for start?

Another question is how can I create a consumer which listens to messages sent to a queue?

I assume you already have two nodes (one for API and one for RabbitMQ broker).
You should just create the third one which will be responsible for processing the data.


text:
Q: Meaning in context: 'I was' or 'I have been' What is correct in this context?
'Have you ever been to Italy?'
->'Yes,  I was last year.'
OR
->'Yes, I have been last year.'
THX

A: If you use a specific time expression like " last year", you have to use past simple. Have you ever been to Italy? Yes, I went last year. Where were you in July last year? I was in Italy.


text:
Q: Displaying results of a stored procedure via a dataset in an MVC 4 View I have spent a lot of time on this, but i can't seem to get it to work. I have a legacy web forms app that i am rewriting in MVC. It has all bussiness logic coming from stored procs and in the iterest of time, I decided to reuse the BAL(bussiness layer) and DAL. Here is what I have:
Model
public class GridDisplay
    {
        public List<string> columnNames { get; set; }
        public List<string> fieldValues { get; set; }

    }

Controller
public ActionResult PatientInfo()
    {

        var model = new PatientInfoViewmodel();
        ViewBag.countries = model.FillCountryDropDown();
        ViewBag.studies = model.FillStudyDropDown();
        SearchElements SE = new SearchElements { StudyID = "PRMDEMO" };
        List<string> fields = new List<string>();
        DataSet ds = new DataSet();
        ds = pibl.PopulateData(SE);
        var display = new List<GridDisplay>();

        display = model.BuildGridData(SE);

        ViewBag.columns = display[0].columnNames.ToList();

        ViewBag.fields = display;
        return View();
    }

List of GridDisplays:
public List<GridDisplay> BuildGridData(SearchElements SE) //(string country, string studyID, string patientid, string lastname)
    {
        DataSet ds = new DataSet();`enter code here`
        ds = pibl.PopulateData(SE);
        GridDisplay display = new GridDisplay();
        List<GridDisplay> displayList = new List<GridDisplay>();
        string strtemp = string.Empty;
        display.columnNames = new List<string>();
        foreach (DataRow row in ds.Tables[0].Rows)
        {
            display.columnNames.Add(row["label"].ToString());
        }

        display.fieldValues = new List<string>();
        foreach (DataRow row in ds.Tables[1].Rows)
        {

        display.fieldValues = new List<string>();
            foreach (DataColumn column in ds.Tables[1].Columns)
            {
                if (column.Caption != "STUDY" & column.Caption != "PATIENT_ID")
                {
                    display.fieldValues.Add(row[column].ToString());
                }
                if (column.Caption == "PATIENT_ID")
                {
                    strtemp = row[column].ToString();
                }
            }
            display.fieldValues.Add(strtemp);
            displayList.Add(new GridDisplay() { columnNames = display.columnNames, fieldValues = display.fieldValues});
        }

        return displayList;
    }

The displayList has everything I need and I am able to display the columns, but not the fields. Below is the view portion that pertains to this(one of my versions)

                @foreach (var col in @ViewBag.columns)
                {

                        @col

                }

                @foreach (var item in @ViewBag.fields.fieldvalues)
                {

                        @item

                }

    </div

A: Understanding models is a beautiful thing. I did figure this out. To recap, I have a stored procedure that returns two result sets via a dataset. Dataset.Tables[0] has header strings and Dataset.Tables[1] contains the information to be displayed.My task was to create an MVC 4 application to view this and then some.
Model
 public class GridDisplay

    {
        public List<string> columnNames { get; set; }
        public List<List<string>> fieldValues { get; set; }

    }

Controller
     public ActionResult PatientInfo()
        {
            var model = new PatientInfoViewmodel();
            // build dropdown lists
            ViewBag.countries = model.FillCountryDropDown();
            ViewBag.studies = model.FillStudyDropDown();
            SearchElements SE = new SearchElements { StudyID = "PRMDEMO" };

            DataSet ds = new DataSet();
            ds = pibl.PopulateData(SE);
            var gridDisplay = new GridDisplay();

            gridDisplay = model.BuildGridData(SE);
            return View(gridDisplay);
        }

View

                @foreach (var col in Model.columnNames)
                {

                        @col

                }

            @for (int i = 0; i < Model.fieldValues.Count; ++i)
            {

                    @foreach (var item in Model.fieldValues[i])
                    {

                            @item

                    }

            }


text:
Q: I want to do practical for puppet with docker I want to do practical of puppet with docker.
I mean puppet server(chef server) will be docker container and puppet client (Chef servers) will be docker container.
So can anyone help me on this?

A: Have a look at the 194 containers about puppet at https://registry.hub.docker.com/search?q=puppet&searchfield=  you should find what you want and at least ideas on how to achieve it.


text:
Q: How to access key in a map returned by kubectl I want to access limits.memory variable returned by get command in k8s
kubectl get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used
USED
map[limits.memory:0 requests.cpu:0 requests.memory:0]

I tried many ways but couldn't succeed
[root@iaasn00126847 ~]# k get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used.limits.memory

returns nothing
Is there a delimiter to fetch the same

A: For values with /, you don't need to escape them, but just the dots using brackets.
$ kubectl -n istio-system get service http2-service-ingress \
-o jsonpath="{.metadata.annotations['service\.beta\.kubernetes\.io/aws-load-balancer-type']}"

A: Since you key (limits.memory) contains dot, maybe you should try like this:
[root@iaasn00126847 ~]# k get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used.'limits\.memory'

A: There is no need to use jsonpath. You can still use the custom-columns output, but you need to put the key in (single or double) quotes, and escape all the dots, like this:
k get resourcequota default -n 103000-p4-dev -o custom-columns=USED:.status.used."limits\.memory"

I am currently using this with kubectl v1.17, to list nodes, as follows:
kubectl get nodes -o custom-columns=NAME:.metadata.name,ZONE:.metadata.labels.'topology\.kubernetes\.io/region'
kubectl get nodes -o custom-columns=NAME:.metadata.name,ZONE:.metadata.labels."topology\.kubernetes\.io/region"

A: Try with jsonpath
kubectl get resourcequota default -n 103000-p4-dev  -o jsonpath="{.status.used.limits\.memory}"

This is what I tried
$ kubectl apply -f https://k8s.io/examples/admin/resource/quota-mem-cpu.yaml
resourcequota/mem-cpu-demo created
$ kubectl get resourcequota
NAME           CREATED AT
mem-cpu-demo   2019-10-09T06:38:39Z
$
$ kubectl get resourcequota mem-cpu-demo -o json
{
    "apiVersion": "v1",
    "kind": "ResourceQuota",
    "metadata": {
        "annotations": {
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"ResourceQuota\",\"metadata\":{\"annotations\":{},\"name\":\"mem-cpu-demo\",\"namespace\":\"default\"},\"spec\":{\"hard\":{\"limits.cpu\":\"2\",\"limits.memory\":\"2Gi\",\"requests.cpu\":\"1\",\"requests.memory\":\"1Gi\"}}}\n"
        },
        "creationTimestamp": "2019-10-09T06:38:39Z",
        "name": "mem-cpu-demo",
        "namespace": "default",
        "resourceVersion": "975",
        "selfLink": "/api/v1/namespaces/default/resourcequotas/mem-cpu-demo",
        "uid": "0d74d782-b717-4845-a0da-424776c05d45"
    },
    "spec": {
        "hard": {
            "limits.cpu": "2",
            "limits.memory": "2Gi",
            "requests.cpu": "1",
            "requests.memory": "1Gi"
        }
    },
    "status": {
        "hard": {
            "limits.cpu": "2",
            "limits.memory": "2Gi",
            "requests.cpu": "1",
            "requests.memory": "1Gi"
        },
        "used": {
            "limits.cpu": "0",
            "limits.memory": "0",
            "requests.cpu": "0",
            "requests.memory": "0"
        }
    }
}
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.used}"
map[limits.cpu:0 limits.memory:0 requests.cpu:0 requests.memory:0]$
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.used.limits\.memory}"
0
$
$ kubectl get resourcequota mem-cpu-demo -o jsonpath="{.status.hard.limits\.memory}"
2Gi
$


text:
Q: How can I compare a users input to a list of methods? I'm writing some code where I have made a few methods and have put all of them in a list however I want the user to be able to choose a method from the list and then run that method as i dont want all the methods to run and only output the answer of chosen method as this is inefficient.
class program
    {
        //arrays
        static void Arrays()
        {
            Console.WriteLine("Enter number of cars:");
            Console.ReadKey();
        }

        // List
        static void List()
        {
            Console.WriteLine("Enter items for shopping list");
            shoppingList.Add("Apples");
            shoppingList.Add("oranges");
            shoppingList.Add("milk");
            shoppingList.Add("butter");

            Console.ReadKey();
        }

        static void Main(string[] strings)
        {
            List<Action> methods = new List<Action>();

            methods.Add(Arrays);
            methods.Add(List);

            Console.WriteLine("what method do you want:");
            string answer = Console.ReadLine();

            foreach (Action a in methods.Where(//one of the methods == answer));
                Console.WriteLine(//the method that is == answer);

            if (answer == //one methods in list)
            {
                Console.WriteLine(////the method that is == answer);
            }
        }

A: You could use a dictionary:
Dictionary<string, Action> methods = new(StringComparer.OrdinalIgnoreCase);
methods.Add(nameof(Arrays), Arrays);
methods.Add(nameof(List), List);

Console.WriteLine("what method do you want:");
string answer = Console.ReadLine();
if(methods.TryGetValue(answer, out Action doIt))
{
    doIt();
}


text:
Q: How to set the size of a Button in Scala Swing? I'm trying to set the size of a button to a specific size of pixels with minimumSize, but it looks like it doesn't work.
I even tried to subclass it and do it this way
class SizedButton(text0: String, width0: Int, height0: Int)
                                      extends Button(text0) {
  minimumSize = new Dimension(width0, height0)
  // also tried preferredSize here ...
}

but that didn't work either.

A: It's a bit hard to tell what you're really trying to do, but generally sizing depends a lot on the layout manager you are using. Anyway the following fixes the size of a button e.g.:
import swing._
import java.awt.Dimension

val s = new Dimension(100, 100)
val f = new Frame {
  contents = new FlowPanel {
    contents += new Button("huhu") {
      minimumSize = s
      maximumSize = s
      preferredSize = s
    }
  }
}

f.pack
f.visible = true


text:
Q: Returning Data Rows to List with SqlDataReader I'm trying to create a generic SqlDataReader which converts a table with 33 columns into a list.  I would like each list item to contain all 33 column values for each row.
However, my code is assigning each value to an individual list item.
So instead of 1000 list items = 1000 rows of data, I have 33,000 list items.
I would prefer to use a list over a datatable, because the list comparisons I need to do are much simpler.
How can I have 1000 list items with 33 values each?
   public static List<string> loadSQL(String query, String connectString)
    {
        List<string> dataList = new List<string>();

        using (SqlConnection connection = new SqlConnection(connectString))
        {
            using (SqlCommand command = new SqlCommand(query, connection))

            {
                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {

                        for (int i = 0; i < reader.FieldCount; i ++)
                            {
                                dataList.Add(Convert.ToString(reader.GetValue(i)));
                            }
                    }
                }
            }
        return dataList;

        }
    }

... update ...
corrected to the following. It returns the list items correctly. However, my list contains 33,000 items containing 33 items each.  How can I control the loop so it stops after 1000 rows?
        using (SqlConnection connection = new SqlConnection(connectString))
        {
            using (SqlCommand command = new SqlCommand(query, connection))

            {
                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {

                       List<string> tempRow = new List<string>();
                        for (int i = 0; i < reader.FieldCount; i ++)
                            {
                                tempRow.Add(Convert.ToString(reader.GetValue(i)));
                            }
                        dataList.Add(tempRow);

                    }
                }
            }
        }

A: The best option for you to do this task is DataTable, But you don't want to use it. So, the net option will be, Create a class based on the query-output then use a List<objectOftheClass>. But in your case, the Input query will be changed all times so a common class will not be meaningful Since you are trying to make it generic. So the option you can follow is List<List<string>> or List<List<object>>. As per this the method signature will be like the following:
public static List<object[]> loadSQL(string query, string connectString)
{
    List<object[]> dataList = new List<object[]>();

    using (SqlConnection connection = new SqlConnection(connectString))
    {
        using (SqlCommand command = new SqlCommand(query, connection))
        {
            connection.Open();

            using (SqlDataReader reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    object[] tempRow = new object[reader.FieldCount];
                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        tempRow[i] = reader[i];
                    }
                    dataList.Add(tempRow);
                }
            }
        }
    }
    return dataList;
}

Why List<object>? why not `List?:
The reader will give you the column data as the same type of column in the table. If it is object then you need not convert it every time.
** Note:-** Change String to string for the arguments in the method signature. You can find a reason here

A: You can use a List<List<string>> like this:
public static List<List<string>> loadSQL(String query, String connectString)
    {
        List<List<string>> dataList = new List<List<string>>();

        using (SqlConnection connection = new SqlConnection(connectString))
        {
            using (SqlCommand command = new SqlCommand(query, connection))

            {
                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var l = new List<string>();
                        for (int i = 0; i < reader.FieldCount; i ++)
                            {
                                l.Add(Convert.ToString(reader.GetValue(i)));
                            }
                        dataList.Add(l);
                    }
                }
            }
        return dataList;

        }
    }

A: You can use an array within the list to achieve what you are trying to do.  Here is a quick example using your code:
public static List<string[]> loadSQL(String query, String connectString)
{
List<string[]> dataList = new List<string[]>();

using (SqlConnection connection = new SqlConnection(connectString))
{
    using (SqlCommand command = new SqlCommand(query, connection))

    {
        connection.Open();

        using (SqlDataReader reader = command.ExecuteReader())
        {
            int rowcounter = 0;

            while (reader.Read())
            {
                string[] value = new string[reader.FieldCount];

                for (int i = 0; i < reader.FieldCount; i ++)
                    {
                        value[i] = Convert.ToString(reader.GetValue(i));
                    }

                dataList.Add(value);
                rowcounter++;
            }
        }
    }
return dataList;

}

Alertnately, if you want to use the List, you will need to embed the values a single string, using a comma separator or something similar.