text:
Q: Correct way to load AngularJS templates for Webpack 4? So far I've been able to bundle up all our controllers/directives/services into 1 script and I also bundled all the vendor scripts into another script file.  Now I'm having trouble figuring out what the right way to load the AngularJS template files are.  We are currently using Grunt and just copying the exact folder structure over to the dist folder but clearly this won't work in Webpack.  Here is an example of our project structure(from the John Papa style guide)

My project inside the dist folder is currently rendered as follows:

Anybody have any input?

A: AngularJS templates are html files, so you need to add some loader for handling them.

*

*You have multiple options, bundle those html files into the js bundle, using html-loader, pros of this approach is that your app won't make ajax call for the template, cons, your js bundle size will become large.
This will allow you to "require" your html template inside your controllers.

*copy those raw files using copy-webpack-plugin, this way it will work the same way it works with Grunt (providing templateUrl path to the file that was copied).

*In-order to be specific regarding lazy-loaded files you can attach .lazy.html suffix.
Then, enable file-loader on the .lazy.html files & assign it to templateUrl, and the regular once use with template: require('template.html').
As of best practice, I would "require" critical templates so they will be in the js bundle, and lazy load (via templateUrl) non-critical ones.
This is an example of webpack.config.js file:
module.exports = {
  module: {
    rules: [
      {
        test: /\.lazy\.html$/,
        use: [
          {
            loader: 'file-loader',
            options: {},
          },
        ],
      },
      {
        test: /\.html$/,
        exclude: /\.lazy\.html$/
        use: [
          {
            loader: 'html-loader',
            options: {
              minimize: true,
            },
          },
        ],
      },
    ],
  },
};

// critical.component.js
angular.
  module('myApp').
  component('greetUser', {
    template: require('critical.html'),
    controller: function GreetUserController() {
      this.user = 'world';
    }
  });

// none-critical.component.js

angular.
  module('myApp').
  component('greetUser', {
    templateUrl: require('non-critical.lazy.html'),
    controller: function GreetUserController() {
      this.user = 'world';
    }
  });


text:
Q: SonarQube: Manual Upload of coverage report I have managed to produce  a coverage report for a .NET core project on a debian container where sonar-scanner resides using minicover.
It seems however there is no easy way of importing this into SonarQube (minicover is not in the list of supported coverage tools and the ones listed do not seem to run on linux platforms).
My question goes to SonarQube and is the following: assuming I have a coverage folder in the form of:
-
|
 \
  coverage-folder/
  |
   index.html
  |
   src/

is there a way for manual upload (e.g. api call) to sonarqube server so that it is streamlined in the project's analysis?
...or is it at least possible at some project settings to hard-code the expected form of coverage report?
(couldn't find anything related to the latter on the server's UI)
Using SonarQube 6.7.

A: You cannot update an existing analysis by any mechanism.
What you should look at is the Generic Test Data format. Set up a translation into this format and then feed your generic report into your analysis (/d:sonar.coverageReportPaths=[path to report]) and you should be good to go.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android green accent color I would like to use this accent (green?) color in my app

I have found that it's probably https://www.google.pl/search?ei=FbhVW4tulIebBcC_tMAL&q=%2380CBC4&oq=%2380CBC4&gs_l=psy-ab.3..0i71k1l2.0.0.0.18385.0.0.0.0.0.0.0.0..0.0....0...1c..64.psy-ab..0.0.0....0.vOOE7QAH0nk
but is that color defined somewhere and I can use it or I need to define it in my resources?

A: Please add below style into your values/styles.xml file
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimary</item>
    <item name="colorAccent">#80cbc4</item>
</style>

A: No, it's not pre-defined in your app.
You have to define the colour explicitly in res/colors.xml file.

A: go to the res =>values=>colors
replace your color with colorAccent

A: That's the Android OS accent color. You can get it using:
android.R.attr.colorActivatedHighlight
Use this function to resolve attributes (Kotlin extension)
fun Context.themeColor(@AttrRes attrRes: Int): Int {
    val typedValue = TypedValue()
    theme.resolveAttribute (attrRes, typedValue, true)
    return typedValue.data
}

So your code would look like this:
themeColor(android.R.attr.colorActivatedHighlight)


text:
Q: Surfacing data in ArcSDE enterprise geodatabases in Portal Is it possible to use data from ArcSDE geodatabases (hosted in Oracle, in this instance) in Portal webmaps? I've been searching documentation and the internet for a while, and it's implied that it's possible, but I can't seem to find a specific instance of it being done or how to do it.

A: Yes (short answer)
How do I do that? (longer answer)
As @Vince and @Mike comment, the missing piece is "Publishing" a map and feature service(s) to ArcGIS for Server (AGS).  So the roadmap is:

*

*a layer in ArcSDE (backend) gets modeled and populated with data, then

*added to an MXD (desktop) and manipulated until it appears as desired, then

*the Map is "Published" to an ArcGIS Server Map Service (middle-tier if you will) making multiple feature services (matching the MXD contents) available and ALSO referencing them within Portal (or ArcGIS Online), then

*the Map services are managed within Portal Administrator (or AGS Online) to share them with the right groups, etc.

*Applications are developed and deployed which consume these Map services and are based on web-language  prototype applications.

Each of these steps are documented to one degree or another, but the high-level roadmap isn't always clear when reading the detailed documentation.  Keep this roadmap handy while you review this tutorial (steps 3-4.)


text:
Q: Using span, other texts are going in the next line I have texts in two spans, but they are not beside each other. (The last text is below the previous text, but it should be beside the previous.)
Here is the code from where the texts are printed:
var display_options_1 = `

         ${question.options[0]}${question.option_text[0]}
         ${question.options[1]}${question.option_text[1]}	`;

var display_options_2 = `

         ${question.options[2]}${question.option_text[2]}
         ${question.options[3]}${question.option_text[3]}	`;

Here is the full code with a working Demo!

It was easier to solve the problem with one ,
${question.options[ ]}

${question.option_text[ ]}
, but I need only ${question.options[]} to be selected not
  ${question.option_text[ ]}

A: Change these lines
${question.options[0]}${question.option_text[0]}
${question.options[1]}${question.option_text[1]}

to these
${question.options[0]}${question.option_text[0]}
${question.options[1]}${question.option_text[1]}

Remove width: 90% on .question1
Add the locked/correct/incorrect classes on the the first child of the selection like
selection.firstElementChild.setAttribute('class', 'locked');

Also change the line where correct answer is checked
if (currentQuestion.answer === e.currentTarget.firstElementChild.innerText) {

var x;

var questions = [{
  questionId: "question1",
  answerId: "C",
  question: "1) जो भवनों में रहते हैं, वे है ?(C186506)",
  options: ["A)", "B)", "C)", "D)"],
  option_text: ["ज्योतिष्क ", "वैमानिक", "भवनपति ", "व्यंतर"],
  answer: "C)",
  locked: false
}];

var table = document.getElementById("test");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
cell1.colSpan = 2;
var i = 0;

function generateQuestion(question) {
  // noinspection JSAnnotator
  i += 1;
  var newQuestion = `

${question.question}`;
  var display_options_1 = `

            ${question.options[0]}${question.option_text[0]}
            ${question.options[1]}${question.option_text[1]}
  `;
  var display_options_2 = `

            ${question.options[2]}${question.option_text[2]}
            ${question.options[3]}${question.option_text[3]}
  `;
  var row2 = table.insertRow(1);
  row2.innerHTML = newQuestion;

  var row3 = table.insertRow(2);
  setTimeout(() => {
    row3.innerHTML = display_options_1;
  }, 2000);
  var row4 = table.insertRow(3);
  setTimeout(function() {
    row4.innerHTML = display_options_2;
  }, 2000);

  var points_display = "1";
  var points_set = "237512";
  var t_points = "237513";
  var distance = "10";
}

function onSelect(e) {
  var selection = e.currentTarget;
  var questionId = e.currentTarget.className;
  var currentQuestion = questions.find(function(q) {
    return q.questionId == questionId;
  });

  if (currentQuestion.locked) {
    alert("Question already answered");
  } else if (currentQuestion.answer === e.currentTarget.firstElementChild.innerText) {
    clearInterval(x);

    //table.deleteRow(0);
    //document.getElementById("timer").setAttribute('class', 'hidden_timer');
    selection.firstElementChild.setAttribute('class', 'locked');
    alert("Correct!!!");
    currentQuestion.locked = true;
    setTimeout(() => {
      selection.setAttribute('class', 'correct');
    }, 2000);

  } else {
    alert("Incorrect...");
    clearInterval(x);
    //table.deleteRow(0);
    //document.getElementById("timer").setAttribute('class', 'hidden_timer');
    selection.firstElementChild.setAttribute('class', 'locked');
    currentQuestion.locked = true;
    setTimeout(() => {
      selection.firstElementChild.setAttribute('class', 'incorrect');
      console.log(document.getElementById(currentQuestion.answerId + i));
      document.getElementById(currentQuestion.answerId + i).setAttribute('class', 'correct');
    }, 2000);
  }
  //generateQuestion(questions[i]);
}

function startTest() {
  generateQuestion(questions[i]);
}
.correct {
  display: flex;
  align-items: center;
  width: 90%;
  height: auto;
  min-height: 40px;
  position: relative;
  background: green;
  color: white;
}

.correct::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 20px solid green;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.correct::before {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 20px solid green;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.lifeline {
  background-color: pink;
  color: white;
}

.incorrect {
  display: flex;
  align-items: center;
  width: 90%;
  height: auto;
  min-height: 40px;
  position: relative;
  background: red;
  color: white;
}

.incorrect::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 20px solid red;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.incorrect::before {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 20px solid red;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.locked {
  display: flex;
  align-items: center;
  width: 90%;
  height: auto;
  min-height: 40px;
  position: relative;
  background: yellow;
  color: white;
}

.locked::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 20px solid yellow;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.locked::before {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 20px solid yellow;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.timeout {
  background-color: orange;
  color: white;
}

.hidden_timer {
  visibility: hidden;
  display: none;
}

.visible {
  visibility: visible !important
}

.timeout {
  display: flex;
  align-items: center;
  width: 90%;
  height: auto;
  min-height: 40px;
  position: relative;
  background: orange;
  color: white;
}

.timeout::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 20px solid orange;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.timeout::before {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 20px solid orange;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.question1 {
  display: flex;
  align-items: center;
  height: auto;
  min-height: 40px;
  position: relative;
  background: blue;
  color: white;
}

.question1::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 20px solid blue;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.question1::before {
  content: "";
  position: absolute;
  right: -20px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 20px solid blue;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
}

.table_cstm {
  border-collapse: separate;
  border-spacing: 15;
  /* Apply cell spacing */
  table-layout: fixed
}

td:last-child div {
  margin-left: auto;
}

/* Play header starts */

.button_cstm_quit {
  background-color: red;
  border: none;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 35px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 50%;
}

.button_cstm_quit:hover {
  color: red;
  font-weight: bold;
  background: none;
  border: 2px solid red;
}

.button_cstm_ll {
  background-color: blue;
  border: none;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 35px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
}

.button_cstm_ll:hover {
  color: blue;
  font-weight: bold;
  background: none;
  border: 2px solid blue;
}

.button_cst_pnts {
  background-color: orange;
  border: none;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 35px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
}

.button_cst_pnt:hover {
  color: orange;
  font-weight: bold;
  background: none;
  border: 2px solid orange;
}

.button_cstm_nxt {
  background-color: blue;
  border: none;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 35px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 50%;
  position: relative;
}

.button_cstm_nxt:hover {
  color: blue;
  font-weight: bold;
  background: none;
  border: 2px solid blue;
}

.button_cstm_time {
  background-color: #FF8C00;
  border: none;
  color: white;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 35px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 50%;
}

.button_cstm_time:hover {
  color: #FF8C00;
  font-weight: bold;
  background: none;
  border: 2px solid #FF8C00;
}

#container_cstm {
  width: 100%;
}

#left_cstm {
  float: left;
  width: 100px;
}

#right_cstm {
  float: right;
  width: 100px;
}

#center_cstm {
  margin: 0 auto;
  width: 100px;
}

#play_head {
  display: flex;
  /* establish flex container */
  flex-direction: row;
  /* default value; can be omitted */
  flex-wrap: nowrap;
  /* default value; can be omitted */
  justify-content: space-between;
  /* switched from default (flex-start, see below) */
}

.red_cross:before,
.red_cross:after {
  position: absolute;
  content: '';
  top: -5px;
  bottom: -5px;
  width: 5px;
  background: #ff0000;
  left: 0;
  right: 0;
  margin: 0 auto;
}

.red_cross:before {
  transform: skew(30deg);
}

.red_cross:after {
  transform: skew(-30deg);
}

.disp_none {
  display: none;
}

/* Play header ends */
<!DOCTYPE html>

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">

A: class="${question.questionId}" this class is assigning display: flex which is making the next span go next line.
Solution:
Add another div which contains both spans and assign class="${question.questionId}"
PS: I tried in that demo, but it's not allowing me to run and check my answer correctness.

A: span is an inline element. You must have changed its display property somewhere in CSS code. Just try adding
display: inline-block;
to your span element.


text:
Q: Mysql excludes first parameter when using AND & OR LIKE in same query? Im trying to perform this really simple query.

links_public 1 = show
links_public 0 = dont show

However, when running the query below it still returns all rows where links_public are set to 0.
 SELECT *
 FROM links
 WHERE links_public = '1'
 AND links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%'
 OR links_link LIKE '%$filter%'
 ORDER BY links_created DESC

A: Try using some brackets.
Something like
 SELECT *
 FROM links
 WHERE links_public = '1'
 AND (links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%'
 OR links_link LIKE '%$filter%')
 ORDER BY links_created DESC

The way you have it, it is seen as
SELECT *
 FROM links
 WHERE (links_public = '1'
 AND links_description LIKE '%$filter%')
 OR links_created_by LIKE '%$filter%'
 OR links_link LIKE '%$filter%'
 ORDER BY links_created DESC

Have a look at 12.3.1. Operator Precedence

A: change
SELECT *
 FROM links
 WHERE links_public = '1'
 AND links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%'
 OR links_link LIKE '%$filter%'
 ORDER BY links_created DESC

to
SELECT *
 FROM links
 WHERE links_public = '1'
 AND ( links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%' OR links_link LIKE '%$filter%' )
 ORDER BY links_created DESC

A: The OR is creating the problem. You need to use () for grouping the condition. You should use:-
SELECT *
 FROM links
 WHERE links_public = '1'
 AND (links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%' OR links_link LIKE '%$filter%' )
 ORDER BY links_created DESC

A: Place brackets around and then try:
SELECT *
 FROM links
 WHERE (links_public = '1')
 AND (links_description LIKE '%$filter%'
 OR links_created_by LIKE '%$filter%'
 OR links_link LIKE '%$filter%')
 ORDER BY links_created DESC


text:
Q: Are bridges like hubs or switches? It is my understanding that the main difference between a network hub and a network switch is that the hub always sends out all packets to all (other?) hosts while the switch is smart about it and keeps track of which port belongs to which MAC address via MAC address tables and whatnot. If a packet is addressed to a host which is connected to the switch but have never sent or received anything, the switch acts like a hub would. But every subsequent packet addressed to that host is not broadcast to the other hosts but forwarded only to that specific host. Please correct me if I got something wrong.
Does a network bridge in Linux act like a hub would, or like a switch?

A: A bridge is a network aggregation device, similar in practice to a switch. The bridges implemented in the Linux kernel follow this model. Like any bridge, they forward traffic based on destination MAC addresses, once the MAC address mapping is known. They are actually more featureful than most switches, since they also support firewalling, traffic shaping etc., using ebtables.
See the bridge documentation for details.

A: actually there is a small difference between the switch and hub.hub don't store the mac of connected devices,so the packets received from any host reaches every other connected hosts .Where as switch stores the mac of connected devices and send the packet to respective receiver whose details(like mac,ip) mentioned in packet headers....


text:
Q: 'pip install durable_rules' fails with multiple errors I'm trying to setup durable_rules but command 'pip install durable_rules' fails. I've followed the guide on https://github.com/jruizgit/rules/blob/master/docs/py/reference.md
I'm using Windows 10, Python 3.7.3 and PyCharm
I've tried installing Visual Studio Build Tools

  Running setup.py install for durable-rules ... error
    ERROR: Complete output from command 'c:\users\erdemonur\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ERDEMO~1\\AppData\\Local\\Temp\\pip-install-3ds9j796\\durable-rules\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ERDEMO~1\AppData\Local\Temp\pip-record-zh_49nld\install-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\durable
    copying libpy\durable\engine.py -> build\lib.win-amd64-3.7\durable
    copying libpy\durable\interface.py -> build\lib.win-amd64-3.7\durable
    copying libpy\durable\lang.py -> build\lib.win-amd64-3.7\durable
    copying libpy\durable\__init__.py -> build\lib.win-amd64-3.7\durable
    running build_clib
    building 'rules_py' library
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\deps
    creating build\temp.win-amd64-3.7\deps\Win32_Interop
    creating build\temp.win-amd64-3.7\deps\hiredis_win
    creating build\temp.win-amd64-3.7\src
    creating build\temp.win-amd64-3.7\src\rules
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcdeps/Win32_Interop/win32_error.c /Fobuild\temp.win-amd64-3.7\deps/Win32_Interop/win32_error.obj
    win32_error.c
    deps/Win32_Interop/win32_error.c(154): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    deps/Win32_Interop/win32_error.c(149): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(182): note: see declaration of 'strerror'
    deps/Win32_Interop/win32_error.c(175): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(182): note: see declaration of 'strerror'
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcdeps/Win32_Interop/win32_ansi.c /Fobuild\temp.win-amd64-3.7\deps/Win32_Interop/win32_ansi.obj
    win32_ansi.c
    deps/Win32_Interop/win32_ansi.c(269): warning C4133: 'function': incompatible types - from 'unsigned short [12]' to 'LPCSTR'
    deps/Win32_Interop/win32_ansi.c(270): warning C4133: 'function': incompatible types - from 'TCHAR [4]' to 'const wchar_t *'
    deps/Win32_Interop/win32_ansi.c(594): warning C4133: 'function': incompatible types - from 'unsigned short [5]' to 'LPTSTR'
    deps/Win32_Interop/win32_ansi.c(600): warning C4047: 'function': 'const size_t' differs in levels of indirection from 'unsigned short [9]'
    deps/Win32_Interop/win32_ansi.c(600): warning C4024: 'sprintf_s': different types for formal and actual parameter 2
    deps/Win32_Interop/win32_ansi.c(600): warning C4047: 'function': 'const char *const ' differs in levels of indirection from 'int'
    deps/Win32_Interop/win32_ansi.c(600): warning C4024: 'sprintf_s': different types for formal and actual parameter 3
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpdeps/Win32_Interop/win32_fdapi.cpp /Fobuild\temp.win-amd64-3.7\deps/Win32_Interop/win32_fdapi.obj
    win32_fdapi.cpp
    deps/Win32_Interop/win32_fdapi.cpp(118): error C2039: 'system_error': is not a member of 'std'
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\string(19): note: see declaration of 'std'
    deps/Win32_Interop/win32_fdapi.cpp(118): error C3861: 'system_category': identifier not found
    deps/Win32_Interop/win32_fdapi.cpp(118): error C3861: 'system_error': identifier not found
    deps/Win32_Interop/win32_fdapi.cpp(1087): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\string.h(338): note: see declaration of 'strncpy'
    deps/Win32_Interop/win32_fdapi.cpp(1109): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
    C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: see declaration of 'sprintf'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command "'c:\users\erdemonur\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ERDEMO~1\\AppData\\Local\\Temp\\pip-install-3ds9j796\\durable-rules\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ERDEMO~1\AppData\Local\Temp\pip-record-zh_49nld\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ERDEMO~1\AppData\Local\Temp\pip-install-3ds9j796\durable-rules\


text:
Q: How to add data in android sqlite? I want to add my new values in the previous one at a specific id, but every time when I want to add it created data on a new id rather than added with the previous one.
Here is the method of my databasehelper class:
     public boolean addalldata(String value1, String value2, String value3) {

    String  previous1 = null,previous2 = null,previous3= null;
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues();
    String myquery = "SELECT * FROM student_table WHERE id = 1";
    Cursor res = db.rawQuery(myquery, null);

    while(res.moveToNext()) {
         previous1 = res.getString(1);
         previous2 = res.getString(2);
         previous3 = res.getString(3);
    }

    contentValues.put(COL_2, value1 + previous1);
    contentValues.put(COL_3, value2 + previous2);
    contentValues.put(COL_4, value3 + previous3);
    long result = db.insert(TABLE_NAME, null, contentValues);
    if (result == -1)
        return false;
    else
        return true;}

here is the method of mainactivity class
        private void AddAllData() {
          btnaddall.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    boolean isInserted =       myDb.addalldata(edit1.getText().toString(),
                            edit2.getText().toString(),
                            edit3.getText().toString());
                    if (isInserted = true)
                        Toast.makeText(MainActivity.this, "Data Inserted", Toast.LENGTH_LONG).show();
                    else
                        Toast.makeText(MainActivity.this, "Data not Inserted", Toast.LENGTH_LONG).show();

                }
            }
    );

}

A: try this:
public boolean addalldata(String value1, String value2, String value3) {

        String  previous1 = "0",previous2 = "0",previous3= "0";
        long result = 0;
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        String myquery = "SELECT * FROM student_table WHERE id = 1";
        Cursor res = db.rawQuery(myquery, null);
        if(res.getCount()>0){
             res.moveToFirst();
             previous1 = res.getString(1);
             previous2 = res.getString(2);
             previous3 = res.getString(3);

             try{
               contentValues.put(COL_2, Integer.parseInt(value1) + Integer.parseInt(previous1));
               contentValues.put(COL_3, Integer.parseInt(value2) + Integer.parseInt(previous2));
               contentValues.put(COL_4, Integer.parseInt(value3) + Integer.parseInt(previous3));
               result = db.update(TABLE_NAME, contentValues, "id = ?", new String[]{"1"});
             }catch(Exception e){
               result = -1;
             }

             if (result == -1)
                return false;
             else
                return true;
        }else{
           contentValues.put(COL_2, value1);
           contentValues.put(COL_3, value2);
           contentValues.put(COL_4, value3);
           result = db.insert(TABLE_NAME, null, contentValues);
           if (result == -1)
                return false;
            else
                return true;
        }

}

if there is no record in the database then insert a new record using db.insert otherwise update the existing record by using db.update

A: try res.moveToFirst().This will move your cursor to first position so that furthur checking starts from the first row.


text:
Q: Como eu posso fazer para que o texto da print apresente de maneira mais lenta?(python) A ideia é dar um delay no texto, não como o sleep, mas fazer os caracteres da frase apareçam numa determinada velocidade, ao invés de apresentar tudo de uma vez.
print('E lá vamos nós')

Existe um comando específico da linguagem para fazer isso ou incluído em um módulo?

A: Use o print para imprimir caractere por caractere e sleep para criar uma pausa entre cada caractere.
Nesse caso para print é passado o argumento '' para o parâmetro end significando que ao final da impressão não será pulada uma linha.
Para o parâmetro flush é passado o argumento True pois print usa um buffer de saída e o parâmetro flush indica que esse buffer deva ser despejado ou não após a evocação do comando e um valor True indica que sim deva ser despejado. Se não fosse feito assim a impressão só seria feita após o término do loop que contém a instrução,
import time

def slowprint(texto, atraso=0.2):
  for c in texto:
    print(c,end='',flush=True)
    time.sleep(atraso)

slowprint('E lá vamos nós')

Teste o código no Repl.it: https://repl.it/repls/UnitedQuestionableAdministration


text:
Q: System architecture when using inmemory objects? I have created a stranger chat web application using .net core and jquery and signalR. Currently I am using dictionary to store connectionid and message for users. I am using the in memory object dictionary and not using any database.For testing perspective, I have deployed it on azure and It is working fine for 3-4 users. My questions are
1.Let's say If my application has 3000 users chatting at a time ,what would be best solution to host the application? My thought process is that I can take multiple system and using the load balancer, I can redirect them to different system. For example lets say there are 1500 users then each server can have 500 users in memory object and those 500 users can chat with each others. I can see one limitation that each users can chat with only those 500 users and not 1500 users. Is this solution feasible?
2.How much Ram/CPU core/storage would I required to handle 3000 users at the same time?
3.Do I need to use elastic search db instead of in memory objects to store messages.? I don't need to store message but would elastic search db help with distributed System?.
4.What are the best ways to use load balancer? and also How many distributed system would I require in my case?
My application supports chatting with strangers,uploading image,videos.
I know this can vary and we cannot tell it accurately but I would like to know the best possible System architecture for my web application.

A: To scale this, I would look out for a PubSub/Realtime database.
Examples are: Firebase Real-Time Database, Kafka Streams, Redis.
With this, it might be that you do not need any custom backend at all.
If you opt for own servers as a middleware for the pubsub, everything becomes way more complex. You would have to find a way to manage your infrastructure (e.g. with Kubernetes) and set up a Load Balancer (e.g. HAProxy) which distributes the requests among the servers.
There are providers like codesphere.com or heroku.com which make this process easier for you.
In addition to that you could serve your frontends via a cdn like cloudflare.com, netlify, or vercel in a scalable and easy way.

A: From what I can understand, the current solution is frontend talking to backend using SignalR and then backend talking to frontend for another user?
The main concern at the moment is the storage, so you would need to extract this into a separate place. Since it's a kind of a cache to store connection details, Redis, or another caching mechanism, would be perfect for that. Then the backend would just communicate with Redis whenever it needs some info.
Second concern is the connection count, since you would have more users. You would need to scale the backend to support that. I am not sure about how Azure works with that, but I am sure it does support it, I would assume there is some kind of a setting to scale the service and use some kind of load balancing strategy such as round robin. Since we don't have to remember which service the user connects to, that should work.
Regarding the message history, you mentioned that you don't store it, and the user would lose it whenever he reloads the app. If you need some kind of a lightweight message storage, you can think about local storage on the web browser. The messages could be stored locally and you would not need to worry about that in the backend. Otherwise, if you come to need to store the messages, then I think a nosql DB would be good for that, since you would just store blobs with a user id and message id. As you said, Elastic would be a good fit for that.
To answer your questions:

*

*Is solved by extracting storage to a cache.

*Difficult to say, you would need to just monitor the Azure services. However, since you could make the app scalable, you should be able to act on it once the limit is reached.

*As mentioned previously, up to you how the app wants to behave, but if you need some kind of storage, either localstorage on the client side or some kind of nosql database would fit this purpose.

*Load balancing should be available in Azure and you would just need to pick some kind of strategy to balance the load.


text:
Q: Generalizations of Sard-Smale Theorem Sard-Smale theorem holds for Fredholm maps $f:M\rightarrow B$ between separable Banach manifolds $M,N$. There are some constrains relating the Fredholm index $\operatorname{ind}(f)$ of $f$ to its differentiablity class. More precisely, we need to require $f\in C^{r}$, where $r>\max{(\operatorname{ind}(f),0)}$.
I would like to know what are the generalizations of this theorem into two directions:

*

*assuming weaker regularity on $f$;

*assuming weaker structure on the spaces $M,N$.

For instance, I know that the result is valid for bounded Fréchet manifolds in the case where $f$ is Lipchitz (see here). The result is also valid for some domains with empty interior (see here).
I would also like to know if the above (or others) generalizations are maximal, in the sense that there are counterexamples in the case of weaker requirements.
Any help is welcome.
Edit: I posted the question on MathOverflow.


text:
Q: Sign in Azure AD external account I thougt this toggle in Azure would enable for external users to log in:

But when I log in from an external account, I get:
AADSTS50020: User account 'xx@xx.se' from identity provider 'https://sts.windows.net/123123/' does not exist in tenant 'YY' and cannot access the application 'sdfsdfs'(asdasd) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account.
Do I have to manually add single accounts to let them login with Azure? Can't I open up for specific domains or all?

A: If you want users from the other organizations to login your application. There are four simple steps.
1.Update your application registration to be multi-tenant
2.Update your code to send requests to the /common endpoint
3.Update your code to handle multiple issuer values
4.Understand user and admin consent and make appropriate code changes
For more details, you can refer to https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant#update-registration-to-be-multi-tenant


text:
Q: Drawing shape and flicker i'm trying to use MouseMove to redraw the same rectangle in a new position inside the panel it works, but i'm having alot of flicker from Invalidate... i tried Refresh (), but it the same... please help me
this is my code for drawing inside the panel with MouseMove event:
if (panel->BackgroundImage == nullptr)
{
    panel->BackgroundImage = gcnew System::Drawing::Bitmap(panel->Width, panel->Height);
}

Graphics^ buffGraphics = Graphics::FromImage(panel->BackgroundImage);

buffGraphics->Clear(panel->BackColor);
buffGraphics->DrawRectangle(System::Drawing::Pens::Blue,10, 10, 50, 50);

panel->Invalidate();
panel->Update();

A: add onForm load method to your Form and enable double buffering as:
DoubleBuffered = true;

or if you want an alternative way to do that is to go the Form design View
right click on the form and click on Properties then search for the DoubleBuffered
property and set it to true
Also, any drawing should be on Paint event

A: It looks like Graphics->CopyFromScreen() might help


text:
Q: C++ Dlib load_image_dataset issues When loading a set of images using dlibs load_image_dataset as so:
//------------
command_line_parser parser;
parser.parse(argc, argv); //inputs argc, argv as defined by main where argv is an .xml containing all file locations

dlib::array<array2d<rgb_pixel> > images;
std::vector<std::vector<rectangle> > object_locations, ignore;

cout << "Loading image dataset from metadata file " << parser[1] << endl;
ignore = load_image_dataset(images, object_locations, parser[1]);
cout << "Number of images loaded: " << images.size() << endl;
//---------------

I get the following error:
"dlib::array2d<T, mem_manager> &dlib::array2d<T, mem_manager>::operator=(dlib::array2d<T, mem_manager> &) [with T=dlib::rgb_pixel, mem_manager=dlib::default_memory_manager]" (declared at line 320 of "C:\..path-to-dlib...\dlib-18.16\dlib\..\dlib/image_processing/../image_processing/../matrix/../array2d/array2d_kernel.h") is inaccessible

If I try to store an individual image from "images" as so:
//--------
array2d<rgb_pixel> img;
img = images[i];
//-----------

But no error if i just display it:
//------
image_window image_i(images[i], "Image i");
//---------

What is happening and how do I fix it?

A: array2d is non-copyable by design because copying images is expensive and almost always unnecessary.  If you want to move an image around use swap().  If you really need to copy an image then you can use the assign_image() function or you can use matrix objects (which are copyable) to represent images instead of array2d.
But really, don't unnecessarily copy images.


text:
Q: Setting up of a WIFI router I recently changed my ISP. So I have 2 modems one is a ADSL2+ Modem and Router with Wifi ( Beetel 450TC1) and other is a cable modem which has 2 RJ45 ports ( No brand mentioned on the device it's from GTPL ).
On my PC I connect to the PPPoE connection that the ISP made for me and everything works fine. Now I have brought 2 more laptops and I want them also to have internet. Is there any way that I can use the old ADSL's Wi-Fi properties and connect all 3 to the internet at the same time?
The old ADSL modem has 4 RJ45 port and 1 RJ11 port and Wifi on it.

A: You should be able to plug your cable modem Network-Out into one of the LAN ports of the old modem, connect all of your computers into the old modem, and use the wireless that's built-in.


text:
Q: R: Package IsoGene, IsoPlot title error I am using the IsoGene CRAN package, but when using the function IsoPlot, I do not seem to be able to change the title of the plots.
I am just trying to reproduce Figure 3 of this paper. This is the code:
library(affy)
library(IsoGene)
data(dopamine)
express <- data.frame(exprs(dopamine))
dose <- pData(dopamine)$dose

IsoPlot(dose,express[56,],type="ordinal", add.curve=TRUE)

The image they show in the paper for this code is this:

However, I obtain this, which might be a bug in the package:

You see the Gene name does not appear, and I have no way of showing it, cause IsoPlot would not accept the "main" parameter.
So anyone has a clue of how to change the title of IsoPlot, or at least just make it show the gene name properly like their example in their paper?
Thanks!

A: If you look at the function code (by typing IsoPlot in the console), you can see that the last line of the function is:
title(paste("Gene: ", row.names(y), sep = ""))

which ought to give you the desired title, since row.names(express[56,]) returns 256_at.
However, if you look at the very first line of the function body, you'll see this:
y <- as.numeric(y)

this converts the y argument of IsoPlot to a numeric vector, stripping off the row name in the process. Thus, when it comes time to add the title at the end, row.name(y) is equal to NULL and nothing gets printed. So I would agree this is a bug. You can file a bug report to let the package author know, and hopefully they will correct it.
For now, as a workaround, you can modify the function. To do this, copy the function code from the console and paste it into an R script. Then give the function a name, so that the first line of the function looks something like this:
myIsoPlot = function (x, y, type = c("continuous", "ordinal"), add.curve = FALSE) {

Add this as the first line of the function (before y <- as.numeric(y)):
my_title = row.names(y)

Change the last line of the function to this:
title(paste("Gene: ", my_title, sep = ""))

Now load the function and then run it:
myIsoPlot(dose, express[56,], type="ordinal", add.curve=TRUE)

Here's a bit of a hack if you don't want to modify the function: You can "cover" the default title with a white rectangle and then add your own title. But you need to place the white rectangle by hand (you could write code to automate it, but it's probably more work than just modifying the IsoPlot function):
IsoPlot(dose, y=express[56,], type="ordinal", add.curve=TRUE)

# White rectangle to cover default title
rect(0, 11, 10, 15, xpd=TRUE, col="white", border="white")

# New title
title(paste("Gene:", row.names(express[56,])))


text:
Q: How to Add Page Template from Plugin without Losing $this Background
I am trying to add page templates from inside of a plugin. For this question, I have trimmed my code down into a test plugin which has two files, the PHP main plugin file, and a PHP template file.
wp-plugins/test-plugin/test-plugin.php
wp-plugins/test-plugin/templates/test-template.php
The plugin has two pieces. First off, I tap into the template_include filter, and I return the path to the template file (test-template.php).
Next, I have a new extension of Walker_Page, called Walker_Page_New in this example. In the file, it is a word for word copy of Walker_Page.
Current Code
test-plugin.php
<?php

/**
 * Plugin Name: Test Plugin
 * Version: 1.0
 * Author: Andy Mercer
 * Author URI: http://www.andymercer.net
 * License: GPL2
 */

add_filter( 'template_include', 'test_get_template' );

function test_get_template( $template ) {

    $template_path = plugin_dir_path( __FILE__ ) . 'templates/test-template.php';

    if ( file_exists( $template_path ) ) {

        $template = $template_path;

    }

    return $template;

}

class Walker_Page_New extends Walker_Page {

    // THE CODE IN HERE IS AN EXACT COPY OF WALKER_PAGE

    // I AM NOT ENTERING IT ALL IN THIS QUESTION BECAUSE IT'S A COUPLE HUNDRED LINES OF CODE

}

test-template.php
<!DOCTYPE HTML>

        ...head stuff...

        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

            <?php $ancestors = get_ancestors( get_the_ID(), 'page' );
            wp_list_pages([
                'title_li' => '',
                'sort_column' => 'menu_order',
                'child_of' => $ancestors[0],
                'depth' => 2,
                'walker' => 'Walker_Page_New',
            ]); ?>

            <?php the_title(); ?>
            <?php the_content() ?>

        <?php endwhile; endif; ?>
        <?php wp_footer(); ?>

Problem
When I then load the page, I only get this error:

Fatal error: Uncaught Error: Using $this when not in object context in C:...\wp-includes\class-wp-walker.php:199

What is triggering this error is the call to wp_list_pages() with a custom Walker. When I remove the Walker, I am fine and everything works as expected.
Research
From looking around, the only specific mention of this I have found is semi-related here: https://github.com/Automattic/amp-wp/issues/412#issuecomment-240871878, where it's stated that using template_include will cause this:

e.g. we would no longer have the $this context in the templates

Question
Is it expected that using template_include will break stuff? Should I use template_redirect instead?

A: WordPress has no concept of passing explicit context to templates. When template is loaded by it several globals will be made explicitly available, but even that is borderline irrelevant.
Overall you have to deal with global scope inside WP templates, one way or another. Approaches vary and in the end it is up to you. Typical solutions can be:

*

*creating your own globals;

*adding your extra data to native WP globals;

*creating functions/methods to access your context.

A: Your walker argument in wp_list_pages should be an instance, not a string.
'walker' => new Walker_Page_New()


text:
Q: file synchronization between two open-e storage servers i am currently trying to find a solution to synchronize two storage servers both running open-e dss 6.

*

*i need only one-way synchronization (storage A -> storage B)

*my volume is 30TB in size, therefore dss' replication will not work (at least afaik it only supports volumes up to 16TB)

*there are about 1.000.000 files to synchronize

i've tried with rsync but things got very, very slow with a million files.
i have no clue if there are any better solutions for this problem, so any help would be very much appreciated!

A: You could potentially use something like DRBD to handle the replication.


text:
Q: GRE topology definition So on a certain GRE subject problem they define for a given a subset $Y$ of a topological space $X$
$$Y' = \{x \in X : x \in \text{cl}(Y \setminus \{x\})\}$$
Where $\text{cl}$ is closure. Is this just a fancy definition for the set of limit points of $Y$
Thanks!

A: Yes.  This is known as the derived set, and is typically denoted with a 'prime'.
If the space is $T_1$, one can say that $Y'$ consists in those points $x $ for which there exists a non-trivial net in $Y $ converging to $x $.
A net is a generalization of a sequence.

A: Yes, this is clear after you know that $\operatorname{cl}(Y)= \{x \in X: \forall O \text{ open }: (x \in O) \to (O \cap Y \neq \emptyset) \}$ for all $Y \subseteq X$ the closure of $Y$ is the set of points $x$ such that each (open) neighbourhood of $x$ intersects $Y$. A limit point of $Y$ is the same except that each neighbourhood of $x$ must contain a point of $Y$ different from $x$ itself, which in fact says that $x$ is in the closure of $Y\setminus \{x\}$.


text:
Q: Probability: 2 random numbers such that $x > 2y$ This is probably an easy one, but I'm new to probability and really don't know how to solve this question.
Select two numbers randomly from interval $[0, 1]$ call them $x$ and $y$, what is the
probability that $x$, (the first number) is greater that $2y$ ?

A: Hint: Draw the part $T$ of the square $[0,1]\times[0,1]$ defined by the inequation $x\gt2y$. (Sub-hint: $T$ is a triangle.) Measure the area of $T$. Conclude.

A: $T$ is the shaded part of this picture:

$x>2y$ is the portion of the rectangle with $(x,y)$ coordinates below the line $y=\frac{1}{2}x$

A: If $y = t$, then valid $x$ points are located above the ${x}\gt{2t}$ (see yellow area in image).  Probability is the contents of the yellow triangle(${{{{1}\over{2}}\cdot{1}}\over{2}}$) divided by the contents of the entire square (${1}\cdot{1}$).
So the value being queried:  $$p(x > 2y) = {{1}\over{4}}$$


text:
Q: Android application crashes unexpectedly while executing catch block I am new in Android and I'm not getting why it is happening.
In my database I am using rollno as primary key.
This code works perfectly and inserts data into database but when i try to insert data with roll number that is already present in the database it should give message that "Data already present",but it crashes unexpectedly.
if (v.getId()==R.id.b1) {
    int rollno,marks;
    String name,m1,rno;
    rno=t1.getText().toString();
    name=t2.getText().toString();
    m1=t3.getText().toString();
    rollno=Integer.parseInt(rno);
    marks=Integer.parseInt(m1);

    try {
        db.execSQL("insert into stud values('" + rollno + "','" + name + "','" + marks + "');");
        Toast.makeText(getApplicationContext(), "Data saved", Toast.LENGTH_LONG).show();
    } catch(Exception e) {
        Toast.makeText(getApplicationContext(), "Data already present", Toast.LENGTH_LONG).show();
    }
}

Logcat
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*cf+(
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*fa88
W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*fa88
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+)(+/(
W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+)(+/(
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*cf+(
W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
D/dalvikvm﹕ GC_CONCURRENT freed 333K, 11% free 9617K/10695K, paused 14ms+4ms, total 72ms
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*cf+(
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*fa88
W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+*fa88
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+)(+/(
W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
D/SensorManager﹕ unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+)(+/(
D/Sensors﹕ Remain listener = Sending .. normal delay 200ms
I/Sensors﹕ sendDelay --- 200000000
D/SensorManager﹕ JNI - sendDelay
I/SensorManager﹕ Set normal delay = true
W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection
D/SensorManager﹕ registerListener :: handle = 4  name= BMA222 3-axis Accelerometer delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)+-+88(
D/AndroidRuntime﹕ Shutting down VM
W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x419222a0)
E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NumberFormatException: Invalid int: ""
            at java.lang.Integer.invalidInt(Integer.java:138)
            at java.lang.Integer.parseInt(Integer.java:359)
            at java.lang.Integer.parseInt(Integer.java:332)
            at com.example.raju.myapp1.MyActivity.onClick(MyActivity.java:111)
            at android.view.View.performClick(View.java:4162)
            at android.view.View$PerformClick.run(View.java:17082)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4856)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
            at dalvik.system.NativeStart.main(Native Method)

A: The first argument of makeText method has to be either Activity or Application.
Use the reference to your Activity object as a first argument to makeText method.

A: You are expecting that this Exception will be caught by the catch block but that's what actually not happening

I am guessing that the rollNo field in your database is specified as a primary key ,and when  you try to reinsert the same roll number again then this SQLITE exception arises. So you need to check before inserting any record in the database that whether that particular roll number is present there or not.
I am going to give you some pseudo code
rollnumber=enteredRolNumber

if(enteredRollNumberisInDatabase)
{
   //No insertion and a message that this roll number already exists
}
else
{
   //Do your insertion here
}

And in your code,There is no check like this,you are doing it like
 try {
            db.execSQL("insert into stud values('" + rollno + "','" + name + "','" + marks + "');");
            Toast.makeText(getApplicationContext(), "Data saved", Toast.LENGTH_LONG).show();
        }
        catch(Exception e)
        {
            Toast.makeText(getApplicationContext(), "Data already present", Toast.LENGTH_LONG).show();

        }


text:
Q: Auto-resizing NSScrollView that wraps an NSTextView How do I tell an NSScrollView that wraps an NSTextView to grow with the NSTextView until a maximum?
== In more details:
The UI is common in many messanger/chat app. Initially, the NSTextView is empty and has just enough height to show one line of text. The NSScrollView is just enough to fit the NSTextView. As the user type in more text, the NSScrollView should grow along with the NSTextView, until reaching a maximum height, then start showing the vertical scroll bar.

A: Observe NSTextStorageDidProcessEditingNotification on the text storage of the text view. Then call usedRectForTextContainer on the layout manager to determine how large the text is for the view's text container.
You may also need to add extraLineFragmentRect to it, I'm not sure. That's also available from the layout manager.


text:
Q: Use three transformations (average, max, min) of pretrained embeddings to a single output layer in Pytorch I have developed a trivial Feed Forward neural network with Pytorch.
The neural network uses GloVe pre-trained embeddings in a freezed nn.Embeddings layer.
Next, the embedding layer splits into three embeddings. Each split is a different transformation applied to the initial embedding layer. Then the embeddings layer feed three nn.Linear layers. And finally I have a single output layer for a binary classification target.
The shape of the embedding tensor is [64,150,50]
-> 64: sentences in the batch,
-> 150: words per sentence,
-> 50: vector-size of a single word (pre-trained GloVe vector)
So after the transformation, the embedding layer splits into three layers with shape [64,50], where 50 = either the torch.mean(),  torch.max() or torch.min() of the 150 words per sentence.
My questions are:

*

*How could I feed the output layer from three different nn.Linear layers to predict a single target value [0,1].

*Is this efficient and helpful to the total predictive power of the model? Or just selecting the average of the embeddings is sufficient and no improvement will be observed.
The forward() method of my PyTorch model is:
  def forward(self, text):

    embedded = self.embedding(text)
    if self.use_pretrained_embeddings:
      embedded_average = torch.mean(embedded, dim=1)
      embedded_max = torch.max(embedded, dim=1)[0]
      embedded_min = torch.min(embedded, dim=1)[0]
    else:
      embedded = self.flatten_layer(embedded)

    input_layer = self.input_layer(embedded_average) #each Linear layer has the same value of hidden unit
    input_layer = self.activation(input_layer)

    input_layer_max = self.input_layer(embedded_max)
    input_layer_max = self.activation(input_layer_max)

    input_layer_min = self.input_layer(embedded_min)
    input_layer_min = self.activation(input_layer_min)

    #What should I do here? to exploit the weights of the 3 hidden layers
    output_layer = self.output_layer(input_layer)
    output_layer = self.activation_output(output_layer) #Sigmoid()

    return output_layer

After the proposed answer the function is:
  def forward(self, text):

    embedded = self.embedding(text)
    if self.use_pretrained_embeddings:
      embedded_average = torch.mean(embedded, dim=1)
      embedded_max = torch.max(embedded, dim=1)[0]
      embedded_min = torch.min(embedded, dim=1)[0]

      #use of average embeddings transformation
      input_layer_average = self.input_layer(embedded_average)
      input_layer_average = self.activation(input_layer_average)

      #use of max embeddings transformation
      input_layer_max = self.input_layer(embedded_max)
      input_layer_max = self.activation(input_layer_max)

      #use of min embeddings transformation
      input_layer_min = self.input_layer(embedded_min)
      input_layer_min = self.activation(input_layer_min)

    else:
      embedded = self.flatten_layer(embedded)

    input_layer = torch.concat([input_layer_average, input_layer_max, input_layer_min], dim=1)
    input_layer = self.activation(input_layer)

    print("3",input_layer.shape) #[192,1] vs [64,1] -> output layer

    if self.n_layers !=0:
      for layer in self.layers:
          input_layer = layer(input_layer)

    output_layer = self.output_layer(input_layer)
    output_layer = self.activation_output(output_layer)

    return output_layer

This generates the following error:

ValueError: Using a target size (torch.Size([64, 1])) that is different to the input size (torch.Size([192, 1])) is deprecated. Please ensure they have the same size.

Expected outcome since the concatenated layer is 3x the size of the sentences (64). Any fix that could resolve it?

A: Regarding 1: You can use torch.concat to concatenate the outputs along the appropriate dimension, and then e.g. map them to a single output using another linear layer.
Regarding 2: You will have to try it yourself and see whether this is useful.


text:
Q: GET form  not redirecting,  not passing kwarg If I use a button in the get form it doesn't redirect to the search page using the kwarg, if I use a  it redirects but passes an empty object.
Trying to write a function that filters my model objects based on a parameter set through a form.
User selects a project engineer and only sees projects that they're assigned to.
I'm somewhat new to django. Just trying to make a user controlled filter... I'm not getting any error messages.
This is my template
{% extends 'projects/base.html' %}

{% block content %}

    <form method="GET">
    <button href="{% url 'project_search' project_engineer=project_engineer %}" class="save btn btn-default">Search by Project Engineer</button>
    <select name="project_engineer">

    {% for pe in pe_list %}
            <option value="{{ pe }}">{{ pe }}</option>
    {% endfor %}
    </select>

    </form>

    {% for post in posts %}

{{ post.name }}

{{ post.description|linebreaksbr }}

Project Engineer: {{ post.project_engineer|linebreaksbr }}

Last Modified: {{ post.published_date }}

    {% endfor %}
{% endblock %}

This is my views
def project_list(request):
    posts = Project.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
    pe_list=["all"]
    for x in range(0, len(posts)):
        if posts[x].project_engineer not in pe_list:
             pe_list.append(posts[x].project_engineer)
    return render(request, 'projects/project_list.html', {'posts': posts, 'pe_list': pe_list})

def project_search(request, project_engineer):
    variable_column = 'project_engineer'
    search_type = 'contains'
    filter = variable_column + '__' + search_type
    posts_all = Project.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
    posts = Project.objects.filter(**{ filter: project_engineer }).order_by('published_date')
    pe_list=["all"]
    for x in range(0, len(posts_all)):
        if posts_all[x].project_engineer not in pe_list:
             pe_list.append(posts_all[x].project_engineer)
    return render(request, 'projects/project_list.html', {'posts': posts, 'pe_list': pe_list})

urls.py
url(r'^(?P<project_engineer>.*)/$', views.project_search, name='project_search'),


text:
Q: How to handle Unhandled exceptions in c# using TryParse if (response.ToLower() == "addition")
{
Console.Write("Enter a number: ");
double num1 = double.Parse(Console.ReadLine());
Console.Write("Enter another number: ");
double num2 = double.Parse(Console.ReadLine());
double addition = (num1) + (num2);
Console.WriteLine("The answer is {0}", addition);
if(!double.TryParse (num1, out addition))
     {
      Console.WriteLine("Try Again");
      tryAgain = true;
     }

I tried to use try parse to handle my unhandled exception and make the user go back and do it again if they dont input a number/ integer/ decimal. I am new to try parse and dont know how to use it properly, So i would like to ask for a way in which i could handle exceptions in the future as well

Here's an inline link to replit(https://replit.com/@NitikPaudel/Maths-Calculator-Upgraded#main.cs)

A: I'd try something like below:
    if (response.ToLower() == "addition")
    {
    double num1;
    double num2;
    Console.Write("Enter a number: ");
    if(!double.TryParse(Console.ReadLine().ToString(),num1)){
       Console.WriteLine("Try Again");
          tryAgain = true;
    };

    Console.Write("Enter another number: ");
    if(!double.TryParse(Console.ReadLine().ToString(),num2)){
       Console.WriteLine("Try Again");
          tryAgain = true;
    };

    double addition = (num1) + (num2);
    Console.WriteLine("The answer is {0}", addition);
}

Or if you would prefer a try/catch
if (response.ToLower() == "addition")
{
    try{
        Console.Write("Enter a number: ");
        double num1 = double.Parse(Console.ReadLine());
        Console.Write("Enter another number: ");
        double num2 = double.Parse(Console.ReadLine());
        double addition = (num1) + (num2);
        Console.WriteLine("The answer is {0}", addition);
    }
    catch(Exception e){
        Console.WriteLine("Try Again");
        tryAgain = true;
    }
}

A: The function TryParse is here to check if a value can be converted and to prevent the exception before it is thrown.
To handle exceptions, you can use try catch, example:
try {
    // do the work
}
catch (Exception ex) {
    // work with exception
}

View this documentation: https://www.tutorialsteacher.com/csharp/csharp-exception-handling


text:
Q: How to get contact's "FreeBusyStatus" in Microsoft Outlook using REST Api?
See above mentioned image, it gives different status but don't know how to get it.
Check Outlook API.
Thanks in advance :-)

A: You can use GET https://outlook.office.com/api/v2.0/me/events/{event_id}?$select=ShowAs to retrieve the FreeBusyStatus of attendee(yourself) for a particular meeting, the return type is something like below,

If you want to check the response from a particular attendee, use GET https://outlook.office.com/api/v2.0/me/events/{event_id}?$select=ShowAs,Attendees, and check on the "Response" from the "Status" response.

A: This enumeration is used for 'Specifies the availability status of an attendee for a meeting.' At present, the Office 365 REST API  is not able to retrieve the contacts' meetings status. And you can submit the feedback from here if you want to the Office 365 REST to support this feature.
We are able to add other's users' calendar manually, then we could see the status of the appoint/meet of him/her. Here is an figure that show the others calendar for your reference:

If you want to retrieve the free/busy information of EWS is a possible workaround. Please refer to here for more detail. And if you require these information to schedule a meeting, you can try to use the Find meeting times (preview).


text:
Q: Parallel while loop in C# I try to write BBS-generator. But this generator is too slow. So I need to parallel while. But i did not how do it. Please help me:).
 public static List<BigInteger> GenerateFullCycle(long N, long x0)
{
              List<BigInteger> randomNumbers = new List<BigInteger>();
              var bbs = new BBS_generator(N, x0);
              BigInteger rvalue = bbs.Generate();
              while(randomNumbers.Contains(rvalue) == false)
              {
                randomNumbers.Add(rvalue);
                rvalue = bbs.Generate();
              }
              return randomNumbers;
       }

A: You might want to look into improving your algorithm first. How large does the randomNumbers list get? Contains is pretty slow on larger lists. You might want to use a HashSet instead.
BBS is slow, as simple as that. Using BigInteger really doesn't help at all - also quite slow.
Apart from that, there is no way to parallelize this code. The second iteration on the loop depends on the first, the third on the second etc.. You can parallelize the GenerateFullCycle calls themselves, but that's about it.
Parallelization isn't a solve-it-all thing. Many things aren't parallelizable at all - and how much do you get by parallelization? Twice faster? Even if you managed to completely separate and run at 100% efficiency, a 4-core CPU still only means you're four times as fast. True, it does have its applications, but I fail to see how it could help a BBS generator.
And the number one rule of performance tweaking - profile. Where is your application actually spending time?

A: Maybe you can use something like a Background Worker:
http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx


text:
Q: Real performance gain from faster IDE or SATA hard drive? How much of a real-world performance gain would you expect from:

*

*replacing a 5400rpm IDE HD with a 7200rpm IDE HD?

*replacing a 5400rpm IDE HD with a SATA-150?
It's assumed that the drive in question is both the system drive and the only drive. A modest AMD Sempron-based home computer with adequate DDR memory running Windows XP Home SP3.
Thanks for looking.

A: In both cases there will definitely be performance gains to see from either. Hard drive performance is a function of a few things, such as:

*

*Drive bus type (IDE ATA66/100/133, SATA150/300/60, SCSI, FC, etc. Affects the upper bound maximum speed, and burst speed from the drive's cache)

*Drive rotational speed (Affects sequential read and write speeds and seek latencies. Faster platters = R/W head gets from point A to B that much quicker.)

*Drive size (The larger a drive, the greater the density of data per square inch, so read/write speeds are that much faster.)

*Number of platters (The fewer platters there are, the greater density (again). Also, noise, heat, and power consumption tend to be lower for a drive that only has to spool up one metal disk instead of five.)

*Drive firmware revisions (Any gains from these would pale in comparison to changes in the above, but for conciseness's sake, it's possibly a factor.)

Today's 1TB+ 7200 RPM hard drives are quite capable of outperforming older 10KRPM server hard drives simply due to the incredible amount of data flying under the drive read/write heads every rotation. Additionally, the price per GB sweet spot lives up in the highest capacity drives.
I believe that at the time of this writing, the greatest platter density is about 500 GB/in^2, which Samsung uses in their Spinpoint drives. These manage enough read/write throughput to actually saturate an ATA133 connection (finally!), so a 1TB+ drive might be choked a little under a SATA150 connection for bursty reads form the disk cache.
Either way I would definitely suggest grabbing a ~$100 USD 1.5 TB drive and connecting it via SATA150. SATA also has the bonus of being the cheaper interface, at the moment; equivalently sized IDE drives tend to carry a bit of a price premium now for being the older, deprecated technology.

A: I would expect bigger performance boost when moving from 5400 to 7200 rpm. SATA gives you performance boost only if interface is bottleneck. In case of 5400 rpm drives, interface is not your problem.
To make it shorter. You will benefit from 7200 rpm drive more.

A: Don't expect anything. Hard disks are ancient things. Mechanical tech that does not belong in an electronical device, switch to SSD.


text:
Q: how to plot probability histogram in ggplot2 I want to plot a probability histogram overlay with probability curve and compare them between two group.
my code is as following,
ggplot(MDmedianall, aes(x= MD_median, y=..density.., fill =IDH.type )) +
 geom_histogram(alpha = 0.5,binwidth = 0.00010,  position = 'identity') +
 geom_density( stat="density", position="identity", alpha=0.3 ) +
 scale_fill_discrete(breaks=c("0","1"), labels=c("IDH wild type","IDH mutant type")) +
 scale_y_continuous(labels = scales :: percent) +
 ylab("Relative cumulative frequency(%)") +
 xlab("MD median value")

However, the y axis is not what I want, any reasons for that?
BTW, how to change the line style and label them within the color square on the right.


text:
Q: How to get InnoDB table index size on a replica running MariaDB 5.5? I tried adapting a solution for MySQL, but it turns out information_schema.innodb_table_stats is empty. SHOW INDEX FROM schema_name.table_name doesn't cut it, by only showing cardinality.

A: mysql.innodb_table_stats is not available until MySQL 5.6 and MariaDB 10.0.  Before that...
SHOW TABLE STATUS LIKE 'tablename';

will provide Data_length, which is the amount of space taken by all indexes except the PRIMARY KEY (in the case of InnoDB).  There was no way to get the sizes of individual secondary indexes.  The PK is "clustered" with the data, so there is really very little space taken in addition to the data.
It is general inadvisable to have a Slave running an older version than the Master, if that is what you are doing.
What are you really looking for?


text:
Q: Why less gauge fixing conditions in Faddeev Popov method? According to Dirac theory of constraints systems, to study the dynamics of gauge invariant observables, we can fix the gauge freedom by fixing it using gauge fixing conditions which are equal to number of first class constraints (even though independent parameters of gauge transformation is equal to number of primary first class constraints). So why is the case that in Yang-Mills theory we have two first class constraints but we use only one gauge fixing condition like axial gauge or Lorenz gauge in Faddeev-Popov method?
According to Rothe and Rothe book, phase space path integral for constraint systems is
$$Z = \int dqdp \Pi_{t, r}\delta(\phi^{1}_{r})\Pi_{t, r}\delta(\xi_{r})\det\{\xi_{\alpha}, \phi^{1}_{\beta}\}\exp\left\{\int dt(qp - H_{0})\right\}$$
(we can also extend this to second-class constraints using Senjanovic path integrals)
Should we not need two gauge fixing conditions with property that Poisson bracket with gauge fixing conditions and first class constraints matrix is non-singular i.e. $\det\{\xi_{\alpha}, \phi^{1}_{\beta}\}=0$ so that we can use above path integral.
I am unable to find where my reasoning is going wrong with this.

A: First, some clarifications.

*

*It does not make sense to talk about "primary first class constraints." You refer to "primary" and "secondary" constraints while going through the Dirac procedure. After the procedure terminates, there is no distinction between primary and secondary constraints; indeed the difference depends on how you do the calculation (for example, all constraints are "primary" if you start with the full Hamiltonian with all necessary constraints included). It is only at this point, after having derived the full set of constraints, that one can distinguish between first class and second class constraints. In other words: before you know all the constraints, you don't know whether a given Poisson bracket vanishes on the constraint surface, so you can't say whether a constraint is first or second class.

*$SU(N)$ Yang-Mills theory has $N^2-1$ first class constraints (ie, the number of generators of the $SU(N)$ algebra), not 2.
With that in mind... fixing Lorentz gauge for Yang-Mills $\partial_\mu A^\mu_a=0$ does in fact impose a set of $N^2-1$ constraints on the $N^2-1$ gauge fields $A_\mu^a$. This makes sense, since there is one gauge field per generator, and one first class constraint per generator.
The counting isn't quite enough though as there is still a residual gauge symmetry even after fixing Lorentz gauge. One way to phrase the problem is that there is a pure-gauge longitudinal mode, which does not decouple from the other degrees of freedom even after fixing Lorentz gauge. Keeping track of how this pure gauge degree of freedom drops out of physical observables in a systematic way requires heavy machinery, such as BRST symmetry.


text:
Q: Wrong matrix output when writing on csv file only for the first line [C] I am writing a program that takes as input from the user names and answers associated for every candidate and print them on a .csv file as follow:
name, answer A, answer B,..., answer Z.
every name is stored in a matrix called nome_cognome;
every answer is stored in a matrix called matrice_risposte;
For some kind of reason I ignore, the program prints the wrong answer only for the last one of the first candidate (the "Z" question). Any other candidate has all the answers reported correctly.
what i tried to do:
I debugged the program for 5 days without understanding the reason behind the problem. I searched the web for similar issues, i tried to modify the code, but i cannot solve it.
I usually write on forums as my last chance, if i cannot find any kind of solution.
I make the user checks if the inserted answers are correct for every candidate before proceeding with the next one. When printing the answers on screen, they are reported correctly. When printing on file it happens as described.
The following image clearly show what i am talking about

I typed for Paul all the answers as 1, while for marie i typed all the answers as 2.
The code shows the section where the program writes on the csv file (it is created).
FILE *file_risultati; //apertura file di testo
strcat(corso,".csv");
file_risultati=fopen(corso, "w");

for (j=0;j<iscritti;j++){

    p=0;
    while(nome_cognome[j][p]!='\n')
    {
    fprintf(file_risultati,"%c", nome_cognome[j][p]);
    p=p+1;
    }
    fprintf(file_risultati,",");

    for(i=0; i<22; i++)
    {
        fprintf(file_risultati,"%d,", matrice_risposte[j][i]);
    }
    if(j != (iscritti-1)){
        fprintf(file_risultati,"\n");
    }
}
    fclose(file_risultati); //chiusura file di testo

The following code is the complete program so you can check it all and verify what i said.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char corso[100];
char acquisizione_nome [40];
char domande[]= "ABCDEFGHIJLMNOPQRSTUVZ";
int iscritti;
int risposta;

int i;
int j;
int k=1;
int p;

// variabili variazione risposta

int modifica_risposta = 1;
int risposta_precedente;
char risposta_modificata;
char domande_min[]="abcdefghijlmnopqrstuvz";

int main()
{
    printf("Program written by Gianluca Gregnol\n\n");
    printf("Raccolta del fabbisogno formativo\n\n");
    printf("Digitare il corso di interesse: ");
    gets(corso);
    printf("Digitare numero di iscritti al corso: ");
    scanf("%d", &iscritti);

    char nome_cognome[iscritti][40];
    int matrice_risposte[iscritti][21];

    // processo di inserimento votazioni //
    for (k=0;k <(iscritti);k++)
    {
        printf("\n iscritto ");
        printf("%d \n\n", k+1);
        printf("nome e cognome: ");
        fflush(stdin);
        fgets(acquisizione_nome,40,stdin);

        for (i=0; i<40; i++)
        {
            nome_cognome[k][i]= acquisizione_nome[i];
        }

        for (i=0; i<22; i++)
        {
            printf("\nvoto della domanda ");
            printf("%c: ", domande[i]);
            scanf("%d", &risposta);

            while (risposta<0 || risposta>3)
            {
                printf("\n VOTO NON VALIDO!\n i voti validi sono: 0,1,2,3\n inserire nuovamente il voto per la domanda ");
                printf("%c:", domande[i]);
                fflush(stdin);
                scanf("%d", &risposta);
            }
            matrice_risposte[k][i]=risposta;

        }

//stampa le risposte attuali per permetterne il controllo
        printf("\nLe risposte attualmente inserite sono: \n");

        for (i=0; i<22; i++)
        {
            printf("%c  ", domande[i]);
        }
        printf("\n");

        for (i=0; i<22; i++)
        {
            printf("%d  ", matrice_risposte[k][i]);
        }

        printf("\nDesideri modificare delle risposte? \n No = 0 \n Si = 1 \n");
        printf("Risposta: ");
        fflush(stdin);
        scanf("%d", &modifica_risposta);

// controlla se l'utente vuole cambiare delle risposte
        while(modifica_risposta == 1){

            printf("\n\nQuale risposta vuoi modificare?\n");
            printf("Risposta: ");
            fflush(stdin);
            scanf("%c", &risposta_modificata);

            for(i=0; i<22; i++){

                if(risposta_modificata == domande_min[i] || risposta_modificata == domande[i]){

                printf("\nIndica il nuovo valore della domanda %c: ", domande[i]);
                fflush(stdin);
                scanf("%d", &risposta);
                while (risposta < 0 || risposta > 3)
                {
                    printf("\n VOTO NON VALIDO!\n i voti validi sono: 0,1,2,3\n inserire nuovamente il voto per la domanda ");
                    printf("%c:", domande[i]);
                    fflush(stdin);
                    scanf("%d", &risposta);
                }
                risposta_precedente = matrice_risposte[k][i] ;
                matrice_risposte[k][i] = risposta;

                printf(" -- Risposta modificata correttamente --\n\n");

                }
            }

            printf("\nDesideri modificare delle risposte? \n No = 0 \n Si = 1 \n");
            printf("Risposta: ");
            fflush(stdin);
            scanf("%d", &modifica_risposta);

        } //main  while

    }

// processo scrittura su file

    FILE *file_risultati; //apertura file di testo
    strcat(corso,".csv");
    file_risultati=fopen(corso, "w");

    for (j=0;j<iscritti;j++){

        p=0;
        while(nome_cognome[j][p]!='\n')
        {
        fprintf(file_risultati,"%c", nome_cognome[j][p]);
        p=p+1;
        }
        fprintf(file_risultati,",");

        for(i=0; i<22; i++)
        {
            fprintf(file_risultati,"%d,", matrice_risposte[j][i]);
        }
        if(j != (iscritti-1)){
            fprintf(file_risultati,"\n");
        }
    }
        fclose(file_risultati); //chiusura file di testo

        return 0;
}

A: Short answer:
in line 32:
int matrice_risposte[iscritti][21];

change 21 to 22
Explanation:
I noticed (from the attached picture) you have 22 questions but declared a 21 element array. In most languages multi-dimensional arrays are implemented by serialization. So matrice_risposte[1][22] is actually matrice_risposte[2][0]. You did not notice the bug because you first print the results then overwrite the last result with next round of input.


text:
Q: How to do an incremental build with distutils in python 2.7? I am using Python 2.7 distutils to build a C++ library. However every time I issue the build command with
python setup.py build

all object files are built again, even though the c++-file did not change.
A friend of mine told me that this would not be the case for Python 2.6.
My questions to this board:

*

*Is there a way to force distutils to incrementally build the code?

*If it is not possible to incrementally build the code,
2.1. is there a way to use Python 2.6 distutils or
2.2. is it possible to alter the Python 2.7 distuils package?

A: You can't do that.  Compiled .o files were reused in a simplistic and buggy way, so this optimization was removed in 2.7.  See http://bugs.python.org/issue5372 for details.

A: I don't know if this solves your exact problem, but I have had a similar issue that I fixed by the following method:
I have a relatively large C++ package with a python wrapper based on cython.  What I ended up doing was compiling the package to a static library using CMake (which does incremental builds), and then linking in the static library with the cython wrapper - which is pretty stable, though it is recompiled every time for safety's sake.  My setup.py is hacked in order to accept some flags that tell CMake what to do.
The relevant snippet from my setup.py that deals with the CMake part (https://github.com/CoolProp/CoolProp/blob/master/wrappers/Python/setup.py) looks like:
# ******************************
#       CMAKE OPTIONS
# ******************************

# Example using CMake to build static library:
# python setup.py install --cmake-compiler vc9 --cmake-bitness 64

if '--cmake-compiler' in sys.argv:
    i = sys.argv.index('--cmake-compiler')
    sys.argv.pop(i)
    cmake_compiler = sys.argv.pop(i)
else:
    cmake_compiler = ''

if '--cmake-bitness' in sys.argv:
    i = sys.argv.index('--cmake-bitness')
    sys.argv.pop(i)
    cmake_bitness = sys.argv.pop(i)
else:
    cmake_bitness = ''

USING_CMAKE = cmake_compiler or cmake_bitness

cmake_config_args = []
cmake_build_args = ['--config','"Release"']
STATIC_LIBRARY_BUILT = False
if USING_CMAKE:

    # Always force build since any changes in the C++ files will not force a rebuild
    touch('CoolProp/CoolProp.pyx')

    if 'clean' in sys.argv:
        if os.path.exists('cmake_build'):
            print('removing cmake_build folder...')
            shutil.rmtree('cmake_build')
            print('removed.')

    if cmake_compiler == 'vc9':
        if cmake_bitness == '32':
            generator = ['-G','"Visual Studio 9 2008"']
        elif cmake_bitness == '64':
            generator = ['-G','"Visual Studio 9 2008 Win64"']
        else:
            raise ValueError('cmake_bitness must be either 32 or 64; got ' + cmake_bitness)
    elif cmake_compiler == 'vc10':
        if cmake_bitness == '32':
            generator = ['-G','"Visual Studio 10 2010"']
        elif cmake_bitness == '64':
            generator = ['-G','"Visual Studio 10 2010 Win64"']
        else:
            raise ValueError('cmake_bitness must be either 32 or 64; got ' + cmake_bitness)
    else:
        raise ValueError('cmake_compiler [' + cmake_compiler + '] is invalid')

    cmake_build_dir = os.path.join('cmake_build', '{compiler}-{bitness}bit'.format(compiler=cmake_compiler, bitness=cmake_bitness))
    if not os.path.exists(cmake_build_dir):
        os.makedirs(cmake_build_dir)
    subprocess.check_call(' '.join(['cmake','../../../..','-DCOOLPROP_STATIC_LIBRARY=ON']+generator+cmake_config_args), shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd = cmake_build_dir)
    subprocess.check_call(' '.join(['cmake','--build', '.']+cmake_build_args), shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd = cmake_build_dir)

    # Now find the static library that we just built
    if sys.platform == 'win32':
        static_libs = []
        for search_suffix in ['Release/*.lib','Release/*.a', 'Debug/*.lib', 'Debug/*.a']:
            static_libs += glob.glob(os.path.join(cmake_build_dir,search_suffix))

    if len(static_libs) != 1:
        raise ValueError("Found more than one static library using CMake build.  Found: "+str(static_libs))
    else:
        STATIC_LIBRARY_BUILT = True
        static_library_path = os.path.dirname(static_libs[0])


text:
Q: Naked Domain Forwarding Broken on Godaddy with Period Slash Is Godaddy naked domain forwarding broken when you have a ./ in the URL?
I use GoDaddy for DNS and have naked domain forwarding setup. I have my A record @ set to GoDaddy servers, and use their interface to forward all naked domain traffic to www.. This works fine in almost all circumstances, such as:

*

*Working: example.com --> www.example.com

*Working: example.com/foo --> www.example.com/foo

*Working: example.com/123/foo --> www.example.com/123/foo

*Working: example.com/.foo/ --> www.example.com/.foo/
However, when I use a period and then a slash in the naked domain name, forwarding does not work:

*

*Broken: example.com/foo./
Notice that the last working example above differs with the broken example only by the placement of the period.
When I go to the broken URL, instead of being forwarded to the www. page, I get the error message depicted in the screenshot below.  This is an aspx .net error message.  None of my servers use aspx or .net, so I know that this request has not even hit my server. Is this a bug with GoDaddy forwarding?


text:
Q: jenkind build from dockerfile appear docker: Error response from daemon: oci runtime error: container_linux.go:235 When I build the job from my Dockerfile in Jenkins
I got the error like "docker: Error response from daemon: oci runtime error: container_linux.go:235" when the console try to exec the docker images.
My Jenkins is built by Dockerfile. Reference is https://medium.com/@gustavo.guss/jenkins-building-docker-image-and-sending-to-registry-64b84ea45ee9.
FROM jenkins/jenkins:lts
USER root
RUN apt-get update && \
apt-get -y install apt-transport-https \
    ca-certificates \
    curl \
    gnupg2 \
    software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
    $(lsb_release -cs) \
    stable" && \
apt-get update && \
apt-get -y install docker-ce
RUN apt-get install -y docker-ce
RUN usermod -a -G docker jenkins
USER jenkins

My Jenkins output like the below. The error is return after succeed build the images.
Successfully built b9afd9ecb148
docker: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "chdir to cwd (\"/var/jenkins_home/workspace/Integration-Es-Contracts\") set in config.json failed: no such file or directory".
FATAL: Failed to run docker image

A: I found the issue is related to the permissions.

A: I had this problem with a runner inside a Group Runners in GitLab (runners in my computer).
The problem was disk full in that runner.


text:
Q: Devise destroy_session_path not working rails4 i'm new to rails so any help will be much appreciated. I can't seem to figure out what i am doing wrong.
i have successfully set up the GEM devise and i am trying to use to the 'logout route path' which is not working.
Any help will much appreciated. Many thanks
error message in console
railties (4.1.6) lib/rails/application.rb:144:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'

  Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/_trace.html.erb (3.6ms)
  Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/routing_error.html.erb within rescues/layout (27.6ms)

Started GET "/userrs/sign_out" for 127.0.0.1 at 2015-03-28 14:18:13 +0000

ActionController::RoutingError (No route matches [GET] "/userrs/sign_out"):
  web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:22:in `middleware_call'
  web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:13:in `call'
  actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.6) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.6) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.6) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
  actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.6) lib/rails/engine.rb:514:in `call'
  railties (4.1.6) lib/rails/application.rb:144:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
  /Users/ARTLoe/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'

  Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/_trace.html.erb (1.6ms)
  Rendered /Users/ARTLoe/.rvm/gems/ruby-2.1.2/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates/rescues/routing_error.html.erb within rescues/layout (22.9ms)

my schema
ActiveRecord::Schema.define(version: 20150317223638) do

  create_table "userrs", force: true do |t|
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0,  null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string   "current_sign_in_ip"
    t.string   "last_sign_in_ip"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "userrs", ["email"], name: "index_userrs_on_email", unique: true
  add_index "userrs", ["reset_password_token"], name: "index_userrs_on_reset_password_token", unique: true

end

my views

    hi <%= current_userr.email %>
    would you like to <%= link_to 'view your account', recruiters_path %>
    not <%= current_userr.email %>?
    <%= link_to 'log out', destroy_userr_session_path %>

routes
new_userr_session GET    /userrs/sign_in(.:format)       devise/sessions#new
            userr_session POST   /userrs/sign_in(.:format)       devise/sessions#create
    destroy_userr_session DELETE /userrs/sign_out(.:format)      devise/sessions#destroy
           userr_password POST   /userrs/password(.:format)      devise/passwords#create
       new_userr_password GET    /userrs/password/new(.:format)  devise/passwords#new
      edit_userr_password GET    /userrs/password/edit(.:format) devise/passwords#edit
                          PATCH  /userrs/password(.:format)      devise/passwords#update
                          PUT    /userrs/password(.:format)      devise/passwords#update
cancel_userr_registration GET    /userrs/cancel(.:format)        devise/registrations#cancel
       userr_registration POST   /userrs(.:format)               devise/registrations#create
   new_userr_registration GET    /userrs/sign_up(.:format)       devise/registrations#new
  edit_userr_registration GET    /userrs/edit(.:format)          devise/registrations#edit
                          PATCH  /userrs(.:format)               devise/registrations#update
                          PUT    /userrs(.:format)               devise/registrations#update
                          DELETE /userrs(.:format)               devise/registrations#destroy

A: In your error message, your link is linking to the GET action of "/userrs/sign_out" (btw, is that spelled right?). You need to have it direct to the DELETE action instead. So change your code to:
<%= link_to 'log out', destroy_userr_session_path, method: :delete %>


text:
Q: Help in regression interpretation, including interaction terms I m doing a quantitative analysis for my dissertation
and I m having issues with the interpretation of my results (I have little knowledge of SPSS).
I m doing a panel data analysis with multiple regression.
What, I want to understand is when I should keep or remove a control variable?
My R2 and adjusted R2 are optimal when I keep my set of variables.
But I have a variable (political stability) that, when I add my explanatory variable (FDI) becomes insignificant and another variable (inflation rate) which logically should be negative becomes positive. I have trouble understanding it: what does it mean?
And also how to interpret interaction terms?
For instance I m studying the effect of FDI on economic growth:
both openness of the economy and FDI are significant and positive on FDI, but the association of FDI and openness comes with a negative coefficient.
How can I explain this?

A: "What I want to understand is when I should keep or remove a control variable."
If your objective is to construct a theoretically sound model, then you shouldn't put too much weight in the R^2 metric. You should include all variables that are justified by theory. If political stability is theoretically related to your independent variable (which you seem to indicate is economic growth), then you should include it.
"I have a variable (political stability) that when I add my explanatory variable (FDI) becomes insignificant and another variable (inflation rate) which logically should be negative becomes positive."
It's not immediately clear why the relationship between inflation and growth should be negative. While the matter is up for debate, according to the AD-AS model in macroeconomics, there is a positive relationship between inflation and growth (at least in the short run).
"And also how to interpret interaction terms."
This really depends on how the openness variable is coded. If it's a binary variable that is 0 for open and 1 for closed, then the negative coefficient would make sense because when economy is closed, then var=1 -> growth= beta1*FDI*var -> growth=beta1*FDI
We would expectd beta1 to be negative for a close economy.